From 24f23908be4b494a9659e0e968a10ecc73dcb6b4 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 27 Feb 2024 05:17:01 +0300 Subject: [PATCH] engine: platform: stub Sys_DebuggerPresent on unsupported platforms --- engine/platform/linux/sys_linux.c | 2 +- engine/platform/platform.h | 11 ++++++++++- engine/platform/win32/sys_win.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/engine/platform/linux/sys_linux.c b/engine/platform/linux/sys_linux.c index 39a92bd9..64dd1844 100644 --- a/engine/platform/linux/sys_linux.c +++ b/engine/platform/linux/sys_linux.c @@ -52,7 +52,7 @@ static pid_t gettid( void ) static void *g_hsystemd; static int (*g_pfn_sd_notify)( int unset_environment, const char *state ); -qboolean Sys_DebuggerPresent( void ) +qboolean Platform_DebuggerPresent( void ) { char buf[4096]; ssize_t num_read; diff --git a/engine/platform/platform.h b/engine/platform/platform.h index d761fc7b..17622027 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -34,8 +34,8 @@ double Platform_DoubleTime( void ); void Platform_Sleep( int msec ); void Platform_ShellExecute( const char *path, const char *parms ); void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ); -qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak void Platform_SetStatus( const char *status ); +qboolean Platform_DebuggerPresent( void ); // legacy iOS port functions #if TARGET_OS_IOS @@ -142,6 +142,15 @@ static inline void Platform_Shutdown( void ) #endif } +static inline qboolean Sys_DebuggerPresent( void ) +{ +#if XASH_LINUX || XASH_WIN32 + return Platform_DebuggerPresent(); +#else + return false; +#endif +} + /* ============================================================================== diff --git a/engine/platform/win32/sys_win.c b/engine/platform/win32/sys_win.c index 5b459a4c..4dc29187 100644 --- a/engine/platform/win32/sys_win.c +++ b/engine/platform/win32/sys_win.c @@ -41,7 +41,7 @@ void Platform_Sleep( int msec ) } #endif // XASH_TIMER == TIMER_WIN32 -qboolean Sys_DebuggerPresent( void ) +qboolean Platform_DebuggerPresent( void ) { return IsDebuggerPresent(); }