Create RARCH_CTL_IS_DUMMY_CORE

This commit is contained in:
twinaphex 2016-01-19 23:44:32 +01:00
parent 01d58f8681
commit 1eac61e9a0
13 changed files with 26 additions and 27 deletions

View File

@ -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;

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -67,6 +67,8 @@ enum rarch_ctl_state
RARCH_CTL_IS_INITED,
RARCH_CTL_IS_DUMMY_CORE,
RARCH_CTL_PREINIT,
RARCH_CTL_DESTROY,

View File

@ -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