engine: platform: as an exception, allow calling direct platform-specific implementations of Platform_Sleep to make them inlined

This commit is contained in:
Alibek Omarov 2024-12-04 18:37:29 +03:00
parent e14cd758ad
commit 614b9113ad
4 changed files with 3 additions and 21 deletions

View file

@ -51,13 +51,11 @@ void IOS_LaunchDialog( void );
#if XASH_POSIX #if XASH_POSIX
void Posix_Daemonize( void ); void Posix_Daemonize( void );
void Posix_SetupSigtermHandling( void ); void Posix_SetupSigtermHandling( void );
void Posix_Sleep( int msec );
#endif #endif
#if XASH_SDL #if XASH_SDL
void SDLash_Init( void ); void SDLash_Init( void );
void SDLash_Shutdown( void ); void SDLash_Shutdown( void );
void SDLash_Sleep( int msec );
#endif #endif
#if XASH_ANDROID #if XASH_ANDROID
@ -78,7 +76,6 @@ void Wcon_ShowConsole( qboolean show );
void Wcon_DisableInput( void ); void Wcon_DisableInput( void );
char *Wcon_Input( void ); char *Wcon_Input( void );
void Wcon_WinPrint( const char *pMsg ); void Wcon_WinPrint( const char *pMsg );
void Win32_Sleep( int msec );
#endif #endif
#if XASH_NSWITCH #if XASH_NSWITCH
@ -170,11 +167,11 @@ static inline void Platform_SetupSigtermHandling( void )
static inline void Platform_Sleep( int msec ) static inline void Platform_Sleep( int msec )
{ {
#if XASH_TIMER == TIMER_SDL #if XASH_TIMER == TIMER_SDL
SDLash_Sleep( msec ); SDL_Delay( msec );
#elif XASH_TIMER == TIMER_POSIX #elif XASH_TIMER == TIMER_POSIX
Posix_Sleep( msec ); usleep( msec * 1000 );
#elif XASH_TIMER == TIMER_WIN32 #elif XASH_TIMER == TIMER_WIN32
Win32_Sleep( msec ); Sleep( msec );
#else #else
// stub // stub
#endif #endif

View file

@ -174,8 +174,3 @@ double Platform_DoubleTime( void )
} }
#endif // XASH_TIMER == TIMER_POSIX #endif // XASH_TIMER == TIMER_POSIX
void Posix_Sleep( int msec )
{
usleep( msec * 1000 );
}

View file

@ -34,11 +34,6 @@ double Platform_DoubleTime( void )
} }
#endif // XASH_TIMER == TIMER_SDL #endif // XASH_TIMER == TIMER_SDL
void SDLash_Sleep( int msec )
{
SDL_Delay( msec );
}
#if XASH_MESSAGEBOX == MSGBOX_SDL #if XASH_MESSAGEBOX == MSGBOX_SDL
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ) void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )
{ {

View file

@ -36,11 +36,6 @@ double Platform_DoubleTime( void )
} }
#endif // XASH_TIMER == TIMER_WIN32 #endif // XASH_TIMER == TIMER_WIN32
void Win32_Sleep( int msec )
{
Sleep( msec );
}
qboolean Platform_DebuggerPresent( void ) qboolean Platform_DebuggerPresent( void )
{ {
return IsDebuggerPresent(); return IsDebuggerPresent();