mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Merge pull request #6282 from fr500/master
Menu Subsystem Implementation
This commit is contained in:
commit
c6a9967b58
@ -48,6 +48,7 @@
|
||||
- SHADERS: SPIRV-Cross/slang shader support for D3D11.
|
||||
- SHIELD ATV: Allow the remote / gamepad takeover hack to work with the 2017 gamepad
|
||||
- SUBSYSTEM: Subsystem saves now respect the save directory
|
||||
- SUBSYSTEM: You can now load subsystem games from the menu (see https://github.com/libretro/RetroArch/pull/6282 for caveats)
|
||||
- VULKAN: Fix swapchain recreation bug on Nvidia GPUs with Windows 10 (resolved in Windows Nvidia driver version 390.77).
|
||||
- WINDOWS: Improved Unicode support (for cores/directory creation and 7zip archives).
|
||||
- WINDOWS: Show progress meter on taskbar for downloads (Windows 7 and up).
|
||||
|
@ -1219,6 +1219,8 @@ static bool event_init_content(void)
|
||||
if (rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
||||
return true;
|
||||
|
||||
content_set_subsystem_info();
|
||||
|
||||
if (!contentless)
|
||||
path_fill_names();
|
||||
|
||||
|
23
content.h
23
content.h
@ -25,6 +25,7 @@
|
||||
|
||||
#include <boolean.h>
|
||||
#include <retro_common_api.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "frontend/frontend_driver.h"
|
||||
|
||||
@ -81,6 +82,28 @@ bool content_reset_savestate_backups(void);
|
||||
bool content_undo_load_buf_is_empty(void);
|
||||
bool content_undo_save_buf_is_empty(void);
|
||||
|
||||
/* Clears the pending subsystem rom buffer*/
|
||||
bool content_is_subsystem_pending_load(void);
|
||||
|
||||
/* Clears the pending subsystem rom buffer*/
|
||||
void content_clear_subsystem(void);
|
||||
|
||||
/* Set the current subsystem*/
|
||||
void content_set_subsystem(unsigned subsystem);
|
||||
|
||||
/* Get the current subsystem*/
|
||||
int content_get_subsystem();
|
||||
|
||||
/* Add a rom to the subsystem rom buffer */
|
||||
void content_add_subsystem(const char* path);
|
||||
|
||||
/* Get the current subsystem rom id */
|
||||
int content_get_subsystem_rom_id();
|
||||
|
||||
/* Set environment variables before a subsystem load */
|
||||
void content_set_subsystem_info();
|
||||
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -361,6 +361,10 @@ MSG_HASH(MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS,
|
||||
"disk_cycle_tray_status")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DISK_IMAGE_APPEND,
|
||||
"disk_image_append")
|
||||
MSG_HASH(MENU_ENUM_LABEL_SUBSYSTEM_ADD,
|
||||
"subsystem_add")
|
||||
MSG_HASH(MENU_ENUM_LABEL_SUBSYSTEM_LOAD,
|
||||
"subsystem_load")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DISK_OPTIONS,
|
||||
"core_disk_options")
|
||||
MSG_HASH(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST,
|
||||
|
@ -23,6 +23,9 @@
|
||||
#ifndef __RARCH_MISCELLANEOUS_H
|
||||
#define __RARCH_MISCELLANEOUS_H
|
||||
|
||||
#define RARCH_MAX_SUBSYSTEMS 10
|
||||
#define RARCH_MAX_SUBSYSTEM_ROMS 10
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <retro_inline.h>
|
||||
|
@ -64,6 +64,7 @@ enum
|
||||
ACTION_OK_LOAD_REMAPPING_FILE,
|
||||
ACTION_OK_LOAD_CHEAT_FILE,
|
||||
ACTION_OK_APPEND_DISK_IMAGE,
|
||||
ACTION_OK_SUBSYSTEM_ADD,
|
||||
ACTION_OK_LOAD_CONFIG_FILE,
|
||||
ACTION_OK_LOAD_CORE,
|
||||
ACTION_OK_LOAD_WALLPAPER,
|
||||
@ -443,6 +444,27 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
info_label = label;
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_SUBSYSTEM_ADD_LIST:
|
||||
filebrowser_clear_type();
|
||||
if (content_get_subsystem() != type - MENU_SETTINGS_SUBSYSTEM_ADD)
|
||||
content_clear_subsystem();
|
||||
content_set_subsystem(type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
filebrowser_set_type(FILEBROWSER_SELECT_FILE_SUBSYSTEM);
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
info_path = settings->paths.directory_menu_content;
|
||||
info_label = label;
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_SUBSYSTEM_LOAD:
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
filebrowser_clear_type();
|
||||
task_push_load_subsystem_with_core_from_menu(
|
||||
NULL, &content_info,
|
||||
CORE_TYPE_PLAIN, NULL, NULL);
|
||||
}
|
||||
break;
|
||||
case ACTION_OK_DL_CHEAT_FILE:
|
||||
filebrowser_clear_type();
|
||||
info.type = type;
|
||||
@ -1168,6 +1190,10 @@ static int generic_action_ok(const char *path,
|
||||
command_event(CMD_EVENT_DISK_APPEND_IMAGE, action_path);
|
||||
generic_action_ok_command(CMD_EVENT_RESUME);
|
||||
break;
|
||||
case ACTION_OK_SUBSYSTEM_ADD:
|
||||
flush_type = MENU_SETTINGS;
|
||||
content_add_subsystem(action_path);
|
||||
break;
|
||||
case ACTION_OK_SET_DIRECTORY:
|
||||
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DIRECTORY_SETTINGS_LIST);
|
||||
ret = set_path_generic(filebrowser_label, action_path);
|
||||
@ -1246,6 +1272,7 @@ default_action_ok_set(action_ok_set_path, ACTION_OK_SET_PATH,
|
||||
default_action_ok_set(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_config_load, ACTION_OK_LOAD_CONFIG_FILE, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_disk_image_append, ACTION_OK_APPEND_DISK_IMAGE, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_subsystem_add, ACTION_OK_SUBSYSTEM_ADD, MSG_UNKNOWN)
|
||||
default_action_ok_set(action_ok_cheat_file_load, ACTION_OK_LOAD_CHEAT_FILE, MENU_ENUM_LABEL_CORE_CHEAT_OPTIONS)
|
||||
default_action_ok_set(action_ok_record_configfile_load, ACTION_OK_LOAD_RECORD_CONFIGFILE, MENU_ENUM_LABEL_RECORDING_SETTINGS)
|
||||
default_action_ok_set(action_ok_remap_file_load, ACTION_OK_LOAD_REMAPPING_FILE, MENU_ENUM_LABEL_CORE_INPUT_REMAPPING_OPTIONS )
|
||||
@ -2972,6 +2999,8 @@ default_action_ok_func(action_ok_core_list, ACTION_OK_DL_CORE_LIST)
|
||||
default_action_ok_func(action_ok_cheat_file, ACTION_OK_DL_CHEAT_FILE)
|
||||
default_action_ok_func(action_ok_playlist_collection, ACTION_OK_DL_PLAYLIST_COLLECTION)
|
||||
default_action_ok_func(action_ok_disk_image_append_list, ACTION_OK_DL_DISK_IMAGE_APPEND_LIST)
|
||||
default_action_ok_func(action_ok_subsystem_add_list, ACTION_OK_DL_SUBSYSTEM_ADD_LIST)
|
||||
default_action_ok_func(action_ok_subsystem_add_load, ACTION_OK_DL_SUBSYSTEM_LOAD)
|
||||
default_action_ok_func(action_ok_record_configfile, ACTION_OK_DL_RECORD_CONFIGFILE)
|
||||
default_action_ok_func(action_ok_remap_file, ACTION_OK_DL_REMAP_FILE)
|
||||
default_action_ok_func(action_ok_shader_preset, ACTION_OK_DL_SHADER_PRESET)
|
||||
@ -4088,6 +4117,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
|
||||
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
|
||||
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SUBSYSTEM_LOAD:
|
||||
BIND_ACTION_OK(cbs, action_ok_subsystem_add_load);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CONFIGURATIONS:
|
||||
BIND_ACTION_OK(cbs, action_ok_configurations_list);
|
||||
break;
|
||||
@ -4282,6 +4317,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_DISK_IMAGE_APPEND:
|
||||
BIND_ACTION_OK(cbs, action_ok_disk_image_append_list);
|
||||
break;
|
||||
case MENU_LABEL_SUBSYSTEM_ADD:
|
||||
BIND_ACTION_OK(cbs, action_ok_subsystem_add_list);
|
||||
break;
|
||||
case MENU_LABEL_SCREEN_RESOLUTION:
|
||||
BIND_ACTION_OK(cbs, action_ok_video_resolution);
|
||||
break;
|
||||
@ -4526,6 +4564,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
|
||||
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
|
||||
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
|
||||
break;
|
||||
default:
|
||||
BIND_ACTION_OK(cbs, action_ok_file_load);
|
||||
break;
|
||||
@ -4552,6 +4593,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_DISK_IMAGE_APPEND:
|
||||
BIND_ACTION_OK(cbs, action_ok_disk_image_append);
|
||||
break;
|
||||
case MENU_LABEL_SUBSYSTEM_ADD:
|
||||
BIND_ACTION_OK(cbs, action_ok_subsystem_add);
|
||||
break;
|
||||
default:
|
||||
BIND_ACTION_OK(cbs, action_ok_file_load);
|
||||
break;
|
||||
|
@ -37,6 +37,9 @@
|
||||
#include "../../network/netplay/netplay_discovery.h"
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../content.h"
|
||||
|
||||
#define default_sublabel_macro(func_name, lbl) \
|
||||
static int (func_name)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len) \
|
||||
{ \
|
||||
@ -396,6 +399,22 @@ static int action_bind_sublabel_cheevos_entry(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_bind_sublabel_subsystem_add(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
subsystem = system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms)
|
||||
snprintf(s, len, " Current Content: %s", content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[content_get_subsystem_rom_id()].desc : subsystem->roms[0].desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static int action_bind_sublabel_netplay_room(
|
||||
file_list_t *list,
|
||||
@ -409,7 +428,7 @@ static int action_bind_sublabel_netplay_room(
|
||||
const char *gamename = NULL;
|
||||
const char *core_ver = NULL;
|
||||
const char *frontend = NULL;
|
||||
|
||||
|
||||
/* This offset may cause issues if any entries are added to this menu */
|
||||
unsigned offset = i - 3;
|
||||
|
||||
@ -744,6 +763,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_DISK_IMAGE_APPEND:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_image_append);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_SUBSYSTEM_ADD:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_subsystem_add);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_DISK_CYCLE_TRAY_STATUS:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_disk_cycle_tray_status);
|
||||
break;
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "../../tasks/tasks_internal.h"
|
||||
|
||||
#include "../../cheevos/badges.h"
|
||||
#include "../../content.h"
|
||||
|
||||
#define XMB_RIBBON_ROWS 64
|
||||
#define XMB_RIBBON_COLS 64
|
||||
@ -4340,6 +4341,8 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
{
|
||||
menu_displaylist_ctx_parse_entry_t entry;
|
||||
int ret = -1;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
core_info_list_t *list = NULL;
|
||||
menu_handle_t *menu = (menu_handle_t*)data;
|
||||
|
||||
@ -4435,6 +4438,46 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
{
|
||||
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
|
||||
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
||||
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
subsystem = system->subsystem.data;
|
||||
if (subsystem)
|
||||
{
|
||||
for (i = 0; i < system->subsystem.size; i++, subsystem++)
|
||||
{
|
||||
char s[PATH_MAX_LENGTH];
|
||||
if (content_get_subsystem() == i)
|
||||
{
|
||||
if (content_get_subsystem_rom_id() < subsystem->num_roms)
|
||||
{
|
||||
snprintf(s, sizeof(s), "Load %s %s", subsystem->desc, i == content_get_subsystem() ? "\u2605" : " ");
|
||||
menu_entries_append_enum(info->list,
|
||||
s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD),
|
||||
MENU_ENUM_LABEL_SUBSYSTEM_ADD,
|
||||
MENU_SETTINGS_SUBSYSTEM_ADD + i, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(s, sizeof(s), "Start %s %s", subsystem->desc, i == content_get_subsystem() ? "\u2605" : " ");
|
||||
menu_entries_append_enum(info->list,
|
||||
s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_LOAD),
|
||||
MENU_ENUM_LABEL_SUBSYSTEM_LOAD,
|
||||
MENU_SETTINGS_SUBSYSTEM_LOAD, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(s, sizeof(s), "Load %s %s", subsystem->desc, i == content_get_subsystem() ? "\u2605" : " ");
|
||||
menu_entries_append_enum(info->list,
|
||||
s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_SUBSYSTEM_ADD),
|
||||
MENU_ENUM_LABEL_SUBSYSTEM_ADD,
|
||||
MENU_SETTINGS_SUBSYSTEM_ADD, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;
|
||||
|
@ -84,6 +84,8 @@ enum
|
||||
ACTION_OK_DL_REMAP_FILE,
|
||||
ACTION_OK_DL_RECORD_CONFIGFILE,
|
||||
ACTION_OK_DL_DISK_IMAGE_APPEND_LIST,
|
||||
ACTION_OK_DL_SUBSYSTEM_ADD_LIST,
|
||||
ACTION_OK_DL_SUBSYSTEM_LOAD,
|
||||
ACTION_OK_DL_PLAYLIST_COLLECTION,
|
||||
ACTION_OK_DL_CONTENT_COLLECTION_LIST,
|
||||
ACTION_OK_DL_CHEAT_FILE,
|
||||
|
@ -208,6 +208,12 @@ enum menu_settings_type
|
||||
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)),
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_END = MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 135,
|
||||
|
||||
MENU_SETTINGS_SUBSYSTEM_LOAD,
|
||||
|
||||
MENU_SETTINGS_SUBSYSTEM_ADD,
|
||||
MENU_SETTINGS_SUBSYSTEM_LAST = MENU_SETTINGS_SUBSYSTEM_ADD + RARCH_MAX_SUBSYSTEMS,
|
||||
|
||||
MENU_SETTINGS_LAST
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,11 @@
|
||||
#include "../../configuration.h"
|
||||
#include "../../paths.h"
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../core.h"
|
||||
#include "../../content.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
static enum filebrowser_enums filebrowser_types = FILEBROWSER_NONE;
|
||||
|
||||
enum filebrowser_enums filebrowser_get_type(void)
|
||||
@ -75,10 +80,23 @@ void filebrowser_parse(void *data, unsigned type_data)
|
||||
|
||||
if (info && path_is_compressed)
|
||||
str_list = file_archive_get_file_list(path, info->exts);
|
||||
else if (!string_is_empty(path))
|
||||
else if (!string_is_empty(path) && filebrowser_types != FILEBROWSER_SELECT_FILE_SUBSYSTEM)
|
||||
str_list = dir_list_new(path,
|
||||
(filter_ext && info) ? info->exts : NULL,
|
||||
true, settings->bools.show_hidden_files, true, false);
|
||||
else if (!string_is_empty(path) && filebrowser_types == FILEBROWSER_SELECT_FILE_SUBSYSTEM)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
subsystem = system->subsystem.data + content_get_subsystem();
|
||||
if (subsystem && content_get_subsystem_rom_id() < subsystem->num_roms)
|
||||
{
|
||||
str_list = dir_list_new(path,
|
||||
(filter_ext && info) ? subsystem->roms[content_get_subsystem_rom_id()].valid_extensions : NULL,
|
||||
true, settings->bools.show_hidden_files, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch (filebrowser_types)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ enum filebrowser_enums
|
||||
FILEBROWSER_SCAN_DIR,
|
||||
FILEBROWSER_SCAN_FILE,
|
||||
FILEBROWSER_SELECT_FILE,
|
||||
FILEBROWSER_SELECT_FILE_SUBSYSTEM,
|
||||
FILEBROWSER_SELECT_IMAGE,
|
||||
FILEBROWSER_SELECT_FONT,
|
||||
FILEBROWSER_SELECT_COLLECTION
|
||||
|
@ -1385,6 +1385,8 @@ enum msg_hash_enums
|
||||
MENU_LABEL(SHUTDOWN),
|
||||
MENU_LABEL(REBOOT),
|
||||
MENU_LABEL(DISK_IMAGE_APPEND),
|
||||
MENU_LABEL(SUBSYSTEM_ADD),
|
||||
MENU_LABEL(SUBSYSTEM_LOAD),
|
||||
MENU_LABEL(CORE_LIST),
|
||||
MENU_LABEL(MANAGEMENT),
|
||||
MENU_LABEL(ONLINE),
|
||||
@ -1849,6 +1851,9 @@ enum msg_hash_enums
|
||||
#define MENU_LABEL_DISK_OPTIONS 0xc61ab5fbU
|
||||
#define MENU_LABEL_DISK_IMAGE_APPEND 0x5af7d709U
|
||||
|
||||
/* Subsystem stuff */
|
||||
#define MENU_LABEL_SUBSYSTEM_ADD 0x576da67cU
|
||||
|
||||
/* Menu settings */
|
||||
|
||||
#define MENU_LABEL_MENU_WALLPAPER 0x3b84de01U
|
||||
|
2
paths.c
2
paths.c
@ -297,7 +297,6 @@ static bool path_init_subsystem(void)
|
||||
|
||||
if (!system || path_is_empty(RARCH_PATH_SUBSYSTEM))
|
||||
return false;
|
||||
|
||||
/* For subsystems, we know exactly which RAM types are supported. */
|
||||
|
||||
info = libretro_find_subsystem_info(
|
||||
@ -306,7 +305,6 @@ static bool path_init_subsystem(void)
|
||||
path_get(RARCH_PATH_SUBSYSTEM));
|
||||
|
||||
/* We'll handle this error gracefully later. */
|
||||
|
||||
if (info)
|
||||
{
|
||||
unsigned num_content = MIN(info->num_roms,
|
||||
|
@ -141,6 +141,16 @@ static bool _content_is_inited = false;
|
||||
static bool core_does_not_need_content = false;
|
||||
static uint32_t content_rom_crc = 0;
|
||||
|
||||
static bool pending_subsystem_init = false;
|
||||
static int pending_subsystem_rom_num = 0;
|
||||
static int pending_subsystem_id = 0;
|
||||
static int pending_subsystem_rom_id = 0;
|
||||
|
||||
static char pending_subsystem_ident[255];
|
||||
static char pending_subsystem_extensions[PATH_MAX_LENGTH];
|
||||
static char pending_subsystem_roms[RARCH_MAX_SUBSYSTEM_ROMS][PATH_MAX_LENGTH];
|
||||
|
||||
|
||||
static int content_file_read(const char *path, void **buf, ssize_t *length)
|
||||
{
|
||||
#ifdef HAVE_COMPRESSION
|
||||
@ -187,7 +197,6 @@ static void content_load_init_wrap(
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (args->sram_path)
|
||||
{
|
||||
argv[(*argc)++] = strdup("-s");
|
||||
@ -235,6 +244,7 @@ static void content_load_init_wrap(
|
||||
**/
|
||||
static bool content_load(content_ctx_info_t *info)
|
||||
{
|
||||
RARCH_LOG("content_load\n");
|
||||
unsigned i;
|
||||
bool retval = true;
|
||||
int rarch_argc = 0;
|
||||
@ -273,6 +283,13 @@ static bool content_load(content_ctx_info_t *info)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (pending_subsystem_init)
|
||||
{
|
||||
command_event(CMD_EVENT_CORE_INIT, NULL);
|
||||
content_clear_subsystem();
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* TODO/FIXME - can we get rid of this? */
|
||||
menu_shader_manager_init();
|
||||
@ -776,7 +793,6 @@ static bool content_file_init(
|
||||
const struct retro_subsystem_info *special =
|
||||
path_is_empty(RARCH_PATH_SUBSYSTEM)
|
||||
? NULL : content_file_init_subsystem(content_ctx, error_string, &ret);
|
||||
|
||||
if ( !ret ||
|
||||
!content_file_init_set_attribs(content, special, content_ctx, error_string))
|
||||
return false;
|
||||
@ -788,6 +804,7 @@ static bool content_file_init(
|
||||
{
|
||||
unsigned i;
|
||||
struct string_list *additional_path_allocs = string_list_new();
|
||||
|
||||
ret = content_file_load(info, content, content_ctx, error_string,
|
||||
special, additional_path_allocs);
|
||||
string_list_free(additional_path_allocs);
|
||||
@ -861,6 +878,8 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
content_get_status(&contentless, &is_inited);
|
||||
|
||||
/* Push entry to top of history playlist */
|
||||
@ -1472,6 +1491,7 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
|
||||
char *error_string = NULL;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct string_list *content = NULL;
|
||||
|
||||
content_ctx.check_firmware_before_loading = settings->bools.check_firmware_before_loading;
|
||||
content_ctx.is_ips_pref = rarch_ctl(RARCH_CTL_IS_IPS_PREF, NULL);
|
||||
@ -1492,6 +1512,26 @@ static bool task_load_content_callback(content_ctx_info_t *content_info,
|
||||
content_ctx.subsystem.data = NULL;
|
||||
content_ctx.subsystem.size = 0;
|
||||
|
||||
rarch_system_info_t *sys_info = runloop_get_system_info();
|
||||
if (sys_info)
|
||||
{
|
||||
content_ctx.history_list_enable = settings->bools.history_list_enable;
|
||||
content_ctx.set_supports_no_game_enable = settings->bools.set_supports_no_game_enable;
|
||||
|
||||
if (!string_is_empty(settings->paths.directory_system))
|
||||
content_ctx.directory_system = strdup(settings->paths.directory_system);
|
||||
if (!string_is_empty(settings->paths.directory_cache))
|
||||
content_ctx.directory_cache = strdup(settings->paths.directory_cache);
|
||||
if (!string_is_empty(sys_info->info.valid_extensions))
|
||||
content_ctx.valid_extensions = strdup(sys_info->info.valid_extensions);
|
||||
|
||||
content_ctx.block_extract = sys_info->info.block_extract;
|
||||
content_ctx.need_fullpath = sys_info->info.need_fullpath;
|
||||
|
||||
content_ctx.subsystem.data = sys_info->subsystem.data;
|
||||
content_ctx.subsystem.size = sys_info->subsystem.size;
|
||||
}
|
||||
|
||||
content_ctx.history_list_enable = settings->bools.history_list_enable;
|
||||
|
||||
if (global)
|
||||
@ -1660,6 +1700,32 @@ bool task_push_load_content_with_core_from_menu(
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool task_push_load_subsystem_with_core_from_menu(
|
||||
const char *fullpath,
|
||||
content_ctx_info_t *content_info,
|
||||
enum rarch_core_type type,
|
||||
retro_task_callback_t cb,
|
||||
void *user_data)
|
||||
{
|
||||
|
||||
pending_subsystem_init = true;
|
||||
|
||||
/* Load content */
|
||||
if (!task_load_content_callback(content_info, true, false))
|
||||
{
|
||||
rarch_menu_running();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Push quick menu onto menu stack */
|
||||
if (type != CORE_TYPE_DUMMY)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void content_get_status(
|
||||
@ -1670,6 +1736,52 @@ void content_get_status(
|
||||
*is_inited = _content_is_inited;
|
||||
}
|
||||
|
||||
/* Clears the pending subsystem rom buffer*/
|
||||
void content_clear_subsystem(void)
|
||||
{
|
||||
pending_subsystem_rom_id = 0;
|
||||
pending_subsystem_init = false;
|
||||
for (int i = 0; i < RARCH_MAX_SUBSYSTEM_ROMS; i++)
|
||||
pending_subsystem_roms[i][0] = '\0';
|
||||
}
|
||||
|
||||
/* Get the current subsystem */
|
||||
int content_get_subsystem()
|
||||
{
|
||||
return pending_subsystem_id;
|
||||
}
|
||||
|
||||
/* Set the current subsystem*/
|
||||
void content_set_subsystem(unsigned idx)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
|
||||
subsystem = system->subsystem.data + pending_subsystem_id;
|
||||
|
||||
pending_subsystem_id = idx;
|
||||
|
||||
strlcpy(pending_subsystem_ident, subsystem->ident, sizeof(pending_subsystem_ident));
|
||||
pending_subsystem_rom_num = subsystem->num_roms;
|
||||
}
|
||||
|
||||
/* Add a rom to the subsystem rom buffer */
|
||||
void content_add_subsystem(const char* path)
|
||||
{
|
||||
strlcpy(pending_subsystem_roms[pending_subsystem_rom_id], path,
|
||||
sizeof(pending_subsystem_roms[pending_subsystem_rom_id]));
|
||||
RARCH_LOG("[subsystem] subsystem id: %d subsystem ident: %s rom id: %d, rom path: %s\n",
|
||||
pending_subsystem_id, pending_subsystem_ident, pending_subsystem_rom_id,
|
||||
pending_subsystem_roms[pending_subsystem_rom_id]);
|
||||
pending_subsystem_rom_id++;
|
||||
}
|
||||
|
||||
/* Get the current subsystem rom id */
|
||||
int content_get_subsystem_rom_id()
|
||||
{
|
||||
return pending_subsystem_rom_id;
|
||||
}
|
||||
|
||||
void content_set_does_not_need_content(void)
|
||||
{
|
||||
core_does_not_need_content = true;
|
||||
@ -1716,6 +1828,18 @@ void content_deinit(void)
|
||||
core_does_not_need_content = false;
|
||||
}
|
||||
|
||||
/* Set environment variables before a subsystem load */
|
||||
void content_set_subsystem_info()
|
||||
{
|
||||
if (pending_subsystem_init)
|
||||
{
|
||||
path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident);
|
||||
char* roms[2] = { pending_subsystem_roms[0], pending_subsystem_roms[1] };
|
||||
/* hardcoded to 2 for testing please fix */
|
||||
path_set_special(roms, pending_subsystem_rom_num);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initializes and loads a content file for the currently
|
||||
* selected libretro core. */
|
||||
bool content_init(void)
|
||||
|
@ -209,6 +209,12 @@ bool task_push_load_content_with_core_from_menu(
|
||||
enum rarch_core_type type,
|
||||
retro_task_callback_t cb,
|
||||
void *user_data);
|
||||
bool task_push_load_subsystem_with_core_from_menu(
|
||||
const char *fullpath,
|
||||
content_ctx_info_t *content_info,
|
||||
enum rarch_core_type type,
|
||||
retro_task_callback_t cb,
|
||||
void *user_data);
|
||||
#endif
|
||||
|
||||
void task_file_load_handler(retro_task_t *task);
|
||||
|
Loading…
x
Reference in New Issue
Block a user