engine: move setjmp for exit-in-main to the beginning of Host_Main function

This commit is contained in:
Alibek Omarov
2025-10-02 18:40:13 +05:00
parent d9567ff3f9
commit cb7094bb2d
2 changed files with 6 additions and 14 deletions

View File

@@ -577,7 +577,7 @@ void Host_Error( const char *error, ... ) FORMAT_CHECK( 1 );
void Host_ValidateEngineFeatures( uint32_t mask, uint32_t features );
void Host_Frame( double time );
void Host_Credits( void );
void Host_ExitInMain( void );
void Host_ExitInMain( void ) NORETURN;
//
// host_state.c

View File

@@ -37,8 +37,8 @@ GNU General Public License for more details.
#include "render_api.h" // decallist_t
#include "tests.h"
static pfnChangeGame pChangeGame = NULL;
host_parm_t host; // host parms
host_parm_t host; // host parms
static pfnChangeGame pChangeGame = NULL;
static jmp_buf return_from_main_buf;
/*
@@ -1177,14 +1177,6 @@ static void Sys_Quit_f( void )
Sys_Quit( "command" );
}
static void Host_MainLoop( void *userdata )
{
double *poldtime = (double *)userdata;
double newtime = Sys_DoubleTime();
COM_Frame( newtime - *poldtime );
*poldtime = newtime;
}
/*
=================
Host_Main
@@ -1195,6 +1187,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
static double oldtime;
string demoname, exename;
if( setjmp( return_from_main_buf ))
return error_on_exit;
host.starttime = Sys_DoubleTime();
pChangeGame = func; // may be NULL
@@ -1338,9 +1333,6 @@ 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( setjmp( return_from_main_buf ))
return error_on_exit;
// main window message loop
while( host.status != HOST_CRASHED )
{