From 96798043823a1924691349eafa83f0ee0cdbefee Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 27 Sep 2015 01:58:24 +0200 Subject: [PATCH] Rename rarch_main_set_state to rarch_ctl --- command_event.c | 18 +++++++++--------- dynamic.c | 2 +- menu/cbs/menu_cbs_ok.c | 2 +- retroarch.c | 22 ++++++++++------------ retroarch.h | 30 +++++++++++++++--------------- runloop.c | 6 +++--- 6 files changed, 39 insertions(+), 41 deletions(-) diff --git a/command_event.c b/command_event.c index a3b5b2c2f4..5957bb6921 100644 --- a/command_event.c +++ b/command_event.c @@ -1037,15 +1037,15 @@ bool event_command(enum event_command cmd) #ifdef HAVE_DYNAMIC event_command(EVENT_CMD_LOAD_CORE); #endif - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); break; #ifdef HAVE_FFMPEG case EVENT_CMD_LOAD_CONTENT_FFMPEG: - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG, NULL); break; #endif case EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER: - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER, NULL); break; case EVENT_CMD_LOAD_CONTENT: #ifdef HAVE_DYNAMIC @@ -1105,9 +1105,9 @@ bool event_command(enum event_command cmd) break; case EVENT_CMD_MENU_TOGGLE: if (menu_driver_alive()) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); else - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL); break; case EVENT_CMD_CONTROLLERS_INIT: event_init_controllers(); @@ -1150,7 +1150,7 @@ bool event_command(enum event_command cmd) *global->path.fullpath = '\0'; - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); } break; case EVENT_CMD_UNLOAD_CORE: @@ -1158,7 +1158,7 @@ bool event_command(enum event_command cmd) event_command(EVENT_CMD_LOAD_CORE_DEINIT); break; case EVENT_CMD_QUIT: - rarch_main_set_state(RARCH_ACTION_STATE_QUIT); + rarch_ctl(RARCH_ACTION_STATE_QUIT, NULL); break; case EVENT_CMD_REINIT: { @@ -1415,10 +1415,10 @@ bool event_command(enum event_command cmd) event_command(EVENT_CMD_DRIVERS_INIT); break; case EVENT_CMD_QUIT_RETROARCH: - rarch_main_set_state(RARCH_ACTION_STATE_FORCE_QUIT); + rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL); break; case EVENT_CMD_RESUME: - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); break; case EVENT_CMD_RESTART_RETROARCH: #if defined(GEKKO) && defined(HW_RVL) diff --git a/dynamic.c b/dynamic.c index e83d7a4ded..9cfa19bf54 100644 --- a/dynamic.c +++ b/dynamic.c @@ -1267,7 +1267,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (driver->frontend_ctx && driver->frontend_ctx->set_fork) driver->frontend_ctx->set_fork(true, true); #elif defined(HAVE_DYNAMIC) - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); #endif if (cmd == RETRO_ENVIRONMENT_EXEC_ESCAPE) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a64f668c87..2141315409 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1173,7 +1173,7 @@ static int action_ok_file_load_or_resume(const char *path, strlcpy(global->path.fullpath, menu->deferred_path, sizeof(global->path.fullpath)); event_command(EVENT_CMD_LOAD_CORE); - rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); + rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL); return -1; } diff --git a/retroarch.c b/retroarch.c index 62ad6c973b..74065e8fc3 100644 --- a/retroarch.c +++ b/retroarch.c @@ -327,8 +327,7 @@ void set_paths_redirect(const char *path) (info->info.library_name[0] != '\0')) ? msg_hash_calculate(info->info.library_name) : 0); - if( - global_library_name_hash != 0 && + if(global_library_name_hash != 0 && (global_library_name_hash != MENU_VALUE_NO_CORE)) { /* per-core saves: append the library_name to the save location */ @@ -1163,8 +1162,7 @@ static void validate_cpu_features(void) **/ void rarch_init_system_av_info(void) { - struct retro_system_av_info *av_info = - video_viewport_get_system_av_info(); + struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); pretro_get_system_av_info(av_info); event_command(EVENT_CMD_SET_FRAME_LIMIT); @@ -1367,14 +1365,14 @@ void rarch_main_init_wrap(const struct rarch_main_wrap *args, #endif } -void rarch_main_set_state(unsigned cmd) +void 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 (cmd) + switch(state) { case RARCH_ACTION_STATE_MENU_RUNNING: #ifdef HAVE_MENU @@ -1389,7 +1387,7 @@ void rarch_main_set_state(unsigned cmd) #ifdef HAVE_MENU /* If content loading fails, we go back to menu. */ if (!menu_load_content(CORE_TYPE_PLAIN)) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL); #endif if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) driver->frontend_ctx->content_loaded(); @@ -1399,7 +1397,7 @@ void rarch_main_set_state(unsigned cmd) #ifdef HAVE_MENU /* If content loading fails, we go back to menu. */ if (!menu_load_content(CORE_TYPE_FFMPEG)) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL); #endif if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) driver->frontend_ctx->content_loaded(); @@ -1409,7 +1407,7 @@ void rarch_main_set_state(unsigned cmd) #ifdef HAVE_MENU /* If content loading fails, we go back to menu. */ if (!menu_load_content(CORE_TYPE_IMAGEVIEWER)) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL); #endif if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) driver->frontend_ctx->content_loaded(); @@ -1425,12 +1423,12 @@ void rarch_main_set_state(unsigned cmd) #endif break; case RARCH_ACTION_STATE_QUIT: - if (global) + if (global) system->shutdown = true; - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); break; case RARCH_ACTION_STATE_FORCE_QUIT: - rarch_main_set_state(RARCH_ACTION_STATE_QUIT); + rarch_ctl(RARCH_ACTION_STATE_QUIT, NULL); break; case RARCH_ACTION_STATE_NONE: default: diff --git a/retroarch.h b/retroarch.h index bb3759ebf6..8298200698 100644 --- a/retroarch.h +++ b/retroarch.h @@ -27,20 +27,6 @@ extern "C" { #endif -enum action_state -{ - RARCH_ACTION_STATE_NONE = 0, - RARCH_ACTION_STATE_LOAD_CONTENT, -#ifdef HAVE_FFMPEG - RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG, -#endif - RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER, - RARCH_ACTION_STATE_MENU_RUNNING, - RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, - RARCH_ACTION_STATE_QUIT, - RARCH_ACTION_STATE_FORCE_QUIT -}; - #define MENU_VALUE_FILE_WEBM 0x7ca00b50U #define MENU_VALUE_FILE_F4F 0x0b886be5U #define MENU_VALUE_FILE_F4V 0x0b886bf5U @@ -67,6 +53,20 @@ enum action_state #define MENU_VALUE_FILE_TGA 0x0b88ae01U #define MENU_VALUE_FILE_BMP 0x0b886244U +enum rarch_ctl_state +{ + RARCH_ACTION_STATE_NONE = 0, + RARCH_ACTION_STATE_LOAD_CONTENT, +#ifdef HAVE_FFMPEG + RARCH_ACTION_STATE_LOAD_CONTENT_FFMPEG, +#endif + RARCH_ACTION_STATE_LOAD_CONTENT_IMAGEVIEWER, + RARCH_ACTION_STATE_MENU_RUNNING, + RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, + RARCH_ACTION_STATE_QUIT, + RARCH_ACTION_STATE_FORCE_QUIT +}; + enum rarch_content_type { RARCH_CONTENT_NONE = 0, @@ -101,7 +101,7 @@ void rarch_main_new(void); void rarch_main_free(void); -void rarch_main_set_state(unsigned action); +void rarch_ctl(enum rarch_ctl_state state, void *data); /** * rarch_main_init: diff --git a/runloop.c b/runloop.c index e9197c5e81..b097c6d10f 100644 --- a/runloop.c +++ b/runloop.c @@ -910,10 +910,10 @@ int rarch_main_iterate(unsigned *sleep_ms) if (menu_driver_alive()) { if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY)) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); } else - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL); } #endif @@ -968,7 +968,7 @@ int rarch_main_iterate(unsigned *sleep_ms) menu_handle_t *menu = menu_driver_get_ptr(); if (menu) if (menu_iterate(true, menu_input_frame(input, trigger_input)) == -1) - rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); + rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL); if (!input && settings->menu.pause_libretro) return 1;