Both the 'pause' state and the 'menu' state return 1 - so that

we can signal to the Apple upper-layer function that we want
to run CFRunLoopWakeUp
This commit is contained in:
twinaphex 2014-10-04 14:14:45 +02:00
parent 291f4579a2
commit 458eff5f4d
4 changed files with 70 additions and 64 deletions

View File

@ -56,7 +56,9 @@
int main_entry_decide(signature(), args_type() args)
{
if (rarch_main_iterate() == -1)
int ret = rarch_main_iterate();
if (ret == -1)
{
if (g_extern.core_shutdown_initiated
&& g_settings.load_dummy_on_core_shutdown)
@ -66,13 +68,12 @@ int main_entry_decide(signature(), args_type() args)
g_extern.core_shutdown_initiated = false;
return 0;
}
return 1;
}
if (driver.frontend_ctx && driver.frontend_ctx->process_events)
driver.frontend_ctx->process_events(args);
return 0;
return ret;
}
void main_exit(args_type() args)
@ -241,7 +242,7 @@ returntype main_entry(signature())
#endif
#if defined(HAVE_MAIN_LOOP)
while (!main_entry_decide(signature_expand(), args));
while (main_entry_decide(signature_expand(), args) != -1);
main_exit(args);
#endif

View File

@ -28,12 +28,17 @@ static CFRunLoopObserverRef iterate_observer;
static void do_iteration(void)
{
if (main_entry_decide(0, NULL, NULL))
int ret = main_entry_decide(0, NULL, NULL);
if (ret == -1)
{
main_exit(NULL);
return;
}
if (ret)
CFRunLoopWakeUp(CFRunLoopGetMain());
/* TODO/FIXME
I am almost positive that this is not necessary and is actually a
bad thing.
@ -91,10 +96,6 @@ static void do_iteration(void)
"ugly way" first because it is the most expedient and
safe. Other eyeballs should decide if it isn't necessary.
*/
#if 0
if ( ! g_extern.is_menu )
CFRunLoopWakeUp(CFRunLoopGetMain());
#endif
}
void apple_start_iteration(void)

View File

@ -27,7 +27,9 @@
static void emscripten_mainloop(void)
{
if (main_entry_decide(0, NULL, NULL))
int ret = main_entry_decide(0, NULL, NULL)
if (ret == -1)
{
main_exit(NULL);
exit(0);

View File

@ -3221,16 +3221,19 @@ static inline int time_to_exit(retro_input_t input)
/* Returns:
* 0 - Successful iteration.
* 1 - Forcibly wake up the loop.
* -1 - Quit out of iteration loop.
*/
int rarch_main_iterate(void)
{
unsigned i;
retro_input_t trigger_input;
int ret = 0;
static retro_input_t last_input = 0;
retro_input_t old_input, trigger_input;
retro_input_t old_input = last_input;
retro_input_t input = input_keys_pressed();
old_input = last_input;
last_input = input;
if (driver.flushing_input)
@ -3258,6 +3261,7 @@ int rarch_main_iterate(void)
if (!menu_iterate(input, old_input, trigger_input))
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED);
ret = 1;
goto success;
}
#endif
@ -3274,9 +3278,7 @@ int rarch_main_iterate(void)
driver.retro_ctx.poll_cb();
rarch_sleep(10);
/* TODO - maybe change this from 0 to something else
* to signal that RetroArch is currently paused. */
return 0;
return 1;
}
#if defined(HAVE_THREADS)
@ -3338,7 +3340,7 @@ success:
if (g_settings.fastforward_ratio_throttle_enable)
limit_frame_time();
return 0;
return ret;
}
void rarch_main_deinit(void)