mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
fix bug when accessing memory address cheat setting before cheat system initialized ; clean up code in some areas
This commit is contained in:
parent
89083fd093
commit
3c0a8c0c10
2
.gitignore
vendored
2
.gitignore
vendored
@ -72,6 +72,8 @@ menu/driverspzarch.c
|
||||
.settings
|
||||
libretro-super
|
||||
run.sh
|
||||
convert_rumble.awk
|
||||
*~
|
||||
|
||||
# Wii U
|
||||
*.depend
|
||||
|
@ -625,8 +625,11 @@ int cheat_manager_initialize_search(void *data, bool wraparound)
|
||||
cheat_manager_state.memory_initialized = true ;
|
||||
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_CHEAT_INIT_SUCCESS), 1, 180, true);
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
if ( !wraparound )
|
||||
{
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SET_PREVENT_POPULATE, NULL);
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -5157,8 +5157,16 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_push = true;
|
||||
break;
|
||||
case DISPLAYLIST_CHEAT_DETAILS_SETTINGS_LIST:
|
||||
{
|
||||
rarch_setting_t *setting = NULL;
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
|
||||
if ( !cheat_manager_state.memory_initialized)
|
||||
cheat_manager_initialize_search(NULL,true) ;
|
||||
|
||||
setting = menu_setting_find(msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADDRESS));
|
||||
if ( setting )
|
||||
setting->max = cheat_manager_state.total_memory_size==0?0:cheat_manager_state.total_memory_size-1;
|
||||
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_CHEAT_IDX,
|
||||
@ -5174,11 +5182,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
MENU_ENUM_LABEL_CHEAT_HANDLER,
|
||||
PARSE_ONLY_UINT, false);
|
||||
if ( cheat_manager_state.working_cheat.handler == CHEAT_HANDLER_TYPE_EMU)
|
||||
{
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_CHEAT_CODE,
|
||||
PARSE_ONLY_STRING, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
@ -5250,10 +5256,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
break;
|
||||
}
|
||||
case DISPLAYLIST_CHEAT_SEARCH_SETTINGS_LIST:
|
||||
{
|
||||
{
|
||||
char cheat_label[64];
|
||||
rarch_setting_t *setting;
|
||||
rarch_setting_t *setting;
|
||||
unsigned int address = 0;
|
||||
unsigned int address_mask = 0;
|
||||
unsigned int prev_val = 0;
|
||||
@ -5346,8 +5353,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
info->need_refresh = true;
|
||||
info->need_push = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DISPLAYLIST_ONSCREEN_DISPLAY_SETTINGS_LIST:
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||
menu_displaylist_parse_settings_enum(menu, info,
|
||||
|
@ -37,6 +37,14 @@
|
||||
#include "setting_list.h"
|
||||
#include "retroarch.h"
|
||||
|
||||
#define _3_SECONDS 3000000
|
||||
#define _6_SECONDS 6000000
|
||||
#define _9_SECONDS 9000000
|
||||
#define _12_SECONDS 12000000
|
||||
#define _15_SECONDS 15000000
|
||||
#define _18_SECONDS 18000000
|
||||
#define _21_SECONDS 21000000
|
||||
|
||||
bool settings_list_append(rarch_setting_t **list,
|
||||
rarch_setting_info_t *list_info)
|
||||
{
|
||||
@ -204,52 +212,38 @@ static float recalc_step_based_on_length_of_action(rarch_setting_t *setting)
|
||||
{
|
||||
float numsteps = (setting->max-setting->min)/setting->step ;
|
||||
float multiplier = 1.0f ;
|
||||
if ( global->menu.action_press_time > 12000000)
|
||||
{
|
||||
if ( global->menu.action_press_time > _12_SECONDS)
|
||||
multiplier = (numsteps/60.0f);
|
||||
} else if ( global->menu.action_press_time > 9000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _9_SECONDS)
|
||||
multiplier = (numsteps/300.0f) ;
|
||||
} else if ( global->menu.action_press_time > 6000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _6_SECONDS)
|
||||
multiplier = (numsteps/750.0f);
|
||||
} else if ( global->menu.action_press_time > 3000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _3_SECONDS)
|
||||
multiplier = (numsteps/3000.0f) ;
|
||||
} else
|
||||
{
|
||||
else
|
||||
multiplier = 1.0f ;
|
||||
}
|
||||
|
||||
step = setting->step*multiplier;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if ( global->menu.action_press_time > 21000000)
|
||||
{
|
||||
if ( global->menu.action_press_time > _21_SECONDS)
|
||||
step = setting->step*1000000.0f ;
|
||||
} else if ( global->menu.action_press_time > 18000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _18_SECONDS)
|
||||
step = setting->step*100000.0f ;
|
||||
else if ( global->menu.action_press_time > _15_SECONDS)
|
||||
step = setting->step*10000.0f ;
|
||||
} else if ( global->menu.action_press_time > 15000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _12_SECONDS)
|
||||
step = setting->step*1000.0f ;
|
||||
} else if ( global->menu.action_press_time > 12000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _9_SECONDS)
|
||||
step = setting->step*100.0f ;
|
||||
} else if ( global->menu.action_press_time > 9000000)
|
||||
{
|
||||
step = setting->step*100.0f ;
|
||||
} else if ( global->menu.action_press_time > 6000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _6_SECONDS)
|
||||
step = setting->step*10.0f ;
|
||||
} else if ( global->menu.action_press_time > 3000000)
|
||||
{
|
||||
else if ( global->menu.action_press_time > _3_SECONDS)
|
||||
step = setting->step*5.0f ;
|
||||
} else
|
||||
{
|
||||
else
|
||||
step = setting->step ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user