workaround a problem with the harmattan gcc
[drnoksnes] / cheats.h
1 /*
2  * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
3  *
4  * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
5  *                           Jerremy Koot (jkoot@snes9x.com)
6  *
7  * Super FX C emulator code 
8  * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
9  *                           Gary Henderson.
10  * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
11  *
12  * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
13  * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
14  * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
15  *
16  * DOS port code contains the works of other authors. See headers in
17  * individual files.
18  *
19  * Snes9x homepage: http://www.snes9x.com
20  *
21  * Permission to use, copy, modify and distribute Snes9x in both binary and
22  * source form, for non-commercial purposes, is hereby granted without fee,
23  * providing that this license information and copyright notice appear with
24  * all copies and any derived work.
25  *
26  * This software is provided 'as-is', without any express or implied
27  * warranty. In no event shall the authors be held liable for any damages
28  * arising from the use of this software.
29  *
30  * Snes9x is freeware for PERSONAL USE only. Commercial users should
31  * seek permission of the copyright holders first. Commercial use includes
32  * charging money for Snes9x or software derived from Snes9x.
33  *
34  * The copyright holders request that bug fixes and improvements to the code
35  * should be forwarded to them so everyone can benefit from the modifications
36  * in future versions.
37  *
38  * Super NES and Super Nintendo Entertainment System are trademarks of
39  * Nintendo Co., Limited and its subsidiary companies.
40  */
41 #ifndef _CHEATS_H_
42 #define _CHEATS_H_
43
44 struct SCheat
45 {
46     uint32  address;
47     uint8   byte;
48     uint8   saved_byte;
49     bool8   enabled;
50     bool8   saved;
51     char    name [22];
52 };
53
54 #define MAX_CHEATS 75
55
56 struct SCheatData
57 {
58     struct SCheat   c [MAX_CHEATS];
59     uint32          num_cheats;
60     uint8           CWRAM [0x20000];
61     uint8           CSRAM [0x10000];
62     uint8           CIRAM [0x2000];
63     uint8           *RAM;
64     uint8           *FillRAM;
65     uint8           *SRAM;
66     uint32          WRAM_BITS [0x20000 >> 3];
67     uint32          SRAM_BITS [0x10000 >> 3];
68     uint32          IRAM_BITS [0x2000 >> 3];
69 };
70
71 typedef enum
72 {
73     S9X_LESS_THAN, S9X_GREATER_THAN, S9X_LESS_THAN_OR_EQUAL,
74     S9X_GREATER_THAN_OR_EQUAL, S9X_EQUAL, S9X_NOT_EQUAL
75 } S9xCheatComparisonType;
76
77 typedef enum
78 {
79     S9X_8_BITS, S9X_16_BITS, S9X_24_BITS, S9X_32_BITS
80 } S9xCheatDataSize;
81
82 void S9xInitCheatData ();
83
84 const char *S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte);
85 const char *S9xProActionReplayToRaw (const char *code, uint32 &address, uint8 &byte);
86 const char *S9xGoldFingerToRaw (const char *code, uint32 &address, bool8 &sram,
87                                 uint8 &num_bytes, uint8 bytes[3]);
88 void S9xApplyCheats ();
89 void S9xApplyCheat (uint32 which1);
90 void S9xRemoveCheats ();
91 void S9xRemoveCheat (uint32 which1);
92 void S9xEnableCheat (uint32 which1);
93 void S9xDisableCheat (uint32 which1);
94 void S9xAddCheat (bool8 enable, bool8 save_current_value, uint32 address,
95                   uint8 byte);
96 void S9xDeleteCheats ();
97 void S9xDeleteCheat (uint32 which1);
98 bool8 S9xLoadCheatFile (const char *filename);
99 bool8 S9xSaveCheatFile (const char *filename);
100
101 void S9xStartCheatSearch (SCheatData *);
102 void S9xSearchForChange (SCheatData *, S9xCheatComparisonType cmp,
103                          S9xCheatDataSize size, bool8 is_signed, bool8 update);
104 void S9xSearchForValue (SCheatData *, S9xCheatComparisonType cmp,
105                         S9xCheatDataSize size, uint32 value,
106                         bool8 is_signed, bool8 update);
107 void S9xOutputCheatSearchResults (SCheatData *);
108
109 #endif