Skip to content

Commit

Permalink
engine: platform: as an exception, allow calling direct platform-spec…
Browse files Browse the repository at this point in the history
…ific implementations of Platform_Sleep to make them inlined
  • Loading branch information
a1batross committed Dec 4, 2024
1 parent e14cd75 commit 614b911
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 21 deletions.
9 changes: 3 additions & 6 deletions engine/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ void IOS_LaunchDialog( void );
#if XASH_POSIX
void Posix_Daemonize( void );
void Posix_SetupSigtermHandling( void );
void Posix_Sleep( int msec );
#endif

#if XASH_SDL
void SDLash_Init( void );
void SDLash_Shutdown( void );
void SDLash_Sleep( int msec );
#endif

#if XASH_ANDROID
Expand All @@ -78,7 +76,6 @@ void Wcon_ShowConsole( qboolean show );
void Wcon_DisableInput( void );
char *Wcon_Input( void );
void Wcon_WinPrint( const char *pMsg );
void Win32_Sleep( int msec );
#endif

#if XASH_NSWITCH
Expand Down Expand Up @@ -170,11 +167,11 @@ static inline void Platform_SetupSigtermHandling( void )
static inline void Platform_Sleep( int msec )
{
#if XASH_TIMER == TIMER_SDL
SDLash_Sleep( msec );
SDL_Delay( msec );
#elif XASH_TIMER == TIMER_POSIX
Posix_Sleep( msec );
usleep( msec * 1000 );
#elif XASH_TIMER == TIMER_WIN32
Win32_Sleep( msec );
Sleep( msec );
#else
// stub
#endif
Expand Down
5 changes: 0 additions & 5 deletions engine/platform/posix/sys_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,3 @@ double Platform_DoubleTime( void )
}
#endif // XASH_TIMER == TIMER_POSIX

void Posix_Sleep( int msec )
{
usleep( msec * 1000 );
}

5 changes: 0 additions & 5 deletions engine/platform/sdl/sys_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ double Platform_DoubleTime( void )
}
#endif // XASH_TIMER == TIMER_SDL

void SDLash_Sleep( int msec )
{
SDL_Delay( msec );
}

#if XASH_MESSAGEBOX == MSGBOX_SDL
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )
{
Expand Down
5 changes: 0 additions & 5 deletions engine/platform/win32/sys_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ double Platform_DoubleTime( void )
}
#endif // XASH_TIMER == TIMER_WIN32

void Win32_Sleep( int msec )
{
Sleep( msec );
}

qboolean Platform_DebuggerPresent( void )
{
return IsDebuggerPresent();
Expand Down

0 comments on commit 614b911

Please sign in to comment.