mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 06:18:34 +00:00
Move rarch_defer_core to menu_content.c and rename it
menu_content_defer_core
This commit is contained in:
parent
58b6499cca
commit
4630d625f1
@ -24,6 +24,7 @@
|
|||||||
#include "../menu_shader.h"
|
#include "../menu_shader.h"
|
||||||
#include "../menu_navigation.h"
|
#include "../menu_navigation.h"
|
||||||
#include "../menu_hash.h"
|
#include "../menu_hash.h"
|
||||||
|
#include "../menu_content.h"
|
||||||
|
|
||||||
#include "../../core_info.h"
|
#include "../../core_info.h"
|
||||||
#include "../../defaults.h"
|
#include "../../defaults.h"
|
||||||
@ -415,7 +416,7 @@ static int rarch_defer_core_wrapper(size_t idx, size_t entry_idx, const char *pa
|
|||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||||
|
|
||||||
ret = rarch_defer_core(list,
|
ret = menu_content_defer_core(list,
|
||||||
menu_path_new, path, menu_label, menu->deferred_path,
|
menu_path_new, path, menu_label, menu->deferred_path,
|
||||||
sizeof(menu->deferred_path));
|
sizeof(menu->deferred_path));
|
||||||
|
|
||||||
@ -1844,7 +1845,7 @@ static int action_ok_load_archive_detect_core(const char *path,
|
|||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_LIST_GET, &list);
|
||||||
|
|
||||||
ret = rarch_defer_core(list, menu_path, content_path, label,
|
ret = menu_content_defer_core(list, menu_path, content_path, label,
|
||||||
menu->deferred_path, sizeof(menu->deferred_path));
|
menu->deferred_path, sizeof(menu->deferred_path));
|
||||||
|
|
||||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||||
|
@ -13,13 +13,16 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <retro_assert.h>
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
|
|
||||||
#include "menu_content.h"
|
#include "menu_content.h"
|
||||||
#include "menu_driver.h"
|
#include "menu_driver.h"
|
||||||
#include "menu_display.h"
|
#include "menu_display.h"
|
||||||
|
#include "menu_hash.h"
|
||||||
#include "menu_shader.h"
|
#include "menu_shader.h"
|
||||||
|
|
||||||
|
#include "../core_info.h"
|
||||||
#include "../configuration.h"
|
#include "../configuration.h"
|
||||||
#include "../defaults.h"
|
#include "../defaults.h"
|
||||||
#include "../frontend/frontend.h"
|
#include "../frontend/frontend.h"
|
||||||
@ -133,3 +136,72 @@ bool menu_content_load(void)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menu_content_defer_core:
|
||||||
|
* @core_info : Core info list handle.
|
||||||
|
* @dir : Directory. Gets joined with @path.
|
||||||
|
* @path : Path. Gets joined with @dir.
|
||||||
|
* @menu_label : Label identifier of menu setting.
|
||||||
|
* @s : Deferred core path. Will be filled in
|
||||||
|
* by function.
|
||||||
|
* @len : Size of @s.
|
||||||
|
*
|
||||||
|
* Gets deferred core.
|
||||||
|
*
|
||||||
|
* Returns: 0 if there are multiple deferred cores and a
|
||||||
|
* selection needs to be made from a list, otherwise
|
||||||
|
* returns -1 and fills in @s with path to core.
|
||||||
|
**/
|
||||||
|
int menu_content_defer_core(void *data, const char *dir,
|
||||||
|
const char *path, const char *menu_label,
|
||||||
|
char *s, size_t len)
|
||||||
|
{
|
||||||
|
char new_core_path[PATH_MAX_LENGTH];
|
||||||
|
const core_info_t *info = NULL;
|
||||||
|
size_t supported = 0;
|
||||||
|
core_info_list_t *core_info = (core_info_list_t*)data;
|
||||||
|
uint32_t menu_label_hash = menu_hash_calculate(menu_label);
|
||||||
|
|
||||||
|
fill_pathname_join(s, dir, path, len);
|
||||||
|
|
||||||
|
#ifdef HAVE_COMPRESSION
|
||||||
|
if (path_is_compressed_file(dir))
|
||||||
|
{
|
||||||
|
/* In case of a compressed archive, we have to join with a hash */
|
||||||
|
/* We are going to write at the position of dir: */
|
||||||
|
retro_assert(strlen(dir) < strlen(s));
|
||||||
|
s[strlen(dir)] = '#';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (core_info)
|
||||||
|
core_info_list_get_supported_cores(core_info, s, &info,
|
||||||
|
&supported);
|
||||||
|
|
||||||
|
/* We started the menu with 'Load Content', we are
|
||||||
|
* going to use the current core to load this. */
|
||||||
|
if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
|
||||||
|
{
|
||||||
|
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, (void*)&info);
|
||||||
|
if (info)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Use the current core (%s) to load this content...\n", info->path);
|
||||||
|
supported = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* There are multiple deferred cores and a
|
||||||
|
* selection needs to be made from a list, return 0. */
|
||||||
|
if (supported != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (info)
|
||||||
|
strlcpy(new_core_path, info->path, sizeof(new_core_path));
|
||||||
|
|
||||||
|
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, s);
|
||||||
|
|
||||||
|
if (path_file_exists(new_core_path))
|
||||||
|
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@ -35,6 +35,27 @@ extern "C" {
|
|||||||
**/
|
**/
|
||||||
bool menu_content_load(void);
|
bool menu_content_load(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* menu_content_defer_core:
|
||||||
|
* @core_info : Core info list handle.
|
||||||
|
* @dir : Directory. Gets joined with @path.
|
||||||
|
* @path : Path. Gets joined with @dir.
|
||||||
|
* @menu_label : Label identifier of menu setting.
|
||||||
|
* @s : Deferred core path. Will be filled in
|
||||||
|
* by function.
|
||||||
|
* @len : Size of @s.
|
||||||
|
*
|
||||||
|
* Gets deferred core.
|
||||||
|
*
|
||||||
|
* Returns: 0 if there are multiple deferred cores and a
|
||||||
|
* selection needs to be made from a list, otherwise
|
||||||
|
* returns -1 and fills in @s with path to core.
|
||||||
|
**/
|
||||||
|
int menu_content_defer_core(void *data,
|
||||||
|
const char *dir, const char *path,
|
||||||
|
const char *menu_label,
|
||||||
|
char *s, size_t len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
72
retroarch.c
72
retroarch.c
@ -1586,78 +1586,6 @@ void rarch_playlist_load_content(void *data, unsigned idx)
|
|||||||
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
|
event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* rarch_defer_core:
|
|
||||||
* @core_info : Core info list handle.
|
|
||||||
* @dir : Directory. Gets joined with @path.
|
|
||||||
* @path : Path. Gets joined with @dir.
|
|
||||||
* @menu_label : Label identifier of menu setting.
|
|
||||||
* @s : Deferred core path. Will be filled in
|
|
||||||
* by function.
|
|
||||||
* @len : Size of @s.
|
|
||||||
*
|
|
||||||
* Gets deferred core.
|
|
||||||
*
|
|
||||||
* Returns: 0 if there are multiple deferred cores and a
|
|
||||||
* selection needs to be made from a list, otherwise
|
|
||||||
* returns -1 and fills in @s with path to core.
|
|
||||||
**/
|
|
||||||
int rarch_defer_core(void *data, const char *dir,
|
|
||||||
const char *path, const char *menu_label,
|
|
||||||
char *s, size_t len)
|
|
||||||
{
|
|
||||||
char new_core_path[PATH_MAX_LENGTH];
|
|
||||||
const core_info_t *info = NULL;
|
|
||||||
size_t supported = 0;
|
|
||||||
core_info_list_t *core_info = (core_info_list_t*)data;
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
uint32_t menu_label_hash = msg_hash_calculate(menu_label);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fill_pathname_join(s, dir, path, len);
|
|
||||||
|
|
||||||
#ifdef HAVE_COMPRESSION
|
|
||||||
if (path_is_compressed_file(dir))
|
|
||||||
{
|
|
||||||
/* In case of a compressed archive, we have to join with a hash */
|
|
||||||
/* We are going to write at the position of dir: */
|
|
||||||
retro_assert(strlen(dir) < strlen(s));
|
|
||||||
s[strlen(dir)] = '#';
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (core_info)
|
|
||||||
core_info_list_get_supported_cores(core_info, s, &info,
|
|
||||||
&supported);
|
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
/* We started the menu with 'Load Content', we are
|
|
||||||
* going to use the current core to load this. */
|
|
||||||
if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
|
|
||||||
{
|
|
||||||
runloop_ctl(RUNLOOP_CTL_CURRENT_CORE_GET, (void*)&info);
|
|
||||||
if (info)
|
|
||||||
{
|
|
||||||
RARCH_LOG("Use the current core (%s) to load this content...\n", info->path);
|
|
||||||
supported = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* There are multiple deferred cores and a
|
|
||||||
* selection needs to be made from a list, return 0. */
|
|
||||||
if (supported != 1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (info)
|
|
||||||
strlcpy(new_core_path, info->path, sizeof(new_core_path));
|
|
||||||
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, s);
|
|
||||||
|
|
||||||
if (path_file_exists(new_core_path))
|
|
||||||
runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len)
|
int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
21
retroarch.h
21
retroarch.h
@ -208,27 +208,6 @@ void rarch_main_deinit(void);
|
|||||||
**/
|
**/
|
||||||
void rarch_playlist_load_content(void *data, unsigned index);
|
void rarch_playlist_load_content(void *data, unsigned index);
|
||||||
|
|
||||||
/**
|
|
||||||
* rarch_defer_core:
|
|
||||||
* @core_info : Core info list handle.
|
|
||||||
* @dir : Directory. Gets joined with @path.
|
|
||||||
* @path : Path. Gets joined with @dir.
|
|
||||||
* @menu_label : Label identifier of menu setting.
|
|
||||||
* @s : Deferred core path. Will be filled in
|
|
||||||
* by function.
|
|
||||||
* @len : Size of @s.
|
|
||||||
*
|
|
||||||
* Gets deferred core.
|
|
||||||
*
|
|
||||||
* Returns: 0 if there are multiple deferred cores and a
|
|
||||||
* selection needs to be made from a list, otherwise
|
|
||||||
* returns -1 and fills in @s with path to core.
|
|
||||||
**/
|
|
||||||
int rarch_defer_core(void *data,
|
|
||||||
const char *dir, const char *path,
|
|
||||||
const char *menu_label,
|
|
||||||
char *s, size_t len);
|
|
||||||
|
|
||||||
void rarch_set_paths(const char *path);
|
void rarch_set_paths(const char *path);
|
||||||
|
|
||||||
int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len);
|
int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t len);
|
||||||
|
Loading…
Reference in New Issue
Block a user