1 /* Cheat Support for PCSX-Reloaded
2 * Copyright (C) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA
34 int First; // index of the first cheat code
35 int n; // number of cheat codes for this cheat
40 void ClearAllCheats();
42 void LoadCheats(const char *filename);
43 void SaveCheats(const char *filename);
47 int AddCheat(const char *descr, char *code);
48 void RemoveCheat(int index);
49 int EditCheat(int index, const char *descr, char *code);
51 void FreeCheatSearchResults();
52 void FreeCheatSearchMem();
53 void CheatSearchBackupMemory();
55 void CheatSearchEqual8(u8 val);
56 void CheatSearchEqual16(u16 val);
57 void CheatSearchEqual32(u32 val);
58 void CheatSearchNotEqual8(u8 val);
59 void CheatSearchNotEqual16(u16 val);
60 void CheatSearchNotEqual32(u32 val);
61 void CheatSearchRange8(u8 min, u8 max);
62 void CheatSearchRange16(u16 min, u16 max);
63 void CheatSearchRange32(u32 min, u32 max);
64 void CheatSearchIncreasedBy8(u8 val);
65 void CheatSearchIncreasedBy16(u16 val);
66 void CheatSearchIncreasedBy32(u32 val);
67 void CheatSearchDecreasedBy8(u8 val);
68 void CheatSearchDecreasedBy16(u16 val);
69 void CheatSearchDecreasedBy32(u32 val);
70 void CheatSearchIncreased8();
71 void CheatSearchIncreased16();
72 void CheatSearchIncreased32();
73 void CheatSearchDecreased8();
74 void CheatSearchDecreased16();
75 void CheatSearchDecreased32();
76 void CheatSearchDifferent8();
77 void CheatSearchDifferent16();
78 void CheatSearchDifferent32();
79 void CheatSearchNoChange8();
80 void CheatSearchNoChange16();
81 void CheatSearchNoChange32();
84 extern CheatCode *CheatCodes;
89 extern u32 *SearchResults;
90 extern int NumSearchResults;
92 extern int NumCheatsAllocated;
93 extern int NumCodesAllocated;
95 #define PREVM(mem) (&prevM[mem])
96 #define PrevMu8(mem) (*(u8 *)PREVM(mem))
97 #define PrevMu16(mem) (SWAP16(*(u16 *)PREVM(mem)))
98 #define PrevMu32(mem) (SWAP32(*(u32 *)PREVM(mem)))
101 #define CHEAT_CONST8 0x30 /* 8-bit Constant Write */
102 #define CHEAT_CONST16 0x80 /* 16-bit Constant Write */
104 #define CHEAT_INC16 0x10 /* 16-bit Increment */
105 #define CHEAT_DEC16 0x11 /* 16-bit Decrement */
106 #define CHEAT_SCRATCHPAD16 0x1F /* 16-bit Scratchpad Write */
107 #define CHEAT_INC8 0x20 /* 8-bit Increment */
108 #define CHEAT_DEC8 0x21 /* 8-bit Decrement */
109 #define CHEAT_SLIDE 0x50 /* Slide Codes */
110 #define CHEAT_MEMCPY 0xC2 /* Memory Copy */
113 #define CHEAT_EQU16 0xD0 /* 16-bit Equal To */
114 #define CHEAT_NOTEQU16 0xD1 /* 16-bit Not Equal To */
115 #define CHEAT_LESSTHAN16 0xD2 /* 16-bit Less Than */
116 #define CHEAT_GREATERTHAN16 0xD3 /* 16-bit Greater Than */
117 #define CHEAT_BUTTONS1_16 0xD4 /* button presses equate to YYYY */
118 #define CHEAT_EQU8 0xE0 /* 8-bit Equal To */
119 #define CHEAT_NOTEQU8 0xE1 /* 8-bit Not Equal To */
120 #define CHEAT_LESSTHAN8 0xE2 /* 8-bit Less Than */
121 #define CHEAT_GREATERTHAN8 0xE3 /* 8-bit Greater Than */