From 9862b75b4b3ca5320ecbba4ce97b46f8fc892363 Mon Sep 17 00:00:00 2001 From: radius Date: Fri, 4 Aug 2017 23:56:17 -0500 Subject: [PATCH 1/3] allow specifying libretro device and analog dpad mode on remap files --- CHANGES.md | 2 ++ command.c | 9 +++++++++ command.h | 1 + input/input_remapping.c | 14 ++++++++++++++ retroarch.c | 1 + 5 files changed, 27 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index afb55b0acb..e8de27aadd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,8 @@ - ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices - AUDIO: Audio mixer supports MOD/S3M/XM file types now! - INPUT: input swap override flag (for remotes) is cleared correctly +- INPUT: allow specifying libretro device in remap files +- INPUT: allow specifying analog dpad mode in remap files - COMMON: Add 'Delete Core'option to Core Information menu. - COMMON: Allow Max Timing Skew to be set to 0. - LOCALIZATION: Update Russian translation diff --git a/command.c b/command.c index ca21d18931..2eedb184a7 100644 --- a/command.c +++ b/command.c @@ -1053,6 +1053,7 @@ static void command_event_deinit_core(bool reinit) command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL); + command_event(CMD_EVENT_RESTORE_REMAPS, NULL); } static void command_event_init_cheats(void) @@ -1287,6 +1288,11 @@ static void command_event_restore_default_shader_preset(void) path_clear(RARCH_PATH_DEFAULT_SHADER_PRESET); } +static void command_event_restore_remaps(void) +{ + input_remapping_set_defaults(); +} + static bool command_event_save_auto_state(void) { char savestate_name_auto[PATH_MAX_LENGTH] = {0}; @@ -1797,6 +1803,7 @@ bool command_event(enum event_command cmd, void *data) command_event(CMD_EVENT_AUTOSAVE_STATE, NULL); command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL); + command_event(CMD_EVENT_RESTORE_REMAPS, NULL); if (is_inited) if (!task_push_start_dummy_core(&content_info)) @@ -2589,6 +2596,8 @@ bool command_event(enum event_command cmd, void *data) case CMD_EVENT_DISABLE_OVERRIDES: command_event_disable_overrides(); break; + case CMD_EVENT_RESTORE_REMAPS: + command_event_restore_remaps(); case CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET: command_event_restore_default_shader_preset(); break; diff --git a/command.h b/command.h index 8cd7ec2132..ccac457ef8 100644 --- a/command.h +++ b/command.h @@ -218,6 +218,7 @@ enum event_command CMD_EVENT_MIXER_VOLUME_UP, CMD_EVENT_MIXER_VOLUME_DOWN, CMD_EVENT_DISABLE_OVERRIDES, + CMD_EVENT_RESTORE_REMAPS, CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, CMD_EVENT_LIBUI_TEST }; diff --git a/input/input_remapping.c b/input/input_remapping.c index 17aae07ab3..f86b1a11ea 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -23,6 +23,9 @@ #include "../configuration.h" #include "../retroarch.h" +static unsigned old_analog_dpad_mode[MAX_USERS]; +static unsigned old_libretro_device[MAX_USERS]; + /** * input_remapping_load_file: * @data : Path to config file. @@ -46,6 +49,9 @@ bool input_remapping_load_file(void *data, const char *path) for (i = 0; i < MAX_USERS; i++) { + old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i]; + old_libretro_device[i] = settings->uints.input_libretro_device[i]; + char buf[64]; char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}}; char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = @@ -82,6 +88,12 @@ bool input_remapping_load_file(void *data, const char *path) settings->uints.input_remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] = key_remap; } + + snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1); + CONFIG_GET_INT_BASE(conf, settings, uints.input_analog_dpad_mode[i], buf); + + snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1); + CONFIG_GET_INT_BASE(conf, settings, uints.input_libretro_device[i], buf); } config_file_free(conf); @@ -180,5 +192,7 @@ void input_remapping_set_defaults(void) } for (j = 0; j < 4; j++) settings->uints.input_remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] = j; + settings->uints.input_analog_dpad_mode[i] = old_analog_dpad_mode[i]; + settings->uints.input_libretro_device[i] = old_libretro_device[i]; } } diff --git a/retroarch.c b/retroarch.c index 7def51cb4b..6ab02a62f4 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2161,6 +2161,7 @@ bool retroarch_main_quit(void) command_event(CMD_EVENT_AUTOSAVE_STATE, NULL); command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL); command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL); + command_event(CMD_EVENT_RESTORE_REMAPS, NULL); } runloop_shutdown_initiated = true; From a973d5dc8ad2682b7918fb79e21f001117bf1270 Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 5 Aug 2017 00:09:46 -0500 Subject: [PATCH 2/3] allow saving analog dpad mode and libretro device to remap files --- CHANGES.md | 2 ++ input/input_remapping.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e8de27aadd..d83f646e7e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ - INPUT: input swap override flag (for remotes) is cleared correctly - INPUT: allow specifying libretro device in remap files - 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 - COMMON: Add 'Delete Core'option to Core Information menu. - COMMON: Allow Max Timing Skew to be set to 0. - LOCALIZATION: Update Russian translation diff --git a/input/input_remapping.c b/input/input_remapping.c index f86b1a11ea..1d9bc79af9 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -170,6 +170,10 @@ bool input_remapping_save_file(const char *path) config_unset(conf,key_ident[j]); } } + snprintf(buf, sizeof(buf), "input_libretro_device_p%u", i + 1); + config_set_int(conf, buf, input_config_get_device(i)); + snprintf(buf, sizeof(buf), "input_player%u_analog_dpad_mode", i + 1); + config_set_int(conf, buf, settings->uints.input_analog_dpad_mode[i]); } ret = config_file_write(conf, remap_file); From 2db79242c94e5582e9ef4f72a0bf477b6d07775b Mon Sep 17 00:00:00 2001 From: radius Date: Sat, 5 Aug 2017 00:37:26 -0500 Subject: [PATCH 3/3] remove remaps --- CHANGES.md | 1 + command.c | 3 +- configuration.c | 3 ++ input/input_remapping.c | 19 ++++++++++ input/input_remapping.h | 2 ++ intl/msg_hash_lbl.h | 4 +++ intl/msg_hash_us.h | 8 +++++ menu/cbs/menu_cbs_ok.c | 77 ++++++++++++++++++++++++++++++++++------- menu/menu_displaylist.c | 19 ++++++++++ msg_hash.h | 4 +++ retroarch.c | 21 +++++++++++ retroarch.h | 8 +++++ 12 files changed, 156 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d83f646e7e..29d33f86a3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/command.c b/command.c index 2eedb184a7..67566fae2c 100644 --- a/command.c +++ b/command.c @@ -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(); diff --git a/configuration.c b/configuration.c index 1704386fbb..47c43c49e5 100644 --- a/configuration.c +++ b/configuration.c @@ -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; } } diff --git a/input/input_remapping.c b/input/input_remapping.c index 1d9bc79af9..80c77d1f8a 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -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; diff --git a/input/input_remapping.h b/input/input_remapping.h index 3c988ad2c5..d2bdec05ac 100644 --- a/input/input_remapping.h +++ b/input/input_remapping.h @@ -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 diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 4444ac9ec3..1314edcc6a 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -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, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index c14eb00878..b870188f6a 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -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, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b7ba381edb..f7c72a85dd 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -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; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c5c3121493..938ac589b9 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -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) diff --git a/msg_hash.h b/msg_hash.h index 39660d6006..48a8fc9d2f 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -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), diff --git a/retroarch.c b/retroarch.c index 6ab02a62f4..95212ace7f 100644 --- a/retroarch.c +++ b/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; diff --git a/retroarch.h b/retroarch.h index e01d4985b6..faf8b5a1df 100644 --- a/retroarch.h +++ b/retroarch.h @@ -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,