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
33 int First; // index of the first cheat code
34 int n; // number of cheat codes for this cheat
38 void ClearAllCheats();
40 void LoadCheats(const char *filename);
41 void SaveCheats(const char *filename);
45 int AddCheat(const char *descr, char *code);
46 void RemoveCheat(int index);
47 int EditCheat(int index, const char *descr, char *code);
49 void FreeCheatSearchResults();
50 void FreeCheatSearchMem();
51 void CheatSearchBackupMemory();
53 void CheatSearchEqual8(u8 val);
54 void CheatSearchEqual16(u16 val);
55 void CheatSearchEqual32(u32 val);
56 void CheatSearchNotEqual8(u8 val);
57 void CheatSearchNotEqual16(u16 val);
58 void CheatSearchNotEqual32(u32 val);
59 void CheatSearchRange8(u8 min, u8 max);
60 void CheatSearchRange16(u16 min, u16 max);
61 void CheatSearchRange32(u32 min, u32 max);
62 void CheatSearchIncreasedBy8(u8 val);
63 void CheatSearchIncreasedBy16(u16 val);
64 void CheatSearchIncreasedBy32(u32 val);
65 void CheatSearchDecreasedBy8(u8 val);
66 void CheatSearchDecreasedBy16(u16 val);
67 void CheatSearchDecreasedBy32(u32 val);
68 void CheatSearchIncreased8();
69 void CheatSearchIncreased16();
70 void CheatSearchIncreased32();
71 void CheatSearchDecreased8();
72 void CheatSearchDecreased16();
73 void CheatSearchDecreased32();
74 void CheatSearchDifferent8();
75 void CheatSearchDifferent16();
76 void CheatSearchDifferent32();
77 void CheatSearchNoChange8();
78 void CheatSearchNoChange16();
79 void CheatSearchNoChange32();
82 extern CheatCode *CheatCodes;
87 extern u32 *SearchResults;
88 extern int NumSearchResults;
90 #define PREVM(mem) (&prevM[mem])
91 #define PrevMu8(mem) (*(u8 *)PREVM(mem))
92 #define PrevMu16(mem) (SWAP16(*(u16 *)PREVM(mem)))
93 #define PrevMu32(mem) (SWAP32(*(u32 *)PREVM(mem)))
96 #define CHEAT_CONST8 0x30 /* 8-bit Constant Write */
97 #define CHEAT_CONST16 0x80 /* 16-bit Constant Write */
98 #define CHEAT_INC16 0x10 /* 16-bit Increment */
99 #define CHEAT_DEC16 0x11 /* 16-bit Decrement */
100 #define CHEAT_INC8 0x20 /* 8-bit Increment */
101 #define CHEAT_DEC8 0x21 /* 8-bit Decrement */
102 #define CHEAT_SLIDE 0x50 /* Slide Codes */
103 #define CHEAT_MEMCPY 0xC2 /* Memory Copy */
105 #define CHEAT_EQU8 0xE0 /* 8-bit Equal To */
106 #define CHEAT_NOTEQU8 0xE1 /* 8-bit Not Equal To */
107 #define CHEAT_LESSTHAN8 0xE2 /* 8-bit Less Than */
108 #define CHEAT_GREATERTHAN8 0xE3 /* 8-bit Greater Than */
109 #define CHEAT_EQU16 0xD0 /* 16-bit Equal To */
110 #define CHEAT_NOTEQU16 0xD1 /* 16-bit Not Equal To */
111 #define CHEAT_LESSTHAN16 0xD2 /* 16-bit Less Than */
112 #define CHEAT_GREATERTHAN16 0xD3 /* 16-bit Greater Than */