diff --git a/engine/platform/dos/in_dos.c b/engine/platform/dos/in_dos.c index ebef6bf9..0444341e 100644 --- a/engine/platform/dos/in_dos.c +++ b/engine/platform/dos/in_dos.c @@ -80,27 +80,11 @@ void Platform_RunEvents( void ) } -void GAME_EXPORT Platform_GetMousePos( int *x, int *y ) -{ - *x = *y = 0; -} - - -void GAME_EXPORT Platform_SetMousePos(int x, int y) -{ - -} - void Platform_EnableTextInput( qboolean enable ) { keystate.chars = enable; } -void Platform_PreCreateMove( void ) -{ - -} - void Platform_MouseMove( float *x, float *y ) { static int lx,ly; diff --git a/engine/platform/dos/sys_dos.c b/engine/platform/dos/sys_dos.c index 48e579b4..d79026b5 100644 --- a/engine/platform/dos/sys_dos.c +++ b/engine/platform/dos/sys_dos.c @@ -15,24 +15,11 @@ GNU General Public License for more details. #include "platform/platform.h" #include -void Platform_GetClipboardText( char *buffer, size_t size ) -{ - -} - -void Platform_SetClipboardText( const char *buffer, size_t size ) -{ - -} - -void Platform_Vibrate(float life, char flags) -{ - -} void Platform_ShellExecute( const char *path, const char *parms ) { } + volatile int ticks=0; #if XASH_TIMER == TIMER_DOS diff --git a/engine/platform/linux/in_evdev.c b/engine/platform/linux/in_evdev.c index 9c8e9f6c..6a3e4c00 100644 --- a/engine/platform/linux/in_evdev.c +++ b/engine/platform/linux/in_evdev.c @@ -179,7 +179,7 @@ void Evdev_Autodetect_f( void ) for( i = 0; i < evdev.devices; i++ ) { - if( !Q_strncmp( evdev.paths[i], path, sizeof( evdev.paths[i] )) + if( !Q_strncmp( evdev.paths[i], path, sizeof( evdev.paths[i] ))) goto next; } diff --git a/engine/platform/linux/vid_fbdev.c b/engine/platform/linux/vid_fbdev.c index ca20765a..fae01ffc 100644 --- a/engine/platform/linux/vid_fbdev.c +++ b/engine/platform/linux/vid_fbdev.c @@ -65,7 +65,7 @@ qboolean R_Init_Video( const int type ) if( fb.fd < 0 ) { - Con_Printf( S_ERROR, "failed to open framebuffer device: %s\n", strerror(errno)); + Con_Printf( S_ERROR "failed to open framebuffer device: %s\n", strerror(errno)); } if( Sys_CheckParm( "-ttygfx" ) ) @@ -134,7 +134,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod Con_Reportf( "%s: forced resolution to %dx%d)\n", __func__, width, height ); VID_SetDisplayTransform( &render_w, &render_h ); - R_SaveVideoMode( width, height, render_w, render_h ); + R_SaveVideoMode( width, height, render_w, render_h, false ); return rserr_ok; } @@ -246,41 +246,4 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint * return true; } -// unrelated stubs -void Platform_GetClipboardText( char *buffer, size_t size ) -{ - -} - -void Platform_SetClipboardText( const char *buffer, size_t size ) -{ - -} - -void Platform_PreCreateMove( void ) -{ - -} - -// will be implemented later -void Platform_RunEvents( void ) -{ - -} - -void GAME_EXPORT Platform_GetMousePos( int *x, int *y ) -{ - *x = *y = 0; -} - - -void GAME_EXPORT Platform_SetMousePos(int x, int y) -{ - -} - -void Platform_Vibrate( float life, char flags ) -{ - -} #endif diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 6ae05018..e9ea15e3 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -207,8 +207,13 @@ static inline void Sys_RestoreCrashHandler( void ) ============================================================================== */ +#if XASH_SDL >= 2 void Platform_Vibrate( float life, char flags ); // left for compatibility void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags ); +#else +static inline void Platform_Vibrate( float life, char flags ) {} +static inline void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags ) {} +#endif /* ============================================================================== @@ -217,47 +222,58 @@ void Platform_Vibrate2( float time, int low_freq, int high_freq, uint flags ); ============================================================================== */ -// Gamepad support -#if XASH_SDL -int Platform_JoyInit( void ); // returns number of connected gamepads, negative if error -void Platform_JoyShutdown( void ); -void Platform_CalibrateGamepadGyro( void ); +#if XASH_SDL // only SDL based backends implements these functions +void Platform_PreCreateMove( void ); +void GAME_EXPORT Platform_GetMousePos( int *x, int *y ); +void GAME_EXPORT Platform_SetMousePos( int x, int y ); +qboolean Platform_GetMouseGrab( void ); +void Platform_SetMouseGrab( qboolean enable ); +void Platform_SetCursorType( VGUI_DefaultCursor type ); +int Platform_GetClipboardText( char *buffer, size_t size ); +void Platform_SetClipboardText( const char *buffer ); #else -static inline int Platform_JoyInit( void ) +static inline void Platform_PreCreateMove( void ) { } +static inline void GAME_EXPORT Platform_SetMousePos( int x, int y ) { } +static inline void Platform_SetMouseGrab( qboolean enable ) { } +static inline void Platform_SetCursorType( VGUI_DefaultCursor type ) { } +static inline int Platform_GetClipboardText( char *buffer, size_t size ) { return 0; } +static inline void Platform_SetClipboardText( const char *buffer ) { } +static inline qboolean Platform_GetMouseGrab( void ) { return false; } +static inline void GAME_EXPORT Platform_GetMousePos( int *x, int *y ) { - return 0; -} - -static inline void Platform_JoyShutdown( void ) -{ - -} - -static inline void Platform_CalibrateGamepadGyro( void ) -{ - + if( x ) *x = 0; + if( y ) *y = 0; } #endif -// Text input -void Platform_EnableTextInput( qboolean enable ); -key_modifier_t Platform_GetKeyModifiers( void ); -// System events +#if XASH_SDL || XASH_DOS void Platform_RunEvents( void ); -// Mouse -void Platform_GetMousePos( int *x, int *y ); -void Platform_SetMousePos( int x, int y ); -void Platform_PreCreateMove( void ); void Platform_MouseMove( float *x, float *y ); -void Platform_SetCursorType( VGUI_DefaultCursor type ); -qboolean Platform_GetMouseGrab( void ); -void Platform_SetMouseGrab( qboolean enable ); -// Clipboard -int Platform_GetClipboardText( char *buffer, size_t size ); -void Platform_SetClipboardText( const char *buffer ); +#else +static inline void Platform_RunEvents( void ) { } +static inline void Platform_MouseMove( float *x, float *y ) +{ + if( x ) *x = 0.0f; + if( y ) *y = 0.0f; +} +#endif -#if XASH_SDL == 1 -#define SDL_IsTextInputActive() host.textmode +#if XASH_SDL >= 2 || XASH_PSVITA || XASH_DOS || XASH_USE_EVDEV +void Platform_EnableTextInput( qboolean enable ); +#else +static inline void Platform_EnableTextInput( qboolean enable ) { } +#endif + +#if XASH_SDL >= 2 +int Platform_JoyInit( void ); // returns number of connected gamepads, negative if error +void Platform_JoyShutdown( void ); +void Platform_CalibrateGamepadGyro( void ); +key_modifier_t Platform_GetKeyModifiers( void ); +#else +static inline int Platform_JoyInit( void ) { return 0; } +static inline void Platform_JoyShutdown( void ) { } +static inline void Platform_CalibrateGamepadGyro( void ) { } +static inline key_modifier_t Platform_GetKeyModifiers( void ) { return KeyModifier_None; } #endif static inline void Platform_SetTimer( float time ) diff --git a/engine/platform/sdl1/host_sdl1.c b/engine/platform/sdl1/host_sdl1.c index 05e8ba50..91cd6164 100644 --- a/engine/platform/sdl1/host_sdl1.c +++ b/engine/platform/sdl1/host_sdl1.c @@ -98,7 +98,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key ) int down = key.state != SDL_RELEASED; int keynum = key.keysym.sym; - if( SDL_IsTextInputActive( ) && down ) + if( host.textmode && down ) { // this is how engine understands ctrl+c, ctrl+v and other hotkeys if( cls.key_dest != key_game && FBitSet( SDL_GetModState(), KMOD_CTRL )) diff --git a/engine/platform/sdl1/in_sdl1.c b/engine/platform/sdl1/in_sdl1.c index 7b3bf517..ef594c26 100644 --- a/engine/platform/sdl1/in_sdl1.c +++ b/engine/platform/sdl1/in_sdl1.c @@ -95,17 +95,6 @@ void Platform_SetClipboardText( const char *buffer ) { } -/* -============= -Platform_EnableTextInput - -============= -*/ -void Platform_EnableTextInput( qboolean enable ) -{ -} - - /* ======================== Platform_SetCursorType @@ -163,14 +152,3 @@ void Platform_SetMouseGrab( qboolean enable ) { SDL_WM_GrabInput( enable ? SDL_GRAB_ON : SDL_GRAB_OFF ); } - -/* -======================== -Platform_GetKeyModifiers - -======================== -*/ -key_modifier_t Platform_GetKeyModifiers( void ) -{ - return KeyModifier_None; -}