Cheat Search: Switch of show address in Game Genie format

This commit is contained in:
owomomo 2020-09-06 08:20:20 +08:00
parent 1f42929f4f
commit 757c13e22a
5 changed files with 39 additions and 11 deletions

View File

@ -63,6 +63,7 @@ CHEATF_SUBFAST SubCheats[256] = { 0 };
uint32 numsubcheats = 0;
int globalCheatDisabled = 0;
int disableAutoLSCheats = 0;
bool disableShowGG = 0;
static _8BYTECHEATMAP* cheatMap = NULL;
struct CHEATF *cheats = 0, *cheatsl = 0;

View File

@ -37,6 +37,7 @@ HMENU hCheatcontext = 0; //Handle to cheat context menu
bool pauseWhileActive = false; //For checkbox "Pause while active"
extern int globalCheatDisabled;
extern int disableAutoLSCheats;
extern bool disableShowGG;
extern bool wasPausedByCheats;
int CheatWindow;
@ -316,6 +317,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_CHEAT_PAUSEWHENACTIVE, pauseWhileActive ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHEAT_GLOBAL_SWITCH, globalCheatDisabled ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_CHEAT_AUTOLOADSAVE, disableAutoLSCheats == 2 ? BST_UNCHECKED : disableAutoLSCheats == 1 ? BST_INDETERMINATE : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_CHEAT_SHOWGG, disableShowGG ? BST_UNCHECKED : BST_CHECKED);
//setup font
SetupCheatFont(hwndDlg);
@ -761,6 +763,31 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
SetCheatToolTip(hwndDlg, IDC_CHEAT_AUTOLOADSAVE);
}
break;
case IDC_CHEAT_SHOWGG:
{
disableShowGG ^= 1;
void(*CreateCheatStr)(char* buf, int a, int v, int c) = disableShowGG ? GetCheatCodeStr : EncodeGG;
int i = 0;
char buf[32];
LVITEM lvi;
lvi.iSubItem = 0;
struct CHEATF* cheat = cheats;
while (cheat != NULL)
{
if (cheat->addr > 0x7FFF)
{
CreateCheatStr(buf, cheat->addr, cheat->val, cheat->compare);
lvi.pszText = buf;
SendDlgItemMessage(hwndDlg, IDC_LIST_CHEATS, LVM_SETITEMTEXT, i, (LPARAM)&lvi);
}
cheat = cheat->next;
++i;
}
}
}
break;
case EN_SETFOCUS:
@ -1311,11 +1338,10 @@ void DoGGConv()
inline void GetCheatStr(char* buf, int a, int v, int c)
{
if (a > 0x7FFF)
EncodeGG(buf, a, v, c);
else {
if (a < 0x8000 || disableShowGG)
GetCheatCodeStr(buf, a, v, c);
}
else
EncodeGG(buf, a, v, c);
}
inline void GetCheatCodeStr(char* buf, int a, int v, int c)

View File

@ -58,6 +58,7 @@ extern int CurrentState;
extern bool pauseWhileActive; //adelikat: Cheats dialog
extern int globalCheatDisabled;
extern int disableAutoLSCheats;
extern bool disableShowGG;
extern bool enableHUDrecording;
extern bool disableMovieMessages;
extern bool replaceP2StartWithMicrophone;
@ -469,6 +470,7 @@ static CFGSTRUCT fceuconfig[] =
AC(compressSavestates),
AC(pauseWhileActive),
AC(disableAutoLSCheats),
AC(disableShowGG),
AC(globalCheatDisabled),
AC(enableHUDrecording),
AC(disableMovieMessages),

View File

@ -1380,9 +1380,9 @@ CAPTION "Cheat Search"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Active Cheats",IDC_GROUPBOX_CHEATLIST,5,2,169,219,WS_TABSTOP
CONTROL "Enable cheats",IDC_CHEAT_GLOBAL_SWITCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,12,58,10
CONTROL "Auto load / save with game",IDC_CHEAT_AUTOLOADSAVE,
"Button",BS_AUTO3STATE | WS_TABSTOP,71,12,100,10
CONTROL "Enable",IDC_CHEAT_GLOBAL_SWITCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,12,38,10
CONTROL "Auto load / save",IDC_CHEAT_AUTOLOADSAVE,"Button",BS_AUTO3STATE | WS_TABSTOP,59,12,66,10
CONTROL "Show GG", IDC_CHEAT_SHOWGG, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 127, 12, 42, 10
CONTROL "",IDC_LIST_CHEATS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,11,24,157,133
LTEXT "Name:",IDC_STATIC,12,162,22,10
EDITTEXT IDC_CHEAT_NAME,37,160,131,12,ES_AUTOHSCROLL | ES_WANTRETURN

View File

@ -625,12 +625,10 @@
#define IDC_MISCELLANEOUS_ROMS_EDIT 1087
#define IDC_EXTEND_SYSTEM_GROUP 1089
#define IDC_EXTEND_SYSTEM_TEXT 1090
#define IDC_BUTTON1 1094
#define IDC_CHEAT_SWITCH 1096
#define IDC_CHEAT_GLOBAL_SWITCH 1096
#define IDC_GAME_GENIE_LABEL 1097
#define IDC_CHEAT_GAME_GENIE_TEXT 1098
#define IDC_CHECK2 1099
#define IDC_RADIO_SHORTCUT1 1100
#define IDC_RADIO_SHORTCUT2 1101
#define IDC_RADIO_SHORTCUT3 1102
@ -643,6 +641,7 @@
#define IDC_RADIO_SHORTCUT0 1109
#define IDC_BOOKMARK_VIEW_TEXT 1110
#define IDC_BOOKMARK_COMBO_VIEW 1112
#define IDC_CHEAT_SHOWGG 1112
#define BTN_ALLOW_LRUD 1117
#define IDC_PRGROM_EDIT 1118
#define IDC_CHRROM_EDIT 1119
@ -1167,7 +1166,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 309
#define _APS_NEXT_COMMAND_VALUE 40005
#define _APS_NEXT_CONTROL_VALUE 1112
#define _APS_NEXT_CONTROL_VALUE 1113
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif