From 1f88e0465da93a8bf354bfa793ff81b762be0b9a Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 29 Sep 2025 00:06:41 +0500 Subject: [PATCH] engine: make Host_ExitInMain used everywhere, as we depend on sjlj functions on all platforms anyway --- engine/common/filesystem_engine.c | 9 --------- engine/common/host.c | 22 +++++++--------------- engine/common/system.c | 14 -------------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/engine/common/filesystem_engine.c b/engine/common/filesystem_engine.c index 28795ff9..3e7b355a 100644 --- a/engine/common/filesystem_engine.c +++ b/engine/common/filesystem_engine.c @@ -262,15 +262,6 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size ) #if TARGET_OS_IOS Q_strncpy( out, IOS_GetDocsDir(), size ); return true; -#elif XASH_ANDROID && XASH_SDL - path = SDL_AndroidGetExternalStoragePath(); - if( path != NULL ) - { - Q_strncpy( out, path, size ); - return true; - } - Sys_Error( "couldn't determine Android external storage path: %s", SDL_GetError( )); - return false; #elif XASH_PSVITA if( PSVita_GetBasePath( out, size )) return true; diff --git a/engine/common/host.c b/engine/common/host.c index 7e7715dc..cc7b8d92 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -39,8 +39,6 @@ GNU General Public License for more details. static pfnChangeGame pChangeGame = NULL; host_parm_t host; // host parms - -#if XASH_ANDROID static jmp_buf return_from_main_buf; /* @@ -59,7 +57,6 @@ void Host_ExitInMain( void ) { longjmp( return_from_main_buf, 1 ); } -#endif // XASH_ANDROID #ifdef XASH_ENGINE_TESTS struct tests_stats_s tests_stats; @@ -203,12 +200,9 @@ static void Sys_PrintUsage( const char *exename ) #if XASH_SDL == 2 O("-sdl_renderer ","use alternative SDL_Renderer for software") #endif // XASH_SDL -#if XASH_ANDROID && !XASH_SDL - O("-nativeegl ","use native egl implementation. Use if screen does not update or black") -#endif // XASH_ANDROID -#if XASH_DOS +#if XASH_VIDEO == VIDEO_DOS O("-novesa ","disable vesa") -#endif // XASH_DOS +#endif // XASH_VIDEO == VIDEO_DOS #if XASH_VIDEO == VIDEO_FBDEV O("-fbdev ","open selected framebuffer") O("-ttygfx ","set graphics mode in tty") @@ -1347,18 +1341,16 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa // check after all configs were executed HPAK_CheckIntegrity( hpk_custom_file.string ); -#if XASH_ANDROID if( setjmp( return_from_main_buf )) return error_on_exit; -#endif // XASH_ANDROID -#if !XASH_EMSCRIPTEN // main window message loop while( host.status != HOST_CRASHED ) - Host_MainLoop( &oldtime ); -#else // XASH_EMSCRIPTEN - emscripten_set_main_loop_arg( Host_MainLoop, &oldtime, 0, false ); -#endif // XASH_EMSCRIPTEN + { + double newtime = Sys_DoubleTime(); + COM_Frame( newtime - oldtime ); + oldtime = newtime; + } return 0; } diff --git a/engine/common/system.c b/engine/common/system.c index 74104db9..b2700e07 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -425,16 +425,6 @@ void Sys_Error( const char *error, ... ) Sys_Quit( "caught an error" ); } -#if XASH_EMSCRIPTEN -#include -#define exit my_exit -void my_exit( int ret ) -{ - emscripten_cancel_main_loop(); - emscripten_force_exit( ret ); -} -#endif - /* ================ Sys_Quit @@ -443,11 +433,7 @@ Sys_Quit void Sys_Quit( const char *reason ) { Host_ShutdownWithReason( reason ); -#if XASH_ANDROID Host_ExitInMain(); -#else - exit( error_on_exit ); -#endif } /*