mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
add ability to edit emu-style cheat code value ; change default handler to emu
This commit is contained in:
parent
badac565da
commit
b62fa8d9ed
@ -250,6 +250,11 @@ bool cheat_manager_copy_working_to_idx(unsigned idx)
|
||||
free(cheat_manager_state.cheats[idx].desc) ;
|
||||
|
||||
cheat_manager_state.cheats[idx].desc = strdup(cheat_manager_state.working_desc) ;
|
||||
|
||||
if ( cheat_manager_state.cheats[idx].code != NULL )
|
||||
free(cheat_manager_state.cheats[idx].code) ;
|
||||
|
||||
cheat_manager_state.cheats[idx].code = strdup(cheat_manager_state.working_code) ;
|
||||
return true ;
|
||||
}
|
||||
static void cheat_manager_new(unsigned size)
|
||||
|
@ -78,7 +78,8 @@ enum cheat_rumble_type
|
||||
RUMBLE_TYPE_DECREASE_BY_VALUE
|
||||
};
|
||||
|
||||
#define CHEAT_CODE_SCRATCH_SIZE 100
|
||||
/* Some codes are ridiculously large - over 10000 bytes */
|
||||
#define CHEAT_CODE_SCRATCH_SIZE 16*1024
|
||||
#define CHEAT_DESC_SCRATCH_SIZE 255
|
||||
|
||||
struct item_cheat
|
||||
|
@ -574,7 +574,7 @@ static int action_left_cheat_num_passes(unsigned type, const char *label,
|
||||
new_size = cheat_manager_get_size() - 1;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2749,7 +2749,7 @@ static int action_ok_cheat_add_top(const char *path,
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat));
|
||||
tmp.idx = 0 ;
|
||||
@ -2780,7 +2780,7 @@ static int action_ok_cheat_add_bottom(const char *path,
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
msg[0] = '\0';
|
||||
strlcpy(msg,
|
||||
@ -2812,7 +2812,7 @@ static int action_ok_cheat_add_new_after(const char *path,
|
||||
bool refresh = false;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat));
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx+1 ;
|
||||
@ -2845,7 +2845,7 @@ static int action_ok_cheat_add_new_before(const char *path,
|
||||
bool refresh = false ;
|
||||
unsigned int new_size = cheat_manager_get_size() + 1;
|
||||
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
memcpy(&tmp, &cheat_manager_state.cheats[cheat_manager_state.size-1], sizeof(struct item_cheat));
|
||||
tmp.idx = cheat_manager_state.working_cheat.idx ;
|
||||
|
@ -355,7 +355,7 @@ static int action_right_cheat_num_passes(unsigned type, const char *label,
|
||||
new_size = cheat_manager_get_size() + 1;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -4029,6 +4029,20 @@ static bool setting_append_list(
|
||||
general_read_handler);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||
|
||||
CONFIG_STRING(
|
||||
list, list_info,
|
||||
cheat_manager_state.working_code,
|
||||
sizeof(cheat_manager_state.working_code),
|
||||
MENU_ENUM_LABEL_CHEAT_CODE,
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_CODE,
|
||||
"",
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler);
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT);
|
||||
|
||||
config_uint_cbs(cheat_manager_state.working_cheat.handler, CHEAT_HANDLER,
|
||||
setting_uint_action_left_with_refresh,setting_uint_action_right_with_refresh,
|
||||
MENU_ENUM_LABEL_CHEAT_HANDLER_TYPE_EMU,&setting_get_string_representation_uint_as_enum,
|
||||
|
Loading…
x
Reference in New Issue
Block a user