Runtime logging fixes: ensure log is generated when runahead is enabled, and when closing cores 'internally' (RETRO_ENVIRONMENT_SHUTDOWN)

This commit is contained in:
jdgleaver 2019-03-04 11:33:19 +00:00
parent 84d6f6231d
commit 8e74ff6122
2 changed files with 17 additions and 2 deletions

View File

@ -1279,6 +1279,14 @@ bool rarch_environment_cb(unsigned cmd, void *data)
case RETRO_ENVIRONMENT_SHUTDOWN:
RARCH_LOG("Environ SHUTDOWN.\n");
/* This case occurs when a core (internally) requests
* a shutdown event. Must save runtime log file here,
* since normal command.c CMD_EVENT_CORE_DEINIT event
* will not occur until after the current content has
* been cleared (causing log to be skipped) */
rarch_ctl(RARCH_CTL_CONTENT_RUNTIME_LOG_DEINIT, NULL);
rarch_ctl(RARCH_CTL_SET_SHUTDOWN, NULL);
rarch_ctl(RARCH_CTL_SET_CORE_SHUTDOWN, NULL);
break;

View File

@ -2426,6 +2426,11 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
}
}
/* Reset runtime
* (Not required, but ensures that time can never
* be logged more than once...) */
libretro_core_runtime_usec = 0;
break;
}
case RARCH_CTL_GET_PERFCNT:
@ -4326,16 +4331,18 @@ int runloop_iterate(unsigned *sleep_ms)
else
{
core_run();
rarch_core_runtime_tick();
}
}
#else
{
core_run();
rarch_core_runtime_tick();
}
#endif
/* Increment runtime tick counter after each call to
* core_run() or run_ahead() */
rarch_core_runtime_tick();
#ifdef HAVE_CHEEVOS
if (runloop_check_cheevos())
cheevos_test();