mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +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;
|
||||
video_frame_info_t video_info;
|
||||
unsigned sleep_ms = 0;
|
||||
|
||||
RWebAudioRecalibrateTime();
|
||||
|
||||
@ -99,10 +98,7 @@ static void emscripten_mainloop(void)
|
||||
command_event(CMD_EVENT_REINIT, NULL);
|
||||
}
|
||||
|
||||
ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
ret = runloop_iterate();
|
||||
|
||||
task_queue_check();
|
||||
|
||||
|
@ -409,7 +409,6 @@ static void main_teardown(void)
|
||||
|
||||
static void main_loop(void)
|
||||
{
|
||||
unsigned sleep_ms = 0;
|
||||
OSTime start_time;
|
||||
int status;
|
||||
|
||||
@ -423,12 +422,9 @@ static void main_loop(void)
|
||||
else
|
||||
task_queue_wait(NULL, NULL);
|
||||
|
||||
status = runloop_iterate(&sleep_ms);
|
||||
status = runloop_iterate();
|
||||
|
||||
if(status == 1 && sleep_ms > 0)
|
||||
usleep(sleep_ms);
|
||||
|
||||
if(status == -1)
|
||||
if (status == -1)
|
||||
break;
|
||||
} while(true);
|
||||
}
|
||||
|
26
retroarch.c
26
retroarch.c
@ -5202,14 +5202,10 @@ int rarch_main(int argc, char *argv[], void *data)
|
||||
{
|
||||
int ret;
|
||||
bool app_exit = false;
|
||||
unsigned sleep_ms = 0;
|
||||
#ifdef HAVE_QT
|
||||
ui_companion_qt.application->process_events();
|
||||
#endif
|
||||
ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
ret = runloop_iterate();
|
||||
|
||||
task_queue_check();
|
||||
|
||||
@ -23040,8 +23036,7 @@ static enum runloop_state runloop_check_state(
|
||||
settings_t *settings,
|
||||
bool input_nonblock_state,
|
||||
bool runloop_is_paused,
|
||||
float fastforward_ratio,
|
||||
unsigned *sleep_ms)
|
||||
float fastforward_ratio)
|
||||
{
|
||||
input_bits_t current_bits;
|
||||
#ifdef HAVE_MENU
|
||||
@ -23860,7 +23855,7 @@ static enum runloop_state runloop_check_state(
|
||||
* button input in order to wake up the loop,
|
||||
* -1 if we forcibly quit out of the RetroArch iteration loop.
|
||||
**/
|
||||
int runloop_iterate(unsigned *sleep_ms)
|
||||
int runloop_iterate(void)
|
||||
{
|
||||
unsigned i;
|
||||
bool runloop_is_paused = runloop_paused;
|
||||
@ -23908,8 +23903,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
settings,
|
||||
input_nonblock_state,
|
||||
runloop_is_paused,
|
||||
fastforward_ratio,
|
||||
sleep_ms))
|
||||
fastforward_ratio))
|
||||
{
|
||||
case RUNLOOP_STATE_QUIT:
|
||||
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... */
|
||||
netplay_driver_ctl(RARCH_NETPLAY_CTL_PAUSE, NULL);
|
||||
#endif
|
||||
*sleep_ms = 10;
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
if (!main_ui_companion_is_on_foreground)
|
||||
#endif
|
||||
retro_sleep(10);
|
||||
return 1;
|
||||
case RUNLOOP_STATE_END:
|
||||
#ifdef HAVE_NETWORKING
|
||||
@ -24087,9 +24084,14 @@ end:
|
||||
|
||||
if (to_sleep_ms > 0)
|
||||
{
|
||||
*sleep_ms = (unsigned)to_sleep_ms;
|
||||
unsigned sleep_ms = (unsigned)to_sleep_ms;
|
||||
/* Combat jitter a bit. */
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ global_t *global_get_ptr(void);
|
||||
* Returns -1 if we forcibly quit out of the
|
||||
* RetroArch iteration loop.
|
||||
**/
|
||||
int runloop_iterate(unsigned *sleep_ms);
|
||||
int runloop_iterate(void);
|
||||
|
||||
void runloop_msg_queue_push(const char *msg,
|
||||
unsigned prio, unsigned duration,
|
||||
|
@ -413,7 +413,6 @@ static char** waiting_argv;
|
||||
do
|
||||
{
|
||||
int ret;
|
||||
unsigned sleep_ms = 0;
|
||||
#ifdef HAVE_QT
|
||||
const ui_application_t *application = &ui_application_qt;
|
||||
#else
|
||||
@ -422,10 +421,7 @@ static char** waiting_argv;
|
||||
if (application)
|
||||
application->process_events();
|
||||
|
||||
ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
ret = runloop_iterate();
|
||||
|
||||
task_queue_check();
|
||||
|
||||
|
@ -79,11 +79,8 @@ static void ui_companion_cocoatouch_event_command(
|
||||
static void rarch_draw_observer(CFRunLoopObserverRef observer,
|
||||
CFRunLoopActivity activity, void *info)
|
||||
{
|
||||
unsigned sleep_ms = 0;
|
||||
int ret = runloop_iterate(&sleep_ms);
|
||||
int ret = runloop_iterate();
|
||||
|
||||
if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
task_queue_check();
|
||||
|
||||
if (ret == -1)
|
||||
|
@ -314,11 +314,7 @@ void App::Run()
|
||||
{
|
||||
CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||
|
||||
unsigned sleep_ms = 0;
|
||||
int ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
int ret = runloop_iterate();
|
||||
|
||||
task_queue_check();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user