mirror of
https://github.com/libretro/libretro-prboom.git
synced 2025-03-01 12:26:14 +00:00
Implement shutdown properly
This commit is contained in:
parent
4bc57526ed
commit
b95d31a8ed
@ -163,10 +163,7 @@ void retro_reset(void)
|
||||
M_EndGame(0);
|
||||
}
|
||||
|
||||
void retro_shutdown_prboom(void)
|
||||
{
|
||||
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
||||
}
|
||||
extern boolean quit_pressed;
|
||||
|
||||
static void update_variables(bool startup)
|
||||
{
|
||||
@ -206,6 +203,11 @@ void retro_run(void)
|
||||
bool updated = false;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
update_variables(false);
|
||||
if (quit_pressed)
|
||||
{
|
||||
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
||||
I_SafeExit(1);
|
||||
}
|
||||
|
||||
D_DoomLoop();
|
||||
I_UpdateSound();
|
||||
|
@ -299,8 +299,6 @@ void D_Display (void)
|
||||
|
||||
int has_exited;
|
||||
|
||||
extern void retro_shutdown_prboom(void);
|
||||
|
||||
/* I_SafeExit
|
||||
* This function is called instead of exit() by functions that might be called
|
||||
* during the exit process (i.e. after exit() has already been called)
|
||||
@ -312,7 +310,6 @@ void I_SafeExit(int rc)
|
||||
if (!has_exited) /* If it hasn't exited yet, exit now -- killough */
|
||||
{
|
||||
has_exited=rc ? 2 : 1;
|
||||
retro_shutdown_prboom();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1015,6 +1015,8 @@ int quitsounds2[8] =
|
||||
sfx_sgtatk
|
||||
};
|
||||
|
||||
boolean quit_pressed = false;
|
||||
|
||||
static void M_QuitResponse(int ch)
|
||||
{
|
||||
if (ch != 'y')
|
||||
@ -1040,7 +1042,8 @@ static void M_QuitResponse(int ch)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
I_SafeExit(1);
|
||||
|
||||
quit_pressed = true;
|
||||
}
|
||||
|
||||
void M_QuitDOOM(int choice)
|
||||
|
Loading…
x
Reference in New Issue
Block a user