From c564cc96c7a45f1d0f302aa8cab7113e2a50b963 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 21 Apr 2025 16:59:44 +0300 Subject: [PATCH] engine: get rid of host.crashed field, as it's a complete duplicate of host.status --- engine/client/cl_main.c | 2 +- engine/common/common.h | 1 - engine/common/host.c | 2 +- engine/platform/posix/crash_glibc.c | 3 +-- engine/platform/posix/crash_libbacktrace.c | 3 +-- engine/platform/posix/crash_posix.c | 3 +-- engine/platform/sdl/events.c | 2 +- engine/platform/win32/crash_win.c | 3 +-- 8 files changed, 7 insertions(+), 12 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index d3724bd5..9d06ffb6 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -3677,7 +3677,7 @@ void CL_Shutdown( void ) { Con_Printf( "%s()\n", __func__ ); - if( !host.crashed && cls.initialized ) + if( host.status != HOST_CRASHED && cls.initialized ) { Host_WriteOpenGLConfig (); Host_WriteVideoConfig (); diff --git a/engine/common/common.h b/engine/common/common.h index f111cbae..aa5916e2 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -342,7 +342,6 @@ typedef struct host_parm_s qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands qboolean apply_opengl_config; // when true apply only to opengl cvars and ignore all other commands qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc - qboolean crashed; // set to true if crashed #if XASH_DLL_LOADER qboolean enabledll; #endif diff --git a/engine/common/host.c b/engine/common/host.c index f50cfa21..be299e7a 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -1355,7 +1355,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa #endif // XASH_ANDROID // main window message loop - while( !host.crashed ) + while( host.status != HOST_CRASHED ) { newtime = Sys_DoubleTime (); COM_Frame( newtime - oldtime ); diff --git a/engine/platform/posix/crash_glibc.c b/engine/platform/posix/crash_glibc.c index a8cdd939..c950056a 100644 --- a/engine/platform/posix/crash_glibc.c +++ b/engine/platform/posix/crash_glibc.c @@ -74,13 +74,12 @@ void Sys_Crash( int signal, siginfo_t *si, void *context ) #if !XASH_DEDICATED IN_SetMouseGrab( false ); #endif - host.crashed = true; + host.status = HOST_CRASHED; Platform_MessageBox( "Xash Error", message, false ); // log saved, now we can try to save configs and close log correctly, it may crash if( host.type == HOST_NORMAL ) CL_Crashed(); - host.status = HOST_CRASHED; Sys_Quit( "crashed" ); } diff --git a/engine/platform/posix/crash_libbacktrace.c b/engine/platform/posix/crash_libbacktrace.c index 1c082435..f8ce6f82 100644 --- a/engine/platform/posix/crash_libbacktrace.c +++ b/engine/platform/posix/crash_libbacktrace.c @@ -167,13 +167,12 @@ void Sys_CrashLibbacktrace( int signal, siginfo_t *si, void *context ) #if !XASH_DEDICATED IN_SetMouseGrab( false ); #endif - host.crashed = true; + host.status = HOST_CRASHED; Platform_MessageBox( "Xash Error", message, false ); // log saved, now we can try to save configs and close log correctly, it may crash if( host.type == HOST_NORMAL ) CL_Crashed(); - host.status = HOST_CRASHED; Sys_Quit( "crashed" ); } diff --git a/engine/platform/posix/crash_posix.c b/engine/platform/posix/crash_posix.c index a72c8ea0..b461dbf1 100644 --- a/engine/platform/posix/crash_posix.c +++ b/engine/platform/posix/crash_posix.c @@ -196,13 +196,12 @@ void Sys_Crash( int signal, siginfo_t *si, void *context ) #if !XASH_DEDICATED IN_SetMouseGrab( false ); #endif - host.crashed = true; + host.status = HOST_CRASHED; Platform_MessageBox( "Xash Error", message, false ); // log saved, now we can try to save configs and close log correctly, it may crash if( host.type == HOST_NORMAL ) CL_Crashed(); - host.status = HOST_CRASHED; Sys_Quit( "crashed" ); } diff --git a/engine/platform/sdl/events.c b/engine/platform/sdl/events.c index 4bf58c71..61a64460 100644 --- a/engine/platform/sdl/events.c +++ b/engine/platform/sdl/events.c @@ -549,7 +549,7 @@ void Platform_RunEvents( void ) { SDL_Event event; - while( !host.crashed && !host.shutdown_issued && SDL_PollEvent( &event ) ) + while( host.status != HOST_CRASHED && !host.shutdown_issued && SDL_PollEvent( &event ) ) SDLash_EventHandler( &event ); #if XASH_PSVITA diff --git a/engine/platform/win32/crash_win.c b/engine/platform/win32/crash_win.c index 332452b7..9798c7f0 100644 --- a/engine/platform/win32/crash_win.c +++ b/engine/platform/win32/crash_win.c @@ -270,7 +270,7 @@ static long _stdcall Sys_Crash( PEXCEPTION_POINTERS pInfo ) if( host.status != HOST_CRASHED ) { // check to avoid recursive call - host.crashed = true; + host.status = HOST_CRASHED; #if !XASH_DEDICATED IN_SetMouseGrab( false ); @@ -302,7 +302,6 @@ static long _stdcall Sys_Crash( PEXCEPTION_POINTERS pInfo ) if( host.type == HOST_NORMAL ) CL_Crashed(); // tell client about crash - else host.status = HOST_CRASHED; if( host_developer.value <= 0 ) {