| 29 | ***************************************************************************/ |
| 30 | |
| 31 | static 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 | |
| 57 | void ToggleCheat(uint32 num) { |
| 58 | if(Cheat.g[num].enabled) { |
no test coverage detected