From 40925baacd1d3d4ecf7e781e2d8123b254de7233 Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Thu, 14 Oct 2021 13:59:23 +0100 Subject: [PATCH] Enable SRAM for contentless cores --- retroarch.c | 16 +++++++++------- tasks/task_save.c | 8 ++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/retroarch.c b/retroarch.c index 8a0461c816..57451482e1 100644 --- a/retroarch.c +++ b/retroarch.c @@ -5882,10 +5882,7 @@ static bool event_init_content( content_get_status(&contentless, &is_inited); - /* TODO/FIXME - just because we have a contentless core does not - * necessarily mean there should be no SRAM, try to find a solution here */ - p_rarch->rarch_use_sram = (current_core_type == CORE_TYPE_PLAIN) - && !contentless; + p_rarch->rarch_use_sram = (current_core_type == CORE_TYPE_PLAIN); /* No content to be loaded for dummy core, * just successfully exit. */ @@ -5896,7 +5893,12 @@ static bool event_init_content( content_get_status(&contentless, &is_inited); - if (!contentless) + /* If core is contentless, just initialise SRAM + * interface, otherwise fill all content-related + * paths */ + if (contentless) + path_init_savefile_internal(global, p_rarch); + else path_fill_names(p_rarch, input_st); if (!content_init()) @@ -5904,8 +5906,8 @@ static bool event_init_content( command_event_set_savestate_auto_index(settings, global); - if (event_load_save_files(p_rarch->rarch_is_sram_load_disabled)) - RARCH_LOG("[SRAM]: %s.\n", + if (!event_load_save_files(p_rarch->rarch_is_sram_load_disabled)) + RARCH_LOG("[SRAM]: %s\n", msg_hash_to_str(MSG_SKIPPING_SRAM_LOAD)); /* diff --git a/tasks/task_save.c b/tasks/task_save.c index 4403032bed..8871b11742 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -2072,14 +2072,18 @@ bool event_save_files(bool is_sram_used) bool event_load_save_files(bool is_sram_load_disabled) { unsigned i; + bool success = false; if (!task_save_files || is_sram_load_disabled) return false; + /* Report a successful load operation if + * any type of ram file is found and + * processed correctly */ for (i = 0; i < task_save_files->size; i++) - content_load_ram_file(i); + success |= content_load_ram_file(i); - return true; + return success; } void path_init_savefile_rtc(const char *savefile_path)