mirror of
https://github.com/libretro/RetroArch
synced 2024-12-26 21:29:08 +00:00
subsystem part 3: cleanups
This commit is contained in:
parent
9730fa5c51
commit
2a9046c06f
10
content.h
10
content.h
@ -39,11 +39,7 @@ typedef struct content_ctx_info
|
||||
environment_get_t environ_get; /* Function passed for environment_get function */
|
||||
} content_ctx_info_t;
|
||||
|
||||
bool pending_subsystem_init;
|
||||
|
||||
int pending_subsystem;
|
||||
int pending_subsystem_rom_id;
|
||||
int pending_subsystem_rom_num;
|
||||
|
||||
char pending_subsystem_ident[255];
|
||||
char pending_subsystem_extensions[PATH_MAX_LENGTH];
|
||||
@ -92,12 +88,18 @@ 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);
|
||||
|
||||
|
@ -446,7 +446,7 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
break;
|
||||
case ACTION_OK_DL_SUBSYSTEM_ADD_LIST:
|
||||
filebrowser_clear_type();
|
||||
if (pending_subsystem != type - MENU_SETTINGS_SUBSYSTEM_ADD)
|
||||
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);
|
||||
@ -457,17 +457,13 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE;
|
||||
break;
|
||||
case ACTION_OK_DL_SUBSYSTEM_LOAD:
|
||||
filebrowser_clear_type();
|
||||
path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident);
|
||||
/* hardcoded to 2 for testing */
|
||||
char* roms[2] = { pending_subsystem_roms[0], pending_subsystem_roms[1] };
|
||||
path_set_special(roms, pending_subsystem_rom_num);
|
||||
content_ctx_info_t content_info = {0};
|
||||
pending_subsystem_init = true;
|
||||
task_push_load_subsystem_with_core_from_menu(
|
||||
NULL, &content_info,
|
||||
CORE_TYPE_PLAIN, NULL, NULL);
|
||||
|
||||
{
|
||||
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();
|
||||
|
@ -409,7 +409,7 @@ static int action_bind_sublabel_subsystem_add(
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
subsystem = system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
if (subsystem && pending_subsystem_rom_id < subsystem->num_roms)
|
||||
snprintf(s, len, " Current Content: %s", pending_subsystem == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[pending_subsystem_rom_id].desc : subsystem->roms[0].desc);
|
||||
snprintf(s, len, " Current Content: %s", content_get_subsystem() == type - MENU_SETTINGS_SUBSYSTEM_ADD ? subsystem->roms[pending_subsystem_rom_id].desc : subsystem->roms[0].desc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -428,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;
|
||||
|
||||
|
@ -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
|
||||
@ -4445,11 +4446,11 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
for (i = 0; i < system->subsystem.size; i++, subsystem++)
|
||||
{
|
||||
char s[PATH_MAX_LENGTH];
|
||||
if (pending_subsystem == i)
|
||||
if (content_get_subsystem() == i)
|
||||
{
|
||||
if (pending_subsystem_rom_id < subsystem->num_roms)
|
||||
{
|
||||
snprintf(s, sizeof(s), "Load %s %c", subsystem->desc, i == pending_subsystem ? '*': ' ');
|
||||
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),
|
||||
@ -4458,8 +4459,7 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* To-Do: replace the MENU_ENUM_LABEL_SUBSYSTEM_ADD for the proper labels and trigger the load action */
|
||||
snprintf(s, sizeof(s), "Start %s %c", subsystem->desc, i == pending_subsystem ? '*': ' ');
|
||||
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),
|
||||
@ -4469,7 +4469,7 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(s, sizeof(s), "Load %s %c", subsystem->desc, i == pending_subsystem ? '*': ' ');
|
||||
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),
|
||||
|
@ -88,10 +88,9 @@ void filebrowser_parse(void *data, unsigned type_data)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
subsystem = system->subsystem.data + pending_subsystem;
|
||||
subsystem = system->subsystem.data + content_get_subsystem();
|
||||
if (subsystem && pending_subsystem_rom_id < subsystem->num_roms)
|
||||
{
|
||||
RARCH_LOG("[subsystem] valid extensions: %s\n", subsystem->roms[pending_subsystem_rom_id].valid_extensions);
|
||||
str_list = dir_list_new(path,
|
||||
(filter_ext && info) ? subsystem->roms[pending_subsystem_rom_id].valid_extensions : NULL,
|
||||
true, settings->bools.show_hidden_files, true, false);
|
||||
|
@ -141,6 +141,10 @@ 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 content_file_read(const char *path, void **buf, ssize_t *length)
|
||||
{
|
||||
#ifdef HAVE_COMPRESSION
|
||||
@ -272,12 +276,14 @@ static bool content_load(content_ctx_info_t *info)
|
||||
retval = false;
|
||||
goto end;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
if (pending_subsystem_init)
|
||||
{
|
||||
content_init();
|
||||
content_clear_subsystem();
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
/* TODO/FIXME - can we get rid of this? */
|
||||
menu_shader_manager_init();
|
||||
@ -1697,6 +1703,9 @@ bool task_push_load_subsystem_with_core_from_menu(
|
||||
retro_task_callback_t cb,
|
||||
void *user_data)
|
||||
{
|
||||
|
||||
pending_subsystem_init = true;
|
||||
|
||||
/* Set content path */
|
||||
path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident);
|
||||
/* hardcoded to 2 for testing */
|
||||
@ -1736,14 +1745,21 @@ void content_clear_subsystem(void)
|
||||
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 sub)
|
||||
void content_set_subsystem(unsigned idx)
|
||||
{
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
const struct retro_subsystem_info* subsystem = NULL;
|
||||
|
||||
pending_subsystem = sub;
|
||||
subsystem = system->subsystem.data + pending_subsystem;
|
||||
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;
|
||||
@ -1752,8 +1768,11 @@ void content_set_subsystem(unsigned sub)
|
||||
/* 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, pending_subsystem_ident, pending_subsystem_rom_id, pending_subsystem_roms[pending_subsystem_rom_id]);
|
||||
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++;
|
||||
}
|
||||
|
||||
@ -1810,10 +1829,9 @@ bool content_init(void)
|
||||
if (pending_subsystem_init)
|
||||
{
|
||||
path_set(RARCH_PATH_SUBSYSTEM, pending_subsystem_ident);
|
||||
/* hardcoded to 2 for testing */
|
||||
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);
|
||||
RARCH_LOG("********%s %s \n", pending_subsystem_ident, path_get(RARCH_PATH_SUBSYSTEM));
|
||||
}
|
||||
content_information_ctx_t content_ctx;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user