Rename rarch_main_set_state to rarch_ctl

This commit is contained in:
twinaphex 2015-09-27 01:58:24 +02:00
parent a8e5cf5483
commit 9679804382
6 changed files with 39 additions and 41 deletions

View File

@ -1037,15 +1037,15 @@ bool event_command(enum event_command cmd)
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
event_command(EVENT_CMD_LOAD_CORE); event_command(EVENT_CMD_LOAD_CORE);
#endif #endif
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL);
break; break;
#ifdef HAVE_FFMPEG #ifdef HAVE_FFMPEG
case EVENT_CMD_LOAD_CONTENT_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; break;
#endif #endif
case EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER: 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; break;
case EVENT_CMD_LOAD_CONTENT: case EVENT_CMD_LOAD_CONTENT:
#ifdef HAVE_DYNAMIC #ifdef HAVE_DYNAMIC
@ -1105,9 +1105,9 @@ bool event_command(enum event_command cmd)
break; break;
case EVENT_CMD_MENU_TOGGLE: case EVENT_CMD_MENU_TOGGLE:
if (menu_driver_alive()) if (menu_driver_alive())
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL);
else else
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL);
break; break;
case EVENT_CMD_CONTROLLERS_INIT: case EVENT_CMD_CONTROLLERS_INIT:
event_init_controllers(); event_init_controllers();
@ -1150,7 +1150,7 @@ bool event_command(enum event_command cmd)
*global->path.fullpath = '\0'; *global->path.fullpath = '\0';
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL);
} }
break; break;
case EVENT_CMD_UNLOAD_CORE: case EVENT_CMD_UNLOAD_CORE:
@ -1158,7 +1158,7 @@ bool event_command(enum event_command cmd)
event_command(EVENT_CMD_LOAD_CORE_DEINIT); event_command(EVENT_CMD_LOAD_CORE_DEINIT);
break; break;
case EVENT_CMD_QUIT: case EVENT_CMD_QUIT:
rarch_main_set_state(RARCH_ACTION_STATE_QUIT); rarch_ctl(RARCH_ACTION_STATE_QUIT, NULL);
break; break;
case EVENT_CMD_REINIT: case EVENT_CMD_REINIT:
{ {
@ -1415,10 +1415,10 @@ bool event_command(enum event_command cmd)
event_command(EVENT_CMD_DRIVERS_INIT); event_command(EVENT_CMD_DRIVERS_INIT);
break; break;
case EVENT_CMD_QUIT_RETROARCH: case EVENT_CMD_QUIT_RETROARCH:
rarch_main_set_state(RARCH_ACTION_STATE_FORCE_QUIT); rarch_ctl(RARCH_ACTION_STATE_FORCE_QUIT, NULL);
break; break;
case EVENT_CMD_RESUME: case EVENT_CMD_RESUME:
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL);
break; break;
case EVENT_CMD_RESTART_RETROARCH: case EVENT_CMD_RESTART_RETROARCH:
#if defined(GEKKO) && defined(HW_RVL) #if defined(GEKKO) && defined(HW_RVL)

View File

@ -1267,7 +1267,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
if (driver->frontend_ctx && driver->frontend_ctx->set_fork) if (driver->frontend_ctx && driver->frontend_ctx->set_fork)
driver->frontend_ctx->set_fork(true, true); driver->frontend_ctx->set_fork(true, true);
#elif defined(HAVE_DYNAMIC) #elif defined(HAVE_DYNAMIC)
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); rarch_ctl(RARCH_ACTION_STATE_LOAD_CONTENT, NULL);
#endif #endif
if (cmd == RETRO_ENVIRONMENT_EXEC_ESCAPE) if (cmd == RETRO_ENVIRONMENT_EXEC_ESCAPE)

View File

@ -1173,7 +1173,7 @@ static int action_ok_file_load_or_resume(const char *path,
strlcpy(global->path.fullpath, strlcpy(global->path.fullpath,
menu->deferred_path, sizeof(global->path.fullpath)); menu->deferred_path, sizeof(global->path.fullpath));
event_command(EVENT_CMD_LOAD_CORE); 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; return -1;
} }

View File

@ -327,8 +327,7 @@ void set_paths_redirect(const char *path)
(info->info.library_name[0] != '\0')) (info->info.library_name[0] != '\0'))
? msg_hash_calculate(info->info.library_name) : 0); ? msg_hash_calculate(info->info.library_name) : 0);
if( if(global_library_name_hash != 0 &&
global_library_name_hash != 0 &&
(global_library_name_hash != MENU_VALUE_NO_CORE)) (global_library_name_hash != MENU_VALUE_NO_CORE))
{ {
/* per-core saves: append the library_name to the save location */ /* 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) void rarch_init_system_av_info(void)
{ {
struct retro_system_av_info *av_info = struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
video_viewport_get_system_av_info();
pretro_get_system_av_info(av_info); pretro_get_system_av_info(av_info);
event_command(EVENT_CMD_SET_FRAME_LIMIT); event_command(EVENT_CMD_SET_FRAME_LIMIT);
@ -1367,14 +1365,14 @@ void rarch_main_init_wrap(const struct rarch_main_wrap *args,
#endif #endif
} }
void rarch_main_set_state(unsigned cmd) void rarch_ctl(enum rarch_ctl_state state, void *data)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr(); rarch_system_info_t *system = rarch_system_info_get_ptr();
switch (cmd) switch(state)
{ {
case RARCH_ACTION_STATE_MENU_RUNNING: case RARCH_ACTION_STATE_MENU_RUNNING:
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -1389,7 +1387,7 @@ void rarch_main_set_state(unsigned cmd)
#ifdef HAVE_MENU #ifdef HAVE_MENU
/* If content loading fails, we go back to menu. */ /* If content loading fails, we go back to menu. */
if (!menu_load_content(CORE_TYPE_PLAIN)) 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 #endif
if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) if (driver->frontend_ctx && driver->frontend_ctx->content_loaded)
driver->frontend_ctx->content_loaded(); driver->frontend_ctx->content_loaded();
@ -1399,7 +1397,7 @@ void rarch_main_set_state(unsigned cmd)
#ifdef HAVE_MENU #ifdef HAVE_MENU
/* If content loading fails, we go back to menu. */ /* If content loading fails, we go back to menu. */
if (!menu_load_content(CORE_TYPE_FFMPEG)) 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 #endif
if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) if (driver->frontend_ctx && driver->frontend_ctx->content_loaded)
driver->frontend_ctx->content_loaded(); driver->frontend_ctx->content_loaded();
@ -1409,7 +1407,7 @@ void rarch_main_set_state(unsigned cmd)
#ifdef HAVE_MENU #ifdef HAVE_MENU
/* If content loading fails, we go back to menu. */ /* If content loading fails, we go back to menu. */
if (!menu_load_content(CORE_TYPE_IMAGEVIEWER)) 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 #endif
if (driver->frontend_ctx && driver->frontend_ctx->content_loaded) if (driver->frontend_ctx && driver->frontend_ctx->content_loaded)
driver->frontend_ctx->content_loaded(); driver->frontend_ctx->content_loaded();
@ -1425,12 +1423,12 @@ void rarch_main_set_state(unsigned cmd)
#endif #endif
break; break;
case RARCH_ACTION_STATE_QUIT: case RARCH_ACTION_STATE_QUIT:
if (global) if (global)
system->shutdown = true; system->shutdown = true;
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED); rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING_FINISHED, NULL);
break; break;
case RARCH_ACTION_STATE_FORCE_QUIT: case RARCH_ACTION_STATE_FORCE_QUIT:
rarch_main_set_state(RARCH_ACTION_STATE_QUIT); rarch_ctl(RARCH_ACTION_STATE_QUIT, NULL);
break; break;
case RARCH_ACTION_STATE_NONE: case RARCH_ACTION_STATE_NONE:
default: default:

View File

@ -27,20 +27,6 @@
extern "C" { extern "C" {
#endif #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_WEBM 0x7ca00b50U
#define MENU_VALUE_FILE_F4F 0x0b886be5U #define MENU_VALUE_FILE_F4F 0x0b886be5U
#define MENU_VALUE_FILE_F4V 0x0b886bf5U #define MENU_VALUE_FILE_F4V 0x0b886bf5U
@ -67,6 +53,20 @@ enum action_state
#define MENU_VALUE_FILE_TGA 0x0b88ae01U #define MENU_VALUE_FILE_TGA 0x0b88ae01U
#define MENU_VALUE_FILE_BMP 0x0b886244U #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 enum rarch_content_type
{ {
RARCH_CONTENT_NONE = 0, RARCH_CONTENT_NONE = 0,
@ -101,7 +101,7 @@ void rarch_main_new(void);
void rarch_main_free(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: * rarch_main_init:

View File

@ -910,10 +910,10 @@ int rarch_main_iterate(unsigned *sleep_ms)
if (menu_driver_alive()) if (menu_driver_alive())
{ {
if (global->inited.main && (global->inited.core.type != CORE_TYPE_DUMMY)) 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 else
rarch_main_set_state(RARCH_ACTION_STATE_MENU_RUNNING); rarch_ctl(RARCH_ACTION_STATE_MENU_RUNNING, NULL);
} }
#endif #endif
@ -968,7 +968,7 @@ int rarch_main_iterate(unsigned *sleep_ms)
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
if (menu) if (menu)
if (menu_iterate(true, menu_input_frame(input, trigger_input)) == -1) 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) if (!input && settings->menu.pause_libretro)
return 1; return 1;