mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-31 16:52:45 +00:00
Move runloop_fullpath to paths.c
This commit is contained in:
parent
d7f9358dd0
commit
2d11ea71cc
@ -1027,8 +1027,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
if (string_is_empty(settings->directory.system))
|
||||
{
|
||||
char *fullpath = NULL;
|
||||
if (runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath) &&
|
||||
fullpath)
|
||||
if (path_get_content(&fullpath) && fullpath)
|
||||
{
|
||||
char temp_path[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
|
@ -386,7 +386,7 @@ static void frontend_gx_exitspawn(char *s, size_t len)
|
||||
{
|
||||
fill_pathname_join(new_path, g_defaults.dir.core,
|
||||
salamander_name, sizeof(new_path));
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, new_path);
|
||||
path_set_content(new_path);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -403,7 +403,7 @@ static void frontend_ps3_exec(const char *path, bool should_load_game)
|
||||
RARCH_LOG("Attempt to load executable: [%s].\n", path);
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
if (should_load_game && !string_is_empty(fullpath))
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ static void frontend_psp_exec(const char *path, bool should_load_game)
|
||||
args = strlen(argp) + 1;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
if (should_load_game && !string_is_empty(fullpath))
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ void system_exec_wii(const char *_path, bool should_load_game)
|
||||
#else
|
||||
char *fullpath = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
strlcpy(game_path, fullpath, sizeof(game_path));
|
||||
#endif
|
||||
}
|
||||
|
@ -1265,7 +1265,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
#ifdef _XBOX
|
||||
char *fullpath = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
#if defined(_XBOX1)
|
||||
LAUNCH_DATA ptr;
|
||||
|
@ -142,7 +142,7 @@ INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
|
||||
unsigned i;
|
||||
/* Add items to list. */
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
core_info_get_list(&core_info_list);
|
||||
core_info_list_get_supported_cores(core_info_list,
|
||||
(const char*)fullpath, &core_info, &list_size);
|
||||
@ -175,7 +175,7 @@ INT_PTR CALLBACK PickCoreProc(HWND hDlg, UINT message,
|
||||
{
|
||||
int lbItem;
|
||||
const core_info_t *info = NULL;
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
HWND hwndList = GetDlgItem(hDlg, ID_CORELISTBOX);
|
||||
lbItem = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0);
|
||||
core_info_get_list(&core_info_list);
|
||||
@ -286,7 +286,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
|
||||
if (!list_size)
|
||||
return 0;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH,szFilename);
|
||||
path_set_content(szFilename);
|
||||
|
||||
if (!path_is_core_empty())
|
||||
{
|
||||
|
@ -2665,7 +2665,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return -1;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)
|
||||
&& string_is_equal(menu->deferred_path, fullpath))
|
||||
|
26
paths.c
26
paths.c
@ -50,6 +50,7 @@
|
||||
|
||||
static char path_main_basename[PATH_MAX_LENGTH] = {0}
|
||||
;
|
||||
static char path_content[PATH_MAX_LENGTH] = {0};
|
||||
static char current_savefile_dir[PATH_MAX_LENGTH] = {0};
|
||||
static char path_libretro[PATH_MAX_LENGTH] = {0};
|
||||
static char path_config_file[PATH_MAX_LENGTH] = {0};
|
||||
@ -208,7 +209,8 @@ void path_set_basename(const char *path)
|
||||
{
|
||||
char *dst = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)path);
|
||||
path_set_content(path);
|
||||
|
||||
strlcpy(path_main_basename, path, sizeof(path_main_basename));
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
@ -560,11 +562,33 @@ void path_clear_config_append(void)
|
||||
*path_config_append_file = '\0';
|
||||
}
|
||||
|
||||
void path_clear_content(void)
|
||||
{
|
||||
*path_content = '\0';
|
||||
}
|
||||
|
||||
bool path_set_content(const char *path)
|
||||
{
|
||||
if (!path)
|
||||
return false;
|
||||
strlcpy(path_content, path, sizeof(path_content));
|
||||
return true;
|
||||
}
|
||||
|
||||
void path_set_config_append(const char *path)
|
||||
{
|
||||
strlcpy(path_config_append_file, path, sizeof(path_config_append_file));
|
||||
}
|
||||
|
||||
bool path_get_content(char **fullpath)
|
||||
{
|
||||
if (!fullpath)
|
||||
return false;
|
||||
*fullpath = (char*)path_content;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *path_get_config_append(void)
|
||||
{
|
||||
if (!path_is_config_append_empty())
|
||||
|
6
paths.h
6
paths.h
@ -41,6 +41,8 @@ void path_fill_names(void);
|
||||
|
||||
void path_set_redirect(void);
|
||||
|
||||
bool path_set_content(const char *path);
|
||||
|
||||
void path_set_names(const char *path);
|
||||
|
||||
void path_set_special(char **argv, unsigned num_content);
|
||||
@ -65,6 +67,8 @@ char *path_get_core_ptr(void);
|
||||
|
||||
/* get functions */
|
||||
|
||||
bool path_get_content(char **fullpath);
|
||||
|
||||
const char *path_get_current_savefile_dir(void);
|
||||
|
||||
const char *path_get_basename(void);
|
||||
@ -81,6 +85,8 @@ const char *path_get_config_append(void);
|
||||
|
||||
void path_clear_basename(void);
|
||||
|
||||
void path_clear_content(void);
|
||||
|
||||
void path_clear_core(void);
|
||||
|
||||
void path_clear_config(void);
|
||||
|
@ -947,7 +947,7 @@ static void retroarch_main_init_media(void)
|
||||
)
|
||||
return;
|
||||
|
||||
if (!runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath))
|
||||
if (!path_get_content(&fullpath))
|
||||
return;
|
||||
|
||||
if (string_is_empty(fullpath))
|
||||
|
22
runloop.c
22
runloop.c
@ -106,7 +106,6 @@ typedef struct event_cmd_state
|
||||
|
||||
static rarch_system_info_t runloop_system;
|
||||
static struct retro_frame_time_callback runloop_frame_time;
|
||||
static char runloop_fullpath[PATH_MAX_LENGTH] = {0};
|
||||
static char runloop_default_shader_preset[PATH_MAX_LENGTH] = {0};
|
||||
static retro_keyboard_event_t runloop_key_event = NULL;
|
||||
static retro_keyboard_event_t runloop_frontend_key_event = NULL;
|
||||
@ -717,25 +716,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
path_set_core(fullpath);
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_CLEAR_CONTENT_PATH:
|
||||
*runloop_fullpath = '\0';
|
||||
break;
|
||||
case RUNLOOP_CTL_GET_CONTENT_PATH:
|
||||
{
|
||||
char **fullpath = (char**)data;
|
||||
if (!fullpath)
|
||||
return false;
|
||||
*fullpath = (char*)runloop_fullpath;
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_SET_CONTENT_PATH:
|
||||
{
|
||||
const char *fullpath = (const char*)data;
|
||||
if (!fullpath)
|
||||
return false;
|
||||
strlcpy(runloop_fullpath, fullpath, sizeof(runloop_fullpath));
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_CLEAR_DEFAULT_SHADER_PRESET:
|
||||
*runloop_default_shader_preset = '\0';
|
||||
break;
|
||||
@ -781,7 +761,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
|
||||
|
||||
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
path_clear_content();
|
||||
runloop_overrides_active = false;
|
||||
|
||||
core_unset_input_descriptors();
|
||||
|
@ -62,10 +62,6 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_SET_NONBLOCK_FORCED,
|
||||
RUNLOOP_CTL_UNSET_NONBLOCK_FORCED,
|
||||
|
||||
RUNLOOP_CTL_GET_CONTENT_PATH,
|
||||
RUNLOOP_CTL_SET_CONTENT_PATH,
|
||||
RUNLOOP_CTL_CLEAR_CONTENT_PATH,
|
||||
|
||||
RUNLOOP_CTL_GET_DEFAULT_SHADER_PRESET,
|
||||
RUNLOOP_CTL_SET_DEFAULT_SHADER_PRESET,
|
||||
RUNLOOP_CTL_CLEAR_DEFAULT_SHADER_PRESET,
|
||||
|
@ -682,7 +682,7 @@ static bool init_content_file_set_attribs(
|
||||
attr.i |= system->info.need_fullpath << 1;
|
||||
attr.i |= (!content_does_not_need_content()) << 2;
|
||||
|
||||
if (!runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath)
|
||||
if (!path_get_content(&fullpath)
|
||||
&& content_does_not_need_content()
|
||||
&& settings->set_supports_no_game_enable)
|
||||
string_list_append(content, "", attr);
|
||||
@ -826,7 +826,7 @@ static void menu_content_environment_get(int *argc, char *argv[],
|
||||
if (!wrap_args)
|
||||
return;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
wrap_args->no_content = menu_driver_ctl(
|
||||
RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL);
|
||||
@ -871,7 +871,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char *fullpath = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
if (launched_from_menu)
|
||||
{
|
||||
@ -999,13 +999,13 @@ static bool command_event_cmd_exec(const char *data,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
|
||||
if (fullpath != (void*)data)
|
||||
{
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
path_clear_content();
|
||||
if (!string_is_empty(data))
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)data);
|
||||
path_set_content(data);
|
||||
}
|
||||
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
@ -1091,7 +1091,7 @@ bool task_push_content_load_default(
|
||||
case CONTENT_MODE_LOAD_NOTHING_WITH_CURRENT_CORE_FROM_MENU:
|
||||
case CONTENT_MODE_LOAD_NOTHING_WITH_VIDEO_PROCESSOR_CORE_FROM_MENU:
|
||||
case CONTENT_MODE_LOAD_NOTHING_WITH_NET_RETROPAD_CORE_FROM_MENU:
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
path_clear_content();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1106,7 +1106,7 @@ bool task_push_content_load_default(
|
||||
case CONTENT_MODE_LOAD_CONTENT_WITH_FFMPEG_CORE_FROM_MENU:
|
||||
case CONTENT_MODE_LOAD_CONTENT_WITH_IMAGEVIEWER_CORE_FROM_MENU:
|
||||
case CONTENT_MODE_LOAD_CONTENT_WITH_NEW_CORE_FROM_MENU:
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)fullpath);
|
||||
path_set_content(fullpath);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1245,7 +1245,7 @@ bool task_push_content_load_default(
|
||||
{
|
||||
char *fullpath = NULL;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath);
|
||||
path_get_content(&fullpath);
|
||||
command_event_cmd_exec(fullpath, mode);
|
||||
command_event(CMD_EVENT_QUIT, NULL);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ static char** waiting_argv;
|
||||
NULL, NULL);
|
||||
}
|
||||
else
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)__core.UTF8String);
|
||||
path_set_content(__core.UTF8String);
|
||||
|
||||
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
||||
}
|
||||
@ -328,7 +328,7 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
|
||||
&& settings->set_supports_no_game_enable)
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL);
|
||||
path_clear_content();
|
||||
task_push_content_load_default(
|
||||
NULL, NULL,
|
||||
&content_info,
|
||||
@ -355,7 +355,7 @@ static void open_document_handler(ui_browser_window_state_t *state, bool result)
|
||||
if (system)
|
||||
core_name = system->library_name;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, (void*)state->result);
|
||||
path_set_content(state->result);
|
||||
|
||||
if (core_name)
|
||||
{
|
||||
|
@ -580,7 +580,8 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam)
|
||||
case ID_M_LOAD_CONTENT:
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, win32_file);
|
||||
|
||||
path_set_content(win32_file);
|
||||
|
||||
do_wm_close = true;
|
||||
task_push_content_load_default(
|
||||
|
Loading…
x
Reference in New Issue
Block a user