2018-10-21 20:52:14 +00:00
|
|
|
/*
|
|
|
|
platform.h - common platform-dependent function defines
|
|
|
|
Copyright (C) 2018 a1batross
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
2018-11-16 13:32:16 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "defaults.h"
|
2022-04-22 17:31:10 +00:00
|
|
|
#include "cursor_type.h"
|
2022-04-22 17:33:07 +00:00
|
|
|
#include "key_modifiers.h"
|
2018-11-16 13:32:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
SYSTEM UTILS
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
*/
|
2020-02-08 16:00:39 +00:00
|
|
|
|
|
|
|
void Platform_Init( void );
|
|
|
|
void Platform_Shutdown( void );
|
2018-11-16 13:32:16 +00:00
|
|
|
double Platform_DoubleTime( void );
|
|
|
|
void Platform_Sleep( int msec );
|
2019-05-01 16:21:47 +00:00
|
|
|
void Platform_ShellExecute( const char *path, const char *parms );
|
2019-05-01 16:44:48 +00:00
|
|
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow );
|
2022-10-18 23:25:48 +00:00
|
|
|
qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak
|
2018-11-16 13:32:16 +00:00
|
|
|
|
2019-11-24 00:52:08 +00:00
|
|
|
#if XASH_ANDROID
|
2019-05-02 15:07:03 +00:00
|
|
|
const char *Android_GetAndroidID( void );
|
|
|
|
const char *Android_LoadID( void );
|
|
|
|
void Android_SaveID( const char *id );
|
|
|
|
#endif
|
|
|
|
|
2022-04-06 12:06:16 +00:00
|
|
|
#if XASH_WIN32
|
|
|
|
void Platform_UpdateStatusLine( void );
|
|
|
|
#else
|
|
|
|
static inline void Platform_UpdateStatusLine( void ) { }
|
|
|
|
#endif
|
|
|
|
|
2023-02-05 01:09:32 +00:00
|
|
|
#if XASH_NSWITCH
|
|
|
|
void NSwitch_Init( void );
|
|
|
|
void NSwitch_Shutdown( void );
|
|
|
|
#endif
|
|
|
|
|
2023-02-13 19:53:17 +00:00
|
|
|
#if XASH_PSVITA
|
|
|
|
void PSVita_Init( void );
|
|
|
|
void PSVita_Shutdown( void );
|
|
|
|
qboolean PSVita_GetBasePath( char *buf, const size_t buflen );
|
|
|
|
#endif
|
|
|
|
|
2021-01-03 01:28:45 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
MOBILE API
|
|
|
|
|
|
|
|
==============================================================================
|
2018-10-21 20:52:14 +00:00
|
|
|
*/
|
|
|
|
void Platform_Vibrate( float life, char flags );
|
2018-10-21 21:21:05 +00:00
|
|
|
void*Platform_GetNativeObject( const char *name );
|
2018-10-21 20:52:14 +00:00
|
|
|
|
2021-01-03 01:28:45 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
INPUT
|
|
|
|
|
|
|
|
==============================================================================
|
2018-10-21 20:52:14 +00:00
|
|
|
*/
|
|
|
|
// Gamepad support
|
|
|
|
int Platform_JoyInit( int numjoy ); // returns number of connected gamepads, negative if error
|
|
|
|
// Text input
|
|
|
|
void Platform_EnableTextInput( qboolean enable );
|
2022-04-22 17:33:07 +00:00
|
|
|
key_modifier_t Platform_GetKeyModifiers( void );
|
2018-10-21 20:52:14 +00:00
|
|
|
// System events
|
|
|
|
void Platform_RunEvents( void );
|
2018-10-21 22:09:43 +00:00
|
|
|
// Mouse
|
|
|
|
void Platform_GetMousePos( int *x, int *y );
|
|
|
|
void Platform_SetMousePos( int x, int y );
|
2019-09-26 19:14:47 +00:00
|
|
|
void Platform_PreCreateMove( void );
|
2020-02-08 16:00:39 +00:00
|
|
|
void Platform_MouseMove( float *x, float *y );
|
2022-04-27 18:32:20 +00:00
|
|
|
void Platform_SetCursorType( VGUI_DefaultCursor type );
|
2018-10-21 22:25:29 +00:00
|
|
|
// Clipboard
|
2022-04-22 17:28:19 +00:00
|
|
|
int Platform_GetClipboardText( char *buffer, size_t size );
|
|
|
|
void Platform_SetClipboardText( const char *buffer );
|
2019-05-02 15:07:03 +00:00
|
|
|
|
2019-10-26 01:36:43 +00:00
|
|
|
#if XASH_SDL == 12
|
|
|
|
#define SDL_SetWindowGrab( wnd, state ) SDL_WM_GrabInput( (state) )
|
|
|
|
#define SDL_MinimizeWindow( wnd ) SDL_WM_IconifyWindow()
|
|
|
|
#define SDL_IsTextInputActive() host.textmode
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !XASH_SDL
|
|
|
|
#define SDL_VERSION_ATLEAST( x, y, z ) 0
|
|
|
|
#endif
|
|
|
|
|
2019-11-24 00:52:08 +00:00
|
|
|
#if XASH_ANDROID
|
2019-05-02 15:07:03 +00:00
|
|
|
void Android_ShowMouse( qboolean show );
|
|
|
|
void Android_MouseMove( float *x, float *y );
|
|
|
|
#endif
|
2018-10-21 20:52:14 +00:00
|
|
|
|
2021-01-03 01:28:45 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
WINDOW MANAGEMENT
|
|
|
|
|
|
|
|
==============================================================================
|
2018-10-21 20:52:14 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
rserr_ok,
|
|
|
|
rserr_invalid_fullscreen,
|
|
|
|
rserr_invalid_mode,
|
|
|
|
rserr_unknown
|
|
|
|
} rserr_t;
|
|
|
|
|
2019-10-26 12:42:00 +00:00
|
|
|
struct vidmode_s;
|
2018-10-21 20:52:14 +00:00
|
|
|
// Window
|
2019-03-22 13:36:46 +00:00
|
|
|
qboolean R_Init_Video( const int type );
|
2018-10-21 20:52:14 +00:00
|
|
|
void R_Free_Video( void );
|
|
|
|
qboolean VID_SetMode( void );
|
|
|
|
rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen );
|
2019-10-04 23:07:49 +00:00
|
|
|
int R_MaxVideoModes( void );
|
2019-10-26 12:42:00 +00:00
|
|
|
struct vidmode_s *R_GetVideoMode( int num );
|
2018-10-21 20:52:14 +00:00
|
|
|
void* GL_GetProcAddress( const char *name ); // RenderAPI requirement
|
2019-03-11 14:37:58 +00:00
|
|
|
void GL_UpdateSwapInterval( void );
|
2019-03-16 02:15:32 +00:00
|
|
|
int GL_SetAttribute( int attr, int val );
|
|
|
|
int GL_GetAttribute( int attr, int *val );
|
2019-10-04 23:07:49 +00:00
|
|
|
void GL_SwapBuffers( void );
|
|
|
|
void *SW_LockBuffer( void );
|
|
|
|
void SW_UnlockBuffer( void );
|
2019-03-24 20:24:31 +00:00
|
|
|
qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint *r, uint *g, uint *b );
|
2018-10-21 20:52:14 +00:00
|
|
|
|
2019-10-21 18:41:44 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// in_evdev.c
|
|
|
|
//
|
|
|
|
#ifdef XASH_USE_EVDEV
|
|
|
|
void Evdev_SetGrab( qboolean grab );
|
|
|
|
void Evdev_Shutdown( void );
|
|
|
|
void Evdev_Init( void );
|
|
|
|
void IN_EvdevMove( float *yaw, float *pitch );
|
|
|
|
void IN_EvdevFrame ( void );
|
|
|
|
#endif // XASH_USE_EVDEV
|
2019-01-07 01:07:01 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
|
|
|
AUDIO INPUT/OUTPUT
|
2018-10-21 20:52:14 +00:00
|
|
|
|
2019-01-07 01:07:01 +00:00
|
|
|
==============================================================================
|
|
|
|
*/
|
|
|
|
// initializes cycling through a DMA buffer and returns information on it
|
2019-07-11 21:32:09 +00:00
|
|
|
qboolean SNDDMA_Init( void );
|
2019-01-07 01:07:01 +00:00
|
|
|
void SNDDMA_Shutdown( void );
|
|
|
|
void SNDDMA_BeginPainting( void );
|
|
|
|
void SNDDMA_Submit( void );
|
|
|
|
void SNDDMA_Activate( qboolean active ); // pause audio
|
|
|
|
// void SNDDMA_PrintDeviceName( void ); // unused
|
|
|
|
// void SNDDMA_LockSound( void ); // unused
|
|
|
|
// void SNDDMA_UnlockSound( void ); // unused
|
2022-08-31 03:50:06 +00:00
|
|
|
|
2021-05-09 13:32:53 +00:00
|
|
|
qboolean VoiceCapture_Init( void );
|
2022-08-20 00:17:51 +00:00
|
|
|
void VoiceCapture_Shutdown( void );
|
2022-08-31 03:50:06 +00:00
|
|
|
qboolean VoiceCapture_Activate( qboolean activate );
|
|
|
|
qboolean VoiceCapture_Lock( qboolean lock );
|
2018-10-21 20:52:14 +00:00
|
|
|
|
|
|
|
#endif // PLATFORM_H
|