Get rid of another 'getter' function

This commit is contained in:
twinaphex 2021-09-21 18:30:56 +02:00
parent 1b7dea7e8e
commit f21641d898
13 changed files with 37 additions and 43 deletions

View File

@ -195,14 +195,12 @@ static void rcheevos_get_core_memory_info(unsigned id, rc_libretro_core_memory_i
static int rcheevos_init_memory(rcheevos_locals_t* locals)
{
rarch_system_info_t* system = runloop_get_system_info();
rarch_memory_map_t* mmaps = &system->mmaps;
struct retro_memory_descriptor* descriptors;
struct retro_memory_map mmap;
unsigned i;
int result;
descriptors = (struct retro_memory_descriptor*)malloc(mmaps->num_descriptors * sizeof(*descriptors));
struct retro_memory_map mmap;
rarch_system_info_t* system = runloop_get_system_info();
rarch_memory_map_t* mmaps = &system->mmaps;
struct retro_memory_descriptor *descriptors = (struct retro_memory_descriptor*)malloc(mmaps->num_descriptors * sizeof(*descriptors));
if (!descriptors)
return 0;
@ -1009,10 +1007,12 @@ void rcheevos_hardcore_enabled_changed(void)
void rcheevos_validate_config_settings(void)
{
const rc_disallowed_setting_t* disallowed_settings;
core_option_manager_t* coreopts = NULL;
struct retro_system_info* system = runloop_get_libretro_system_info();
int i;
const rc_disallowed_setting_t
*disallowed_settings = NULL;
core_option_manager_t* coreopts = NULL;
struct retro_system_info *system =
&runloop_get_system_info()->info;
if (!system->library_name || !rcheevos_locals.hardcore_active)
return;

View File

@ -114,8 +114,8 @@ static int append_no_spaces(char* buffer, char* stop, const char* text)
void rcheevos_get_user_agent(rcheevos_locals_t *locals,
char *buffer, size_t len)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
char* ptr;
struct retro_system_info *system = &runloop_get_system_info()->info;
/* if we haven't calculated the non-changing portion yet, do so now
* [retroarch version + os version] */

View File

@ -451,7 +451,7 @@ static int general_push(menu_displaylist_info_t *info,
case PUSH_ARCHIVE_OPEN:
{
struct retro_system_info *system =
runloop_get_libretro_system_info();
&runloop_get_system_info()->info;
if (system)
if (!string_is_empty(system->valid_extensions))
strlcpy(newstring2, system->valid_extensions,
@ -468,7 +468,7 @@ static int general_push(menu_displaylist_info_t *info,
else
{
struct retro_system_info *system =
runloop_get_libretro_system_info();
&runloop_get_system_info()->info;
if (system && !string_is_empty(system->valid_extensions))
{
new_exts = strdup(system->valid_extensions);
@ -514,7 +514,8 @@ static int general_push(menu_displaylist_info_t *info,
union string_list_elem_attr attr;
char newstring[PATH_MAX_LENGTH];
struct string_list str_list2 = {0};
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system =
&runloop_get_system_info()->info;
newstring[0] = '\0';
attr.i = 0;

View File

@ -1048,8 +1048,8 @@ int generic_action_ok_displaylist_push(const char *path,
break;
case ACTION_OK_DL_REMAP_FILE:
{
struct retro_system_info *system = runloop_get_libretro_system_info();
const char *core_name = system ? system->library_name : NULL;
struct retro_system_info *system = &runloop_get_system_info()->info;
const char *core_name = system ? system->library_name : NULL;
if (!string_is_empty(core_name) && !string_is_empty(settings->paths.directory_input_remapping))
{
@ -2669,7 +2669,7 @@ static int action_ok_load_cdrom(const char *path,
return -1;
}
system = runloop_get_libretro_system_info();
system = &runloop_get_system_info()->info;
if (system && !string_is_empty(system->library_name))
{
@ -3352,7 +3352,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
char directory[PATH_MAX_LENGTH];
char file[PATH_MAX_LENGTH];
char content_dir[PATH_MAX_LENGTH];
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
const char *core_name = system ? system->library_name : NULL;
settings_t *settings = config_get_ptr();
const char *path_dir_input_remapping = settings->paths.directory_input_remapping;
@ -5182,7 +5182,7 @@ static int action_ok_add_to_favorites(const char *path,
if (!string_is_empty(content_path))
{
global_t *global = global_get_ptr();
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
struct string_list *str_list = NULL;
const char *crc32 = NULL;
const char *db_name = NULL;

View File

@ -1255,7 +1255,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
string_is_empty(exts))
#endif
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
const char *core_path = core_path_current;
const char *core_name = system ? system->library_name : NULL;
@ -3395,7 +3395,7 @@ static unsigned menu_displaylist_parse_information_list(file_list_t *info_list)
{
unsigned count = 0;
core_info_t *core_info = NULL;
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
core_info_get_current_core(&core_info);

View File

@ -2864,7 +2864,7 @@ bool menu_shader_manager_remove_auto_preset(
const char *dir_video_shader,
const char *dir_menu_config)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
settings_t *settings = config_get_ptr();
return menu_shader_manager_operate_auto_preset(
system, settings->bools.video_shader_preset_save_reference_enable,
@ -2885,7 +2885,7 @@ bool menu_shader_manager_auto_preset_exists(
const char *dir_video_shader,
const char *dir_menu_config)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
settings_t *settings = config_get_ptr();
return menu_shader_manager_operate_auto_preset(
system, settings->bools.video_shader_preset_save_reference_enable,
@ -2916,7 +2916,7 @@ bool menu_shader_manager_save_auto_preset(
const char *dir_menu_config,
bool apply)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
settings_t *settings = config_get_ptr();
return menu_shader_manager_operate_auto_preset(
system, settings->bools.video_shader_preset_save_reference_enable,
@ -5133,7 +5133,7 @@ static const char * msvc_vercode_to_str(const unsigned vercode)
* (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
const char *core_name =
(system && !string_is_empty(system->library_name))
? system->library_name

View File

@ -569,7 +569,7 @@ bool netplay_lan_ad_server(netplay_t *netplay)
if (strstr(interfaces.entries[k].host, sub) &&
!strstr(interfaces.entries[k].host, "127.0.0.1"))
{
struct retro_system_info *info = runloop_get_libretro_system_info();
struct retro_system_info *info = &runloop_get_system_info()->info;
RARCH_LOG ("[Discovery] Query received on common interface: %s/%s (theirs / ours) \n",
reply_addr, interfaces.entries[k].host);
@ -1077,7 +1077,7 @@ static bool netplay_handshake_info(netplay_t *netplay,
{
struct info_buf_s info_buf;
uint32_t content_crc = 0;
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
memset(&info_buf, 0, sizeof(info_buf));
info_buf.cmd[0] = htonl(NETPLAY_CMD_INFO);
@ -1417,7 +1417,7 @@ static bool netplay_handshake_pre_info(netplay_t *netplay,
ssize_t recvd;
uint32_t content_crc = 0;
const char *dmsg = NULL;
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
RECV(&info_buf, sizeof(info_buf.cmd)) {}

View File

@ -29563,11 +29563,6 @@ rarch_system_info_t *runloop_get_system_info(void)
return &runloop_state.system;
}
struct retro_system_info *runloop_get_libretro_system_info(void)
{
return &runloop_state.system.info;
}
void retroarch_force_video_driver_fallback(const char *driver)
{
struct rarch_state *p_rarch = &rarch_st;

View File

@ -430,8 +430,6 @@ void retroarch_menu_running_finished(bool quit);
rarch_system_info_t *runloop_get_system_info(void);
struct retro_system_info *runloop_get_libretro_system_info(void);
void retroarch_force_video_driver_fallback(const char *driver);
enum retro_language rarch_get_language_from_iso(const char *lang);

View File

@ -1543,7 +1543,7 @@ static void task_push_to_history_list(
{
char tmp[PATH_MAX_LENGTH];
const char *path_content = path_get(RARCH_PATH_CONTENT);
struct retro_system_info *info = runloop_get_libretro_system_info();
struct retro_system_info *info = &runloop_get_system_info()->info;
tmp[0] = '\0';
@ -2292,7 +2292,7 @@ static bool task_load_content_internal(
if (sys_info)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
content_ctx.set_supports_no_game_enable = set_supports_no_game_enable;
@ -2784,7 +2784,7 @@ bool content_init(void)
if (sys_info)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
content_ctx.set_supports_no_game_enable = set_supports_no_game_enable;

View File

@ -92,7 +92,7 @@ static void netplay_crc_scan_callback(retro_task_t *task,
if (!string_is_empty(state->core_path) && !string_is_empty(state->content_path)
&& !state->contentless && !state->current)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
RARCH_LOG("[Lobby]: Loading core %s with content file %s\n",
state->core_path, state->content_path);
@ -120,7 +120,7 @@ static void netplay_crc_scan_callback(retro_task_t *task,
&& state->contentless)
{
content_ctx_info_t content_info = {0};
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
RARCH_LOG("[Lobby]: Loading contentless core %s\n", state->core_path);

View File

@ -686,7 +686,7 @@ static ui_application_t ui_application_cocoa = {
{
if ((filenames.count == 1) && [filenames objectAtIndex:0])
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
NSString *__core = [filenames objectAtIndex:0];
const char *core_name = system->library_name;
@ -724,7 +724,7 @@ static ui_application_t ui_application_cocoa = {
static void open_core_handler(ui_browser_window_state_t *state, bool result)
{
rarch_system_info_t *info = runloop_get_system_info();
rarch_system_info_t *info = &runloop_get_system_info();
settings_t *settings = config_get_ptr();
bool set_supports_no_game_enable =
settings->bools.set_supports_no_game_enable;
@ -753,7 +753,7 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
static void open_document_handler(
ui_browser_window_state_t *state, bool result)
{
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
const char *core_name = system ? system->library_name : NULL;
if (!state || string_is_empty(state->result))

View File

@ -3671,7 +3671,7 @@ void MainWindow::onStopClicked()
void MainWindow::setCurrentCoreLabel()
{
bool update = false;
struct retro_system_info *system = runloop_get_libretro_system_info();
struct retro_system_info *system = &runloop_get_system_info()->info;
QString libraryName = system->library_name;
const char *no_core_str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);