mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-15 23:06:40 +00:00
remove remaps
This commit is contained in:
parent
a973d5dc8a
commit
2db79242c9
@ -7,6 +7,7 @@
|
||||
- INPUT: allow specifying analog dpad mode in remap files
|
||||
- INPUT: allow saving libretro device to remap files
|
||||
- INPUT: allow saving analog dpad mode to remap files
|
||||
- INPUT: allow removing core and game remap files from the menu
|
||||
- COMMON: Add 'Delete Core'option to Core Information menu.
|
||||
- COMMON: Allow Max Timing Skew to be set to 0.
|
||||
- LOCALIZATION: Update Russian translation
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
* Copyright (C) 2016-2017 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
@ -1227,7 +1228,7 @@ static bool command_event_init_core(enum rarch_core_type *data)
|
||||
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
|
||||
}
|
||||
|
||||
/* Auto-remap: apply shader preset files */
|
||||
/* Auto-shaders: apply shader preset files */
|
||||
if(settings->bools.auto_shaders_enable)
|
||||
config_load_shader_preset();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
* Copyright (C) 2016-2017 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
@ -2925,6 +2926,7 @@ bool config_load_remap(void)
|
||||
if (input_remapping_load_file(new_conf, game_path))
|
||||
{
|
||||
runloop_msg_queue_push("Game remap file loaded.", 1, 100, true);
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2944,6 +2946,7 @@ bool config_load_remap(void)
|
||||
if (input_remapping_load_file(new_conf, core_path))
|
||||
{
|
||||
runloop_msg_queue_push("Core remap file loaded.", 1, 100, true);
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -182,6 +183,24 @@ bool input_remapping_save_file(const char *path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool input_remapping_remove_file(const char *path)
|
||||
{
|
||||
bool ret;
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
char remap_file[PATH_MAX_LENGTH];
|
||||
config_file_t *conf = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
buf[0] = remap_file[0] = '\0';
|
||||
|
||||
fill_pathname_join(buf, settings->paths.directory_input_remapping,
|
||||
path, sizeof(buf));
|
||||
|
||||
fill_pathname_noext(remap_file, buf, ".rmp", sizeof(remap_file));
|
||||
|
||||
return remove(remap_file) == 0 ? true : false;
|
||||
}
|
||||
|
||||
void input_remapping_set_defaults(void)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
@ -44,6 +44,8 @@ bool input_remapping_load_file(void *data, const char *path);
|
||||
**/
|
||||
bool input_remapping_save_file(const char *path);
|
||||
|
||||
bool input_remapping_remove_file(const char *path);
|
||||
|
||||
void input_remapping_set_defaults(void);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
@ -821,6 +821,10 @@ MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_SAVE_CORE,
|
||||
"remap_file_save_core")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME,
|
||||
"remap_file_save_game")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE,
|
||||
"remap_file_remove_core")
|
||||
MSG_HASH(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME,
|
||||
"remap_file_remove_game")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RESTART_CONTENT,
|
||||
"restart_content")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RESTART_RETROARCH,
|
||||
|
@ -1217,6 +1217,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_REMAP_FILE_SAVE_CORE,
|
||||
"Save Core 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_REQUIRED,
|
||||
"Required")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_RESTART_CONTENT,
|
||||
@ -1945,6 +1949,8 @@ MSG_HASH(MSG_ERROR_SAVING_CORE_OPTIONS_FILE,
|
||||
"Error saving core options file.")
|
||||
MSG_HASH(MSG_ERROR_SAVING_REMAP_FILE,
|
||||
"Error saving remap file.")
|
||||
MSG_HASH(MSG_ERROR_REMOVING_REMAP_FILE,
|
||||
"Error removing remap file.")
|
||||
MSG_HASH(MSG_ERROR_SAVING_SHADER_PRESET,
|
||||
"Error saving shader preset.")
|
||||
MSG_HASH(MSG_EXTERNAL_APPLICATION_DIR,
|
||||
@ -2137,6 +2143,8 @@ MSG_HASH(MSG_REDIRECTING_SAVESTATE_TO,
|
||||
"Redirecting savestate to")
|
||||
MSG_HASH(MSG_REMAP_FILE_SAVED_SUCCESSFULLY,
|
||||
"Remap file saved successfully.")
|
||||
MSG_HASH(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY,
|
||||
"Remap file removed successfully.")
|
||||
MSG_HASH(MSG_REMOVED_DISK_FROM_TRAY,
|
||||
"Removed disk from tray.")
|
||||
MSG_HASH(MSG_REMOVING_TEMPORARY_CONTENT_FILE,
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2016-2017 - Brad Parker
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -2090,10 +2091,12 @@ static int action_ok_cheat_file_save_as(const char *path,
|
||||
enum
|
||||
{
|
||||
ACTION_OK_REMAP_FILE_SAVE_CORE = 0,
|
||||
ACTION_OK_REMAP_FILE_SAVE_GAME
|
||||
ACTION_OK_REMAP_FILE_SAVE_GAME,
|
||||
ACTION_OK_REMAP_FILE_REMOVE_CORE,
|
||||
ACTION_OK_REMAP_FILE_REMOVE_GAME
|
||||
};
|
||||
|
||||
static int generic_action_ok_remap_file_save(const char *path,
|
||||
static int generic_action_ok_remap_file_operation(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
||||
unsigned action_type)
|
||||
{
|
||||
@ -2118,10 +2121,12 @@ static int generic_action_ok_remap_file_save(const char *path,
|
||||
switch (action_type)
|
||||
{
|
||||
case ACTION_OK_REMAP_FILE_SAVE_CORE:
|
||||
case ACTION_OK_REMAP_FILE_REMOVE_CORE:
|
||||
if (!string_is_empty(core_name))
|
||||
fill_pathname_join(file, core_name, core_name, sizeof(file));
|
||||
break;
|
||||
case ACTION_OK_REMAP_FILE_SAVE_GAME:
|
||||
case ACTION_OK_REMAP_FILE_REMOVE_GAME:
|
||||
if (!string_is_empty(core_name))
|
||||
fill_pathname_join(file, core_name,
|
||||
path_basename(path_get(RARCH_PATH_BASENAME)), sizeof(file));
|
||||
@ -2131,32 +2136,74 @@ static int generic_action_ok_remap_file_save(const char *path,
|
||||
if(!path_file_exists(directory))
|
||||
path_mkdir(directory);
|
||||
|
||||
if(input_remapping_save_file(file))
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY),
|
||||
1, 100, true);
|
||||
else
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_ERROR_SAVING_REMAP_FILE),
|
||||
1, 100, true);
|
||||
if (action_type < ACTION_OK_REMAP_FILE_REMOVE_CORE)
|
||||
{
|
||||
if(input_remapping_save_file(file))
|
||||
{
|
||||
if (action_type == ACTION_OK_REMAP_FILE_SAVE_CORE)
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
|
||||
else
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_SAVED_SUCCESSFULLY),
|
||||
1, 100, true);
|
||||
}
|
||||
else
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_ERROR_SAVING_REMAP_FILE),
|
||||
1, 100, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_LOG("removing %s", file);
|
||||
if(input_remapping_remove_file(file))
|
||||
{
|
||||
if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE)
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
|
||||
else
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL);
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY),
|
||||
1, 100, true);
|
||||
}
|
||||
else
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_ERROR_REMOVING_REMAP_FILE),
|
||||
1, 100, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_save_core(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return generic_action_ok_remap_file_save(path, label, type,
|
||||
return generic_action_ok_remap_file_operation(path, label, type,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_CORE);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_save_game(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
return generic_action_ok_remap_file_save(path, label, type,
|
||||
return generic_action_ok_remap_file_operation(path, label, type,
|
||||
idx, entry_idx, ACTION_OK_REMAP_FILE_SAVE_GAME);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_remove_core(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_CORE);
|
||||
}
|
||||
|
||||
static int action_ok_remap_file_remove_game(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_GAME);
|
||||
}
|
||||
|
||||
int action_ok_path_use_directory(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
@ -4766,6 +4813,12 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
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_GAME:
|
||||
BIND_ACTION_OK(cbs, action_ok_remap_file_remove_game);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST:
|
||||
BIND_ACTION_OK(cbs, action_ok_content_collection_list);
|
||||
break;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2014-2017 - Jean-André Santoni
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
* Copyright (C) 2016-2017 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
@ -3372,6 +3373,24 @@ static int menu_displaylist_parse_options_remappings(
|
||||
MENU_ENUM_LABEL_REMAP_FILE_SAVE_GAME,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL))
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_CORE),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE),
|
||||
MENU_ENUM_LABEL_REMAP_FILE_REMOVE_CORE,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
|
||||
{
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_REMAP_FILE_REMOVE_GAME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME),
|
||||
MENU_ENUM_LABEL_REMAP_FILE_REMOVE_GAME,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
}
|
||||
|
||||
system = runloop_get_system_info();
|
||||
|
||||
if (system)
|
||||
|
@ -287,8 +287,10 @@ enum msg_hash_enums
|
||||
MSG_INPUT_PRESET_FILENAME,
|
||||
MSG_INPUT_CHEAT_FILENAME,
|
||||
MSG_REMAP_FILE_SAVED_SUCCESSFULLY,
|
||||
MSG_REMAP_FILE_REMOVED_SUCCESSFULLY,
|
||||
MSG_SHADER_PRESET_SAVED_SUCCESSFULLY,
|
||||
MSG_ERROR_SAVING_REMAP_FILE,
|
||||
MSG_ERROR_REMOVING_REMAP_FILE,
|
||||
MSG_ERROR_SAVING_SHADER_PRESET,
|
||||
MSG_FAILED_TO_CREATE_THE_DIRECTORY,
|
||||
MSG_ERROR_SAVING_CORE_OPTIONS_FILE,
|
||||
@ -1366,6 +1368,8 @@ enum msg_hash_enums
|
||||
|
||||
MENU_LABEL(REMAP_FILE_SAVE_CORE),
|
||||
MENU_LABEL(REMAP_FILE_SAVE_GAME),
|
||||
MENU_LABEL(REMAP_FILE_REMOVE_CORE),
|
||||
MENU_LABEL(REMAP_FILE_REMOVE_GAME),
|
||||
MENU_LABEL(RESTART_CONTENT),
|
||||
MENU_LABEL(RESUME),
|
||||
MENU_LABEL(RESUME_CONTENT),
|
||||
|
21
retroarch.c
21
retroarch.c
@ -2,6 +2,7 @@
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2012-2015 - Michael Lelli
|
||||
* Copyright (C) 2015-2017 - Andrés Suárez
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -236,6 +237,8 @@ static bool runloop_shutdown_initiated = false;
|
||||
static bool runloop_core_shutdown_initiated = false;
|
||||
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_game_options_active = false;
|
||||
static bool runloop_missing_bios = false;
|
||||
static bool runloop_autosave = false;
|
||||
@ -310,6 +313,8 @@ static void global_free(void)
|
||||
rarch_ups_pref = false;
|
||||
rarch_patch_blocked = false;
|
||||
runloop_overrides_active = false;
|
||||
runloop_remaps_core_active = false;
|
||||
runloop_remaps_game_active = false;
|
||||
|
||||
core_unset_input_descriptors();
|
||||
|
||||
@ -1587,6 +1592,22 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_CTL_IS_OVERRIDES_ACTIVE:
|
||||
return runloop_overrides_active;
|
||||
case RARCH_CTL_SET_REMAPS_CORE_ACTIVE:
|
||||
runloop_remaps_core_active = true;
|
||||
break;
|
||||
case RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE:
|
||||
runloop_remaps_core_active = false;
|
||||
break;
|
||||
case RARCH_CTL_IS_REMAPS_CORE_ACTIVE:
|
||||
return runloop_remaps_core_active;
|
||||
case RARCH_CTL_SET_REMAPS_GAME_ACTIVE:
|
||||
runloop_remaps_game_active = true;
|
||||
break;
|
||||
case RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE:
|
||||
runloop_remaps_game_active = false;
|
||||
break;
|
||||
case RARCH_CTL_IS_REMAPS_GAME_ACTIVE:
|
||||
return runloop_remaps_game_active;
|
||||
case RARCH_CTL_SET_MISSING_BIOS:
|
||||
runloop_missing_bios = true;
|
||||
break;
|
||||
|
@ -98,6 +98,14 @@ enum rarch_ctl_state
|
||||
RARCH_CTL_SET_OVERRIDES_ACTIVE,
|
||||
RARCH_CTL_UNSET_OVERRIDES_ACTIVE,
|
||||
|
||||
RARCH_CTL_IS_REMAPS_CORE_ACTIVE,
|
||||
RARCH_CTL_SET_REMAPS_CORE_ACTIVE,
|
||||
RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE,
|
||||
|
||||
RARCH_CTL_IS_REMAPS_GAME_ACTIVE,
|
||||
RARCH_CTL_SET_REMAPS_GAME_ACTIVE,
|
||||
RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE,
|
||||
|
||||
RARCH_CTL_IS_MISSING_BIOS,
|
||||
RARCH_CTL_SET_MISSING_BIOS,
|
||||
RARCH_CTL_UNSET_MISSING_BIOS,
|
||||
|
Loading…
Reference in New Issue
Block a user