aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authoraliaspider2014-10-29 10:11:16 +0100
committeraliaspider2014-10-29 10:11:16 +0100
commit4fb67d24cdde1e085d09a699ed2f5d68c306f534 (patch)
tree92fbe54e835ca1c799f15b250241929681a26a99 /source
parent9c8d36087b5b35c35c7ff9276a15d400ce45f519 (diff)
downloadsnesemu-4fb67d24cdde1e085d09a699ed2f5d68c306f534.tar.gz
snesemu-4fb67d24cdde1e085d09a699ed2f5d68c306f534.tar.bz2
snesemu-4fb67d24cdde1e085d09a699ed2f5d68c306f534.zip
get rid of all remaining C++ code.
Diffstat (limited to 'source')
-rw-r--r--source/65c816.h4
-rw-r--r--source/apu.h14
-rw-r--r--source/cheats2.c2
-rw-r--r--source/cpuexec.h24
-rw-r--r--source/cpuops.c12
-rw-r--r--source/dsp1.h6
-rw-r--r--source/gfx.h4
-rw-r--r--source/globals.c22
-rw-r--r--source/port.h10
-rw-r--r--source/sa1.h22
-rw-r--r--source/snaporig.c6
-rw-r--r--source/snapshot.c127
-rw-r--r--source/snes9x.h28
-rw-r--r--source/soundux.c26
-rw-r--r--source/spc700.h4
-rw-r--r--source/spc7110.c47
-rw-r--r--source/srtc.c24
-rw-r--r--source/tile.c94
-rw-r--r--source/tile.h12
19 files changed, 255 insertions, 233 deletions
diff --git a/source/65c816.h b/source/65c816.h
index 04b591c..eee60b3 100644
--- a/source/65c816.h
+++ b/source/65c816.h
@@ -154,7 +154,7 @@ typedef union
uint16 W;
} pair;
-struct SRegisters{
+typedef struct {
uint8 PB;
uint8 DB;
pair P;
@@ -164,7 +164,7 @@ struct SRegisters{
pair X;
pair Y;
uint16 PC;
-};
+}SRegisters;
#endif
diff --git a/source/apu.h b/source/apu.h
index 7cce703..847a2a8 100644
--- a/source/apu.h
+++ b/source/apu.h
@@ -92,10 +92,10 @@
#include "spc700.h"
-struct SIAPU
+typedef struct
{
uint8 *PC;
- struct SAPURegisters Registers;
+ SAPURegisters Registers;
uint8 *RAM;
uint8 *DirectPage;
bool8 APUExecuting;
@@ -111,9 +111,9 @@ struct SIAPU
uint32 Scanline;
int32 OneCycle;
int32 TwoCycles;
-};
+}SIAPU;
-struct SAPU
+typedef struct
{
int32 Cycles;
bool8 ShowROM;
@@ -126,10 +126,10 @@ struct SAPU
uint16 TimerTarget [3];
bool8 TimerEnabled [3];
bool8 TimerValueWritten [3];
-};
+}SAPU;
-struct SAPU APU;
-struct SIAPU IAPU;
+SAPU APU;
+SIAPU IAPU;
extern int spc_is_dumping;
extern int spc_is_dumping_temp;
extern uint8 spc_dump_dsp[0x100];
diff --git a/source/cheats2.c b/source/cheats2.c
index d45e229..845918d 100644
--- a/source/cheats2.c
+++ b/source/cheats2.c
@@ -98,7 +98,7 @@ extern SCheatData Cheat;
void S9xInitCheatData ()
{
Cheat.RAM = Memory.RAM;
- Cheat.SRAM = SRAM;
+ Cheat.SRAM = Memory.SRAM;
Cheat.FillRAM = Memory.FillRAM;
}
diff --git a/source/cpuexec.h b/source/cpuexec.h
index 67ac5a9..346b90e 100644
--- a/source/cpuexec.h
+++ b/source/cpuexec.h
@@ -101,19 +101,19 @@
if (CPU.Cycles >= CPU.NextEvent) \
S9xDoHBlankProcessing_NoSFX ();
-struct SOpcodes {
+typedef struct {
#ifdef __WIN32__
void (__cdecl *S9xOpcode)( void);
#else
void (*S9xOpcode)( void);
#endif
-};
+}SOpcodes;
-struct SICPU
+typedef struct
{
uint8 *Speed;
- struct SOpcodes *S9xOpcodes;
- struct SRegisters Registers;
+ SOpcodes *S9xOpcodes;
+ SRegisters Registers;
uint8 _Carry;
uint8 _Zero;
uint8 _Negative;
@@ -124,7 +124,7 @@ struct SICPU
uint32 Frame;
uint32 Scanline;
uint32 FrameAdvanceCount;
-};
+}SICPU;
void S9xMainLoop (void);
void S9xReset (void);
@@ -134,13 +134,13 @@ void S9xDoHBlankProcessing_NoSFX ();
void S9xClearIRQ (uint32);
void S9xSetIRQ (uint32);
-extern struct SOpcodes S9xOpcodesE1 [256];
-extern struct SOpcodes S9xOpcodesM1X1 [256];
-extern struct SOpcodes S9xOpcodesM1X0 [256];
-extern struct SOpcodes S9xOpcodesM0X1 [256];
-extern struct SOpcodes S9xOpcodesM0X0 [256];
+extern SOpcodes S9xOpcodesE1 [256];
+extern SOpcodes S9xOpcodesM1X1 [256];
+extern SOpcodes S9xOpcodesM1X0 [256];
+extern SOpcodes S9xOpcodesM0X1 [256];
+extern SOpcodes S9xOpcodesM0X0 [256];
-extern struct SICPU ICPU;
+extern SICPU ICPU;
STATIC inline void S9xUnpackStatus()
{
diff --git a/source/cpuops.c b/source/cpuops.c
index 445c439..14a627f 100644
--- a/source/cpuops.c
+++ b/source/cpuops.c
@@ -3362,7 +3362,7 @@ static void Op0CM0 (void)
#ifdef CPU_SHUTDOWN
#ifndef SA1_OPCODES
-inline void CPUShutdown()
+static inline void CPUShutdown()
{
if (Settings.Shutdown && CPU.PC == CPU.WaitAddress)
{
@@ -5025,7 +5025,7 @@ static void Op42 (void)
/*****************************************************************************/
/* CPU-S9xOpcodes Definitions */
/*****************************************************************************/
-struct SOpcodes S9xOpcodesM1X1[256] =
+SOpcodes S9xOpcodesM1X1[256] =
{
{Op00}, {Op01M1}, {Op02}, {Op03M1}, {Op04M1},
{Op05M1}, {Op06M1}, {Op07M1}, {Op08}, {Op09M1},
@@ -5081,7 +5081,7 @@ struct SOpcodes S9xOpcodesM1X1[256] =
{OpFFM1}
};
-struct SOpcodes S9xOpcodesE1[256] =
+SOpcodes S9xOpcodesE1[256] =
{
{Op00}, {Op01M1}, {Op02}, {Op03M1}, {Op04M1},
{Op05M1}, {Op06M1}, {Op07M1}, {Op08E1}, {Op09M1},
@@ -5137,7 +5137,7 @@ struct SOpcodes S9xOpcodesE1[256] =
{OpFFM1}
};
-struct SOpcodes S9xOpcodesM1X0[256] =
+SOpcodes S9xOpcodesM1X0[256] =
{
{Op00}, {Op01M1}, {Op02}, {Op03M1}, {Op04M1},
{Op05M1}, {Op06M1}, {Op07M1}, {Op08}, {Op09M1},
@@ -5193,7 +5193,7 @@ struct SOpcodes S9xOpcodesM1X0[256] =
{OpFFM1}
};
-struct SOpcodes S9xOpcodesM0X0[256] =
+SOpcodes S9xOpcodesM0X0[256] =
{
{Op00}, {Op01M0}, {Op02}, {Op03M0}, {Op04M0},
{Op05M0}, {Op06M0}, {Op07M0}, {Op08}, {Op09M0},
@@ -5249,7 +5249,7 @@ struct SOpcodes S9xOpcodesM0X0[256] =
{OpFFM0}
};
-struct SOpcodes S9xOpcodesM0X1[256] =
+SOpcodes S9xOpcodesM0X1[256] =
{
{Op00}, {Op01M0}, {Op02}, {Op03M0}, {Op04M0},
{Op05M0}, {Op06M0}, {Op07M0}, {Op08}, {Op09M0},
diff --git a/source/dsp1.h b/source/dsp1.h
index 05a706b..a2c5f1b 100644
--- a/source/dsp1.h
+++ b/source/dsp1.h
@@ -105,7 +105,7 @@ uint8 DSP3GetByte(uint16 address);
void DSP4SetByte(uint8 byte, uint16 address);
uint8 DSP4GetByte(uint16 address);
-struct SDSP1 {
+typedef struct{
bool8 waiting4command;
bool8 first_parameter;
uint8 command;
@@ -116,12 +116,12 @@ struct SDSP1 {
uint8 parameters [512];
//output was 512 for DSP-2 work, updated to reflect current thinking on DSP-3
uint8 output [512];
-};
+}SDSP1;
void S9xResetDSP1 ();
uint8 S9xGetDSP (uint16 Address);
void S9xSetDSP (uint8 Byte, uint16 Address);
-extern struct SDSP1 DSP1;
+extern SDSP1 DSP1;
//extern struct SDSP1 DSP1;
diff --git a/source/gfx.h b/source/gfx.h
index 1b545f7..8280987 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -245,9 +245,9 @@ GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
((C1) & (C2) & RGB_LOW_BITS_MASK)]
#else
-inline uint16 COLOR_ADD (uint16, uint16);
+static inline uint16 COLOR_ADD (uint16, uint16);
-inline uint16 COLOR_ADD (uint16 C1, uint16 C2)
+static inline uint16 COLOR_ADD (uint16 C1, uint16 C2)
{
if (C1 == 0)
return C2;
diff --git a/source/globals.c b/source/globals.c
index 5fb7051..3a4dc4b 100644
--- a/source/globals.c
+++ b/source/globals.c
@@ -106,19 +106,19 @@ char String[513];
struct Missing missing;
-struct SICPU ICPU;
+SICPU ICPU;
-struct SCPUState CPU;
+SCPUState CPU;
-struct SAPU APU;
+SAPU APU;
-struct SIAPU IAPU;
+SIAPU IAPU;
-struct SSettings Settings;
+SSettings Settings;
-struct SDSP1 DSP1;
+SDSP1 DSP1;
-struct SSA1 SA1;
+SSA1 SA1;
SSoundData SoundData;
@@ -127,16 +127,16 @@ SnesModel M2SNES={2,4,3};
SnesModel* Model=&M1SNES;
-uint8 *SRAM = NULL;
-uint8 *ROM = NULL;
-uint8 *RegRAM = NULL;
+uint8 *SRAM_g = NULL;
+uint8 *ROM_g = NULL;
+uint8 *RegRAM_g = NULL;
uint8 *C4RAM = NULL;
long OpAddress = 0;
CMemory Memory;
-struct SSNESGameFixes SNESGameFixes;
+SSNESGameFixes SNESGameFixes;
uint8 OpenBus = 0;
diff --git a/source/port.h b/source/port.h
index 9583a74..2ddab20 100644
--- a/source/port.h
+++ b/source/port.h
@@ -288,5 +288,15 @@ void MixSound(void);
#define STATIC static
#endif
+#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
+/* Hack applied for MSVC when compiling in C89 mode
+ * as it isn't C99-compliant. */
+#define bool unsigned char
+#define true 1
+#define false 0
+#else
+#include <stdbool.h>
+#endif
+
#endif
diff --git a/source/sa1.h b/source/sa1.h
index a58cd2c..fffb3b1 100644
--- a/source/sa1.h
+++ b/source/sa1.h
@@ -93,7 +93,7 @@
#include "memmap.h"
#include "cpuexec.h"
-struct SSA1Registers {
+typedef struct {
uint8 PB;
uint8 DB;
pair P;
@@ -103,10 +103,10 @@ struct SSA1Registers {
pair X;
pair Y;
uint16 PC;
-};
+}SSA1Registers;
-struct SSA1 {
- struct SOpcodes *S9xOpcodes;
+typedef struct{
+ SOpcodes *S9xOpcodes;
uint8 _Carry;
uint8 _Zero;
uint8 _Negative;
@@ -142,8 +142,8 @@ struct SSA1 {
uint8 VirtualBitmapFormat;
bool8 in_char_dma;
uint8 variable_bit_pos;
- struct SSA1Registers Registers;
-};
+ SSA1Registers Registers;
+}SSA1;
#define SA1CheckZero() (SA1._Zero == 0)
#define SA1CheckCarry() (SA1._Carry)
@@ -168,11 +168,11 @@ void S9xSA1SetPCBase (uint32);
uint8 S9xGetSA1 (uint32);
void S9xSetSA1 (uint8, uint32);
-extern struct SOpcodes S9xSA1OpcodesM1X1 [256];
-extern struct SOpcodes S9xSA1OpcodesM1X0 [256];
-extern struct SOpcodes S9xSA1OpcodesM0X1 [256];
-extern struct SOpcodes S9xSA1OpcodesM0X0 [256];
-extern struct SSA1 SA1;
+extern SOpcodes S9xSA1OpcodesM1X1 [256];
+extern SOpcodes S9xSA1OpcodesM1X0 [256];
+extern SOpcodes S9xSA1OpcodesM0X1 [256];
+extern SOpcodes S9xSA1OpcodesM0X0 [256];
+extern SSA1 SA1;
void S9xSA1MainLoop ();
void S9xSA1Init ();
diff --git a/source/snaporig.c b/source/snaporig.c
index 2c77818..fbea9c7 100644
--- a/source/snaporig.c
+++ b/source/snaporig.c
@@ -230,7 +230,7 @@ static int ReadOrigSnapshot (STREAM snap)
if ((result = ReadBlock ("REG:", &OrigRegisters, sizeof (OrigRegisters), snap)) != SUCCESS)
return (result);
- ICPU.Registers = *(struct SRegisters *) &OrigRegisters;
+ ICPU.Registers = *(SRegisters *) &OrigRegisters;
if ((result = ReadBlock ("PPU:", &OrigPPU, sizeof (OrigPPU), snap)) != SUCCESS)
return (result);
@@ -376,12 +376,12 @@ static int ReadOrigSnapshot (STREAM snap)
return (result);
if (ReadBlock ("APU:", &OrigAPU, sizeof (OrigAPU), snap) == SUCCESS)
{
- APU = *(struct SAPU *) &OrigAPU;
+ APU = *(SAPU *) &OrigAPU;
if ((result = ReadBlock ("ARE:", &OrigAPURegisters,
sizeof (OrigAPURegisters), snap)) != SUCCESS)
return (result);
- IAPU.Registers = *(struct SAPURegisters *) &OrigAPURegisters;
+ IAPU.Registers = *(SAPURegisters *) &OrigAPURegisters;
if ((result = ReadBlock ("ARA:", IAPU.RAM, 0x10000, snap)) != SUCCESS)
return (result);
if ((result = ReadBlock ("SOU:", &OrigSoundData,
diff --git a/source/snapshot.c b/source/snapshot.c
index 0cc5a9a..df64a1c 100644
--- a/source/snapshot.c
+++ b/source/snapshot.c
@@ -139,20 +139,20 @@ enum {
#define COUNT(ARRAY) (sizeof (ARRAY) / sizeof (ARRAY[0]))
-struct SnapshotMovieInfo
+typedef struct
{
uint32 MovieInputDataSize;
-};
+}SnapshotMovieInfo;
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SnapshotMovieInfo *)
+#define OFFSET(f) Offset(f,SnapshotMovieInfo *)
static FreezeData SnapMovie [] = {
{OFFSET (MovieInputDataSize), 4, INT_V},
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SCPUState *)
+#define OFFSET(f) Offset(f,SCPUState *)
static FreezeData SnapCPU [] = {
{OFFSET (Flags), 4, INT_V},
@@ -170,7 +170,7 @@ static FreezeData SnapCPU [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SRegisters *)
+#define OFFSET(f) Offset(f,SRegisters *)
static FreezeData SnapRegisters [] = {
{OFFSET (PB), 1, INT_V},
@@ -185,7 +185,7 @@ static FreezeData SnapRegisters [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SPPU *)
+#define OFFSET(f) Offset(f,SPPU *)
static FreezeData SnapPPU [] = {
{OFFSET (BGMode), 1, INT_V},
@@ -318,32 +318,32 @@ static FreezeData SnapPPU [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SDMA *)
+#define OFFSET(f) Offset(f,SDMA *)
static FreezeData SnapDMA [] = {
#define O(N) \
- {OFFSET (TransferDirection) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (AAddressFixed) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (AAddressDecrement) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (TransferMode) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (ABank) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (AAddress) + N * sizeof (struct SDMA), 2, INT_V}, \
- {OFFSET (Address) + N * sizeof (struct SDMA), 2, INT_V}, \
- {OFFSET (BAddress) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (TransferBytes) + N * sizeof (struct SDMA), 2, INT_V}, \
- {OFFSET (HDMAIndirectAddressing) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (IndirectAddress) + N * sizeof (struct SDMA), 2, INT_V}, \
- {OFFSET (IndirectBank) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (Repeat) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (LineCount) + N * sizeof (struct SDMA), 1, INT_V}, \
- {OFFSET (FirstLine) + N * sizeof (struct SDMA), 1, INT_V}
+ {OFFSET (TransferDirection) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (AAddressFixed) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (AAddressDecrement) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (TransferMode) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (ABank) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (AAddress) + N * sizeof (SDMA), 2, INT_V}, \
+ {OFFSET (Address) + N * sizeof (SDMA), 2, INT_V}, \
+ {OFFSET (BAddress) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (TransferBytes) + N * sizeof (SDMA), 2, INT_V}, \
+ {OFFSET (HDMAIndirectAddressing) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (IndirectAddress) + N * sizeof (SDMA), 2, INT_V}, \
+ {OFFSET (IndirectBank) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (Repeat) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (LineCount) + N * sizeof (SDMA), 1, INT_V}, \
+ {OFFSET (FirstLine) + N * sizeof (SDMA), 1, INT_V}
O(0), O(1), O(2), O(3), O(4), O(5), O(6), O(7)
#undef O
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SAPU *)
+#define OFFSET(f) Offset(f, SAPU *)
static FreezeData SnapAPU [] = {
{OFFSET (Cycles), 4, INT_V},
@@ -360,7 +360,7 @@ static FreezeData SnapAPU [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SAPURegisters *)
+#define OFFSET(f) Offset(f, SAPURegisters *)
static FreezeData SnapAPURegisters [] = {
{OFFSET (P), 1, INT_V},
@@ -421,7 +421,7 @@ static FreezeData SnapSoundData [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SSA1Registers *)
+#define OFFSET(f) Offset(f,SSA1Registers *)
static FreezeData SnapSA1Registers [] = {
{OFFSET (PB), 1, INT_V},
@@ -436,7 +436,7 @@ static FreezeData SnapSA1Registers [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SSA1 *)
+#define OFFSET(f) Offset(f,SSA1 *)
static FreezeData SnapSA1 [] = {
{OFFSET (Flags), 4, INT_V},
@@ -451,7 +451,7 @@ static FreezeData SnapSA1 [] = {
};
#undef OFFSET
-#define OFFSET(f) Offset(f,struct SPC7110EmuVars *)
+#define OFFSET(f) Offset(f,SPC7110Regs *)
static FreezeData SnapSPC7110 [] = {
{OFFSET (reg4800), 1, INT_V},
@@ -660,7 +660,7 @@ void S9xFreezeToStream (STREAM stream)
// RAM and VRAM
FreezeBlock (stream, "VRA", Memory.VRAM, 0x10000);
FreezeBlock (stream, "RAM", Memory.RAM, 0x20000);
- FreezeBlock (stream, "SRA", ::SRAM, 0x20000);
+ FreezeBlock (stream, "SRA", SRAM_g, 0x20000);
FreezeBlock (stream, "FIL", Memory.FillRAM, 0x8000);
if (Settings.APUEnabled)
{
@@ -803,7 +803,7 @@ int S9xUnfreezeFromStream (STREAM stream)
UnfreezeStructFromCopy (DMA, SnapDMA, COUNT (SnapDMA), local_dma);
memcpy (Memory.VRAM, local_vram, 0x10000);
memcpy (Memory.RAM, local_ram, 0x20000);
- memcpy (::SRAM, local_sram, 0x20000);
+ memcpy (SRAM_g, local_sram, 0x20000);
memcpy (Memory.FillRAM, local_fillram, 0x8000);
if(local_apu)
{
@@ -826,7 +826,7 @@ int S9xUnfreezeFromStream (STREAM stream)
UnfreezeStructFromCopy (&rtc_f9, SnapS7RTC, COUNT (SnapS7RTC), local_spc_rtc);
}
- Memory.FixROMSpeed ();
+ FixROMSpeed ();
CPU.Flags |= old_flags & (DEBUG_MODE_FLAG | TRACE_FLAG |
SINGLE_STEP_FLAG | FRAME_ADVANCE_FLAG);
@@ -895,23 +895,23 @@ int S9xUnfreezeFromStream (STREAM stream)
S9xSDD1PostLoadState ();
}
- if (local_cpu) delete [] local_cpu;
- if (local_registers) delete [] local_registers;
- if (local_ppu) delete [] local_ppu;
- if (local_dma) delete [] local_dma;
- if (local_vram) delete [] local_vram;
- if (local_ram) delete [] local_ram;
- if (local_sram) delete [] local_sram;
- if (local_fillram) delete [] local_fillram;
- if (local_apu) delete [] local_apu;
- if (local_apu_registers) delete [] local_apu_registers;
- if (local_apu_ram) delete [] local_apu_ram;
- if (local_apu_sounddata) delete [] local_apu_sounddata;
- if (local_sa1) delete [] local_sa1;
- if (local_sa1_registers) delete [] local_sa1_registers;
- if (local_spc) delete [] local_spc;
- if (local_spc_rtc) delete [] local_spc_rtc;
- if (local_movie_data) delete [] local_movie_data;
+ if (local_cpu) free(local_cpu);
+ if (local_registers) free(local_registers);
+ if (local_ppu) free(local_ppu);
+ if (local_dma) free(local_dma);
+ if (local_vram) free(local_vram);
+ if (local_ram) free(local_ram);
+ if (local_sram) free(local_sram);
+ if (local_fillram) free(local_fillram);
+ if (local_apu) free(local_apu);
+ if (local_apu_registers) free(local_apu_registers);
+ if (local_apu_ram) free(local_apu_ram);
+ if (local_apu_sounddata) free(local_apu_sounddata);
+ if (local_sa1) free(local_sa1);
+ if (local_sa1_registers) free(local_sa1_registers);
+ if (local_spc) free(local_spc);
+ if (local_spc_rtc) free(local_spc_rtc);
+ if (local_movie_data) free(local_movie_data);
return (result);
}
@@ -945,7 +945,7 @@ void FreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fiel
fields [i].type);
}
- uint8 *block = new uint8 [len];
+ uint8 *block = (uint8*) malloc(len);
uint8 *ptr = block;
uint16 word;
uint32 dword;
@@ -1014,7 +1014,7 @@ void FreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fiel
}
FreezeBlock (stream, name, block, len);
- delete[] block;
+ free(block);
}
void FreezeBlock (STREAM stream, const char *name, uint8 *block, int size)
@@ -1042,7 +1042,7 @@ int UnfreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fie
fields [i].type);
}
- uint8 *block = new uint8 [len];
+ uint8 *block = (uint8*) malloc(len);
uint8 *ptr = block;
uint16 word;
uint32 dword;
@@ -1051,7 +1051,7 @@ int UnfreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fie
if ((result = UnfreezeBlock (stream, name, block, len)) != SUCCESS)
{
- delete block;
+ free(block);
return (result);
}
@@ -1117,7 +1117,7 @@ int UnfreezeStruct (STREAM stream, const char *name, void *base, FreezeData *fie
}
}
- delete [] block;
+ free(block);
return (result);
}
@@ -1147,9 +1147,9 @@ int UnfreezeBlock (STREAM stream, const char *name, uint8 *block, int size)
}
if (rem)
{
- char *junk = new char [rem];
+ char *junk = (char*) malloc(rem);
READ_STREAM (junk, rem, stream);
- delete [] junk;
+ free(junk);
}
return (SUCCESS);
@@ -1246,12 +1246,12 @@ void UnfreezeStructFromCopy (void *base, FreezeData *fields, int num_fields, uin
int UnfreezeBlockCopy (STREAM stream, const char *name, uint8** block, int size)
{
- *block = new uint8 [size];
+ *block = (uint8*) malloc(size);
int result;
if ((result = UnfreezeBlock (stream, name, *block, size)) != SUCCESS)
{
- delete [] (*block);
+ free((*block));
*block = NULL;
return (result);
}
@@ -1585,7 +1585,7 @@ bool8 S9xUnfreezeZSNES (const char *filename)
if (Settings.SuperFX)
{
- fread (::SRAM, 1, 64 * 1024, fs);
+ fread (SRAM_g, 1, 64 * 1024, fs);
fseek (fs, 64 * 1024, SEEK_CUR);
fread (Memory.FillRAM + 0x7000, 1, 692, fs);
}
@@ -1617,7 +1617,7 @@ bool8 S9xUnfreezeZSNES (const char *filename)
// DS2 DMA notes: This code path is not used [Neb]
memcpy (&Memory.FillRAM [0x3000], t + 692, 2 * 1024);
- fread (::SRAM, 1, 64 * 1024, fs);
+ fread (SRAM_g, 1, 64 * 1024, fs);
fseek (fs, 64 * 1024, SEEK_CUR);
S9xFixSA1AfterSnapshotLoad ();
}
@@ -1747,12 +1747,15 @@ fread(&temp, 1, 4, fs);
s7r.reg4809=temp&(0x0FF);
s7r.reg480A=(temp>>8)&(0x0FF);
//NEWSYM SPCCompCommand, dd 0 480B
-fread(&temp, 1, 4, fs);
+ fread(&temp, 1, 4, fs);
s7r.reg480B=temp&(0x0FF);
//NEWSYM SPCCheckFix, dd 0 written(if 1, then set writtne to max value!)
-fread(&temp, 1, 4, fs);
-(temp&(0x0FF))?s7r.written=0x1F:s7r.written=0x00;
+ fread(&temp, 1, 4, fs);
+ if (temp&(0x0FF))
+ s7r.written=0x1F;
+ else
+ s7r.written=0x00;
//NEWSYM SPCSignedVal, dd 0 482E
fread(&temp, 1, 4, fs);
@@ -1761,7 +1764,7 @@ fread(&temp, 1, 4, fs);
}
fclose (fs);
- Memory.FixROMSpeed ();
+ FixROMSpeed ();
IPPU.ColorsChanged = TRUE;
IPPU.OBJChanged = TRUE;
CPU.InDMA = FALSE;
diff --git a/source/snes9x.h b/source/snes9x.h
index 1747389..5590349 100644
--- a/source/snes9x.h
+++ b/source/snes9x.h
@@ -95,16 +95,6 @@
#include <stdlib.h>
#include <stdint.h>
-#if defined(_MSC_VER) && !defined(SN_TARGET_PS3)
-/* Hack applied for MSVC when compiling in C89 mode
- * as it isn't C99-compliant. */
-#define bool unsigned char
-#define true 1
-#define false 0
-#else
-#include <stdbool.h>
-#endif
-
//#include "fs_api.h"
//#include "ds2_malloc.h"
@@ -219,7 +209,7 @@ enum {
#define DELAYED_NMI_FLAG2 (1 << 10)
#define IRQ_PENDING_FLAG (1 << 11)
-struct SCPUState{
+typedef struct {
uint32 Flags;
bool8 BranchSkip;
bool8 NMIActive;
@@ -248,7 +238,7 @@ struct SCPUState{
#ifdef DEBUG_MAXCOUNT
unsigned long GlobalLoopCount;
#endif
-};
+}SCPUState;
#define HBLANK_START_EVENT 0
#define HBLANK_END_EVENT 1
@@ -256,7 +246,7 @@ struct SCPUState{
#define HTIMER_AFTER_EVENT 3
#define NO_EVENT 4
-struct SSettings{
+typedef struct {
/* CPU options */
bool8 APUEnabled;
bool8 Shutdown;
@@ -384,9 +374,9 @@ struct SSettings{
#ifdef DEBUG_MAXCOUNT
unsigned int MaxCount;
#endif
-};
+}SSettings;
-struct SSNESGameFixes
+typedef struct
{
uint8 alienVSpredetorFix;
uint8 APU_OutPorts_ReturnValueFix;
@@ -394,11 +384,11 @@ struct SSNESGameFixes
uint8 SRAMInitialValue;
uint8 Uniracers;
bool8 EchoOnlyOutput;
-};
+}SSNESGameFixes;
-extern struct SSettings Settings;
-extern struct SCPUState CPU;
-extern struct SSNESGameFixes SNESGameFixes;
+extern SSettings Settings;
+extern SCPUState CPU;
+extern SSNESGameFixes SNESGameFixes;
extern char String [513];
void S9xExit ();
diff --git a/source/soundux.c b/source/soundux.c
index 7e69c4d..e021381 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -298,7 +298,8 @@ void S9xSetEchoEnable (uint8 byte)
}
SoundData.echo_enable = byte;
- for (int i = 0; i < NUM_CHANNELS; i++)
+ int i;
+ for (i = 0; i < NUM_CHANNELS; i++)
{
if (byte & (1 << i))
SoundData.channels [i].echo_buf_ptr = EchoBuffer;
@@ -362,7 +363,8 @@ void S9xFixSoundAfterSnapshotLoad ()
S9xSetFilterCoefficient (5, (signed char) APU.DSP [APU_C5]);
S9xSetFilterCoefficient (6, (signed char) APU.DSP [APU_C6]);
S9xSetFilterCoefficient (7, (signed char) APU.DSP [APU_C7]);
- for (int i = 0; i < 8; i++)
+ int i;
+ for (i = 0; i < 8; i++)
{
SoundData.channels[i].needs_decode = TRUE;
S9xSetSoundFrequency (i, SoundData.channels[i].hertz);
@@ -447,7 +449,7 @@ int S9xGetEnvelopeHeight (int channel)
}
#if 1
-void S9xSetSoundSample (int, uint16)
+void S9xSetSoundSample (int channel, uint16 sample_number)
{
}
#else
@@ -832,7 +834,8 @@ void DecodeBlock (Channel *ch)
sample1 >>= 4;
if (invalid_header) { sample1>>=3; sample2>>=3; }
- for (int nybblesmp = 0; nybblesmp<2; nybblesmp++){
+ int nybblesmp;
+ for (nybblesmp = 0; nybblesmp<2; nybblesmp++){
out=(((nybblesmp) ? sample2 : sample1) << shift);
out >>= 1;
@@ -1013,7 +1016,8 @@ void DecodeBlock (Channel *ch)
sample1 >>= 4;
if (invalid_header) { sample1>>=3; sample2>>=3; }
- for (int nybblesmp = 0; nybblesmp<2; nybblesmp++){
+ int nybblesmp;
+ for (nybblesmp = 0; nybblesmp<2; nybblesmp++){
out=(((nybblesmp) ? sample2 : sample1) << shift);
out >>= 1;
@@ -1057,7 +1061,8 @@ static inline void MixStereo (int sample_count)
int pitch_mod = SoundData.pitch_mod & ~APU.DSP[APU_NON];
- for (uint32 J = 0; J < NUM_CHANNELS; J++)
+ uint32 J;
+ for (J = 0; J < NUM_CHANNELS; J++)
{
Channel *ch = &SoundData.channels[J];
@@ -1093,7 +1098,8 @@ static inline void MixStereo (int sample_count)
VL = (ch->sample * ch-> left_vol_level) / 128;
VR = (ch->sample * ch->right_vol_level) / 128;
- for (uint32 I = 0; I < (uint32) sample_count; I += 2)
+ uint32 I;
+ for (I = 0; I < (uint32) sample_count; I += 2)
{
unsigned long freq = freq0;
@@ -1463,7 +1469,8 @@ END_OF_FUNCTION(S9xMixSamples);
void S9xResetSound (bool8 full)
{
- for (int i = 0; i < 8; i++)
+ int i;
+ for (i = 0; i < 8; i++)
{
SoundData.channels[i].state = SOUND_SILENT;
SoundData.channels[i].mode = MODE_NONE;
@@ -1534,7 +1541,8 @@ void S9xSetPlaybackRate (uint32 playback_rate)
so.playback_rate = playback_rate;
so.err_rate = (uint32) (SNES_SCANLINE_TIME * FIXED_POINT / (1.0 / (double) so.playback_rate));
S9xSetEchoDelay (APU.DSP [APU_EDL] & 0xf);
- for (int i = 0; i < 8; i++)
+ int i;
+ for (i = 0; i < 8; i++)
S9xSetSoundFrequency (i, SoundData.channels [i].hertz);
}
diff --git a/source/spc700.h b/source/spc700.h
index b38c814..9500183 100644
--- a/source/spc700.h
+++ b/source/spc700.h
@@ -141,13 +141,13 @@ typedef union
uint16 W;
} YAndA;
-struct SAPURegisters{
+typedef struct{
uint8 P;
YAndA YA;
uint8 X;
uint8 S;
uint16 PC;
-};
+}SAPURegisters;
// Needed by ILLUSION OF GAIA
//#define ONE_APU_CYCLE 14
diff --git a/source/spc7110.c b/source/spc7110.c
index f296fc2..b9fa722 100644
--- a/source/spc7110.c
+++ b/source/spc7110.c
@@ -252,7 +252,7 @@ void MovePackData()
s7r.AlignBy=0;
else
{
- switch(ROM[j])
+ switch(Memory.ROM[j])
{
case 0x03:
s7r.AlignBy=8;
@@ -343,7 +343,7 @@ void ReadPackData()
s7r.AlignBy=0;
else
{
- switch(ROM[j])
+ switch(Memory.ROM[j])
{
case 0x03:
s7r.AlignBy=8;
@@ -472,7 +472,7 @@ void GetPackData()
s7r.AlignBy=0;
else
{
- switch(ROM[j])
+ switch(Memory.ROM[j])
{
case 0x03:
s7r.AlignBy=8;
@@ -622,7 +622,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
}
i+=s7r.DataRomOffset;
- uint8 tmp=ROM[i];
+ uint8 tmp=Memory.ROM[i];
i=(s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811;
if(s7r.reg4818&0x02)
@@ -760,7 +760,7 @@ uint8 S9xGetSPC7110(uint16 Address)
i%=s7r.DataRomSize;
i+=s7r.DataRomOffset;
- uint8 tmp=ROM[i];
+ uint8 tmp=Memory.ROM[i];
i=((s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811);
if(0x60==(s7r.reg4818&0x60))
{
@@ -967,7 +967,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
s7r.AlignBy=0;
else
{
- switch(ROM[j])
+ switch(Memory.ROM[j])
{
case 0x03:
s7r.AlignBy=8;
@@ -1274,7 +1274,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
//SRAM toggle
case 0x4830:
- Memory.SPC7110Sram(data);
+ SPC7110Sram(data);
s7r.reg4830=data;
break;
//Bank DX mapping
@@ -1418,7 +1418,7 @@ uint8 S9xGetSPC7110Byte(uint32 Address)
}
i+=Address&0x000FFFFF;
i+=s7r.DataRomOffset;
- return ROM[i];
+ return Memory.ROM[i];
}
/**********************************************************************************************/
@@ -1621,7 +1621,7 @@ uint8* Get7110BasePtr(uint32 Address)
default:i=0;
}
i+=Address&0x000F0000;
- return &ROM[i];
+ return &Memory.ROM[i];
}
//loads the index into memory.
@@ -1677,7 +1677,7 @@ void SPC7110Load(char* dirname)
char temp_path[PATH_MAX];
int i=0;
- decompack=new Pack7110;
+ decompack=(Pack7110*)malloc(sizeof(Pack7110));
#ifndef _XBOX
getcwd(temp_path,PATH_MAX);
@@ -1711,7 +1711,7 @@ void SPC7110Load(char* dirname)
#endif
struct stat buf;
if(-1!=stat(binname, &buf))
- decompack->binfiles[i]=new uint8[buf.st_size];
+ decompack->binfiles[i]=(uint8*)malloc(buf.st_size);
FILE* fp=fopen(binname, "rb");
if(fp)
{
@@ -1740,7 +1740,7 @@ void SPC7110Open(char* dirname)
char temp_path[PATH_MAX];
int i=0;
- decompack=new Pack7110;
+ decompack=(Pack7110*)malloc(sizeof(Pack7110));
#ifndef _XBOX
getcwd(temp_path,PATH_MAX);
@@ -1787,7 +1787,7 @@ void SPC7110Grab(char* dirname)
char temp_path[PATH_MAX];
int i=0;
- decompack=new Pack7110;
+ decompack=(Pack7110*)malloc(sizeof(Pack7110));
#ifndef _XBOX
getcwd(temp_path,PATH_MAX);
@@ -1826,7 +1826,7 @@ void SPC7110Grab(char* dirname)
if(-1!=stat(binname, &buf))
{
if(buf.st_size<buffer_size)
- decompack->binfiles[i]=new uint8[buf.st_size];
+ decompack->binfiles[i]=(uint8*)malloc(buf.st_size);
FILE* fp=fopen(binname, "rb");
//use them here
if(fp)
@@ -1880,14 +1880,14 @@ void Del7110Gfx()
{
if(decompack->binfiles[i]!=NULL)
{
- delete []decompack->binfiles[i];
+ free(decompack->binfiles[i]);
decompack->binfiles[i]=NULL;
}
}
Settings.SPC7110=false;
Settings.SPC7110RTC=false;
if(NULL!=decompack)
- delete decompack;
+ free(decompack);
decompack=NULL;
CleanUp7110=NULL;
Copy7110=NULL;
@@ -1917,7 +1917,7 @@ void Close7110Gfx()
Settings.SPC7110=false;
Settings.SPC7110RTC=false;
if(NULL!=decompack)
- delete decompack;
+ free(decompack);
decompack=NULL;
CleanUp7110=NULL;
Copy7110=NULL;
@@ -1947,7 +1947,7 @@ void Drop7110Gfx()
}
else
{
- delete []decompack->binfiles[i];
+ free(decompack->binfiles[i]);
decompack->binfiles[i]=NULL;
}
}
@@ -1955,7 +1955,7 @@ void Drop7110Gfx()
Settings.SPC7110=false;
Settings.SPC7110RTC=false;
if(NULL!=decompack)
- delete decompack;
+ free(decompack);
decompack=NULL;
CleanUp7110=NULL;
Copy7110=NULL;
@@ -2159,7 +2159,8 @@ void Do7110Logging()
int temp=0;
for(j=0;j<MAX_TABLES;j++)
{
- for(int k=0;k<256;k++)
+ int k;
+ for(k=0;k<256;k++)
{
if(decompack->tableEnts[j].location[k].used_len!=0)
entries++;
@@ -2190,7 +2191,8 @@ void Do7110Logging()
for(j=0;j<MAX_TABLES;j++)
{
- for(int k=0;k<256;k++)
+ int k;
+ for(k=0;k<256;k++)
{
if(decompack->tableEnts[j].location[k].used_len!=0)
{
@@ -2255,7 +2257,8 @@ bool8 S9xLoadSPC7110RTC (S7RTC *rtc_f9)
if((fp=fopen(S9xGetFilename(".rtc"), "rb"))==NULL)
return (FALSE);
- for (int i=0; i<16;i++)
+ int i;
+ for (i=0; i<16;i++)
{
fread(&(rtc_f9->reg[i]),1,1,fp);
}
diff --git a/source/srtc.c b/source/srtc.c
index 0e6f30e..482ce7b 100644
--- a/source/srtc.c
+++ b/source/srtc.c
@@ -523,16 +523,16 @@ void S9xSRTCPreSaveState ()
if (s > 0x20000)
s = 0x20000;
- SRAM [s + 0] = rtc.needs_init;
- SRAM [s + 1] = rtc.count_enable;
+ Memory.SRAM [s + 0] = rtc.needs_init;
+ Memory.SRAM [s + 1] = rtc.count_enable;
// memmove converted: Different mallocs [Neb]
- memcpy (&SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1);
- SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index;
- SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode;
+ memcpy (&Memory.SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1);
+ Memory.SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index;
+ Memory.SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode;
#ifdef LSB_FIRST
// memmove converted: Different mallocs [Neb]
- memcpy (&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
+ memcpy (&Memory.SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
#else
SRAM [s + 5 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 0);
SRAM [s + 6 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 8);
@@ -555,16 +555,16 @@ void S9xSRTCPostLoadState ()
if (s > 0x20000)
s = 0x20000;
- rtc.needs_init = SRAM [s + 0];
- rtc.count_enable = SRAM [s + 1];
+ rtc.needs_init = Memory.SRAM [s + 0];
+ rtc.count_enable = Memory.SRAM [s + 1];
// memmove converted: Different mallocs [Neb]
- memcpy (rtc.data, &SRAM [s + 2], MAX_RTC_INDEX + 1);
- rtc.index = SRAM [s + 3 + MAX_RTC_INDEX];
- rtc.mode = SRAM [s + 4 + MAX_RTC_INDEX];
+ memcpy (rtc.data, &Memory.SRAM [s + 2], MAX_RTC_INDEX + 1);
+ rtc.index = Memory.SRAM [s + 3 + MAX_RTC_INDEX];
+ rtc.mode = Memory.SRAM [s + 4 + MAX_RTC_INDEX];
#ifdef LSB_FIRST
// memmove converted: Different mallocs [Neb]
- memcpy (&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8);
+ memcpy (&rtc.system_timestamp, &Memory.SRAM [s + 5 + MAX_RTC_INDEX], 8);
#else
rtc.system_timestamp |= (SRAM [s + 5 + MAX_RTC_INDEX] << 0);
rtc.system_timestamp |= (SRAM [s + 6 + MAX_RTC_INDEX] << 8);
diff --git a/source/tile.c b/source/tile.c
index 3dcab74..ae9edfd 100644
--- a/source/tile.c
+++ b/source/tile.c
@@ -220,11 +220,11 @@ static uint8 ConvertTile (uint8 *pCache, uint32 TileAddr)
static void WRITE_4PIXELS16 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -236,11 +236,11 @@ static void WRITE_4PIXELS16 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
static void WRITE_4PIXELS16_FLIPPED (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -252,11 +252,11 @@ static void WRITE_4PIXELS16_FLIPPED (int32 Offset, uint8 *Pixels, uint16 *Screen
static void WRITE_4PIXELS16_HALFWIDTH (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N += 2)
+ for (N = 0; N < 4; N += 2)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -268,11 +268,11 @@ static void WRITE_4PIXELS16_HALFWIDTH (int32 Offset, uint8 *Pixels, uint16 *Scre
static void WRITE_4PIXELS16_FLIPPED_HALFWIDTH (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N += 2)
+ for (N = 0; N < 4; N += 2)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[2 - N]))
{
@@ -284,11 +284,11 @@ static void WRITE_4PIXELS16_FLIPPED_HALFWIDTH (int32 Offset, uint8 *Pixels, uint
static void WRITE_4PIXELS16x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -300,11 +300,11 @@ static void WRITE_4PIXELS16x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors
static void WRITE_4PIXELS16_FLIPPEDx2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -316,11 +316,11 @@ static void WRITE_4PIXELS16_FLIPPEDx2 (int32 Offset, uint8 *Pixels, uint16 *Scre
static void WRITE_4PIXELS16x2x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -332,11 +332,11 @@ static void WRITE_4PIXELS16x2x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColo
static void WRITE_4PIXELS16_FLIPPEDx2x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.DB + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -454,12 +454,12 @@ void DrawLargePixel16HalfWidth (uint32 Tile, int32 Offset,
static void WRITE_4PIXELS16_ADD (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -482,12 +482,12 @@ static void WRITE_4PIXELS16_ADD (int32 Offset, uint8 *Pixels, uint16 *ScreenColo
static void WRITE_4PIXELS16_FLIPPED_ADD (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -510,12 +510,12 @@ static void WRITE_4PIXELS16_FLIPPED_ADD (int32 Offset, uint8 *Pixels, uint16 *Sc
static void WRITE_4PIXELS16_ADD1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -538,12 +538,12 @@ static void WRITE_4PIXELS16_ADD1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenC
static void WRITE_4PIXELS16_FLIPPED_ADD1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -566,12 +566,12 @@ static void WRITE_4PIXELS16_FLIPPED_ADD1_2 (int32 Offset, uint8 *Pixels, uint16
static void WRITE_4PIXELS16_SUB (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -594,12 +594,12 @@ static void WRITE_4PIXELS16_SUB (int32 Offset, uint8 *Pixels, uint16 *ScreenColo
static void WRITE_4PIXELS16_FLIPPED_SUB (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -622,12 +622,12 @@ static void WRITE_4PIXELS16_FLIPPED_SUB (int32 Offset, uint8 *Pixels, uint16 *Sc
static void WRITE_4PIXELS16_SUB1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -650,12 +650,12 @@ static void WRITE_4PIXELS16_SUB1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenC
static void WRITE_4PIXELS16_FLIPPED_SUB1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint8 N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -693,7 +693,8 @@ void DrawTile16Add (uint32 Tile, int32 Offset, uint32 StartLine,
bp = pCache + StartLine;
for (l = LineCount; l != 0; l--, bp += 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- for (uint8 N = 0; N < 8; N++)
+ uint8 N;
+ for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[N]))
{
@@ -717,8 +718,9 @@ void DrawTile16Add (uint32 Tile, int32 Offset, uint32 StartLine,
case H_FLIP:
bp = pCache + StartLine;
for (l = LineCount; l != 0; l--, bp += 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
- {
- for (uint8 N = 0; N < 8; N++)
+ {
+ uint8 N;
+ for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[7 - N]))
{
@@ -743,7 +745,8 @@ void DrawTile16Add (uint32 Tile, int32 Offset, uint32 StartLine,
bp = pCache + 56 - StartLine;
for (l = LineCount; l != 0; l--, bp -= 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- for (uint8 N = 0; N < 8; N++)
+ uint8 N;
+ for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[7 - N]))
{
@@ -768,7 +771,8 @@ void DrawTile16Add (uint32 Tile, int32 Offset, uint32 StartLine,
bp = pCache + 56 - StartLine;
for (l = LineCount; l != 0; l--, bp -= 8, Screen += GFX.PPL, Depth += GFX.PPL, SubDepth += GFX.PPL)
{
- for (uint8 N = 0; N < 8; N++)
+ uint8 N;
+ for (N = 0; N < 8; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = bp[N]))
{
@@ -867,12 +871,12 @@ void DrawClippedTile16Sub1_2 (uint32 Tile, int32 Offset,
static void WRITE_4PIXELS16_ADDF1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -887,12 +891,12 @@ static void WRITE_4PIXELS16_ADDF1_2 (int32 Offset, uint8 *Pixels, uint16 *Screen
static void WRITE_4PIXELS16_FLIPPED_ADDF1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
@@ -907,12 +911,12 @@ static void WRITE_4PIXELS16_FLIPPED_ADDF1_2 (int32 Offset, uint8 *Pixels, uint16
static void WRITE_4PIXELS16_SUBF1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
{
@@ -927,12 +931,12 @@ static void WRITE_4PIXELS16_SUBF1_2 (int32 Offset, uint8 *Pixels, uint16 *Screen
static void WRITE_4PIXELS16_FLIPPED_SUBF1_2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{
- uint8 Pixel;
+ uint8 Pixel,N;
uint16 *Screen = (uint16 *) GFX.S + Offset;
uint8 *Depth = GFX.ZBuffer + Offset;
uint8 *SubDepth = GFX.SubZBuffer + Offset;
- for (uint N = 0; N < 4; N++)
+ for (N = 0; N < 4; N++)
{
if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
{
diff --git a/source/tile.h b/source/tile.h
index 73f2860..ee52e19 100644
--- a/source/tile.h
+++ b/source/tile.h
@@ -258,7 +258,8 @@
pixel = PIXEL; \
for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \
{ \
- for (int z = Pixels - 1; z >= 0; z--) \
+ int z; \
+ for (z = Pixels - 1; z >= 0; z--) \
if (GFX.Z1 > Depth [z]) \
{ \
sp [z] = FUNCTION(sp + z, pixel); \
@@ -276,7 +277,8 @@
pixel = PIXEL; \
for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \
{ \
- for (int z = Pixels - 1; z >= 0; z--) \
+ int z; \
+ for (z = Pixels - 1; z >= 0; z--) \
if (GFX.Z1 > Depth [z]) \
{ \
sp [z] = FUNCTION(sp + z, pixel); \
@@ -301,7 +303,8 @@
pixel = PIXEL; \
for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \
{ \
- for (int z = Pixels - 2; z >= 0; z -= 2) \
+ int z; \
+ for (z = Pixels - 2; z >= 0; z -= 2) \
if (GFX.Z1 > Depth [z]) \
{ \
sp [z >> 1] = FUNCTION(sp + z, pixel); \
@@ -319,7 +322,8 @@
pixel = PIXEL; \
for (l = LineCount; l != 0; l--, sp += GFX.PPL, Depth += GFX.PPL) \
{ \
- for (int z = Pixels - 2; z >= 0; z -= 2) \
+ int z; \
+ for (z = Pixels - 2; z >= 0; z -= 2) \
if (GFX.Z1 > Depth [z]) \
{ \
sp [z >> 1] = FUNCTION(sp + z, pixel); \