mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Cleanup runloop_iterate
NOTE/CHECK: Hopefully wiiu is unaffected by the change in sleeping
This commit is contained in:
parent
e4e86d027e
commit
ca3a80091a
@ -69,7 +69,6 @@ static void emscripten_mainloop(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
video_frame_info_t video_info;
|
video_frame_info_t video_info;
|
||||||
unsigned sleep_ms = 0;
|
|
||||||
|
|
||||||
RWebAudioRecalibrateTime();
|
RWebAudioRecalibrateTime();
|
||||||
|
|
||||||
@ -99,10 +98,7 @@ static void emscripten_mainloop(void)
|
|||||||
command_event(CMD_EVENT_REINIT, NULL);
|
command_event(CMD_EVENT_REINIT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = runloop_iterate(&sleep_ms);
|
ret = runloop_iterate();
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
|
||||||
retro_sleep(sleep_ms);
|
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
|
@ -409,7 +409,6 @@ static void main_teardown(void)
|
|||||||
|
|
||||||
static void main_loop(void)
|
static void main_loop(void)
|
||||||
{
|
{
|
||||||
unsigned sleep_ms = 0;
|
|
||||||
OSTime start_time;
|
OSTime start_time;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@ -423,12 +422,9 @@ static void main_loop(void)
|
|||||||
else
|
else
|
||||||
task_queue_wait(NULL, NULL);
|
task_queue_wait(NULL, NULL);
|
||||||
|
|
||||||
status = runloop_iterate(&sleep_ms);
|
status = runloop_iterate();
|
||||||
|
|
||||||
if(status == 1 && sleep_ms > 0)
|
if (status == -1)
|
||||||
usleep(sleep_ms);
|
|
||||||
|
|
||||||
if(status == -1)
|
|
||||||
break;
|
break;
|
||||||
} while(true);
|
} while(true);
|
||||||
}
|
}
|
||||||
|
26
retroarch.c
26
retroarch.c
@ -5202,14 +5202,10 @@ int rarch_main(int argc, char *argv[], void *data)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
bool app_exit = false;
|
bool app_exit = false;
|
||||||
unsigned sleep_ms = 0;
|
|
||||||
#ifdef HAVE_QT
|
#ifdef HAVE_QT
|
||||||
ui_companion_qt.application->process_events();
|
ui_companion_qt.application->process_events();
|
||||||
#endif
|
#endif
|
||||||
ret = runloop_iterate(&sleep_ms);
|
ret = runloop_iterate();
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
|
||||||
retro_sleep(sleep_ms);
|
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
@ -23040,8 +23036,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
settings_t *settings,
|
settings_t *settings,
|
||||||
bool input_nonblock_state,
|
bool input_nonblock_state,
|
||||||
bool runloop_is_paused,
|
bool runloop_is_paused,
|
||||||
float fastforward_ratio,
|
float fastforward_ratio)
|
||||||
unsigned *sleep_ms)
|
|
||||||
{
|
{
|
||||||
input_bits_t current_bits;
|
input_bits_t current_bits;
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
@ -23860,7 +23855,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
* button input in order to wake up the loop,
|
* button input in order to wake up the loop,
|
||||||
* -1 if we forcibly quit out of the RetroArch iteration loop.
|
* -1 if we forcibly quit out of the RetroArch iteration loop.
|
||||||
**/
|
**/
|
||||||
int runloop_iterate(unsigned *sleep_ms)
|
int runloop_iterate(void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
bool runloop_is_paused = runloop_paused;
|
bool runloop_is_paused = runloop_paused;
|
||||||
@ -23908,8 +23903,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
|||||||
settings,
|
settings,
|
||||||
input_nonblock_state,
|
input_nonblock_state,
|
||||||
runloop_is_paused,
|
runloop_is_paused,
|
||||||
fastforward_ratio,
|
fastforward_ratio))
|
||||||
sleep_ms))
|
|
||||||
{
|
{
|
||||||
case RUNLOOP_STATE_QUIT:
|
case RUNLOOP_STATE_QUIT:
|
||||||
frame_limit_last_time = 0.0;
|
frame_limit_last_time = 0.0;
|
||||||
@ -23920,7 +23914,10 @@ int runloop_iterate(unsigned *sleep_ms)
|
|||||||
/* FIXME: This is an ugly way to tell Netplay this... */
|
/* FIXME: This is an ugly way to tell Netplay this... */
|
||||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL);
|
netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL);
|
||||||
#endif
|
#endif
|
||||||
*sleep_ms = 10;
|
#if defined(HAVE_COCOATOUCH)
|
||||||
|
if (!main_ui_companion_is_on_foreground)
|
||||||
|
#endif
|
||||||
|
retro_sleep(10);
|
||||||
return 1;
|
return 1;
|
||||||
case RUNLOOP_STATE_END:
|
case RUNLOOP_STATE_END:
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
@ -24087,9 +24084,14 @@ end:
|
|||||||
|
|
||||||
if (to_sleep_ms > 0)
|
if (to_sleep_ms > 0)
|
||||||
{
|
{
|
||||||
*sleep_ms = (unsigned)to_sleep_ms;
|
unsigned sleep_ms = (unsigned)to_sleep_ms;
|
||||||
/* Combat jitter a bit. */
|
/* Combat jitter a bit. */
|
||||||
frame_limit_last_time += frame_limit_minimum_time;
|
frame_limit_last_time += frame_limit_minimum_time;
|
||||||
|
if (sleep_ms > 0)
|
||||||
|
#if defined(HAVE_COCOATOUCH)
|
||||||
|
if (!main_ui_companion_is_on_foreground)
|
||||||
|
#endif
|
||||||
|
retro_sleep(sleep_ms);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ global_t *global_get_ptr(void);
|
|||||||
* Returns -1 if we forcibly quit out of the
|
* Returns -1 if we forcibly quit out of the
|
||||||
* RetroArch iteration loop.
|
* RetroArch iteration loop.
|
||||||
**/
|
**/
|
||||||
int runloop_iterate(unsigned *sleep_ms);
|
int runloop_iterate(void);
|
||||||
|
|
||||||
void runloop_msg_queue_push(const char *msg,
|
void runloop_msg_queue_push(const char *msg,
|
||||||
unsigned prio, unsigned duration,
|
unsigned prio, unsigned duration,
|
||||||
|
@ -413,7 +413,6 @@ static char** waiting_argv;
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
unsigned sleep_ms = 0;
|
|
||||||
#ifdef HAVE_QT
|
#ifdef HAVE_QT
|
||||||
const ui_application_t *application = &ui_application_qt;
|
const ui_application_t *application = &ui_application_qt;
|
||||||
#else
|
#else
|
||||||
@ -422,10 +421,7 @@ static char** waiting_argv;
|
|||||||
if (application)
|
if (application)
|
||||||
application->process_events();
|
application->process_events();
|
||||||
|
|
||||||
ret = runloop_iterate(&sleep_ms);
|
ret = runloop_iterate();
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
|
||||||
retro_sleep(sleep_ms);
|
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
|
@ -79,11 +79,8 @@ static void ui_companion_cocoatouch_event_command(
|
|||||||
static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
||||||
CFRunLoopActivity activity, void *info)
|
CFRunLoopActivity activity, void *info)
|
||||||
{
|
{
|
||||||
unsigned sleep_ms = 0;
|
int ret = runloop_iterate();
|
||||||
int ret = runloop_iterate(&sleep_ms);
|
|
||||||
|
|
||||||
if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0)
|
|
||||||
retro_sleep(sleep_ms);
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
|
@ -314,11 +314,7 @@ void App::Run()
|
|||||||
{
|
{
|
||||||
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||||
|
|
||||||
unsigned sleep_ms = 0;
|
int ret = runloop_iterate();
|
||||||
int ret = runloop_iterate(&sleep_ms);
|
|
||||||
|
|
||||||
if (ret == 1 && sleep_ms > 0)
|
|
||||||
retro_sleep(sleep_ms);
|
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user