mirror of
https://github.com/libretro/libretro-prboom.git
synced 2025-03-02 12:55:32 +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);
|
M_EndGame(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void retro_shutdown_prboom(void)
|
extern boolean quit_pressed;
|
||||||
{
|
|
||||||
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void update_variables(bool startup)
|
static void update_variables(bool startup)
|
||||||
{
|
{
|
||||||
@ -206,6 +203,11 @@ void retro_run(void)
|
|||||||
bool updated = false;
|
bool updated = false;
|
||||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||||
update_variables(false);
|
update_variables(false);
|
||||||
|
if (quit_pressed)
|
||||||
|
{
|
||||||
|
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
|
||||||
|
I_SafeExit(1);
|
||||||
|
}
|
||||||
|
|
||||||
D_DoomLoop();
|
D_DoomLoop();
|
||||||
I_UpdateSound();
|
I_UpdateSound();
|
||||||
|
@ -299,8 +299,6 @@ void D_Display (void)
|
|||||||
|
|
||||||
int has_exited;
|
int has_exited;
|
||||||
|
|
||||||
extern void retro_shutdown_prboom(void);
|
|
||||||
|
|
||||||
/* I_SafeExit
|
/* I_SafeExit
|
||||||
* This function is called instead of exit() by functions that might be called
|
* 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)
|
* 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 */
|
if (!has_exited) /* If it hasn't exited yet, exit now -- killough */
|
||||||
{
|
{
|
||||||
has_exited=rc ? 2 : 1;
|
has_exited=rc ? 2 : 1;
|
||||||
retro_shutdown_prboom();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1015,6 +1015,8 @@ int quitsounds2[8] =
|
|||||||
sfx_sgtatk
|
sfx_sgtatk
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean quit_pressed = false;
|
||||||
|
|
||||||
static void M_QuitResponse(int ch)
|
static void M_QuitResponse(int ch)
|
||||||
{
|
{
|
||||||
if (ch != 'y')
|
if (ch != 'y')
|
||||||
@ -1040,7 +1042,8 @@ static void M_QuitResponse(int ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
I_SafeExit(1);
|
|
||||||
|
quit_pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_QuitDOOM(int choice)
|
void M_QuitDOOM(int choice)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user