Move system->shutdown to runloop_ctl, turn it into a local

static variable
This commit is contained in:
twinaphex 2015-12-04 12:44:12 +01:00
parent 371ebc6133
commit c0a1a6a3fe
13 changed files with 26 additions and 29 deletions

View File

@ -19,7 +19,6 @@
#include "../audio_driver.h"
#include "../../configuration.h"
#include "../../performance.h"
#include "../../system.h"
typedef struct
{
@ -240,12 +239,11 @@ static bool ctr_csnd_audio_alive(void *data)
static bool ctr_csnd_audio_start(void *data)
{
ctr_csnd_audio_t* ctr = (ctr_csnd_audio_t*)data;
rarch_system_info_t *system = rarch_system_info_get_ptr();
/* Prevents restarting audio when the menu
* is toggled off on shutdown */
if (system->shutdown)
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
return true;
#if 0

View File

@ -19,7 +19,6 @@
#include "../audio_driver.h"
#include "../../configuration.h"
#include "../../performance.h"
#include "../../system.h"
#include "../../ctr/ctr_debug.h"
typedef struct
@ -164,12 +163,11 @@ static bool ctr_dsp_audio_alive(void *data)
static bool ctr_dsp_audio_start(void *data)
{
ctr_dsp_audio_t* ctr = (ctr_dsp_audio_t*)data;
rarch_system_info_t *system = rarch_system_info_get_ptr();
/* Prevents restarting audio when the menu
* is toggled off on shutdown */
if (system->shutdown)
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
return true;
ndspSetMasterVol(1.0);

View File

@ -767,7 +767,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SHUTDOWN:
RARCH_LOG("Environ SHUTDOWN.\n");
system->shutdown = true;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
runloop_ctl(RUNLOOP_CTL_SET_CORE_SHUTDOWN, NULL);
break;

View File

@ -81,12 +81,11 @@ static void callback_sysutil_exit(uint64_t status,
case CELL_SYSUTIL_REQUEST_EXITGAME:
{
frontend_ctx_driver_t *frontend = frontend_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
if (system)
system->shutdown = true;
if (frontend)
frontend->shutdown = frontend_ps3_shutdown;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
}
break;
}

View File

@ -96,7 +96,6 @@ static void android_gfx_ctx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
unsigned new_width, new_height;
rarch_system_info_t *system = rarch_system_info_get_ptr();
(void)frame_count;
@ -112,7 +111,7 @@ static void android_gfx_ctx_check_window(void *data, bool *quit,
}
/* Check if we are exiting. */
if (system->shutdown)
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
*quit = true;
}

View File

@ -228,7 +228,6 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
unsigned new_width, new_height;
rarch_system_info_t *system = rarch_system_info_get_ptr();
(void)data;
(void)frame_count;
@ -244,7 +243,7 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
}
/* Check if we are exiting. */
if (system->shutdown)
if (runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
*quit = true;
}

View File

@ -31,7 +31,6 @@
#include "../../performance.h"
#include "../../general.h"
#include "../../driver.h"
#include "../../system.h"
#define MAX_TOUCH 16
@ -886,7 +885,6 @@ static void android_input_poll_memcpy(void *data)
static void android_input_poll(void *data)
{
int ident;
rarch_system_info_t *system = rarch_system_info_get_ptr();
struct android_app *android_app = (struct android_app*)g_android;
while ((ident =
@ -909,7 +907,7 @@ static void android_input_poll(void *data)
if (android_app->destroyRequested != 0)
{
system->shutdown = true;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
return;
}
}
@ -919,7 +917,6 @@ static void android_input_poll(void *data)
bool android_run_events(void *data)
{
rarch_system_info_t *system = rarch_system_info_get_ptr();
struct android_app *android_app = (struct android_app*)g_android;
if (ALooper_pollOnce(-1, NULL, NULL, NULL) == LOOPER_ID_MAIN)
@ -928,7 +925,7 @@ bool android_run_events(void *data)
/* Check if we are exiting. */
if (android_app->destroyRequested != 0)
{
system->shutdown = true;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
return false;
}

View File

@ -586,7 +586,6 @@ static void qnx_handle_navigator_event(
int rc;
navigator_window_state_t state;
bps_event_t *event_pause = NULL;
rarch_system_info_t *system = rarch_system_info_get_ptr();
(void)rc;
@ -617,7 +616,7 @@ static void qnx_handle_navigator_event(
}
else if (bps_event_get_code(event_pause) == NAVIGATOR_EXIT)
{
system->shutdown = true;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
break;
}
}

View File

@ -322,7 +322,7 @@ void menu_driver_toggle(bool latch)
}
else
{
if (!system->shutdown)
if (!runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL))
driver_set_nonblock_state();
if (settings && settings->menu.pause_libretro)

View File

@ -1336,7 +1336,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
switch(state)
{
@ -1437,8 +1436,7 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
#endif
break;
case RARCH_CTL_QUIT:
if (global)
system->shutdown = true;
runloop_ctl(RUNLOOP_CTL_SET_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
break;
case RARCH_CTL_FORCE_QUIT:

View File

@ -357,6 +357,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
static bool runloop_idle = false;
static bool runloop_exec = false;
static bool runloop_slowmotion = false;
static bool runloop_shutdown_initiated = false;
static bool runloop_core_shutdown_initiated = false;
#ifdef HAVE_THREADS
static slock_t *runloop_msg_queue_lock = NULL;
@ -790,6 +791,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
break;
case RUNLOOP_CTL_IS_CORE_SHUTDOWN:
return runloop_core_shutdown_initiated;
case RUNLOOP_CTL_SET_SHUTDOWN:
runloop_shutdown_initiated = true;
break;
case RUNLOOP_CTL_UNSET_SHUTDOWN:
runloop_shutdown_initiated = false;
break;
case RUNLOOP_CTL_IS_SHUTDOWN:
return runloop_shutdown_initiated;
case RUNLOOP_CTL_SET_EXEC:
runloop_exec = true;
break;
@ -930,8 +939,7 @@ static void rarch_main_cmd_get_state(
static INLINE int rarch_main_iterate_time_to_exit(bool quit_key_pressed)
{
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
bool time_to_exit = (system && system->shutdown) || quit_key_pressed;
bool time_to_exit = runloop_ctl(RUNLOOP_CTL_IS_SHUTDOWN, NULL) || quit_key_pressed;
time_to_exit = time_to_exit || (video_driver_ctl(RARCH_DISPLAY_CTL_IS_ALIVE, NULL) == false);
time_to_exit = time_to_exit || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL);
time_to_exit = time_to_exit || runloop_ctl(RUNLOOP_CTL_IS_FRAME_COUNT_END, NULL);
@ -954,7 +962,7 @@ static INLINE int rarch_main_iterate_time_to_exit(bool quit_key_pressed)
if (!runloop_ctl(RUNLOOP_CTL_PREPARE_DUMMY, NULL))
return -1;
system->shutdown = false;
runloop_ctl(RUNLOOP_CTL_UNSET_SHUTDOWN, NULL);
runloop_ctl(RUNLOOP_CTL_UNSET_CORE_SHUTDOWN, NULL);
return 0;

View File

@ -62,6 +62,9 @@ enum runloop_ctl_state
RUNLOOP_CTL_SET_CORE_SHUTDOWN,
RUNLOOP_CTL_UNSET_CORE_SHUTDOWN,
RUNLOOP_CTL_IS_CORE_SHUTDOWN,
RUNLOOP_CTL_SET_SHUTDOWN,
RUNLOOP_CTL_UNSET_SHUTDOWN,
RUNLOOP_CTL_IS_SHUTDOWN,
RUNLOOP_CTL_SET_EXEC,
RUNLOOP_CTL_UNSET_EXEC,
RUNLOOP_CTL_IS_EXEC,

View File

@ -31,7 +31,6 @@ typedef struct rarch_system_info
struct retro_system_info info;
unsigned rotation;
bool shutdown;
unsigned performance_level;
bool block_extract;