aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/gfx.c6
-rw-r--r--source/gfx.h6
-rw-r--r--source/memmap.c12
-rw-r--r--source/memmap.h4
-rw-r--r--source/ppu.c156
-rw-r--r--source/sdd1.c6
-rw-r--r--source/snes9x.h1
-rw-r--r--source/spc700.c22
-rw-r--r--source/spc7110.c4
9 files changed, 19 insertions, 198 deletions
diff --git a/source/gfx.c b/source/gfx.c
index 303d09f..db89ec2 100644
--- a/source/gfx.c
+++ b/source/gfx.c
@@ -254,7 +254,7 @@ void DrawLargePixel16Sub1_2(uint32 Tile, int32 Offset,
uint32 StartPixel, uint32 Pixels,
uint32 StartLine, uint32 LineCount);
-bool8 S9xGraphicsInit()
+bool8 S9xInitGFX()
{
register uint32 PixelOdd = 1;
register uint32 PixelEven = 2;
@@ -532,9 +532,9 @@ bool8 S9xGraphicsInit()
return (TRUE);
}
-void S9xGraphicsDeinit(void)
+void S9xDeinitGFX(void)
{
- // Free any memory allocated in S9xGraphicsInit
+ // Free any memory allocated in S9xInitGFX
if (GFX.X2)
{
free((char*) GFX.X2);
diff --git a/source/gfx.h b/source/gfx.h
index 0441223..5c55f64 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -105,8 +105,8 @@ void S9xBuildDirectColourMaps();
// port.
extern struct SGFX GFX;
-bool8 S9xGraphicsInit();
-void S9xGraphicsDeinit();
+bool8 S9xInitGFX();
+void S9xDeinitGFX();
bool8 S9xInitUpdate(void);
#if 0
void S9xSyncSpeed();
@@ -129,7 +129,7 @@ struct SGFX
uint8* SubZBuffer;
uint32 Pitch;
- // Setup in call to S9xGraphicsInit()
+ // Setup in call to S9xInitGFX()
int Delta;
uint16* X2;
uint16* ZERO_OR_X2;
diff --git a/source/memmap.c b/source/memmap.c
index c058002..13fcd9c 100644
--- a/source/memmap.c
+++ b/source/memmap.c
@@ -406,10 +406,10 @@ char* Safe(const char* s)
}
/**********************************************************************************************/
-/* Init() */
+/* S9xInitMemory() */
/* This function allocates and zeroes all the memory needed by the emulator */
/**********************************************************************************************/
-bool8 Init()
+bool8 S9xInitMemory()
{
// DS2 DMA notes: These would do well to be allocated with 32 extra bytes
// so they can be 32-byte aligned. [Neb]
@@ -448,7 +448,7 @@ bool8 Init()
!IPPU.TileCache [TILE_8BIT] || !IPPU.TileCached [TILE_2BIT] ||
!IPPU.TileCached [TILE_4BIT] || !IPPU.TileCached [TILE_8BIT])
{
- Deinit();
+ S9xDeinitMemory();
return (FALSE);
}
@@ -485,7 +485,7 @@ bool8 Init()
return (TRUE);
}
-void Deinit()
+void S9xDeinitMemory()
{
#ifdef __W32_HEAP
if (_HEAPOK != _heapchk())
@@ -910,7 +910,7 @@ again:
FreeSDD1Data();
InitROM(Tales);
- S9xLoadCheatFile(S9xGetFilename(".cht"));
+ S9xLoadCheatFile(S9xGetFilename("cht"));
S9xInitCheatData();
S9xApplyCheats();
@@ -4146,7 +4146,7 @@ void CheckForIPSPatch(const char* rom_filename, bool8 header,
if (!(patch_file = fopen(fname, "rb")))
{
- if (!(patch_file = fopen(S9xGetFilename(".ips"), "rb")))
+ if (!(patch_file = fopen(S9xGetFilename("ips"), "rb")))
return;
}
diff --git a/source/memmap.h b/source/memmap.h
index 4614e83..c4902f6 100644
--- a/source/memmap.h
+++ b/source/memmap.h
@@ -146,8 +146,8 @@ uint32 FileLoader(uint8* buffer, const char* filename, int32 maxsize);
void InitROM(bool8);
bool8 LoadSRAM(const char*);
bool8 SaveSRAM(const char*);
-bool8 Init();
-void Deinit();
+bool8 S9xInitMemory();
+void S9xDeinitMemory();
void FreeSDD1Data();
void WriteProtectROM();
diff --git a/source/ppu.c b/source/ppu.c
index a0e0f55..181fdaf 100644
--- a/source/ppu.c
+++ b/source/ppu.c
@@ -2775,7 +2775,6 @@ void S9xUpdateJoypads()
void S9xSuperFXExec()
{
-#if 1
if (Settings.SuperFX)
{
if ((Memory.FillRAM [0x3000 + GSU_SFR] & FLG_G) &&
@@ -2794,161 +2793,6 @@ void S9xSuperFXExec()
}
}
}
-#else
- uint32 tmp = (Memory.FillRAM[0x3034] << 16) + *(uint16*)
- &Memory.FillRAM [0x301e];
-
-#if 0
- if (tmp == 0x018428)
- {
- *(uint16*) &SRAM [0x0064] = 0xbc00;
- *(uint16*) &SRAM [0x002c] = 0x8000;
- }
-#endif
- if (tmp == -1)//0x018428) //0x01bfc3) //0x09edaf) //-1) //0x57edaf)
- {
- while (Memory.FillRAM [0x3030] & 0x20)
- {
- int i;
- int32 vError;
- uint8 avReg[0x40];
- char tmp[128];
- uint8 vPipe;
- uint8 vColr;
- uint8 vPor;
-
- FxPipeString(tmp);
- /* Make the string 32 chars long */
- if (strlen(tmp) < 32)
- {
- memset(&tmp[strlen(tmp)], ' ', 32 - strlen(tmp));
- tmp[32] = 0;
- }
-
- /* Copy registers (so we can see if any changed) */
- vColr = FxGetColorRegister();
- vPor = FxGetPlotOptionRegister();
- memcpy(avReg, SuperFX.pvRegisters, 0x40);
-
- /* Print the pipe string */
- printf(tmp);
-
- /* Execute the instruction in the pipe */
- vPipe = FxPipe();
- vError = FxEmulate(1);
-
- /* Check if any registers changed (and print them if they did) */
- for (i = 0; i < 16; i++)
- {
- uint32 a = 0;
- uint32 r1 = ((uint32)avReg[i * 2]) | (((uint32)avReg[(i * 2) + 1]) << 8);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[i * 2]) | (((uint32)
- SuperFX.pvRegisters[(i * 2) + 1]) << 8);
- if (i == 15)
- a = OPCODE_BYTES(vPipe);
- if (((r1 + a) & 0xffff) != r2)
- printf(" r%d=$%04x", i, r2);
- }
- {
- /* Check SFR */
- uint32 r1 = ((uint32)avReg[0x30]) | (((uint32)avReg[0x31]) << 8);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[0x30]) | (((uint32)
- SuperFX.pvRegisters[0x31]) << 8);
- if ((r1 & (1 << 1)) != (r2 & (1 << 1)))
- printf(" Z=%d", (uint32)(!!(r2 & (1 << 1))));
- if ((r1 & (1 << 2)) != (r2 & (1 << 2)))
- printf(" CY=%d", (uint32)(!!(r2 & (1 << 2))));
- if ((r1 & (1 << 3)) != (r2 & (1 << 3)))
- printf(" S=%d", (uint32)(!!(r2 & (1 << 3))));
- if ((r1 & (1 << 4)) != (r2 & (1 << 4)))
- printf(" OV=%d", (uint32)(!!(r2 & (1 << 4))));
- if ((r1 & (1 << 5)) != (r2 & (1 << 5)))
- printf(" G=%d", (uint32)(!!(r2 & (1 << 5))));
- if ((r1 & (1 << 6)) != (r2 & (1 << 6)))
- printf(" R=%d", (uint32)(!!(r2 & (1 << 6))));
- if ((r1 & (1 << 8)) != (r2 & (1 << 8)))
- printf(" ALT1=%d", (uint32)(!!(r2 & (1 << 8))));
- if ((r1 & (1 << 9)) != (r2 & (1 << 9)))
- printf(" ALT2=%d", (uint32)(!!(r2 & (1 << 9))));
- if ((r1 & (1 << 10)) != (r2 & (1 << 10)))
- printf(" IL=%d", (uint32)(!!(r2 & (1 << 10))));
- if ((r1 & (1 << 11)) != (r2 & (1 << 11)))
- printf(" IH=%d", (uint32)(!!(r2 & (1 << 11))));
- if ((r1 & (1 << 12)) != (r2 & (1 << 12)))
- printf(" B=%d", (uint32)(!!(r2 & (1 << 12))));
- if ((r1 & (1 << 15)) != (r2 & (1 << 15)))
- printf(" IRQ=%d", (uint32)(!!(r2 & (1 << 15))));
- }
- {
- /* Check PBR */
- uint32 r1 = ((uint32)avReg[0x34]);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[0x34]);
- if (r1 != r2)
- printf(" PBR=$%02x", r2);
- }
- {
- /* Check ROMBR */
- uint32 r1 = ((uint32)avReg[0x36]);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[0x36]);
- if (r1 != r2)
- printf(" ROMBR=$%02x", r2);
- }
- {
- /* Check RAMBR */
- uint32 r1 = ((uint32)avReg[0x3c]);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[0x3c]);
- if (r1 != r2)
- printf(" RAMBR=$%02x", r2);
- }
- {
- /* Check CBR */
- uint32 r1 = ((uint32)avReg[0x3e]) | (((uint32)avReg[0x3f]) << 8);
- uint32 r2 = (uint32)(SuperFX.pvRegisters[0x3e]) | (((uint32)
- SuperFX.pvRegisters[0x3f]) << 8);
- if (r1 != r2)
- printf(" CBR=$%04x", r2);
- }
- {
- /* Check COLR */
- if (vColr != FxGetColorRegister())
- printf(" COLR=$%02x", FxGetColorRegister());
- }
- {
- /* Check POR */
- if (vPor != FxGetPlotOptionRegister())
- printf(" POR=$%02x", FxGetPlotOptionRegister());
- }
- printf("\n");
- }
- S9xExit();
- }
- else
- {
- uint32 t = (Memory.FillRAM [0x3034] << 16) +
- (Memory.FillRAM [0x301f] << 8) +
- (Memory.FillRAM [0x301e] << 0);
-
- printf("%06x: %d\n", t, FxEmulate(2000000));
- // FxEmulate (2000000);
- }
-#if 0
- if (!(CPU.Flags & TRACE_FLAG))
- {
- static int z = 1;
- if (z == 0)
- {
- extern FILE* trace;
- CPU.Flags |= TRACE_FLAG;
- trace = fopen("trace.log", "wb");
- }
- else
- z--;
- }
-#endif
- Memory.FillRAM [0x3030] &= ~0x20;
- if (Memory.FillRAM [0x3031] & 0x80)
- S9xSetIRQ(GSU_IRQ_SOURCE);
-#endif
}
// Register reads and writes...
diff --git a/source/sdd1.c b/source/sdd1.c
index de7fd5e..bf14496 100644
--- a/source/sdd1.c
+++ b/source/sdd1.c
@@ -149,7 +149,7 @@ void S9xSDD1SaveLoggedData()
qsort(Memory.SDD1LoggedData, Memory.SDD1LoggedDataCount, 8,
S9xCompareSDD1LoggedDataEntries);
- FILE* fs = fopen(S9xGetFilename(".dat"), "wb");
+ FILE* fs = fopen(S9xGetFilename("dat"), "wb");
if (fs)
{
@@ -157,7 +157,7 @@ void S9xSDD1SaveLoggedData()
Memory.SDD1LoggedDataCount, fs);
fclose(fs);
#if defined(__linux)
- chown(S9xGetFilename(".dat"), getuid(), getgid());
+ chown(S9xGetFilename("dat"), getuid(), getgid());
#endif
}
Memory.SDD1LoggedDataCountPrev = Memory.SDD1LoggedDataCount;
@@ -166,7 +166,7 @@ void S9xSDD1SaveLoggedData()
void S9xSDD1LoadLoggedData()
{
- FILE* fs = fopen(S9xGetFilename(".dat"), "rb");
+ FILE* fs = fopen(S9xGetFilename("dat"), "rb");
Memory.SDD1LoggedDataCount = Memory.SDD1LoggedDataCountPrev = 0;
diff --git a/source/snes9x.h b/source/snes9x.h
index 912f101..c230f17 100644
--- a/source/snes9x.h
+++ b/source/snes9x.h
@@ -393,7 +393,6 @@ extern SCPUState CPU;
extern SSNESGameFixes SNESGameFixes;
extern char String [513];
-void S9xExit();
void S9xMessage(int type, int number, const char* message);
void S9xLoadSDD1Data();
diff --git a/source/spc700.c b/source/spc700.c
index e95ff46..7481c50 100644
--- a/source/spc700.c
+++ b/source/spc700.c
@@ -137,21 +137,6 @@ void S9xAPUSetByte(uint8, uint32 address);
#define APUSetZN16(w)\
IAPU._Zero = ((w) != 0) | ((w) >> 8);
-void STOP(char* s)
-{
- char buffer[100];
-
- buffer[0] = '\0';
-
- sprintf(String, "Sound CPU in unknown state executing %s at %04X\n%s\n", s,
- IAPU.PC - IAPU.RAM, buffer);
- S9xMessage(S9X_ERROR, S9X_APU_STOPPED, String);
- APU.TimerEnabled[0] = APU.TimerEnabled[1] = APU.TimerEnabled[2] = FALSE;
- IAPU.APUExecuting = FALSE;
-
- S9xExit();
-}
-
#define TCALL(n)\
{\
SPC700_PushW (IAPU.PC - IAPU.RAM + 1); \
@@ -906,9 +891,6 @@ void Apu0F()
{
// BRK
-#if 0
- STOP("BRK");
-#else
SPC700_PushW(IAPU.PC + 1 - IAPU.RAM);
S9xAPUPackStatus();
Push(IAPU.Registers.P);
@@ -916,14 +898,12 @@ void Apu0F()
APUClearInterrupt();
// XXX:Where is the BRK vector ???
IAPU.PC = IAPU.RAM + APU.ExtraRAM[0x20] + (APU.ExtraRAM[0x21] << 8);
-#endif
}
void ApuEF()
{
// SLEEP
// XXX: sleep
- // STOP ("SLEEP");
IAPU.APUExecuting = FALSE;
IAPU.PC++;
}
@@ -931,7 +911,6 @@ void ApuEF()
void ApuFF()
{
// STOP
- // STOP ("STOP");
IAPU.APUExecuting = FALSE;
IAPU.PC++;
}
@@ -1964,7 +1943,6 @@ void Apu6F()
void Apu7F()
{
// RETI
- // STOP ("RETI");
Pop(IAPU.Registers.P);
S9xAPUUnpackStatus();
PopW(IAPU.Registers.PC);
diff --git a/source/spc7110.c b/source/spc7110.c
index a53198c..4285cb3 100644
--- a/source/spc7110.c
+++ b/source/spc7110.c
@@ -2240,7 +2240,7 @@ bool8 S9xSaveSPC7110RTC(S7RTC* rtc_f9)
{
FILE* fp;
- if ((fp = fopen(S9xGetFilename(".rtc"), "wb")) == NULL)
+ if ((fp = fopen(S9xGetFilename("rtc"), "wb")) == NULL)
return (FALSE);
int i = 0;
uint8 temp = 0;
@@ -2270,7 +2270,7 @@ bool8 S9xLoadSPC7110RTC(S7RTC* rtc_f9)
{
FILE* fp;
- if ((fp = fopen(S9xGetFilename(".rtc"), "rb")) == NULL)
+ if ((fp = fopen(S9xGetFilename("rtc"), "rb")) == NULL)
return (FALSE);
int i;
for (i = 0; i < 16; i++)