From 29b36a801d8522c62b8a935453ce53b33ddf8e0c Mon Sep 17 00:00:00 2001 From: owomomo Date: Wed, 12 Jun 2019 22:16:01 +0800 Subject: [PATCH] Cheat console: 1. Added a global switch for all cheats, it is checked by default. Check or uncheck it can quickly tweak all cheats enabled or disabled. It's not game specific and effective to all games. 2. Added a checkmark to check behaviour of automatically load cheats. 3. Fixed a wierd bug in loading names of cheats from file. iNES Header Editor: 4. Disable iNES header editor menu when currently loaded game is not in iNES format. Others: 5. Some of the checkbox passed parameter MF_CHECKED, the right one is BST_CHECKED, though they have the same value. 6. Code/Data Logger is created by CreateDialog(), but destroyed by EndDialog()? A non-modal window should be destroy by DestroyWindow(), EndDialog() is for DialogBox(). It seems nobody noticed this bug for years. 7. Detail. Currently there are some opposite tweaks in the config file for the new feature in cheat console, for example the unchcecked state is 1 in config file, that's for backward compatibility. The iNES header editor might not quite stable as newly baked from the oven, there might be some improvements to its code. --- src/cheat.h | 3 +++ src/driver.h | 1 - src/drivers/common/cheat.h | 4 +++- src/drivers/win/cheat.cpp | 3 ++- src/drivers/win/cheat.h | 4 +++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/cheat.h b/src/cheat.h index 9e8476b4..84e75ef7 100644 --- a/src/cheat.h +++ b/src/cheat.h @@ -1,3 +1,5 @@ +#ifndef CHEAT_H +#define CHEAT_H void FCEU_CheatResetRAM(void); void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p); @@ -59,3 +61,4 @@ struct SEARCHPOSSIBLE { for (int i = 0; i < numsubcheats && count < size; ++i) \ if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \ ++count +#endif \ No newline at end of file diff --git a/src/driver.h b/src/driver.h index 4ce67eeb..496ab636 100644 --- a/src/driver.h +++ b/src/driver.h @@ -192,7 +192,6 @@ int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int ty int FCEUI_DelCheat(uint32 which); int FCEUI_ToggleCheat(uint32 which); int FCEUI_GlobalToggleCheat(int global_enable); -void FCEU_SaveGameCheats(FILE *fp, int release = 0); int32 FCEUI_CheatSearchGetCount(void); void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current)); diff --git a/src/drivers/common/cheat.h b/src/drivers/common/cheat.h index 77619fe3..d8dc8f60 100644 --- a/src/drivers/common/cheat.h +++ b/src/drivers/common/cheat.h @@ -17,5 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - +#ifndef COMMON_CHEAT_H +#define COMMON_CHEAT_H void DoConsoleCheatConfig(void); +#endif \ No newline at end of file diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index d6eb59d6..b6cd9b27 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -975,8 +975,9 @@ void UpdateCheatListGroupBoxUI() EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE); } - SetDlgItemText(hCheat, IDC_GROUPBOX_CHEATLIST, temp); + + EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_EXPORTTOFILE), cheats != 0); } //Used by cheats and external dialogs such as hex editor to update items in the cheat search dialog diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 7552746c..af9d7689 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -1,5 +1,7 @@ //-- //mbg merge 7/18/06 had to make these extern +#ifndef WIN_CHEAT_H +#define WIN_CHEAT_H extern int CheatWindow,CheatStyle; //bbit edited: this line added extern HWND hCheat; @@ -44,4 +46,4 @@ SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \ SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \ SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"") & \ SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPTSTR)"")) - +#endif \ No newline at end of file