MCPcopy Create free account
hub / github.com/dborth/snes9xgx / LoadCheatFile

Function LoadCheatFile

source/cheatmgr.cpp:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 ***************************************************************************/
30
31static bool LoadCheatFile (int length)
32{
33 uint8 data [28];
34 int offset = 0;
35
36 while (offset < length) {
37 if(Cheat.g.size() >= MAX_CHEATS || (length - offset) < 28)
38 break;
39
40 memcpy (data, savebuffer+offset, 28);
41 offset += 28;
42
43 SCheat c;
44 char name[21];
45 char cheat[10];
46 c.byte = data[1];
47 c.address = data[2] | (data[3] << 8) | (data[4] << 16);
48 memcpy (name, &data[8], 20);
49 name[20] = 0;
50
51 snprintf (cheat, 10, "%x=%x", c.address, c.byte);
52 S9xAddCheatGroup (name, cheat);
53 }
54 return true;
55}
56
57void ToggleCheat(uint32 num) {
58 if(Cheat.g[num].enabled) {

Callers 1

WiiSetupCheatsFunction · 0.85

Calls 2

S9xAddCheatGroupFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected