From 77de248b716c5a43fc32a616145d31b8e20660df Mon Sep 17 00:00:00 2001 From: skidau Date: Mon, 18 May 2015 05:37:37 +0000 Subject: [PATCH] Raised the maximum number of cheats allowed from 100 to 16384. --- src/common/ConfigManager.h | 3 ++- src/gb/gbCheats.cpp | 2 +- src/gb/gbCheats.h | 3 ++- src/gba/Cheats.cpp | 4 ++-- src/gba/Cheats.h | 4 +++- src/gba/RTC.cpp | 8 ++++---- src/wx/guiinit.cpp | 10 +++++----- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/common/ConfigManager.h b/src/common/ConfigManager.h index 1da026bd..2a8bde8b 100644 --- a/src/common/ConfigManager.h +++ b/src/common/ConfigManager.h @@ -14,6 +14,8 @@ # include #endif // ! __GNUC__ +#define MAX_CHEATS 16384 + extern bool cpuIsMultiBoot; extern bool mirroringEnable; extern bool parseDebug; @@ -137,7 +139,6 @@ extern u32 movieLastJoypad; extern u32 movieNextJoypad; extern int throttle; -#define MAX_CHEATS 100 extern int preparedCheats; extern const char* preparedCheatCodes[MAX_CHEATS]; diff --git a/src/gb/gbCheats.cpp b/src/gb/gbCheats.cpp index 365ecc1f..13ef58b2 100644 --- a/src/gb/gbCheats.cpp +++ b/src/gb/gbCheats.cpp @@ -12,7 +12,7 @@ #include "gb.h" #include "../common/ConfigManager.h" -gbCheat gbCheatList[100]; +gbCheat gbCheatList[MAX_CHEATS]; int gbCheatNumber = 0; int gbNextCheat = 0; bool gbCheatMap[0x10000]; diff --git a/src/gb/gbCheats.h b/src/gb/gbCheats.h index 261767e4..74c6a5a3 100644 --- a/src/gb/gbCheats.h +++ b/src/gb/gbCheats.h @@ -2,6 +2,7 @@ #define GBCHEATS_H #include "../System.h" +#include "../common/ConfigManager.h" struct gbXxCheat { char cheatDesc[100]; @@ -38,7 +39,7 @@ bool gbVerifyGgCode(const char *code); extern int gbCheatNumber; -extern gbCheat gbCheatList[100]; +extern gbCheat gbCheatList[MAX_CHEATS]; extern bool gbCheatMap[0x10000]; #endif // GBCHEATS_H diff --git a/src/gba/Cheats.cpp b/src/gba/Cheats.cpp index feb42524..2ec4c96b 100644 --- a/src/gba/Cheats.cpp +++ b/src/gba/Cheats.cpp @@ -178,7 +178,7 @@ #define CHEATS_16_BIT_WRITE 114 #define CHEATS_32_BIT_WRITE 115 -CheatsData cheatsList[100]; +CheatsData cheatsList[MAX_CHEATS]; int cheatsNumber = 0; u32 rompatch2addr [4]; u16 rompatch2val [4]; @@ -1314,7 +1314,7 @@ void cheatsAdd(const char *codeStr, int code, int size) { - if(cheatsNumber < 100) { + if(cheatsNumber < MAX_CHEATS) { int x = cheatsNumber; cheatsList[x].code = code; cheatsList[x].size = size; diff --git a/src/gba/Cheats.h b/src/gba/Cheats.h index 277d43ca..f67b2261 100644 --- a/src/gba/Cheats.h +++ b/src/gba/Cheats.h @@ -1,6 +1,8 @@ #ifndef CHEATS_H #define CHEATS_H +#include "../common/ConfigManager.h" + struct CheatsData { int code; int size; @@ -36,6 +38,6 @@ void cheatsWriteByte(u32 address, u8 value); int cheatsCheckKeys(u32 keys, u32 extended); extern int cheatsNumber; -extern CheatsData cheatsList[100]; +extern CheatsData cheatsList[MAX_CHEATS]; #endif // CHEATS_H diff --git a/src/gba/RTC.cpp b/src/gba/RTC.cpp index 7852d64d..8fc66bd8 100644 --- a/src/gba/RTC.cpp +++ b/src/gba/RTC.cpp @@ -33,17 +33,17 @@ typedef struct { } RTCCLOCKDATA; static RTCCLOCKDATA rtcClockData; -static bool rtcEnabled = true; +static bool rtcClockEnabled = true; static bool rtcRumbleEnabled = false; void rtcEnable(bool e) { - rtcEnabled = e; + rtcClockEnabled = e; } bool rtcIsEnabled() { - return rtcEnabled; + return rtcClockEnabled; } void rtcEnableRumble(bool e) @@ -80,7 +80,7 @@ u16 rtcRead(u32 address) return ((v >> rtcClockData.reserved[11]) & 1) << 2; } // Real Time Clock - else if (rtcEnabled) { + else if (rtcClockEnabled) { //sprintf(DebugStr, "Reading RTC %02x, %02x, %02x", rtcClockData.byte0, rtcClockData.byte1, rtcClockData.byte2); return rtcClockData.byte0; } diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 9ac1b236..29b9cd18 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -267,7 +267,7 @@ public: { wxString line = text.ReadLine().Trim(); - if (line.Contains(wxT("["))) + if (line.Contains(wxT("[")) && !line.Contains(wxT("="))) { cheat_desc = line.AfterFirst('[').BeforeLast(']'); } @@ -599,10 +599,10 @@ public: if (ncodes > id + 1) { - wxString codes[100]; - wxString descs[100]; - bool checked[100]; - bool v3[100]; + wxString codes[MAX_CHEATS]; + wxString descs[MAX_CHEATS]; + bool checked[MAX_CHEATS]; + bool v3[MAX_CHEATS]; for (int i = id + 1; i < ncodes; i++) {