mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-09 12:30:41 +00:00
Merge pull request #4084 from fr500/master
Prevent loading content when firmware is missing
This commit is contained in:
commit
b4a3975907
10
core_info.c
10
core_info.c
@ -21,6 +21,8 @@
|
||||
#include <file/file_path.h>
|
||||
#include <lists/dir_list.h>
|
||||
#include <file/archive_file.h>
|
||||
#include <runloop.h>
|
||||
#include <verbosity.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -410,7 +412,7 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_UNSET_MISSING_BIOS, NULL);
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
{
|
||||
if (!info->firmware[i].path)
|
||||
@ -419,6 +421,11 @@ static bool core_info_list_update_missing_firmware_internal(
|
||||
fill_pathname_join(path, systemdir,
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].missing = !path_file_exists(path);
|
||||
if (info->firmware[i].missing && !info->firmware[i].optional)
|
||||
{
|
||||
runloop_ctl(RUNLOOP_CTL_SET_MISSING_BIOS, NULL);
|
||||
RARCH_WARN("Firmware missing: %s\n", info->firmware[i].path);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -522,7 +529,6 @@ bool core_info_list_update_missing_firmware(core_info_ctx_firmware_t *info)
|
||||
{
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
return core_info_list_update_missing_firmware_internal(
|
||||
core_info_curr_list,
|
||||
info->path, info->directory.system);
|
||||
|
@ -1936,6 +1936,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Loaded state from slot #-1 (auto).")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Loading")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"Loading content file")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -1902,6 +1902,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Chargement du savestate à partir du slot #-1 (auto).")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Loading")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"Chargement du contenu")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -1938,6 +1938,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"スロット-1 (自動)から保存状態をロードしました。")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"ロード中")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"コンテンツをロード中")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -1936,6 +1936,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Loaded state from slot #-1 (auto).")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Loading")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"Loading content file")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -1930,6 +1930,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Загружено сохранение из слота #-1 (auto).")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Loading")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"Загружен файл контента")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -1936,6 +1936,8 @@ MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO,
|
||||
"Loaded state from slot #-1 (auto).")
|
||||
MSG_HASH(MSG_LOADING,
|
||||
"Loading")
|
||||
MSG_HASH(MSG_FIRMWARE,
|
||||
"One or more firmware files are missing")
|
||||
MSG_HASH(MSG_LOADING_CONTENT_FILE,
|
||||
"Loading content file")
|
||||
MSG_HASH(MSG_LOADING_HISTORY_FILE,
|
||||
|
@ -854,7 +854,12 @@ static int generic_action_ok_file_load(const char *corepath, const char *fullpat
|
||||
enum rarch_core_type action_type, enum content_mode_load content_enum_idx)
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
||||
if(runloop_ctl(RUNLOOP_CTL_IS_MISSING_BIOS, NULL))
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_FIRMWARE), 200, 100, true);
|
||||
RARCH_LOG(msg_hash_to_str(MSG_FIRMWARE));
|
||||
return 0;
|
||||
}
|
||||
if (!task_push_content_load_default(
|
||||
corepath, fullpath,
|
||||
&content_info,
|
||||
@ -1877,7 +1882,6 @@ static int action_ok_load_core_deferred(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
|
@ -155,6 +155,7 @@ enum msg_hash_enums
|
||||
MSG_FAILED,
|
||||
MSG_SUCCEEDED,
|
||||
MSG_LOADING,
|
||||
MSG_FIRMWARE,
|
||||
MSG_CONNECTING_TO_PORT,
|
||||
MSG_CONNECTED_TO,
|
||||
MSG_FAILED_TO_LOAD,
|
||||
|
28
runloop.c
28
runloop.c
@ -127,6 +127,7 @@ static bool runloop_core_shutdown_initiated = false;
|
||||
static bool runloop_perfcnt_enable = false;
|
||||
static bool runloop_overrides_active = false;
|
||||
static bool runloop_game_options_active = false;
|
||||
static bool runloop_missing_bios = false;
|
||||
|
||||
global_t *global_get_ptr(void)
|
||||
{
|
||||
@ -134,6 +135,18 @@ global_t *global_get_ptr(void)
|
||||
return &g_extern;
|
||||
}
|
||||
|
||||
void update_firmware_status()
|
||||
{
|
||||
core_info_t *core_info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
core_info_ctx_firmware_t firmware_info;
|
||||
|
||||
core_info_get_current_core(&core_info);
|
||||
firmware_info.path = core_info->path;
|
||||
firmware_info.directory.system = settings->directory.system;
|
||||
core_info_list_update_missing_firmware(&firmware_info);
|
||||
}
|
||||
|
||||
void runloop_msg_queue_push(const char *msg,
|
||||
unsigned prio, unsigned duration,
|
||||
bool flush)
|
||||
@ -341,6 +354,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
break;
|
||||
case RUNLOOP_CTL_IS_OVERRIDES_ACTIVE:
|
||||
return runloop_overrides_active;
|
||||
case RUNLOOP_CTL_SET_MISSING_BIOS:
|
||||
runloop_missing_bios = true;
|
||||
break;
|
||||
case RUNLOOP_CTL_UNSET_MISSING_BIOS:
|
||||
runloop_missing_bios = false;
|
||||
break;
|
||||
case RUNLOOP_CTL_IS_MISSING_BIOS:
|
||||
return runloop_missing_bios;
|
||||
case RUNLOOP_CTL_SET_GAME_OPTIONS_ACTIVE:
|
||||
runloop_game_options_active = true;
|
||||
break;
|
||||
@ -1109,6 +1130,13 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t current_input = menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ? input_menu_keys_pressed() : input_keys_pressed();
|
||||
uint64_t old_input = last_input;
|
||||
static char old_core[PATH_MAX_LENGTH] = "";
|
||||
|
||||
if (!string_is_equal(old_core, path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
update_firmware_status();
|
||||
strlcpy (old_core, path_get(RARCH_PATH_CORE), sizeof(old_core));
|
||||
}
|
||||
|
||||
last_input = current_input;
|
||||
|
||||
|
@ -54,6 +54,10 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_SET_OVERRIDES_ACTIVE,
|
||||
RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE,
|
||||
|
||||
RUNLOOP_CTL_IS_MISSING_BIOS,
|
||||
RUNLOOP_CTL_SET_MISSING_BIOS,
|
||||
RUNLOOP_CTL_UNSET_MISSING_BIOS,
|
||||
|
||||
RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE,
|
||||
RUNLOOP_CTL_SET_GAME_OPTIONS_ACTIVE,
|
||||
RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE,
|
||||
|
Loading…
Reference in New Issue
Block a user