Rewrite RUNLOOP_CTL_SYSTEM_INFO_GET

This commit is contained in:
twinaphex 2017-04-23 16:41:26 +02:00
parent 627089e2f6
commit 3ec5816259
22 changed files with 88 additions and 161 deletions

View File

@ -1062,8 +1062,7 @@ static size_t cheevos_highest_bit(size_t n)
void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value)
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
var->bank_id = -1;
var->value = value;
@ -1784,12 +1783,11 @@ Test all the achievements (call once per frame).
uint8_t *cheevos_get_memory(const cheevos_var_t *var)
{
uint8_t *memory;
uint8_t *memory = NULL;
if (var->bank_id >= 0)
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
if (system->mmaps.num_descriptors != 0)
memory = (uint8_t *)system->mmaps.descriptors[var->bank_id].core.ptr;
@ -1799,8 +1797,6 @@ uint8_t *cheevos_get_memory(const cheevos_var_t *var)
if (memory)
memory += var->value;
}
else
memory = NULL;
return memory;
}

View File

@ -860,13 +860,11 @@ static void command_event_disk_control_set_eject(bool new_state, bool print_log)
{
char msg[128];
bool error = false;
rarch_system_info_t *info = NULL;
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *info = runloop_get_system_info();
msg[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info)
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
@ -912,13 +910,11 @@ static void command_event_disk_control_set_index(unsigned idx)
unsigned num_disks;
char msg[128];
bool error = false;
rarch_system_info_t *info = NULL;
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *info = runloop_get_system_info();
msg[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info)
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
@ -973,12 +969,10 @@ static bool command_event_disk_control_append_image(const char *path)
char msg[128];
struct retro_game_info info = {0};
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *sysinfo = NULL;
rarch_system_info_t *sysinfo = runloop_get_system_info();
msg[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sysinfo);
if (sysinfo)
control = (const struct retro_disk_control_callback*)
&sysinfo->disk_control_cb;
@ -1122,9 +1116,7 @@ static void command_event_init_controllers(void)
{
unsigned i;
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
rarch_system_info_t *info = runloop_get_system_info();
for (i = 0; i < MAX_USERS; i++)
{
@ -2544,8 +2536,7 @@ bool command_event(enum event_command cmd, void *data)
}
case CMD_EVENT_DISK_EJECT_TOGGLE:
{
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
rarch_system_info_t *info = runloop_get_system_info();
if (info && info->disk_control_cb.get_num_images)
{
@ -2567,8 +2558,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_DISK_NEXT:
{
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
rarch_system_info_t *info = runloop_get_system_info();
if (info && info->disk_control_cb.get_num_images)
{
@ -2592,8 +2582,7 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_DISK_PREV:
{
rarch_system_info_t *info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
rarch_system_info_t *info = runloop_get_system_info();
if (info && info->disk_control_cb.get_num_images)
{

View File

@ -2294,13 +2294,12 @@ bool config_load_override(void)
config_file_t *new_conf = NULL;
const char *core_name = NULL;
const char *game_name = NULL;
rarch_system_info_t *system = NULL;
bool should_append = false;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
if (system)
core_name = system->info.library_name;
game_name = path_basename(path_get(RARCH_PATH_BASENAME));
if (string_is_empty(core_name) || string_is_empty(game_name))
@ -2447,13 +2446,11 @@ bool config_load_remap(void)
char remap_directory[PATH_MAX_LENGTH]; /* path to the directory containing retroarch.cfg (prefix) */
char core_path[PATH_MAX_LENGTH]; /* final path for core-specific configuration (prefix+suffix) */
char game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */
config_file_t *new_conf = NULL;
const char *core_name = NULL;
const char *game_name = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
config_file_t *new_conf = NULL;
const char *core_name = NULL;
const char *game_name = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = runloop_get_system_info();
if (system)
core_name = system->info.library_name;
@ -2550,12 +2547,10 @@ bool config_load_shader_preset(void)
char shader_directory[PATH_MAX_LENGTH]; /* path to the directory containing retroarch.cfg (prefix) */
char core_path[PATH_MAX_LENGTH]; /* final path for core-specific configuration (prefix+suffix) */
char game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */
const char *core_name = NULL;
const char *game_name = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
const char *core_name = NULL;
const char *game_name = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = runloop_get_system_info();
if (system)
core_name = system->info.library_name;
@ -3160,8 +3155,6 @@ bool config_save_overrides(int override_type)
const char *game_name = NULL;
config_file_t *conf = NULL;
settings_t *settings = NULL;
settings_t *overrides = config_get_ptr();
rarch_system_info_t *system = NULL;
struct config_bool_setting *bool_settings = NULL;
struct config_bool_setting *bool_overrides = NULL;
struct config_int_setting *int_settings = NULL;
@ -3172,8 +3165,8 @@ bool config_save_overrides(int override_type)
struct config_array_setting *array_overrides= NULL;
struct config_path_setting *path_settings = NULL;
struct config_path_setting *path_overrides = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
settings_t *overrides = config_get_ptr();
rarch_system_info_t *system = runloop_get_system_info();
if (system)
core_name = system->info.library_name;

View File

@ -954,10 +954,8 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
unsigned p;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (ignore_environment_cb)
return false;

View File

@ -838,7 +838,7 @@ static bool video_driver_init_internal(void)
video_driver_get_viewport_info(custom_vp);
}
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
system = runloop_get_system_info();
video_driver_set_rotation(
(settings->video.rotation + system->rotation) % 4);

View File

@ -206,9 +206,7 @@ bool driver_location_get_position(double *lat, double *lon,
void init_location(void)
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
/* Resource leaks will follow if location interface is initialized twice. */
if (location_data)
@ -230,9 +228,7 @@ void init_location(void)
static void uninit_location(void)
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
if (location_data && location_driver)
{

View File

@ -615,9 +615,9 @@ static int general_push(menu_displaylist_info_t *info,
{
struct retro_system_info *system_menu = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
core_info_list_t *list = NULL;
menu_handle_t *menu = NULL;
rarch_system_info_t *system = runloop_get_system_info();
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
@ -625,7 +625,6 @@ static int general_push(menu_displaylist_info_t *info,
core_info_get_list(&list);
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET, &system_menu);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
switch (id)
{

View File

@ -994,10 +994,9 @@ static void menu_action_setting_disp_set_label_menu_disk_index(
char *s2, size_t len2)
{
unsigned images = 0, current = 0;
rarch_system_info_t *system = NULL;
struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *system = runloop_get_system_info();
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!system)
return;
@ -1367,9 +1366,8 @@ static void menu_action_setting_disp_set_label_core_option_create(
const char *path,
char *s2, size_t len2)
{
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!system)
return;

View File

@ -1842,13 +1842,11 @@ static int generic_action_ok_shader_preset_save(const char *path,
char file[PATH_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = NULL;
const char *core_name = NULL;
rarch_system_info_t *info = runloop_get_system_info();
directory[0] = file[0] = tmp[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info)
core_name = info->info.library_name;
@ -1961,13 +1959,11 @@ static int generic_action_ok_remap_file_save(const char *path,
char directory[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = NULL;
const char *core_name = NULL;
rarch_system_info_t *info = runloop_get_system_info();
directory[0] = file[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info)
core_name = info->info.library_name;

View File

@ -860,11 +860,11 @@ static size_t mui_list_get_size(void *data, enum menu_list_type type)
static int mui_get_core_title(char *s, size_t len)
{
struct retro_system_info *system = NULL;
rarch_system_info_t *info = NULL;
struct retro_system_info *system = NULL;
settings_t *settings = config_get_ptr();
const char *core_name = NULL;
const char *core_version = NULL;
rarch_system_info_t *info = runloop_get_system_info();
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
&system);
@ -875,15 +875,12 @@ static int mui_get_core_title(char *s, size_t len)
if (!settings->menu.core_enable)
return -1;
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info))
if (info)
{
if (info)
{
if (string_is_empty(core_name))
core_name = info->info.library_name;
if (!core_version)
core_version = info->info.library_version;
}
if (string_is_empty(core_name))
core_name = info->info.library_name;
if (!core_version)
core_version = info->info.library_version;
}
if (string_is_empty(core_name))

View File

@ -2652,9 +2652,7 @@ static int menu_displaylist_parse_load_content_settings(
#ifdef HAVE_LAKKA
bool show_advanced_settings = settings->menu.show_advanced_settings;
#endif
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RESUME_CONTENT),
@ -3251,7 +3249,7 @@ static int menu_displaylist_parse_options_remappings(
MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME,
MENU_SETTING_ACTION, 0, 0);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
system = runloop_get_system_info();
if (system)
{
@ -4288,8 +4286,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
return true;
case DISPLAYLIST_MAIN_MENU:
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
menu_displaylist_parse_settings_enum(menu, info,

View File

@ -273,8 +273,7 @@ int menu_entries_get_core_title(char *s, size_t len)
core_name = system->library_name;
core_version = system->library_version;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
info = runloop_get_system_info();
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;

View File

@ -425,7 +425,7 @@ static void setting_get_string_representation_uint_libretro_device(void *data,
unsigned index_offset;
const struct retro_controller_description *desc = NULL;
const char *name = NULL;
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
rarch_setting_t *setting = (rarch_setting_t*)data;
settings_t *settings = config_get_ptr();
@ -434,8 +434,7 @@ static void setting_get_string_representation_uint_libretro_device(void *data,
index_offset = setting->index_offset;
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
&& system)
if (system)
{
if (index_offset < system->ports.size)
desc = libretro_find_controller_description(
@ -1015,7 +1014,7 @@ static int setting_action_start_libretro_device_type(void *data)
unsigned index_offset, current_device;
unsigned devices[128], types = 0, port = 0;
const struct retro_controller_info *desc = NULL;
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
rarch_setting_t *setting = (rarch_setting_t*)data;
if (setting_generic_action_start_default(setting) != 0)
@ -1027,8 +1026,7 @@ static int setting_action_start_libretro_device_type(void *data)
devices[types++] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
&& system)
if (system)
{
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
@ -1132,7 +1130,7 @@ static int setting_action_left_libretro_device_type(
devices[types++] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
system = runloop_get_system_info();
if (system)
{
@ -1190,7 +1188,7 @@ static int setting_action_right_libretro_device_type(
const struct retro_controller_info *desc = NULL;
rarch_setting_t *setting = (rarch_setting_t*)data;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
if (!setting)
return -1;
@ -1200,8 +1198,7 @@ static int setting_action_right_libretro_device_type(
devices[types++] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system)
&& system)
if (system)
{
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
@ -1674,8 +1671,8 @@ void general_write_handler(void *data)
break;
case MENU_ENUM_LABEL_VIDEO_ROTATION:
{
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
rarch_system_info_t *system = runloop_get_system_info();
if (system)
video_driver_set_rotation(
(*setting->value.target.unsigned_integer +
@ -1877,14 +1874,11 @@ static bool setting_append_list_input_player_options(
rarch_setting_group_info_t group_info = {0};
rarch_setting_group_info_t subgroup_info = {0};
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
const char *temp_value = NULL;
rarch_system_info_t *system = runloop_get_system_info();
const struct retro_keybind* const defaults =
(user == 0) ? retro_keybinds_1 : retro_keybinds_rest;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
temp_value =msg_hash_to_str((enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_USER_1_BINDS + user));
const char *temp_value = msg_hash_to_str
((enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_USER_1_BINDS + user));
snprintf(buffer[user], sizeof(buffer[user]),
"%s %u", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), user + 1);

View File

@ -171,7 +171,6 @@ static int httpserver_handle_basic_info(struct mg_connection* conn, void* cbdata
retro_ctx_memory_info_t vram;
char core_path[PATH_MAX_LENGTH] = {0};
const char* pixel_format = NULL;
const rarch_system_info_t* system = NULL;
const struct retro_subsystem_info* subsys = NULL;
const struct retro_subsystem_rom_info* rom = NULL;
const struct retro_subsystem_memory_info* mem = NULL;
@ -182,9 +181,7 @@ static int httpserver_handle_basic_info(struct mg_connection* conn, void* cbdata
const core_option_manager_t* core_opts = NULL;
const struct mg_request_info * req = mg_get_request_info(conn);
const settings_t * settings = config_get_ptr();
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
rarch_system_info_t *system = runloop_get_system_info();
if (string_is_empty(system->info.library_name))
return httpserver_error(conn, 500, "Core not initialized in %s", __FUNCTION__);
@ -413,16 +410,13 @@ static int httpserver_handle_get_mmaps(struct mg_connection* conn, void* cbdata)
unsigned id;
const struct mg_request_info* req = mg_get_request_info(conn);
const char* comma = "";
rarch_system_info_t * system = NULL;
const struct retro_memory_map* mmaps = NULL;
const struct retro_memory_descriptor* mmap = NULL;
rarch_system_info_t *system = runloop_get_system_info();
if (strcmp(req->request_method, "GET"))
return httpserver_error(conn, 405, "Unimplemented method in %s: %s", __FUNCTION__, req->request_method);
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
mmaps = &system->mmaps;
mmap = mmaps->descriptors;
@ -469,11 +463,11 @@ static int httpserver_handle_get_mmap(struct mg_connection* conn, void* cbdata)
uLong buflen;
const struct mg_request_info * req = mg_get_request_info(conn);
const char * comma = "";
rarch_system_info_t* system = NULL;
const struct retro_memory_map* mmaps = NULL;
const struct retro_memory_descriptor* mmap = NULL;
const char* param = NULL;
Bytef* buffer = NULL;
rarch_system_info_t *system = runloop_get_system_info();
if (strcmp(req->request_method, "GET"))
return httpserver_error(conn, 405, "Unimplemented method in %s: %s", __FUNCTION__, req->request_method);
@ -481,9 +475,6 @@ static int httpserver_handle_get_mmap(struct mg_connection* conn, void* cbdata)
if (sscanf(req->request_uri, "/" MEMORY_MAP "/%u", &id) != 1)
return httpserver_error(conn, 500, "Malformed request in %s: %s", __FUNCTION__, req->request_uri);
if (!runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system))
return httpserver_error(conn, 500, "Could not get system information in %s", __FUNCTION__);
mmaps = &system->mmaps;
if (id >= mmaps->num_descriptors)

View File

@ -231,6 +231,7 @@ bool netplay_lan_ad_server(netplay_t *netplay)
/* Somebody queried, so check that it's valid */
addr_size = sizeof(their_addr);
if (recvfrom(lan_ad_server_fd, (char*)&ad_packet_buffer,
sizeof(struct ad_packet), 0, &their_addr, &addr_size) >=
(ssize_t) (2*sizeof(uint32_t)))
@ -247,7 +248,7 @@ bool netplay_lan_ad_server(netplay_t *netplay)
NETPLAY_PROTOCOL_VERSION)
continue;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
info = runloop_get_system_info();
/* Now build our response */
content_get_crc(&content_crc_ptr);
@ -265,6 +266,7 @@ bool netplay_lan_ad_server(netplay_t *netplay)
? path_basename(path_get(RARCH_PATH_BASENAME)) : "N/A",
NETPLAY_HOST_STR_LEN);
strlcpy(ad_packet_buffer.nick, netplay->nick, NETPLAY_HOST_STR_LEN);
if (info)
{
strlcpy(ad_packet_buffer.core, info->info.library_name,

View File

@ -601,18 +601,16 @@ static void netplay_announce(void)
{
char buf [2048];
char url [2048] = "http://newlobby.libretro.com/add/";
rarch_system_info_t *system = NULL;
settings_t *settings = config_get_ptr();
char *username = NULL;
char *corename = NULL;
char *gamename = NULL;
char *coreversion = NULL;
uint32_t *content_crc_ptr = NULL;
char *username;
char *corename;
char *gamename;
char *coreversion;
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = runloop_get_system_info();
content_get_crc(&content_crc_ptr);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
net_http_urlencode_full(&username, settings->username);
net_http_urlencode_full(&corename, system->info.library_name);
net_http_urlencode_full(&gamename, !string_is_empty(path_basename(path_get(RARCH_PATH_BASENAME))) ? path_basename(path_get(RARCH_PATH_BASENAME)) : "N/A");

View File

@ -470,16 +470,14 @@ static void netplay_handshake_ready(netplay_t *netplay, struct netplay_connectio
bool netplay_handshake_info(netplay_t *netplay, struct netplay_connection *connection)
{
struct info_buf_s info_buf;
rarch_system_info_t *core_info;
uint32_t *content_crc_ptr;
uint32_t *content_crc_ptr = NULL;
rarch_system_info_t *core_info = runloop_get_system_info();
memset(&info_buf, 0, sizeof(info_buf));
info_buf.cmd[0] = htonl(NETPLAY_CMD_INFO);
info_buf.cmd[1] = htonl(sizeof(info_buf) - 2*sizeof(uint32_t));
/* Get our core info */
core_info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &core_info);
if (core_info)
{
strlcpy(info_buf.core_name, core_info->info.library_name, sizeof(info_buf.core_name));
@ -487,7 +485,7 @@ bool netplay_handshake_info(netplay_t *netplay, struct netplay_connection *conne
}
else
{
strlcpy(info_buf.core_name, "UNKNOWN", sizeof(info_buf.core_name));
strlcpy(info_buf.core_name, "UNKNOWN", sizeof(info_buf.core_name));
strlcpy(info_buf.core_version, "UNKNOWN", sizeof(info_buf.core_version));
}
@ -767,9 +765,9 @@ bool netplay_handshake_pre_info(netplay_t *netplay,
struct info_buf_s info_buf;
uint32_t cmd_size;
ssize_t recvd;
rarch_system_info_t *core_info;
uint32_t *content_crc_ptr;
const char *dmsg = NULL;
uint32_t *content_crc_ptr = NULL;
const char *dmsg = NULL;
rarch_system_info_t *core_info = runloop_get_system_info();
RECV(&info_buf, sizeof(info_buf.cmd)) {}
@ -807,8 +805,7 @@ bool netplay_handshake_pre_info(netplay_t *netplay,
}
/* Check the core info */
core_info = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &core_info);
if (core_info)
{
if (strncmp(info_buf.core_name, core_info->info.library_name, sizeof(info_buf.core_name)) ||

13
paths.c
View File

@ -65,15 +65,13 @@ void path_set_redirect(void)
char new_savestate_dir[PATH_MAX_LENGTH];
uint32_t library_name_hash = 0;
bool check_library_name_hash = false;
rarch_system_info_t *info = NULL;
global_t *global = global_get_ptr();
const char *old_savefile_dir = dir_get(RARCH_DIR_SAVEFILE);
const char *old_savestate_dir = dir_get(RARCH_DIR_SAVESTATE);
rarch_system_info_t *info = runloop_get_system_info();
new_savefile_dir[0] = new_savestate_dir[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info && info->info.library_name &&
!string_is_empty(info->info.library_name))
library_name_hash =
@ -296,15 +294,10 @@ static bool path_init_subsystem(void)
{
unsigned i, j;
const struct retro_subsystem_info *info = NULL;
rarch_system_info_t *system = NULL;
global_t *global = global_get_ptr();
rarch_system_info_t *system = runloop_get_system_info();
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!system)
return false;
if (path_is_empty(RARCH_PATH_SUBSYSTEM))
if (!system || path_is_empty(RARCH_PATH_SUBSYSTEM))
return false;
/* For subsystems, we know exactly which RAM types are supported. */

View File

@ -919,12 +919,10 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir)
char config_directory[PATH_MAX_LENGTH];
const char *core_name = NULL;
const char *game_name = NULL;
rarch_system_info_t *system = NULL;
rarch_system_info_t *system = runloop_get_system_info();
config_directory[0] = core_path[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (system)
core_name = system->info.library_name;

View File

@ -265,14 +265,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
*coreopts = runloop_core_options;
}
break;
case RUNLOOP_CTL_SYSTEM_INFO_GET:
{
rarch_system_info_t **system = (rarch_system_info_t**)data;
if (!system)
return false;
*system = &runloop_system;
}
break;
case RUNLOOP_CTL_SYSTEM_INFO_FREE:
/* No longer valid. */
@ -1208,3 +1200,8 @@ end:
return 0;
}
rarch_system_info_t *runloop_get_system_info(void)
{
return &runloop_system;
}

View File

@ -23,6 +23,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include "core.h"
#include "runloop_defines.h"
RETRO_BEGIN_DECLS
@ -107,7 +108,6 @@ enum runloop_ctl_state
RUNLOOP_CTL_CORE_OPTIONS_FREE,
/* System info */
RUNLOOP_CTL_SYSTEM_INFO_GET,
RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE,
@ -209,6 +209,8 @@ void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion,
bool runloop_ctl(enum runloop_ctl_state state, void *data);
rarch_system_info_t *runloop_get_system_info(void);
RETRO_END_DECLS
#endif

View File

@ -844,11 +844,10 @@ static bool task_load_content(content_ctx_info_t *content_info,
{
char tmp[PATH_MAX_LENGTH];
struct retro_system_info *info = NULL;
rarch_system_info_t *sys_info = NULL;
rarch_system_info_t *sys_info = runloop_get_system_info();
tmp[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
if (sys_info)
info = &sys_info->info;
@ -1611,13 +1610,11 @@ bool content_init(void)
bool ret = true;
char *error_string = NULL;
rarch_system_info_t *sys_info = NULL;
settings_t *settings = config_get_ptr();
rarch_system_info_t *sys_info = runloop_get_system_info();
temporary_content = string_list_new();
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sys_info);
content_ctx.check_firmware_before_loading = settings->check_firmware_before_loading;
content_ctx.temporary_content = temporary_content;
content_ctx.history_list_enable = false;