mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 01:21:47 +00:00
Move code to menu_content.c
This commit is contained in:
parent
14329b0656
commit
56ef899946
@ -17,6 +17,7 @@
|
|||||||
#include <string/stdstring.h>
|
#include <string/stdstring.h>
|
||||||
#include <lists/string_list.h>
|
#include <lists/string_list.h>
|
||||||
|
|
||||||
|
#include "../menu_content.h"
|
||||||
#include "../menu_driver.h"
|
#include "../menu_driver.h"
|
||||||
#include "../menu_cbs.h"
|
#include "../menu_cbs.h"
|
||||||
#include "../menu_input.h"
|
#include "../menu_input.h"
|
||||||
@ -26,6 +27,7 @@
|
|||||||
|
|
||||||
#include "../../core_info.h"
|
#include "../../core_info.h"
|
||||||
#include "../../managers/cheat_manager.h"
|
#include "../../managers/cheat_manager.h"
|
||||||
|
#include "../../file_path_special.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
#include "../../retroarch.h"
|
#include "../../retroarch.h"
|
||||||
#include "../../system.h"
|
#include "../../system.h"
|
||||||
@ -324,8 +326,9 @@ static int playlist_association_left(unsigned type, const char *label,
|
|||||||
stnames = string_split(settings->playlist_names, ";");
|
stnames = string_split(settings->playlist_names, ";");
|
||||||
stcores = string_split(settings->playlist_cores, ";");
|
stcores = string_split(settings->playlist_cores, ";");
|
||||||
|
|
||||||
if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path)))
|
if (!menu_content_playlist_find_associated_core(path, core_path, sizeof(core_path)))
|
||||||
strlcpy(core_path, "DETECT", sizeof(core_path));
|
strlcpy(core_path,
|
||||||
|
file_path_str(FILE_PATH_DETECT), sizeof(core_path));
|
||||||
|
|
||||||
for (i = 0; i < list->count; i++)
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
|
@ -695,7 +695,7 @@ static int action_ok_playlist_entry_collection(const char *path,
|
|||||||
const char *path_base =
|
const char *path_base =
|
||||||
path_basename(menu->db_playlist_file);
|
path_basename(menu->db_playlist_file);
|
||||||
bool found_associated_core =
|
bool found_associated_core =
|
||||||
menu_playlist_find_associated_core(
|
menu_content_playlist_find_associated_core(
|
||||||
path_base, new_core_path, sizeof(new_core_path));
|
path_base, new_core_path, sizeof(new_core_path));
|
||||||
|
|
||||||
core_info.inf = NULL;
|
core_info.inf = NULL;
|
||||||
@ -734,7 +734,7 @@ static int action_ok_playlist_entry_collection(const char *path,
|
|||||||
playlist_info.data = playlist;
|
playlist_info.data = playlist;
|
||||||
playlist_info.idx = selection_ptr;
|
playlist_info.idx = selection_ptr;
|
||||||
|
|
||||||
if (!menu_content_load_from_playlist(&playlist_info))
|
if (!menu_content_playlist_load(&playlist_info))
|
||||||
return menu_cbs_exit();
|
return menu_cbs_exit();
|
||||||
|
|
||||||
playlist_get_index(playlist,
|
playlist_get_index(playlist,
|
||||||
@ -809,7 +809,7 @@ static int action_ok_playlist_entry(const char *path,
|
|||||||
const char *path_base =
|
const char *path_base =
|
||||||
path_basename(menu->db_playlist_file);
|
path_basename(menu->db_playlist_file);
|
||||||
bool found_associated_core =
|
bool found_associated_core =
|
||||||
menu_playlist_find_associated_core(
|
menu_content_playlist_find_associated_core(
|
||||||
path_base, new_core_path, sizeof(new_core_path));
|
path_base, new_core_path, sizeof(new_core_path));
|
||||||
|
|
||||||
core_info.inf = NULL;
|
core_info.inf = NULL;
|
||||||
@ -848,7 +848,7 @@ static int action_ok_playlist_entry(const char *path,
|
|||||||
playlist_info.data = playlist;
|
playlist_info.data = playlist;
|
||||||
playlist_info.idx = selection_ptr;
|
playlist_info.idx = selection_ptr;
|
||||||
|
|
||||||
if (!menu_content_load_from_playlist(&playlist_info))
|
if (!menu_content_playlist_load(&playlist_info))
|
||||||
return menu_cbs_exit();
|
return menu_cbs_exit();
|
||||||
|
|
||||||
playlist_get_index(playlist,
|
playlist_get_index(playlist,
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <lists/string_list.h>
|
#include <lists/string_list.h>
|
||||||
#include <string/stdstring.h>
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
|
#include "../menu_content.h"
|
||||||
#include "../menu_driver.h"
|
#include "../menu_driver.h"
|
||||||
#include "../menu_cbs.h"
|
#include "../menu_cbs.h"
|
||||||
#include "../menu_input.h"
|
#include "../menu_input.h"
|
||||||
@ -26,6 +27,7 @@
|
|||||||
|
|
||||||
#include "../../core_info.h"
|
#include "../../core_info.h"
|
||||||
#include "../../managers/cheat_manager.h"
|
#include "../../managers/cheat_manager.h"
|
||||||
|
#include "../../file_path_special.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
#include "../../retroarch.h"
|
#include "../../retroarch.h"
|
||||||
#include "../../system.h"
|
#include "../../system.h"
|
||||||
@ -345,8 +347,9 @@ static int playlist_association_right(unsigned type, const char *label,
|
|||||||
stnames = string_split(settings->playlist_names, ";");
|
stnames = string_split(settings->playlist_names, ";");
|
||||||
stcores = string_split(settings->playlist_cores, ";");
|
stcores = string_split(settings->playlist_cores, ";");
|
||||||
|
|
||||||
if (!menu_playlist_find_associated_core(path, core_path, sizeof(core_path)))
|
if (!menu_content_playlist_find_associated_core(path, core_path, sizeof(core_path)))
|
||||||
strlcpy(core_path, "DETECT", sizeof(core_path));
|
strlcpy(core_path,
|
||||||
|
file_path_str(FILE_PATH_DETECT), sizeof(core_path));
|
||||||
|
|
||||||
for (i = 0; i < list->count; i++)
|
for (i = 0; i < list->count; i++)
|
||||||
{
|
{
|
||||||
|
@ -206,8 +206,6 @@ void menu_cbs_init(void *data,
|
|||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
unsigned type, size_t idx);
|
unsigned type, size_t idx);
|
||||||
|
|
||||||
bool menu_playlist_find_associated_core(const char *path, char *s, size_t len);
|
|
||||||
|
|
||||||
int menu_cbs_exit(void);
|
int menu_cbs_exit(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
*
|
*
|
||||||
* Initializes core and loads content based on playlist entry.
|
* Initializes core and loads content based on playlist entry.
|
||||||
**/
|
**/
|
||||||
bool menu_content_load_from_playlist(menu_content_ctx_playlist_info_t *info)
|
bool menu_content_playlist_load(menu_content_ctx_playlist_info_t *info)
|
||||||
{
|
{
|
||||||
playlist_t *playlist = NULL;
|
playlist_t *playlist = NULL;
|
||||||
const char *path = NULL;
|
const char *path = NULL;
|
||||||
@ -94,6 +94,39 @@ error:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool menu_content_playlist_find_associated_core(const char *path, char *s, size_t len)
|
||||||
|
{
|
||||||
|
unsigned j;
|
||||||
|
bool ret = false;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
struct string_list *existing_core_names =
|
||||||
|
string_split(settings->playlist_names, ";");
|
||||||
|
struct string_list *existing_core_paths =
|
||||||
|
string_split(settings->playlist_cores, ";");
|
||||||
|
|
||||||
|
for (j = 0; j < existing_core_names->size; j++)
|
||||||
|
{
|
||||||
|
if (string_is_equal(path, existing_core_names->elems[j].data))
|
||||||
|
{
|
||||||
|
if (existing_core_paths)
|
||||||
|
{
|
||||||
|
const char *existing_core = existing_core_paths->elems[j].data;
|
||||||
|
|
||||||
|
if (existing_core)
|
||||||
|
{
|
||||||
|
strlcpy(s, existing_core, len);
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string_list_free(existing_core_names);
|
||||||
|
string_list_free(existing_core_paths);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* menu_content_find_first_core:
|
* menu_content_find_first_core:
|
||||||
* @core_info : Core info list handle.
|
* @core_info : Core info list handle.
|
||||||
|
@ -41,13 +41,16 @@ typedef struct menu_content_ctx_defer_info
|
|||||||
} menu_content_ctx_defer_info_t;
|
} menu_content_ctx_defer_info_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* menu_content_load_from_playlist:
|
* menu_content_playlist_load:
|
||||||
* @playlist : Playlist handle.
|
* @playlist : Playlist handle.
|
||||||
* @idx : Index in playlist.
|
* @idx : Index in playlist.
|
||||||
*
|
*
|
||||||
* Initializes core and loads content based on playlist entry.
|
* Initializes core and loads content based on playlist entry.
|
||||||
**/
|
**/
|
||||||
bool menu_content_load_from_playlist(menu_content_ctx_playlist_info_t *info);
|
bool menu_content_playlist_load(menu_content_ctx_playlist_info_t *info);
|
||||||
|
|
||||||
|
bool menu_content_playlist_find_associated_core(const char *path,
|
||||||
|
char *s, size_t len);
|
||||||
|
|
||||||
bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info,
|
bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info,
|
||||||
bool load_content_with_current_core,
|
bool load_content_with_current_core,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <string/stdstring.h>
|
#include <string/stdstring.h>
|
||||||
#include <features/features_cpu.h>
|
#include <features/features_cpu.h>
|
||||||
|
|
||||||
|
#include "menu_content.h"
|
||||||
#include "menu_driver.h"
|
#include "menu_driver.h"
|
||||||
#include "menu_navigation.h"
|
#include "menu_navigation.h"
|
||||||
#include "menu_cbs.h"
|
#include "menu_cbs.h"
|
||||||
@ -3405,39 +3406,6 @@ static int menu_displaylist_parse_generic(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_playlist_find_associated_core(const char *path, char *s, size_t len)
|
|
||||||
{
|
|
||||||
unsigned j;
|
|
||||||
bool ret = false;
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
struct string_list *existing_core_names =
|
|
||||||
string_split(settings->playlist_names, ";");
|
|
||||||
struct string_list *existing_core_paths =
|
|
||||||
string_split(settings->playlist_cores, ";");
|
|
||||||
|
|
||||||
for (j = 0; j < existing_core_names->size; j++)
|
|
||||||
{
|
|
||||||
if (string_is_equal(path, existing_core_names->elems[j].data))
|
|
||||||
{
|
|
||||||
if (existing_core_paths)
|
|
||||||
{
|
|
||||||
const char *existing_core = existing_core_paths->elems[j].data;
|
|
||||||
|
|
||||||
if (existing_core)
|
|
||||||
{
|
|
||||||
strlcpy(s, existing_core, len);
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string_list_free(existing_core_names);
|
|
||||||
string_list_free(existing_core_paths);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void menu_displaylist_parse_playlist_associations(
|
static void menu_displaylist_parse_playlist_associations(
|
||||||
menu_displaylist_info_t *info)
|
menu_displaylist_info_t *info)
|
||||||
{
|
{
|
||||||
@ -3462,7 +3430,7 @@ static void menu_displaylist_parse_playlist_associations(
|
|||||||
const char *path =
|
const char *path =
|
||||||
path_basename(str_list->elems[i].data);
|
path_basename(str_list->elems[i].data);
|
||||||
|
|
||||||
if (!menu_playlist_find_associated_core(
|
if (!menu_content_playlist_find_associated_core(
|
||||||
path, core_path, sizeof(core_path)))
|
path, core_path, sizeof(core_path)))
|
||||||
strlcpy(core_path, file_path_str(FILE_PATH_DETECT), sizeof(core_path));
|
strlcpy(core_path, file_path_str(FILE_PATH_DETECT), sizeof(core_path));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user