mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
add saving, deletion options for per-dir remaps
This commit is contained in:
parent
0a0365e49a
commit
f81ea09f20
@ -1297,7 +1297,9 @@ static void command_event_restore_default_shader_preset(void)
|
||||
|
||||
static void command_event_restore_remaps(void)
|
||||
{
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL) ||
|
||||
rarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL) ||
|
||||
rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
@ -1520,6 +1522,7 @@ static void command_event_save_current_config(enum override_type type)
|
||||
break;
|
||||
case OVERRIDE_GAME:
|
||||
case OVERRIDE_CORE:
|
||||
case OVERRIDE_CONTENT_DIR:
|
||||
if (config_save_overrides(type))
|
||||
{
|
||||
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
|
||||
|
@ -3262,7 +3262,7 @@ bool config_load_remap(void)
|
||||
{
|
||||
runloop_msg_queue_push(msg_hash_to_str(
|
||||
MSG_GAME_REMAP_FILE_LOADED), 1, 100, true);
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE, NULL);
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
|
@ -288,6 +288,7 @@ void input_remapping_set_defaults(bool deinit)
|
||||
free(global->name.remapfile);
|
||||
global->name.remapfile = NULL;
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CONTENT_DIR_ACTIVE, NULL);
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
|
@ -897,8 +897,12 @@ MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_LOAD,
|
||||
"remap_file_load")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE,
|
||||
"remap_file_save_core")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR,
|
||||
"remap_file_save_content_dir")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME,
|
||||
"remap_file_save_game")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CONTENT_DIR,
|
||||
"remap_file_remove_content_dir")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE,
|
||||
"remap_file_remove_core")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME,
|
||||
|
@ -1343,12 +1343,16 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_LOAD,
|
||||
"Load Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE,
|
||||
"Save Core Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR,
|
||||
"Save Content Directory Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME,
|
||||
"Save Game Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE,
|
||||
"Delete Core Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME,
|
||||
"Delete Game Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CONTENT_DIR,
|
||||
"Delete Game Content Directory Remap File")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_REQUIRED,
|
||||
"Required")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RESTART_CONTENT,
|
||||
|
@ -93,8 +93,10 @@ enum
|
||||
enum
|
||||
{
|
||||
ACTION_OK_REMAP_FILE_SAVE_CORE = 0,
|
||||
ACTION_OK_REMAP_FILE_SAVE_CONTENT_DIR,
|
||||
ACTION_OK_REMAP_FILE_SAVE_GAME,
|
||||
ACTION_OK_REMAP_FILE_REMOVE_CORE,
|
||||
ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR,
|
||||
ACTION_OK_REMAP_FILE_REMOVE_GAME
|
||||
};
|
||||
|
||||
@ -2309,6 +2311,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
{
|
||||
char directory[PATH_MAX_LENGTH];
|
||||
char file[PATH_MAX_LENGTH];
|
||||
char content_dir[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *core_name = NULL;
|
||||
rarch_system_info_t *info = runloop_get_system_info();
|
||||
@ -2338,6 +2341,15 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
fill_pathname_join(file, core_name,
|
||||
path_basename(path_get(RARCH_PATH_BASENAME)), sizeof(file));
|
||||
break;
|
||||
case ACTION_OK_REMAP_FILE_SAVE_CONTENT_DIR:
|
||||
case ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR:
|
||||
if (!string_is_empty(core_name))
|
||||
{
|
||||
fill_pathname_parent_dir_name(content_dir, path_get(RARCH_PATH_BASENAME), sizeof(content_dir));
|
||||
fill_pathname_join(file, core_name,
|
||||
content_dir, sizeof(file));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!filestream_exists(directory))
|
||||
@ -2351,6 +2363,8 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
|
||||
else if (action_type == ACTION_OK_REMAP_FILE_SAVE_GAME)
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
|
||||
else if (action_type == ACTION_OK_REMAP_FILE_SAVE_CONTENT_DIR)
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE, NULL);
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY),
|
||||
@ -2379,6 +2393,13 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
else if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR &&
|
||||
rarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL))
|
||||
{
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CONTENT_DIR_ACTIVE, NULL);
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY),
|
||||
1, 100, true);
|
||||
@ -2398,6 +2419,13 @@ static int action_ok_remap_file_save_core(const char *path,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_CORE);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_save_content_dir(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return generic_action_ok_remap_file_operation(path, label, type,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_CONTENT_DIR);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_save_game(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -2412,6 +2440,13 @@ static int action_ok_remap_file_remove_core(const char *path,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_REMOVE_CORE);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_remove_content_dir(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return generic_action_ok_remap_file_operation(path, label, type,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_REMOVE_CONTENT_DIR);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_remove_game(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -4522,12 +4557,18 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_core);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_content_dir);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_game);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_core);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CONTENT_DIR:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_content_dir);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_game);
|
||||
break;
|
||||
@ -4744,6 +4785,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
case MENU_LABEL_REMAP_FILE_SAVE_CORE:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_core);
|
||||
break;
|
||||
case MENU_LABEL_REMAP_FILE_SAVE_CONTENT_DIR:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_content_dir);
|
||||
break;
|
||||
case MENU_LABEL_REMAP_FILE_SAVE_GAME:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_save_game);
|
||||
break;
|
||||
|
@ -3206,6 +3206,11 @@ static int menu_displaylist_parse_options_remappings(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE),
|
||||
MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CONTENT_DIR),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR),
|
||||
MENU_ENUM_LABEL_REMAP_FILE_SAVE_CONTENT_DIR,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_GAME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME),
|
||||
@ -3230,6 +3235,15 @@ static int menu_displaylist_parse_options_remappings(
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE, NULL))
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CONTENT_DIR),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CONTENT_DIR),
|
||||
MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CONTENT_DIR,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
|
||||
system = runloop_get_system_info();
|
||||
|
||||
if (system)
|
||||
|
@ -1548,8 +1548,10 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_OSK_ENABLE,
|
||||
|
||||
MENU_LABEL(REMAP_FILE_SAVE_CORE),
|
||||
MENU_LABEL(REMAP_FILE_SAVE_CONTENT_DIR),
|
||||
MENU_LABEL(REMAP_FILE_SAVE_GAME),
|
||||
MENU_LABEL(REMAP_FILE_REMOVE_CORE),
|
||||
MENU_LABEL(REMAP_FILE_REMOVE_CONTENT_DIR),
|
||||
MENU_LABEL(REMAP_FILE_REMOVE_GAME),
|
||||
MENU_LABEL(RESTART_CONTENT),
|
||||
MENU_LABEL(RESUME),
|
||||
@ -2052,6 +2054,7 @@ enum msg_hash_enums
|
||||
#define MENU_LABEL_CUSTOM_BIND_DEFAULTS 0xe88f7b13U
|
||||
#define MENU_LABEL_CONFIGURATIONS 0x3e930a50U
|
||||
#define MENU_LABEL_REMAP_FILE_SAVE_CORE 0x7c9d4c8fU
|
||||
#define MENU_LABEL_REMAP_FILE_SAVE_CONTENT_DIR 0x7b99c1ffU
|
||||
#define MENU_LABEL_REMAP_FILE_SAVE_GAME 0x7c9f41e0U
|
||||
#define MENU_LABEL_CONTENT_COLLECTION_LIST 0x32d1df83U
|
||||
#define MENU_LABEL_COLLECTION 0x5fea5991U
|
||||
|
10
retroarch.c
10
retroarch.c
@ -236,6 +236,7 @@ static bool runloop_perfcnt_enable = false;
|
||||
static bool runloop_overrides_active = false;
|
||||
static bool runloop_remaps_core_active = false;
|
||||
static bool runloop_remaps_game_active = false;
|
||||
static bool runloop_remaps_content_dir_active = false;
|
||||
static bool runloop_game_options_active = false;
|
||||
static bool runloop_missing_bios = false;
|
||||
static bool runloop_autosave = false;
|
||||
@ -348,6 +349,7 @@ static void global_free(void)
|
||||
runloop_overrides_active = false;
|
||||
runloop_remaps_core_active = false;
|
||||
runloop_remaps_game_active = false;
|
||||
runloop_remaps_content_dir_active = false;
|
||||
|
||||
core_unset_input_descriptors();
|
||||
|
||||
@ -1701,6 +1703,14 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_CTL_IS_REMAPS_GAME_ACTIVE:
|
||||
return runloop_remaps_game_active;
|
||||
case RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE:
|
||||
runloop_remaps_content_dir_active = true;
|
||||
break;
|
||||
case RARCH_CTL_UNSET_REMAPS_CONTENT_DIR_ACTIVE:
|
||||
runloop_remaps_content_dir_active = false;
|
||||
break;
|
||||
case RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE:
|
||||
return runloop_remaps_content_dir_active;
|
||||
case RARCH_CTL_SET_MISSING_BIOS:
|
||||
runloop_missing_bios = true;
|
||||
break;
|
||||
|
@ -100,6 +100,10 @@ enum rarch_ctl_state
|
||||
RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
|
||||
RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE,
|
||||
|
||||
RARCH_CTL_IS_REMAPS_CONTENT_DIR_ACTIVE,
|
||||
RARCH_CTL_SET_REMAPS_CONTENT_DIR_ACTIVE,
|
||||
RARCH_CTL_UNSET_REMAPS_CONTENT_DIR_ACTIVE,
|
||||
|
||||
RARCH_CTL_IS_REMAPS_GAME_ACTIVE,
|
||||
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
|
||||
RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE,
|
||||
|
Loading…
Reference in New Issue
Block a user