aboutsummaryrefslogtreecommitdiff
path: root/source/cheats2.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/cheats2.c')
-rw-r--r--source/cheats2.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/source/cheats2.c b/source/cheats2.c
index aaee684..7781ba7 100644
--- a/source/cheats2.c
+++ b/source/cheats2.c
@@ -105,8 +105,8 @@ void S9xInitCheatData()
Cheat.FillRAM = Memory.FillRAM;
}
-void S9xAddCheat(bool8 enable, bool8 save_current_value,
- uint32 address, uint8 byte)
+void S9xAddCheat(bool enable, bool save_current_value,
+ uint32_t address, uint8_t byte)
{
if (Cheat.num_cheats < sizeof(Cheat.c) / sizeof(Cheat.c [0]))
{
@@ -116,7 +116,7 @@ void S9xAddCheat(bool8 enable, bool8 save_current_value,
if (save_current_value)
{
Cheat.c [Cheat.num_cheats].saved_byte = S9xGetByte(address);
- Cheat.c [Cheat.num_cheats].saved = TRUE;
+ Cheat.c [Cheat.num_cheats].saved = true;
}
Cheat.num_cheats++;
if (enable)
@@ -124,7 +124,7 @@ void S9xAddCheat(bool8 enable, bool8 save_current_value,
}
}
-void S9xDeleteCheat(uint32 which1)
+void S9xDeleteCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats)
{
@@ -144,62 +144,62 @@ void S9xDeleteCheats()
Cheat.num_cheats = 0;
}
-void S9xEnableCheat(uint32 which1)
+void S9xEnableCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats && !Cheat.c [which1].enabled)
{
- Cheat.c [which1].enabled = TRUE;
+ Cheat.c [which1].enabled = true;
S9xApplyCheat(which1);
}
}
-void S9xDisableCheat(uint32 which1)
+void S9xDisableCheat(uint32_t which1)
{
if (which1 < Cheat.num_cheats && Cheat.c [which1].enabled)
{
S9xRemoveCheat(which1);
- Cheat.c [which1].enabled = FALSE;
+ Cheat.c [which1].enabled = false;
}
}
-void S9xRemoveCheat(uint32 which1)
+void S9xRemoveCheat(uint32_t which1)
{
if (Cheat.c [which1].saved)
{
- uint32 address = Cheat.c [which1].address;
+ uint32_t address = Cheat.c [which1].address;
int block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
- uint8* ptr = Memory.Map [block];
+ uint8_t* ptr = Memory.Map [block];
- if (ptr >= (uint8*) MAP_LAST)
+ if (ptr >= (uint8_t*) MAP_LAST)
*(ptr + (address & 0xffff)) = Cheat.c [which1].saved_byte;
else
S9xSetByte(Cheat.c [which1].saved_byte, address);
// Unsave the address for the next call to S9xRemoveCheat.
- Cheat.c [which1].saved = FALSE;
+ Cheat.c [which1].saved = false;
}
}
-void S9xApplyCheat(uint32 which1)
+void S9xApplyCheat(uint32_t which1)
{
- uint32 address = Cheat.c [which1].address;
+ uint32_t address = Cheat.c [which1].address;
if (!Cheat.c [which1].saved)
Cheat.c [which1].saved_byte = S9xGetByte(address);
int block = (address >> MEMMAP_SHIFT) & MEMMAP_MASK;
- uint8* ptr = Memory.Map [block];
+ uint8_t* ptr = Memory.Map [block];
- if (ptr >= (uint8*) MAP_LAST)
+ if (ptr >= (uint8_t*) MAP_LAST)
*(ptr + (address & 0xffff)) = Cheat.c [which1].byte;
else
S9xSetByte(Cheat.c [which1].byte, address);
- Cheat.c [which1].saved = TRUE;
+ Cheat.c [which1].saved = true;
}
void S9xApplyCheats()
{
- uint32 i;
+ uint32_t i;
if (Settings.ApplyCheats)
{
for (i = 0; i < Cheat.num_cheats; i++)
@@ -210,21 +210,21 @@ void S9xApplyCheats()
void S9xRemoveCheats()
{
- uint32 i;
+ uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
if (Cheat.c [i].enabled)
S9xRemoveCheat(i);
}
-bool8 S9xLoadCheatFile(const char* filename)
+bool S9xLoadCheatFile(const char* filename)
{
Cheat.num_cheats = 0;
FILE* fs = fopen(filename, "rb");
- uint8 data [8 + MAX_SFCCHEAT_NAME];
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
if (!fs)
- return (FALSE);
+ return (false);
while (fread((void*) data, 1, 8 + MAX_SFCCHEAT_NAME,
fs) == 8 + MAX_SFCCHEAT_NAME)
@@ -232,7 +232,7 @@ bool8 S9xLoadCheatFile(const char* filename)
if (data[6] != 254 || data[7] != 252)
{
fclose(fs);
- return (FALSE);
+ return (false);
}
Cheat.c [Cheat.num_cheats].enabled = (data [0] & 4) == 0;
Cheat.c [Cheat.num_cheats].byte = data [1];
@@ -245,24 +245,24 @@ bool8 S9xLoadCheatFile(const char* filename)
}
fclose(fs);
- return (TRUE);
+ return (true);
}
-bool8 S9xSaveCheatFile(const char* filename)
+bool S9xSaveCheatFile(const char* filename)
{
if (Cheat.num_cheats == 0)
{
(void) remove(filename);
- return (TRUE);
+ return (true);
}
FILE* fs = fopen(filename, "wb");
- uint8 data [8 + MAX_SFCCHEAT_NAME];
+ uint8_t data [8 + MAX_SFCCHEAT_NAME];
if (!fs)
- return (FALSE);
+ return (false);
- uint32 i;
+ uint32_t i;
for (i = 0; i < Cheat.num_cheats; i++)
{
memset(data, 0, 8 + MAX_SFCCHEAT_NAME);
@@ -275,21 +275,21 @@ bool8 S9xSaveCheatFile(const char* filename)
data [0] |= 8;
data [1] = Cheat.c [i].byte;
- data [2] = (uint8) Cheat.c [i].address;
- data [3] = (uint8)(Cheat.c [i].address >> 8);
- data [4] = (uint8)(Cheat.c [i].address >> 16);
+ data [2] = (uint8_t) Cheat.c [i].address;
+ data [3] = (uint8_t)(Cheat.c [i].address >> 8);
+ data [4] = (uint8_t)(Cheat.c [i].address >> 16);
data [5] = Cheat.c [i].saved_byte;
memcpy(&data [8], Cheat.c [i].name, MAX_SFCCHEAT_NAME - 1);
if (fwrite(data, 8 + MAX_SFCCHEAT_NAME, 1, fs) != 1)
{
fclose(fs);
- return (FALSE);
+ return (false);
}
}
fclose(fs);
- return (TRUE);
+ return (true);
}
#endif