diff --git a/command_event.c b/command_event.c index 785f185724..d0a8ce03bd 100644 --- a/command_event.c +++ b/command_event.c @@ -530,7 +530,7 @@ static bool event_init_content(void) /* No content to be loaded for dummy core, * just successfully exit. */ - if (global->inited.core.type == CORE_TYPE_DUMMY) + if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) return true; if (!content_ctl(CONTENT_CTL_DOES_NOT_NEED_CONTENT, NULL)) @@ -607,7 +607,7 @@ static bool event_save_auto_state(void) if (!settings->savestate_auto_save) return false; - if (global->inited.core.type == CORE_TYPE_DUMMY) + if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) return false; if (content_ctl(CONTENT_CTL_DOES_NOT_NEED_CONTENT, NULL)) return false; diff --git a/configuration.c b/configuration.c index 583b0d24de..031edd0d35 100644 --- a/configuration.c +++ b/configuration.c @@ -1850,7 +1850,7 @@ static void config_load_core_specific(void) if (!*settings->libretro) return; #ifdef HAVE_DYNAMIC - if (global->inited.core.type == CORE_TYPE_DUMMY) + if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) return; #endif diff --git a/frontend/frontend.c b/frontend/frontend.c index f3eb676894..4f57fa4fb2 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -150,13 +150,12 @@ static void history_playlist_push(content_playlist_t *playlist, const char *path, const char *core_path, struct retro_system_info *info) { - char tmp[PATH_MAX_LENGTH] = {0}; - global_t *global = global_get_ptr(); + char tmp[PATH_MAX_LENGTH]; rarch_system_info_t *system = NULL; runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); - if (!playlist || (global->inited.core.type == CORE_TYPE_DUMMY) || !info) + if (!playlist || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) || !info) return; /* Path can be relative here. diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 3b87c7dc8b..f4380ce031 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1325,7 +1325,7 @@ static int mui_list_push(void *data, void *userdata, case DISPLAYLIST_MAIN_MENU: menu_entries_clear(info->list); - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index f5afc91d14..053e31765d 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2568,7 +2568,7 @@ static int xmb_list_push(void *data, void *userdata, menu_displaylist_info_t *in case DISPLAYLIST_MAIN_MENU: menu_entries_clear(info->list); - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false); diff --git a/menu/drivers_display/menu_display_d3d.cpp b/menu/drivers_display/menu_display_d3d.cpp index f9992bce15..8223bd6ea8 100644 --- a/menu/drivers_display/menu_display_d3d.cpp +++ b/menu/drivers_display/menu_display_d3d.cpp @@ -200,7 +200,7 @@ static void menu_display_d3d_draw_bg( menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL); if ((settings->menu.pause_libretro - || !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || (global->inited.core.type == CORE_TYPE_DUMMY)) + || !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) && !force_transparency && texture) coords.color = (const float*)coord_color2; diff --git a/menu/drivers_display/menu_display_gl.c b/menu/drivers_display/menu_display_gl.c index 36fcfb41c7..6310270eff 100644 --- a/menu/drivers_display/menu_display_gl.c +++ b/menu/drivers_display/menu_display_gl.c @@ -140,7 +140,6 @@ static void menu_display_gl_draw_bg( struct gfx_coords coords; const GLfloat *new_vertex = NULL; const GLfloat *new_tex_coord = NULL; - global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); gl_t *gl = gl_get_ptr(); @@ -166,7 +165,7 @@ static void menu_display_gl_draw_bg( menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL); if ((settings->menu.pause_libretro - || !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || (global->inited.core.type == CORE_TYPE_DUMMY)) + || !rarch_ctl(RARCH_CTL_IS_INITED, NULL) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) && !force_transparency && texture) coords.color = (const float*)coord_color2; diff --git a/menu/menu_display.c b/menu/menu_display.c index 4a9e70857c..4eaa76d250 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -306,12 +306,9 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data) } return true; case MENU_DISPLAY_CTL_LIBRETRO_RUNNING: - { - global_t *global = global_get_ptr(); - if (!settings->menu.pause_libretro) - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) - return true; - } + if (!settings->menu.pause_libretro) + if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) + return true; break; case MENU_DISPLAY_CTL_LIBRETRO: video_driver_set_texture_enable(true, false); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e48b698208..eec39d500f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1721,7 +1721,7 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t if (!menu) return -1; - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { rarch_system_info_t *system = NULL; @@ -1774,7 +1774,7 @@ static int menu_displaylist_parse_load_content_settings(menu_displaylist_info_t menu_hash_to_str(MENU_LABEL_VALUE_CORE_CHEAT_OPTIONS), menu_hash_to_str(MENU_LABEL_CORE_CHEAT_OPTIONS), MENU_SETTING_ACTION, 0, 0); - if ((global->inited.core.type != CORE_TYPE_DUMMY) && system && system->disk_control.get_num_images) + if ((!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) && system && system->disk_control.get_num_images) menu_entries_push(info->list, menu_hash_to_str(MENU_LABEL_VALUE_DISK_OPTIONS), menu_hash_to_str(MENU_LABEL_DISK_OPTIONS), @@ -1819,8 +1819,8 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath); - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY) - && !strcmp(menu->deferred_path, fullpath)) + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) + && !strcmp(menu->deferred_path, fullpath)) menu_displaylist_parse_load_content_settings(info); else menu_entries_push(info->list, "Run", "collection", @@ -2599,7 +2599,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type) info->need_push = true; break; case DISPLAYLIST_MAIN_MENU: - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) + if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) menu_displaylist_parse_settings(menu, info, menu_hash_to_str(MENU_LABEL_CONTENT_SETTINGS), PARSE_ACTION, false); diff --git a/record/record_driver.c b/record/record_driver.c index 7cfbdadff6..429055a53d 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -22,6 +22,7 @@ #include "../command_event.h" #include "../general.h" +#include "../retroarch.h" #include "../verbosity.h" #include "../msg_hash.h" #include "../string_list_special.h" @@ -293,7 +294,7 @@ bool recording_init(void) if (!*recording_enabled) return false; - if (global->inited.core.type == CORE_TYPE_DUMMY) + if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { RARCH_WARN("%s\n", msg_hash_to_str(MSG_USING_LIBRETRO_DUMMY_CORE_RECORDING_SKIPPED)); return false; diff --git a/retroarch.c b/retroarch.c index 759c159f04..4f15e23355 100644 --- a/retroarch.c +++ b/retroarch.c @@ -953,7 +953,7 @@ static void parse_input(int argc, char *argv[]) } } - if (global->inited.core.type == CORE_TYPE_DUMMY) + if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { if (optind < argc) { @@ -1293,6 +1293,8 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data) switch(state) { + case RARCH_CTL_IS_DUMMY_CORE: + return (global->inited.core.type == CORE_TYPE_DUMMY); case RARCH_CTL_IS_INITED: return rarch_is_inited; case RARCH_CTL_UNSET_INITED: diff --git a/retroarch.h b/retroarch.h index e55d95ee0b..456ea7201f 100644 --- a/retroarch.h +++ b/retroarch.h @@ -67,6 +67,8 @@ enum rarch_ctl_state RARCH_CTL_IS_INITED, + RARCH_CTL_IS_DUMMY_CORE, + RARCH_CTL_PREINIT, RARCH_CTL_DESTROY, diff --git a/runloop.c b/runloop.c index 32ddb1f209..da2bc851df 100644 --- a/runloop.c +++ b/runloop.c @@ -1236,7 +1236,6 @@ int runloop_iterate(unsigned *sleep_ms) static retro_time_t frame_limit_last_time = 0.0; static retro_input_t last_input = 0; settings_t *settings = config_get_ptr(); - global_t *global = global_get_ptr(); rarch_system_info_t *system = NULL; cmd.state[1] = last_input; @@ -1327,11 +1326,11 @@ int runloop_iterate(unsigned *sleep_ms) event_command(EVENT_CMD_GRAB_MOUSE_TOGGLE); #ifdef HAVE_MENU - if (runloop_cmd_menu_press(cmd_ptr) || (global->inited.core.type == CORE_TYPE_DUMMY)) + if (runloop_cmd_menu_press(cmd_ptr) || rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) { if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL)) { - if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && (global->inited.core.type != CORE_TYPE_DUMMY)) + if (rarch_ctl(RARCH_CTL_IS_INITED, NULL) && !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)) rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL); } else