mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Cheat menu rework
This commit is contained in:
1 parent
fe835819d0
commit
ec51281203
12 files changed
+150
-118
No files matched your search
+34
-18
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <file/config_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <compat/strl.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <string/stdstring.h>
|
||||
@@ -102,12 +103,12 @@ void cheat_manager_apply_cheats(bool notification_show_cheats_applied)
|
||||
}
|
||||
}
|
||||
|
||||
if (cheat_st->size > 0 && notification_show_cheats_applied)
|
||||
if (cheat_st->size && notification_show_cheats_applied)
|
||||
{
|
||||
char msg[128];
|
||||
size_t _len = strlcpy(msg, msg_hash_to_str(MSG_APPLYING_CHEAT), sizeof(msg));
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
RARCH_LOG("[Cheats] %s\n", msg);
|
||||
}
|
||||
|
||||
@@ -169,9 +170,15 @@ bool cheat_manager_save(
|
||||
(char*)"cheat%u_repeat_add_to_address"
|
||||
};
|
||||
|
||||
if (!cheat_st->cheats || cheat_st->size == 0)
|
||||
if (!cheat_st->cheats)
|
||||
return false;
|
||||
|
||||
if (!cheat_st->size)
|
||||
{
|
||||
filestream_delete(path);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cheat_database)
|
||||
strlcpy(cheats_file, path, sizeof(cheats_file));
|
||||
else
|
||||
@@ -598,27 +605,32 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
|
||||
{
|
||||
size_t _len;
|
||||
char msg[256];
|
||||
enum message_queue_category msg_cat = MESSAGE_QUEUE_CATEGORY_INFO;
|
||||
|
||||
if (!handle || !handle->cheats || handle->size == 0)
|
||||
return;
|
||||
|
||||
/* TODO/FIXME - localize */
|
||||
_len = snprintf(msg, sizeof(msg),
|
||||
"Cheat: #%u [%s]: %s",
|
||||
"%s #%u: %s: %s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT),
|
||||
handle_idx,
|
||||
handle->cheats[handle_idx].state
|
||||
? msg_hash_to_str(MENU_ENUM_LABEL_ON)
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_OFF),
|
||||
handle->cheats[handle_idx].desc
|
||||
? (handle->cheats[handle_idx].desc)
|
||||
: (handle->cheats[handle_idx].code)
|
||||
? (handle->cheats[handle_idx].desc)
|
||||
: (handle->cheats[handle_idx].code),
|
||||
handle->cheats[handle_idx].state
|
||||
? msg_hash_to_str(MENU_ENUM_LABEL_ON)
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_OFF)
|
||||
);
|
||||
|
||||
msg_cat = handle->cheats[handle_idx].state
|
||||
? MESSAGE_QUEUE_CATEGORY_SUCCESS : MESSAGE_QUEUE_CATEGORY_ERROR;
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, msg_cat);
|
||||
RARCH_LOG("[Cheats] %s\n", msg);
|
||||
}
|
||||
|
||||
void cheat_manager_toggle_index(bool apply_cheats_after_toggle,
|
||||
void cheat_manager_toggle_index(
|
||||
bool apply_cheats_after_toggle,
|
||||
bool notification_show_cheats_applied,
|
||||
unsigned i)
|
||||
{
|
||||
@@ -627,7 +639,9 @@ void cheat_manager_toggle_index(bool apply_cheats_after_toggle,
|
||||
return;
|
||||
|
||||
cheat_st->cheats[i].state = !cheat_st->cheats[i].state;
|
||||
cheat_manager_update(cheat_st, i);
|
||||
|
||||
if (notification_show_cheats_applied)
|
||||
cheat_manager_update(cheat_st, i);
|
||||
|
||||
if (apply_cheats_after_toggle)
|
||||
cheat_manager_apply_cheats(notification_show_cheats_applied);
|
||||
@@ -641,7 +655,9 @@ void cheat_manager_toggle(bool notification_show_cheats_applied)
|
||||
|
||||
cheat_st->cheats[cheat_st->ptr].state ^= true;
|
||||
cheat_manager_apply_cheats(notification_show_cheats_applied);
|
||||
cheat_manager_update(cheat_st, cheat_st->ptr);
|
||||
|
||||
if (notification_show_cheats_applied)
|
||||
cheat_manager_update(cheat_st, cheat_st->ptr);
|
||||
}
|
||||
|
||||
void cheat_manager_index_next(void)
|
||||
@@ -1227,7 +1243,7 @@ int cheat_manager_add_matches(const char *path,
|
||||
{
|
||||
_len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_SEARCH_ADDED_MATCHES_TOO_MANY), sizeof(msg));
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
|
||||
return 0;
|
||||
}
|
||||
cheat_manager_setup_search_meta(cheat_st->search_bit_size, &bytes_per_item, &mask, &bits);
|
||||
@@ -1685,13 +1701,13 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
{
|
||||
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_FAIL);
|
||||
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_ADD_MATCH_SUCCESS);
|
||||
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
}
|
||||
return;
|
||||
case CHEAT_MATCH_ACTION_TYPE_DELETE:
|
||||
@@ -1706,7 +1722,7 @@ void cheat_manager_match_action(enum cheat_match_action_type match_action, unsig
|
||||
cheat_st->num_matches--;
|
||||
_msg = msg_hash_to_str(MSG_CHEAT_SEARCH_DELETE_MATCH_SUCCESS);
|
||||
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-4
@@ -164,7 +164,6 @@ struct cheat_manager
|
||||
uint8_t *matches;
|
||||
uint8_t **memory_buf_list;
|
||||
unsigned *memory_size_list;
|
||||
unsigned int delete_state;
|
||||
unsigned int loading_cheat_size;
|
||||
unsigned int loading_cheat_offset;
|
||||
unsigned ptr;
|
||||
@@ -183,9 +182,9 @@ struct cheat_manager
|
||||
unsigned browse_address;
|
||||
char working_desc[CHEAT_DESC_SCRATCH_SIZE];
|
||||
char working_code[CHEAT_CODE_SCRATCH_SIZE];
|
||||
bool big_endian;
|
||||
bool memory_initialized;
|
||||
bool memory_search_initialized;
|
||||
bool big_endian;
|
||||
bool memory_initialized;
|
||||
bool memory_search_initialized;
|
||||
};
|
||||
|
||||
typedef struct cheat_manager cheat_manager_t;
|
||||
|
||||
+9
-9
@@ -9528,10 +9528,6 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_START_OR_CONT,
|
||||
""
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_HELP_CHEAT_START_OR_CONT,
|
||||
"Scan memory to create new cheats."
|
||||
)
|
||||
MSG_HASH(
|
||||
@@ -9556,7 +9552,7 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_RELOAD_CHEATS,
|
||||
""
|
||||
"Reload all existing cheats."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS,
|
||||
@@ -9572,7 +9568,7 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_TOP,
|
||||
""
|
||||
"Prepend a cheat to the list."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_ADD_NEW_BOTTOM,
|
||||
@@ -9580,7 +9576,7 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_ADD_NEW_BOTTOM,
|
||||
""
|
||||
"Append a cheat to the list."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_DELETE_ALL,
|
||||
@@ -9588,7 +9584,7 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_DELETE_ALL,
|
||||
""
|
||||
"Clear the cheat list."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_APPLY_AFTER_LOAD,
|
||||
@@ -9747,7 +9743,7 @@ MSG_HASH(
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES,
|
||||
"Add the %u Matches to Your List"
|
||||
"Add %u Matches to the List"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CHEAT_ADD_MATCHES,
|
||||
@@ -15399,6 +15395,10 @@ MSG_HASH(
|
||||
MSG_CHEAT_DELETE_ALL_SUCCESS,
|
||||
"All cheats deleted."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_CHEAT_RELOAD_ALL_SUCCESS,
|
||||
"All cheats reloaded."
|
||||
)
|
||||
MSG_HASH(
|
||||
MSG_CHEAT_ADD_BEFORE_SUCCESS,
|
||||
"New cheat added before this one."
|
||||
|
||||
@@ -862,30 +862,16 @@ static size_t menu_action_setting_disp_set_label_cheat(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
size_t _len = 0;
|
||||
size_t _len = 0;
|
||||
unsigned cheat_index = type - MENU_SETTINGS_CHEAT_BEGIN;
|
||||
|
||||
if (cheat_index < cheat_manager_get_buf_size())
|
||||
{
|
||||
_len =
|
||||
snprintf(s, len, "(%s) : ",
|
||||
cheat_manager_get_code_state(cheat_index)
|
||||
_len = strlcpy(s,
|
||||
cheat_manager_get_code_state(cheat_index)
|
||||
? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF));
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
|
||||
len);
|
||||
|
||||
if (cheat_manager_state.cheats[cheat_index].handler == CHEAT_HANDLER_TYPE_EMU)
|
||||
{
|
||||
const char *code = cheat_manager_get_code(cheat_index);
|
||||
_len += strlcpy(s + _len,
|
||||
code
|
||||
? code
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
len - _len);
|
||||
}
|
||||
else
|
||||
_len += snprintf(s + _len, len - _len, "%08X",
|
||||
cheat_manager_state.cheats[cheat_index].address);
|
||||
}
|
||||
*w = 19;
|
||||
|
||||
if (!string_is_empty(path))
|
||||
|
||||
+25
-20
@@ -2444,7 +2444,7 @@ static int generic_action_ok(const char *path,
|
||||
flush_char = msg_hash_to_str(flush_id);
|
||||
cheat_manager_state_free();
|
||||
|
||||
if (!cheat_manager_load(action_path,false))
|
||||
if (!cheat_manager_load(action_path, false))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -2452,7 +2452,7 @@ static int generic_action_ok(const char *path,
|
||||
#ifdef HAVE_CHEATS
|
||||
flush_char = msg_hash_to_str(flush_id);
|
||||
|
||||
if (!cheat_manager_load(action_path,true))
|
||||
if (!cheat_manager_load(action_path, true))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -4487,6 +4487,8 @@ push_dropdown_list:
|
||||
static int action_ok_cheat_reload_cheats(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
size_t _len;
|
||||
char msg[128];
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_cheat_database = settings->paths.path_cheat_database;
|
||||
@@ -4498,6 +4500,13 @@ static int action_ok_cheat_reload_cheats(const char *path,
|
||||
|
||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
|
||||
| MENU_ST_FLAG_PREVENT_POPULATE;
|
||||
|
||||
_len = strlcpy(msg,
|
||||
msg_hash_to_str(MSG_CHEAT_RELOAD_ALL_SUCCESS), sizeof(msg));
|
||||
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -4563,7 +4572,7 @@ static int action_ok_cheat_add_top(const char *path,
|
||||
_len = strlcpy(msg, msg_hash_to_str(MSG_CHEAT_ADD_TOP_SUCCESS), sizeof(msg));
|
||||
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4584,7 +4593,7 @@ static int action_ok_cheat_add_bottom(const char *path,
|
||||
msg_hash_to_str(MSG_CHEAT_ADD_BOTTOM_SUCCESS), sizeof(msg));
|
||||
|
||||
runloop_msg_queue_push(msg, _len, 1, 180, true, NULL,
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_SUCCESS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4596,7 +4605,6 @@ static int action_ok_cheat_delete_all(const char *path,
|
||||
char msg[128];
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
cheat_manager_state.delete_state = 0;
|
||||
cheat_manager_realloc(0, CHEAT_HANDLER_TYPE_EMU);
|
||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
|
||||
| MENU_ST_FLAG_PREVENT_POPULATE;
|
||||
@@ -4769,26 +4777,23 @@ static int action_ok_cheat_delete(const char *path,
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
unsigned int new_size = cheat_manager_get_size() - 1;
|
||||
|
||||
if (new_size >0)
|
||||
if (new_size > 0)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
if (cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].code)
|
||||
free(cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].code);
|
||||
if (cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].desc)
|
||||
free(cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].desc);
|
||||
|
||||
for (i = cheat_manager_state.working_cheat.idx; i <cheat_manager_state.size-1; i++)
|
||||
for (i = cheat_manager_state.working_cheat.idx; i < cheat_manager_state.size - 1; i++)
|
||||
{
|
||||
memcpy(&cheat_manager_state.cheats[i], &cheat_manager_state.cheats[i+1], sizeof(struct item_cheat ));
|
||||
cheat_manager_state.cheats[i].idx--;
|
||||
memcpy(&cheat_manager_state.cheats[i], &cheat_manager_state.cheats[i + 1], sizeof(struct item_cheat));
|
||||
|
||||
if (cheat_manager_state.cheats[i + 1].code)
|
||||
cheat_manager_state.cheats[i].code = strdup(cheat_manager_state.cheats[i + 1].code);
|
||||
|
||||
if (cheat_manager_state.cheats[i + 1].desc)
|
||||
cheat_manager_state.cheats[i].desc = strdup(cheat_manager_state.cheats[i + 1].desc);
|
||||
|
||||
if (cheat_manager_state.cheats[i].idx)
|
||||
cheat_manager_state.cheats[i].idx--;
|
||||
}
|
||||
|
||||
cheat_manager_state.cheats[cheat_manager_state.size-1].code = NULL;
|
||||
cheat_manager_state.cheats[cheat_manager_state.size-1].desc = NULL;
|
||||
cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].desc = NULL;
|
||||
cheat_manager_state.cheats[cheat_manager_state.working_cheat.idx].code = NULL;
|
||||
|
||||
}
|
||||
|
||||
cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_RETRO);
|
||||
|
||||
@@ -110,9 +110,9 @@ int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool apply_cheats_after_toggle = settings->bools.apply_cheats_after_toggle;
|
||||
|
||||
cheat_manager_toggle_index(apply_cheats_after_toggle,
|
||||
cheat_manager_toggle_index(
|
||||
settings->bools.apply_cheats_after_toggle,
|
||||
settings->bools.notification_show_cheats_applied,
|
||||
(unsigned)idx);
|
||||
|
||||
|
||||
@@ -692,9 +692,6 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_widgets, MENU_
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_show_load_content_animation, MENU_ENUM_SUBLABEL_MENU_SHOW_LOAD_CONTENT_ANIMATION)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_autoconfig, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_AUTOCONFIG)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_autoconfig_fails, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_AUTOCONFIG_FAILS)
|
||||
#ifdef HAVE_CHEATS
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_cheats_applied, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_CHEATS_APPLIED)
|
||||
#endif
|
||||
#ifdef HAVE_PATCH
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_patch_applied, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_PATCH_APPLIED)
|
||||
#endif
|
||||
@@ -780,6 +777,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_run_ahead_frames, MENU_
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_preempt_frames, MENU_ENUM_SUBLABEL_PREEMPT_FRAMES)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_block_timeout, MENU_ENUM_SUBLABEL_INPUT_BLOCK_TIMEOUT)
|
||||
#ifdef HAVE_CHEATS
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_cheats_applied, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_CHEATS_APPLIED)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cheat_apply_after_toggle, MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_TOGGLE)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cheat_apply_after_load, MENU_ENUM_SUBLABEL_CHEAT_APPLY_AFTER_LOAD)
|
||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_cheat_idx, MENU_ENUM_SUBLABEL_CHEAT_IDX)
|
||||
@@ -1744,15 +1742,23 @@ static int action_bind_sublabel_cheat_desc(
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
unsigned offset = (type - MENU_SETTINGS_CHEAT_BEGIN);
|
||||
size_t _len = 0;
|
||||
unsigned cheat_index = (type - MENU_SETTINGS_CHEAT_BEGIN);
|
||||
|
||||
if (cheat_manager_state.cheats)
|
||||
{
|
||||
/* TODO/FIXME - localize */
|
||||
if (cheat_manager_state.cheats[offset].handler == CHEAT_HANDLER_TYPE_EMU)
|
||||
strlcpy(s, "Emulator-Handled", len);
|
||||
if (cheat_manager_state.cheats[cheat_index].handler == CHEAT_HANDLER_TYPE_EMU)
|
||||
{
|
||||
const char *code = cheat_manager_get_code(cheat_index);
|
||||
_len += strlcpy(s + _len,
|
||||
!string_is_empty(code)
|
||||
? code
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
len - _len);
|
||||
}
|
||||
else
|
||||
strlcpy(s, "RetroArch-Handled", len);
|
||||
_len += snprintf(s + _len, len - _len, "%08X",
|
||||
cheat_manager_state.cheats[cheat_index].address);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2209,6 +2209,7 @@ static uintptr_t ozone_entries_icon_get_texture(
|
||||
case MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE_ALL:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE_MATCH:
|
||||
case MENU_ENUM_LABEL_CORE_DELETE:
|
||||
case MENU_ENUM_LABEL_DELETE_PLAYLIST:
|
||||
case MENU_ENUM_LABEL_CORE_DELETE_BACKUP_LIST:
|
||||
@@ -2353,6 +2354,8 @@ static uintptr_t ozone_entries_icon_get_texture(
|
||||
case MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES:
|
||||
case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES:
|
||||
return ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_CHECKMARK];
|
||||
case MENU_ENUM_LABEL_CHEAT_COPY_MATCH:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_MATCHES:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_AFTER:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BEFORE:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_TOP:
|
||||
|
||||
@@ -3888,6 +3888,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
||||
case MENU_ENUM_LABEL_QUICK_MENU_STOP_RECORDING:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE_ALL:
|
||||
case MENU_ENUM_LABEL_CHEAT_DELETE_MATCH:
|
||||
case MENU_ENUM_LABEL_CORE_DELETE:
|
||||
case MENU_ENUM_LABEL_DELETE_PLAYLIST:
|
||||
case MENU_ENUM_LABEL_CORE_DELETE_BACKUP_LIST:
|
||||
@@ -3992,6 +3993,8 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
|
||||
case MENU_ENUM_LABEL_CHEAT_APPLY_CHANGES:
|
||||
case MENU_ENUM_LABEL_SHADER_APPLY_CHANGES:
|
||||
return xmb->textures.list[XMB_TEXTURE_CHECKMARK];
|
||||
case MENU_ENUM_LABEL_CHEAT_COPY_MATCH:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_MATCHES:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_AFTER:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_BEFORE:
|
||||
case MENU_ENUM_LABEL_CHEAT_ADD_NEW_TOP:
|
||||
|
||||
+43
-38
@@ -8681,12 +8681,6 @@ unsigned menu_displaylist_build_list(
|
||||
MENU_ENUM_LABEL_CHEAT_FILE_LOAD_APPEND,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
if (menu_entries_append(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RELOAD_CHEATS),
|
||||
MENU_ENUM_LABEL_CHEAT_RELOAD_CHEATS,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
if (menu_entries_append(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_FILE_SAVE_AS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_FILE_SAVE_AS),
|
||||
@@ -8711,6 +8705,12 @@ unsigned menu_displaylist_build_list(
|
||||
MENU_ENUM_LABEL_CHEAT_DELETE_ALL,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
if (menu_entries_append(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_RELOAD_CHEATS),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_RELOAD_CHEATS),
|
||||
MENU_ENUM_LABEL_CHEAT_RELOAD_CHEATS,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
}
|
||||
|
||||
if (menu_entries_append(list,
|
||||
@@ -9561,28 +9561,6 @@ unsigned menu_displaylist_build_list(
|
||||
count++;
|
||||
}
|
||||
|
||||
cheat_label[0] = '\0';
|
||||
snprintf(cheat_label, sizeof(cheat_label),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES),
|
||||
cheat_manager_state.num_matches);
|
||||
|
||||
if (menu_entries_append(list,
|
||||
cheat_label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADD_MATCHES),
|
||||
MENU_ENUM_LABEL_CHEAT_ADD_MATCHES,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_CHEAT_DELETE_MATCH,
|
||||
PARSE_ONLY_UINT, false) != -1)
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_CHEAT_COPY_MATCH,
|
||||
PARSE_ONLY_UINT, false) != -1)
|
||||
count++;
|
||||
|
||||
{
|
||||
unsigned int address_mask = 0;
|
||||
unsigned int address = 0;
|
||||
@@ -9593,7 +9571,7 @@ unsigned menu_displaylist_build_list(
|
||||
|
||||
cheat_manager_match_action(CHEAT_MATCH_ACTION_TYPE_VIEW,
|
||||
cheat_manager_state.match_idx,
|
||||
&address, &address_mask, &prev_val, &curr_val) ;
|
||||
&address, &address_mask, &prev_val, &curr_val);
|
||||
snprintf(cheat_label, sizeof(cheat_label),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_MATCH),
|
||||
address, address_mask);
|
||||
@@ -9609,14 +9587,38 @@ unsigned menu_displaylist_build_list(
|
||||
PARSE_ONLY_UINT, false) != -1)
|
||||
count++;
|
||||
|
||||
cheat_label[0] = '\0';
|
||||
|
||||
snprintf(cheat_label, sizeof(cheat_label),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CHEAT_ADD_MATCHES),
|
||||
cheat_manager_state.num_matches);
|
||||
|
||||
if (menu_entries_append(list,
|
||||
cheat_label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_ADD_MATCHES),
|
||||
MENU_ENUM_LABEL_CHEAT_ADD_MATCHES,
|
||||
MENU_SETTING_ACTION, 0, 0, NULL))
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_CHEAT_COPY_MATCH,
|
||||
PARSE_ONLY_UINT, false) != -1)
|
||||
count++;
|
||||
|
||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||
MENU_ENUM_LABEL_CHEAT_DELETE_MATCH,
|
||||
PARSE_ONLY_UINT, false) != -1)
|
||||
count++;
|
||||
|
||||
{
|
||||
rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_DELETE_MATCH);
|
||||
if (setting)
|
||||
setting->max = cheat_manager_state.num_matches-1;
|
||||
setting->max = cheat_manager_state.num_matches - 1;
|
||||
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_COPY_MATCH)))
|
||||
setting->max = cheat_manager_state.num_matches-1;
|
||||
setting->max = cheat_manager_state.num_matches - 1;
|
||||
if ((setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY)))
|
||||
setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ;
|
||||
setting->max = (cheat_manager_state.total_memory_size > 0)
|
||||
? cheat_manager_state.total_memory_size - 1 : 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -9629,16 +9631,19 @@ unsigned menu_displaylist_build_list(
|
||||
|
||||
{
|
||||
rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS);
|
||||
if (setting )
|
||||
setting->max = cheat_manager_state.total_memory_size==0?0:cheat_manager_state.total_memory_size-1;
|
||||
if (setting)
|
||||
setting->max = (cheat_manager_state.total_memory_size == 0)
|
||||
? 0 : cheat_manager_state.total_memory_size - 1;
|
||||
|
||||
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_ADDRESS_BIT_POSITION);
|
||||
if (setting )
|
||||
setting->max = (cheat_manager_state.working_cheat.memory_search_size < 3) ? 255 : 0 ;
|
||||
if (setting)
|
||||
setting->max = (cheat_manager_state.working_cheat.memory_search_size < 3)
|
||||
? 255 : 0;
|
||||
|
||||
setting = menu_setting_find_enum(MENU_ENUM_LABEL_CHEAT_BROWSE_MEMORY);
|
||||
if (setting )
|
||||
setting->max = cheat_manager_state.total_memory_size>0?cheat_manager_state.total_memory_size-1:0 ;
|
||||
if (setting)
|
||||
setting->max = (cheat_manager_state.total_memory_size > 0)
|
||||
? cheat_manager_state.total_memory_size - 1 : 0;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -5603,6 +5603,14 @@ unsigned menu_event(
|
||||
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
|
||||
setting_type = entry.setting_type;
|
||||
|
||||
#ifdef HAVE_CHEATS
|
||||
/* Treat cheat left/right toggle as bools */
|
||||
if ( !setting_type
|
||||
&& entry.type >= MENU_SETTINGS_CHEAT_BEGIN
|
||||
&& entry.type <= MENU_SETTINGS_CHEAT_END)
|
||||
setting_type = ST_BOOL;
|
||||
#endif
|
||||
|
||||
if (setting_type == ST_BOOL)
|
||||
{
|
||||
char value[8];
|
||||
|
||||
@@ -3923,6 +3923,7 @@ enum msg_hash_enums
|
||||
MSG_CHEAT_ADD_TOP_SUCCESS,
|
||||
MSG_CHEAT_ADD_BOTTOM_SUCCESS,
|
||||
MSG_CHEAT_DELETE_ALL_SUCCESS,
|
||||
MSG_CHEAT_RELOAD_ALL_SUCCESS,
|
||||
MSG_CHEAT_ADD_AFTER_SUCCESS,
|
||||
MSG_CHEAT_ADD_BEFORE_SUCCESS,
|
||||
MSG_CHEAT_COPY_AFTER_SUCCESS,
|
||||
|
||||
Reference in new issue
Block a user