aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2014-10-29 05:28:04 +0100
committeraliaspider2014-10-29 05:28:04 +0100
commit1d98e1c317fa19687ae6bc3cb8e550ef7531bf02 (patch)
tree343103da8fe67905e99b16636e93421397fe692b
parentf518934e3b664d0cf9535a391d6572300958d3bf (diff)
downloadsnesemu-1d98e1c317fa19687ae6bc3cb8e550ef7531bf02.tar.gz
snesemu-1d98e1c317fa19687ae6bc3cb8e550ef7531bf02.tar.bz2
snesemu-1d98e1c317fa19687ae6bc3cb8e550ef7531bf02.zip
cleanups (cont.)
-rw-r--r--Makefile5
-rw-r--r--libretro.cpp44
-rw-r--r--source/dma.cpp3
-rw-r--r--source/getset.h24
-rw-r--r--source/gfx.cpp405
-rw-r--r--source/gfx.h12
-rw-r--r--source/globals.cpp34
-rw-r--r--source/loadzip.cpp267
-rw-r--r--source/memmap.cpp180
-rw-r--r--source/memmap.h5
-rw-r--r--source/pixform.h36
-rw-r--r--source/port.h4
-rw-r--r--source/ppu.cpp20
-rw-r--r--source/snes9x.h3
-rw-r--r--source/soundux.cpp542
-rw-r--r--source/soundux.h6
-rw-r--r--source/spc7110.cpp26
-rw-r--r--source/tile.cpp238
18 files changed, 135 insertions, 1719 deletions
diff --git a/Makefile b/Makefile
index 43af188..b6ede7c 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ CPP_SOURCES = source/apu.cpp source/c4.cpp \
source/cpuops.cpp source/data.cpp\
source/dma.cpp source/dsp1.cpp \
source/fxdbg.cpp source/fxemu.cpp source/fxinst.cpp \
- source/gfx.cpp source/globals.cpp source/loadzip.cpp \
+ source/gfx.cpp source/globals.cpp \
source/memmap.cpp \
source/obc1.cpp source/ppu.cpp \
source/sa1.cpp source/sa1cpu.cpp source/screenshot.cpp \
@@ -76,8 +76,7 @@ OBJECTS = $(C_OBJECTS) $(CPP_OBJECTS)
DEFS += -DSPC700_C -DEXECUTE_SUPERFX_PER_LINE -DSDD1_DECOMP \
-DVAR_CYCLES -DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
- -DNO_INLINE_SET_GET -DNOASM -DHAVE_MKSTEMP '-DACCEPT_SIZE_T=size_t' \
- -DFOREVER_16_BIT_SOUND -DFOREVER_STEREO
+ -DNO_INLINE_SET_GET -DNOASM -DHAVE_MKSTEMP '-DACCEPT_SIZE_T=size_t'
ifeq ($(DEBUG), 1)
OPTIMIZE := -O0 -g
diff --git a/libretro.cpp b/libretro.cpp
index 0b70312..ded3dc9 100644
--- a/libretro.cpp
+++ b/libretro.cpp
@@ -227,7 +227,7 @@ void S9xDeinitUpdate (int width, int height, bool8 /*sixteen_bit*/)
}
#else
-void S9xDeinitUpdate (int width, int height, bool8 /*sixteen_bit*/)
+void S9xDeinitUpdate (int width, int height)
{
video_cb(GFX.Screen, width, height, GFX.Pitch);
}
@@ -471,21 +471,8 @@ int load_gamepak(const char* file)
Settings.FrameTime = (Settings.PAL ? Settings.FrameTimePAL : Settings.FrameTimeNTSC);
Memory.LoadSRAM (S9xGetFilename (".srm"));
- // mdelay(50); // Delete this delay
S9xLoadCheatFile (S9xGetFilename (".chb")); // cheat binary file, as opposed to text
-/*
- if (snapshot_filename)
- {
- int Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG);
- if (!S9xLoadSnapshot (snapshot_filename))
- exit (1);
- CPU.Flags |= Flags;
- }
-*/
-
- // mdelay(50); // Delete this delay
-
return 0;
}
@@ -517,10 +504,6 @@ void retro_init (void)
S9xInitSound (Settings.SoundPlaybackRate,
TRUE,
Settings.SoundBufferSize);
-#ifdef GFX_MULTI_FORMAT
-// S9xSetRenderPixelFormat (RGB565);
- S9xSetRenderPixelFormat (BGR555);
-#endif
#ifdef JOYSTICK_SUPPORT
uint32 JoypadSkip = 0;
@@ -620,12 +603,7 @@ void S9xGenerateSound ()
void S9xGenerateSound0 ()
{
-#ifndef FOREVER_16_BIT_SOUND
- int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) :
- so.samples_mixed_so_far;
-#else
int bytes_so_far = so.samples_mixed_so_far << 1;
-#endif
if (bytes_so_far >= so.buffer_size)
return;
@@ -635,10 +613,7 @@ void S9xGenerateSound0 ()
{
// Write this many samples overall
int samples_to_write = so.err_counter >> FIXED_POINT_SHIFT;
-#ifndef FOREVER_STEREO
- if (so.stereo)
-#endif
- samples_to_write <<= 1;
+ samples_to_write <<= 1;
int byte_offset = (bytes_so_far + so.play_position) & SOUND_BUFFER_SIZE_MASK;
so.err_counter &= FIXED_POINT_REMAINDER;
@@ -646,10 +621,7 @@ void S9xGenerateSound0 ()
do
{
int bytes_this_run = samples_to_write;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- bytes_this_run <<= 1;
+ bytes_this_run <<= 1;
if (byte_offset + bytes_this_run > SOUND_BUFFER_SIZE)
{
@@ -664,20 +636,12 @@ void S9xGenerateSound0 ()
}
int samples_this_run = bytes_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- samples_this_run >>= 1;
+ samples_this_run >>= 1;
S9xMixSamples (Buf + byte_offset, samples_this_run);
so.samples_mixed_so_far += samples_this_run;
samples_to_write -= samples_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- bytes_so_far += so.sixteen_bit ? (samples_this_run << 1) :
- samples_this_run;
-#else
bytes_so_far += samples_this_run << 1;
-#endif
byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK;
} while (samples_to_write > 0);
}
diff --git a/source/dma.cpp b/source/dma.cpp
index 0ed7535..71f8e03 100644
--- a/source/dma.cpp
+++ b/source/dma.cpp
@@ -293,9 +293,6 @@ void S9xDoDMA (uint8 Channel)
{
uint32 i,j;
i=(s7r.reg4805|(s7r.reg4806<<8));
-#ifdef SPC7110_DEBUG
- printf("DMA Transfer of %04X bytes from %02X%02X%02X:%02X, offset of %04X, internal bank of %04X, multiplier %02X\n",d->TransferBytes,s7r.reg4803,s7r.reg4802,s7r.reg4801, s7r.reg4804,i, s7r.bank50Internal, s7r.AlignBy);
-#endif
i*=s7r.AlignBy;
i+=s7r.bank50Internal;
i%=DECOMP_BUFFER_SIZE;
diff --git a/source/getset.h b/source/getset.h
index 189991b..f37779e 100644
--- a/source/getset.h
+++ b/source/getset.h
@@ -152,15 +152,9 @@ uint8 S9xGetByte (uint32 Address)
return (S9xGetC4 (Address & 0xffff));
case CMemory::MAP_SPC7110_ROM:
-#ifdef SPC7110_DEBUG
- printf("reading spc7110 ROM (byte) at %06X\n", Address);
-#endif
return S9xGetSPC7110Byte(Address);
case CMemory::MAP_SPC7110_DRAM:
-#ifdef SPC7110_DEBUG
- printf("reading Bank 50 (byte)\n");
-#endif
return S9xGetSPC7110(0x4800);
case CMemory::MAP_OBC_RAM:
@@ -271,15 +265,9 @@ uint16 S9xGetWord (uint32 Address)
(S9xGetC4 ((Address + 1) & 0xffff) << 8));
case CMemory::MAP_SPC7110_ROM:
-#ifdef SPC7110_DEBUG
- printf("reading spc7110 ROM (word) at %06X\n", Address);
-#endif
return (S9xGetSPC7110Byte(Address)|
(S9xGetSPC7110Byte (Address+1))<<8);
case CMemory::MAP_SPC7110_DRAM:
-#ifdef SPC7110_DEBUG
- printf("reading Bank 50 (word)\n");
-#endif
return (S9xGetSPC7110(0x4800)|
(S9xGetSPC7110 (0x4800) << 8));
case CMemory::MAP_OBC_RAM:
@@ -387,9 +375,6 @@ void S9xSetByte (uint8 Byte, uint32 Address)
return;
case CMemory::MAP_SPC7110_DRAM:
-#ifdef SPC7110_DEBUG
- printf("Writing Byte at %06X\n", Address);
-#endif
s7r.bank50[(Address & 0xffff)]= (uint8) Byte;
break;
@@ -524,9 +509,6 @@ void S9xSetWord (uint16 Word, uint32 Address)
case CMemory::MAP_DEBUG:
case CMemory::MAP_SPC7110_DRAM:
-#ifdef SPC7110_DEBUG
- printf("Writing Word at %06X\n", Address);
-#endif
s7r.bank50[(Address & 0xffff)]= (uint8) Word;
s7r.bank50[((Address + 1) & 0xffff)]= (uint8) Word;
break;
@@ -580,16 +562,10 @@ uint8 *GetBasePointer (uint32 Address)
switch ((intptr_t) GetAddress)
{
case CMemory::MAP_SPC7110_DRAM:
-#ifdef SPC7110_DEBUG
- printf("Getting Base pointer to DRAM\n");
-#endif
{
return s7r.bank50;
}
case CMemory::MAP_SPC7110_ROM:
-#ifdef SPC7110_DEBUG
- printf("Getting Base pointer to SPC7110ROM\n");
-#endif
return Get7110BasePtr(Address);
case CMemory::MAP_PPU:
//just a guess, but it looks like this should match the CPU as a source.
diff --git a/source/gfx.cpp b/source/gfx.cpp
index 0936430..34fb235 100644
--- a/source/gfx.cpp
+++ b/source/gfx.cpp
@@ -169,35 +169,6 @@ extern uint8 Mode7Depths [2];
#define BLACK BUILD_PIXEL(0,0,0)
-#ifndef FOREVER_16_BIT
-void DrawTile (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTile (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTileHalfWidth (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTileHalfWidth (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTilex2 (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTilex2 (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawTilex2x2 (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount);
-void DrawClippedTilex2x2 (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount);
-void DrawLargePixel (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-void DrawLargePixelHalfWidth (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount);
-#endif
-
void DrawTile16 (uint32 Tile, int32 Offset, uint32 StartLine,
uint32 LineCount);
void DrawClippedTile16 (uint32 Tile, int32 Offset,
@@ -288,11 +259,6 @@ bool8 S9xGraphicsInit ()
register uint32 PixelOdd = 1;
register uint32 PixelEven = 2;
-#ifdef GFX_MULTI_FORMAT
- if (GFX.BuildPixel == NULL)
- S9xSetRenderPixelFormat (RGB565);
-#endif
-
for (uint8 bitshift = 0; bitshift < 4; bitshift++)
{
for (register int i = 0; i < 16; i++)
@@ -385,10 +351,7 @@ bool8 S9xGraphicsInit ()
GFX.RealPitch = GFX.Pitch2 = GFX.Pitch;
GFX.ZPitch = GFX.Pitch;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
- GFX.ZPitch >>= 1;
+ GFX.ZPitch >>= 1;
GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
GFX.DepthDelta = GFX.SubZBuffer - GFX.ZBuffer;
//GFX.InfoStringTimeout = 0;
@@ -396,17 +359,9 @@ bool8 S9xGraphicsInit ()
PPU.BG_Forced = 0;
IPPU.OBJChanged = TRUE;
-#ifndef FOREVER_16_BIT
- if (Settings.Transparency)
- Settings.SixteenBit = TRUE;
-#endif
IPPU.DirectColourMapsNeedRebuild = TRUE;
GFX.PixSize = 1;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
DrawTilePtr = DrawTile16;
DrawClippedTilePtr = DrawClippedTile16;
DrawLargePixelPtr = DrawLargePixel16;
@@ -422,33 +377,8 @@ bool8 S9xGraphicsInit ()
}
GFX.PPL = GFX.Pitch >> 1;
GFX.PPLx2 = GFX.Pitch;
-#ifndef FOREVER_16_BIT
- }
- else
- {
- DrawTilePtr = DrawTile;
- DrawClippedTilePtr = DrawClippedTile;
- DrawLargePixelPtr = DrawLargePixel;
- if (Settings.SupportHiRes)
- {
- DrawHiResTilePtr= DrawTile;
- DrawHiResClippedTilePtr = DrawClippedTile;
- }
- else
- {
- DrawHiResTilePtr= DrawTileHalfWidth;
- DrawHiResClippedTilePtr = DrawClippedTileHalfWidth;
- }
- GFX.PPL = GFX.Pitch;
- GFX.PPLx2 = GFX.Pitch * 2;
- }
-#endif
S9xFixColourBrightness ();
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
if (!(GFX.X2 = (uint16 *) malloc (sizeof (uint16) * 0x10000)))
return (FALSE);
@@ -595,16 +525,6 @@ bool8 S9xGraphicsInit ()
}
}
}
-#ifndef FOREVER_16_BIT
- }
- else
- {
- GFX.X2 = NULL;
- GFX.ZERO_OR_X2 = NULL;
- GFX.ZERO = NULL;
- }
-#endif
-
return (TRUE);
}
@@ -675,28 +595,14 @@ void S9xStartScreenRefresh ()
IPPU.DoubleHeightPixels = TRUE;
GFX.Pitch2 = GFX.RealPitch;
GFX.Pitch = GFX.RealPitch * 2;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
- GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
-#ifndef FOREVER_16_BIT
- else
- GFX.PPL = GFX.PPLx2 = GFX.RealPitch << 1;
-#endif
+ GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
}
else
{
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
GFX.Pitch2 = GFX.Pitch = GFX.RealPitch;
- IPPU.DoubleHeightPixels = FALSE;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
- GFX.PPL = GFX.Pitch >> 1;
-#ifndef FOREVER_16_BIT
- else
- GFX.PPL = GFX.Pitch;
-#endif
+ IPPU.DoubleHeightPixels = FALSE;
+ GFX.PPL = GFX.Pitch >> 1;
GFX.PPLx2 = GFX.PPL << 1;
}
}
@@ -719,10 +625,7 @@ void S9xStartScreenRefresh ()
GFX.Pitch2 = GFX.Pitch = GFX.RealPitch;
GFX.PPL = GFX.PPLx2 >> 1;
GFX.ZPitch = GFX.RealPitch;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
- GFX.ZPitch >>= 1;
+ GFX.ZPitch >>= 1;
}
}
@@ -791,51 +694,14 @@ void S9xEndScreenRefresh ()
FLUSH_REDRAW ();
if (IPPU.ColorsChanged)
{
- uint32 saved = PPU.CGDATA[0];
-#ifndef FOREVER_16_BIT
- if (!Settings.SixteenBit)
- {
- // Hack for Super Mario World - to get its sky blue
- // (It uses Fixed colour addition on the backdrop colour)
- if (!(Memory.FillRAM [0x2131] & 0x80) && (Memory.FillRAM[0x2131] & 0x20) &&
- (PPU.FixedColourRed || PPU.FixedColourGreen || PPU.FixedColourBlue))
- {
- PPU.CGDATA[0] = PPU.FixedColourRed | (PPU.FixedColourGreen << 5) |
- (PPU.FixedColourBlue << 10);
- }
- }
-#endif
+ uint32 saved = PPU.CGDATA[0];
IPPU.ColorsChanged = FALSE;
PPU.CGDATA[0] = saved;
}
GFX.Pitch = GFX.Pitch2 = GFX.RealPitch;
GFX.PPL = GFX.PPLx2 >> 1;
-#if 0
- //take screenshot here.
- if(Settings.TakeScreenshot)
- {
- S9xDoScreenshot(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);
- cprintf("%s:%d\n", __FILE__, __LINE__);
- }
- if (Settings.DisplayFrameRate)
- {
- S9xDisplayFrameRate ();
- cprintf("%s:%d\n", __FILE__, __LINE__);
- }
- if (GFX.InfoString)
- {
- S9xDisplayString (GFX.InfoString);
- cprintf("%s:%d\n", __FILE__, __LINE__);
- }
-#endif
- S9xDeinitUpdate (IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight,
-#ifndef FOREVER_16_BIT
- Settings.SixteenBit
-#else
- TRUE
-#endif
- );
+ S9xDeinitUpdate (IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);
}
S9xApplyCheats ();
@@ -844,19 +710,6 @@ void S9xEndScreenRefresh ()
{
S9xAutoSaveSRAM ();
CPU.SRAMModified = FALSE;
- /*if (!CPU.AutoSaveTimer)
- {
- if (!(CPU.AutoSaveTimer = Settings.AutoSaveDelay * Memory.ROMFramesPerSecond))
- CPU.SRAMModified = FALSE;
- }
- else
- {
- if (!--CPU.AutoSaveTimer)
- {
- S9xAutoSaveSRAM ();
- CPU.SRAMModified = FALSE;
- }
- }*/
}
}
@@ -1237,55 +1090,19 @@ if(Settings.BGLayering) {
GFX.PixSize = 2;
if (IPPU.DoubleHeightPixels)
{
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- DrawTilePtr = DrawTile16x2x2;
- DrawClippedTilePtr = DrawClippedTile16x2x2;
-#ifndef FOREVER_16_BIT
- }
- else
- {
- DrawTilePtr = DrawTilex2x2;
- DrawClippedTilePtr = DrawClippedTilex2x2;
- }
-#endif
+ DrawTilePtr = DrawTile16x2x2;
+ DrawClippedTilePtr = DrawClippedTile16x2x2;
}
else
{
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- DrawTilePtr = DrawTile16x2;
- DrawClippedTilePtr = DrawClippedTile16x2;
-#ifndef FOREVER_16_BIT
- }
- else
- {
- DrawTilePtr = DrawTilex2;
- DrawClippedTilePtr = DrawClippedTilex2;
- }
-#endif
+ DrawTilePtr = DrawTile16x2;
+ DrawClippedTilePtr = DrawClippedTile16x2;
}
}
else
{
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- DrawTilePtr = DrawTile16;
- DrawClippedTilePtr = DrawClippedTile16;
-#ifndef FOREVER_16_BIT
- }
- else
- {
- DrawTilePtr = DrawTile;
- DrawClippedTilePtr = DrawClippedTile;
- }
-#endif
+ DrawTilePtr = DrawTile16;
+ DrawClippedTilePtr = DrawClippedTile16;
}
}
else // if (!Settings.SupportHiRes)
@@ -1298,20 +1115,8 @@ if(Settings.BGLayering) {
// problems.
OnMain = FALSE;
}
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
DrawTilePtr = DrawTile16;
DrawClippedTilePtr = DrawClippedTile16;
-#ifndef FOREVER_16_BIT
- }
- else
- {
- DrawTilePtr = DrawTile;
- DrawClippedTilePtr = DrawClippedTile;
- }
-#endif
}
GFX.Z1 = D + 2;
@@ -3495,63 +3300,37 @@ static void RenderScreen (uint8 *Screen, bool8 sub, bool8 force_no_add, uint8 D)
void DisplayChar (uint8 *Screen, uint8 c)
{
- int line = (((c & 0x7f) - 32) >> 4) * font_height;
- int offset = (((c & 0x7f) - 32) & 15) * font_width;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- int h, w;
- uint16 *s = (uint16 *) Screen;
- for (h = 0; h < font_height; h++, line++,
- s += GFX.PPL - font_width)
- {
- for (w = 0; w < font_width; w++, s++)
- {
- uint8 p = font [line][offset + w];
-
- if (p == '#')
- {
- /*
- if(Memory.Hacked)
- *s= BUILD_PIXEL(31,0,0);
- else if(Memory.Iffy)
- *s= BUILD_PIXEL(31,31,0);
- else if(Memory.Iformat==1)
- *s= BUILD_PIXEL(0,31,0);
- else if(Memory.Iformat==2)
- *s= BUILD_PIXEL(0,31,31);
- else *s = 0xffff;
- */
- *s=Settings.DisplayColor;
- }
- else
- if (p == '.')
- *s = BLACK;
- }
- }
-#ifndef FOREVER_16_BIT
- }
- else
- {
- int h, w;
- uint8 *s = Screen;
- for (h = 0; h < font_height; h++, line++,
- s += GFX.PPL - font_width)
- {
- for (w = 0; w < font_width; w++, s++)
- {
- uint8 p = font [line][offset + w];
-
- if (p == '#')
- *s = 255;
- else
- if (p == '.')
- *s = BLACK;
- }
- }
- }
-#endif
+ int line = (((c & 0x7f) - 32) >> 4) * font_height;
+ int offset = (((c & 0x7f) - 32) & 15) * font_width;
+ int h, w;
+ uint16 *s = (uint16 *) Screen;
+ for (h = 0; h < font_height; h++, line++,
+ s += GFX.PPL - font_width)
+ {
+ for (w = 0; w < font_width; w++, s++)
+ {
+ uint8 p = font [line][offset + w];
+
+ if (p == '#')
+ {
+ /*
+ if(Memory.Hacked)
+ *s= BUILD_PIXEL(31,0,0);
+ else if(Memory.Iffy)
+ *s= BUILD_PIXEL(31,31,0);
+ else if(Memory.Iformat==1)
+ *s= BUILD_PIXEL(0,31,0);
+ else if(Memory.Iformat==2)
+ *s= BUILD_PIXEL(0,31,31);
+ else *s = 0xffff;
+ */
+ *s=Settings.DisplayColor;
+ }
+ else
+ if (p == '.')
+ *s = BLACK;
+ }
+ }
}
static void S9xDisplayFrameRate ()
@@ -3568,12 +3347,7 @@ static void S9xDisplayFrameRate ()
for (i = 0; i < len; i++)
{
DisplayChar (Screen, string [i]);
-#ifndef FOREVER_16_BIT
- Screen += Settings.SixteenBit ? (font_width - 1) * sizeof (uint16) :
- (font_width - 1);
-#else
Screen += (font_width - 1) * sizeof (uint16);
-#endif
}
}
@@ -3590,13 +3364,7 @@ static void S9xDisplayString (const char *string)
{
if (char_count >= max_chars || string [i] < 32)
{
-#ifndef FOREVER_16_BIT
- Screen -= Settings.SixteenBit ?
- (font_width - 1) * sizeof (uint16) * max_chars :
- (font_width - 1) * max_chars;
-#else
Screen -= (font_width - 1) * max_chars * sizeof (uint16);
-#endif
Screen += font_height * GFX.Pitch;
if (Screen >= GFX.Screen + GFX.Pitch * IPPU.RenderedScreenHeight)
break;
@@ -3605,12 +3373,7 @@ static void S9xDisplayString (const char *string)
if (string [i] < 32)
continue;
DisplayChar (Screen, string [i]);
-#ifndef FOREVER_16_BIT
- Screen += Settings.SixteenBit ? (font_width - 1) * sizeof (uint16) :
- (font_width - 1);
-#else
Screen += (font_width - 1) * sizeof (uint16);
-#endif
}
}
@@ -3676,31 +3439,14 @@ void S9xUpdateScreen ()
{
// The game has switched from lo-res to hi-res mode part way down
// the screen. Scale any existing lo-res pixels on screen
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- for (register uint32 y = 0; y < starty; y++)
- {
- register uint16 *p = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 255;
- register uint16 *q = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 510;
-
- for (register int x = 255; x >= 0; x--, p--, q -= 2)
- *q = *(q + 1) = *p;
- }
-#ifndef FOREVER_16_BIT
- }
- else
- {
- for (register uint32 y = 0; y < starty; y++)
- {
- register uint8 *p = GFX.Screen + y * GFX.Pitch2 + 255;
- register uint8 *q = GFX.Screen + y * GFX.Pitch2 + 510;
- for (register int x = 255; x >= 0; x--, p--, q -= 2)
- *q = *(q + 1) = *p;
- }
- }
-#endif
+ for (register uint32 y = 0; y < starty; y++)
+ {
+ register uint16 *p = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 255;
+ register uint16 *q = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 510;
+
+ for (register int x = 255; x >= 0; x--, p--, q -= 2)
+ *q = *(q + 1) = *p;
+ }
IPPU.DoubleWidthPixels = TRUE;
IPPU.HalfWidthPixels = FALSE;
}
@@ -3714,14 +3460,8 @@ void S9xUpdateScreen ()
IPPU.DoubleHeightPixels = TRUE;
GFX.Pitch2 = GFX.RealPitch;
GFX.Pitch = GFX.RealPitch * 2;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
- GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
-#ifndef FOREVER_16_BIT
- else
- GFX.PPL = GFX.PPLx2 = GFX.RealPitch << 1;
-#endif
+ GFX.PPL = GFX.PPLx2 = GFX.RealPitch;
+
// The game has switched from non-interlaced to interlaced mode
// part way down the screen. Scale everything.
@@ -3763,11 +3503,7 @@ void S9xUpdateScreen ()
uint32 black = BLACK | (BLACK << 16);
- if (Settings.Transparency
-#ifndef FOREVER_16_BIT
- && Settings.SixteenBit
-#endif
- )
+ if (Settings.Transparency)
{
if (GFX.Pseudo)
{
@@ -4178,30 +3914,13 @@ void S9xUpdateScreen ()
{
// Mixure of background modes used on screen - scale width
// of all non-mode 5 and 6 pixels.
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
- for (register uint32 y = starty; y <= endy; y++)
- {
- register uint16 *p = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 255;
- register uint16 *q = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 510;
- for (register int x = 255; x >= 0; x--, p--, q -= 2)
- *q = *(q + 1) = *p;
- }
-#ifndef FOREVER_16_BIT
- }
- else
- {
- for (register uint32 y = starty; y <= endy; y++)
- {
- register uint8 *p = GFX.Screen + y * GFX.Pitch2 + 255;
- register uint8 *q = GFX.Screen + y * GFX.Pitch2 + 510;
- for (register int x = 255; x >= 0; x--, p--, q -= 2)
- *q = *(q + 1) = *p;
- }
- }
-#endif
+ for (register uint32 y = starty; y <= endy; y++)
+ {
+ register uint16 *p = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 255;
+ register uint16 *q = (uint16 *) (GFX.Screen + y * GFX.Pitch2) + 510;
+ for (register int x = 255; x >= 0; x--, p--, q -= 2)
+ *q = *(q + 1) = *p;
+ }
}
// Double the height of the pixels just drawn
diff --git a/source/gfx.h b/source/gfx.h
index 24364f8..2cc95ef 100644
--- a/source/gfx.h
+++ b/source/gfx.h
@@ -109,13 +109,9 @@ extern struct SGFX GFX;
bool8 S9xGraphicsInit ();
void S9xGraphicsDeinit();
bool8 S9xInitUpdate (void);
-void S9xDeinitUpdate (int width, int height, bool8 sixteen_bit);
+void S9xDeinitUpdate (int width, int height);
void S9xSyncSpeed ();
-#ifdef GFX_MULTI_FORMAT
-bool8 S9xSetRenderPixelFormat (int format);
-#endif
-
END_EXTERN_C
struct SGFX{
@@ -170,12 +166,6 @@ struct SGFX{
uint8 r2131;
bool8 Pseudo;
-#ifdef GFX_MULTI_FORMAT
- uint32 PixelFormat;
- uint32 (*BuildPixel) (uint32 R, uint32 G, uint32 B);
- uint32 (*BuildPixel2) (uint32 R, uint32 G, uint32 B);
- void (*DecomposePixel) (uint32 Pixel, uint32 &R, uint32 &G, uint32 &B);
-#endif
};
struct SLineData {
diff --git a/source/globals.cpp b/source/globals.cpp
index d4476af..670dc92 100644
--- a/source/globals.cpp
+++ b/source/globals.cpp
@@ -178,40 +178,6 @@ uint32 odd_low[4][16];
uint32 even_high[4][16];
uint32 even_low[4][16];
-#ifdef GFX_MULTI_FORMAT
-
-uint32 RED_LOW_BIT_MASK = RED_LOW_BIT_MASK_RGB565;
-uint32 GREEN_LOW_BIT_MASK = GREEN_LOW_BIT_MASK_RGB565;
-uint32 BLUE_LOW_BIT_MASK = BLUE_LOW_BIT_MASK_RGB565;
-uint32 RED_HI_BIT_MASK = RED_HI_BIT_MASK_RGB565;
-uint32 GREEN_HI_BIT_MASK = GREEN_HI_BIT_MASK_RGB565;
-uint32 BLUE_HI_BIT_MASK = BLUE_HI_BIT_MASK_RGB565;
-uint32 MAX_RED = MAX_RED_RGB565;
-uint32 MAX_GREEN = MAX_GREEN_RGB565;
-uint32 MAX_BLUE = MAX_BLUE_RGB565;
-uint32 SPARE_RGB_BIT_MASK = SPARE_RGB_BIT_MASK_RGB565;
-uint32 GREEN_HI_BIT = (MAX_GREEN_RGB565 + 1) >> 1;
-uint32 RGB_LOW_BITS_MASK = (RED_LOW_BIT_MASK_RGB565 |
- GREEN_LOW_BIT_MASK_RGB565 |
- BLUE_LOW_BIT_MASK_RGB565);
-uint32 RGB_HI_BITS_MASK = (RED_HI_BIT_MASK_RGB565 |
- GREEN_HI_BIT_MASK_RGB565 |
- BLUE_HI_BIT_MASK_RGB565);
-uint32 RGB_HI_BITS_MASKx2 = (RED_HI_BIT_MASK_RGB565 |
- GREEN_HI_BIT_MASK_RGB565 |
- BLUE_HI_BIT_MASK_RGB565) << 1;
-uint32 RGB_REMOVE_LOW_BITS_MASK = ~RGB_LOW_BITS_MASK;
-uint32 FIRST_COLOR_MASK = FIRST_COLOR_MASK_RGB565;
-uint32 SECOND_COLOR_MASK = SECOND_COLOR_MASK_RGB565;
-uint32 THIRD_COLOR_MASK = THIRD_COLOR_MASK_RGB565;
-uint32 ALPHA_BITS_MASK = ALPHA_BITS_MASK_RGB565;
-uint32 FIRST_THIRD_COLOR_MASK = 0;
-uint32 TWO_LOW_BITS_MASK = 0;
-uint32 HIGH_BITS_SHIFTED_TWO_MASK = 0;
-
-uint32 current_graphic_format = RGB565;
-#endif
-
struct SCheatData Cheat;
SoundStatus so;
diff --git a/source/loadzip.cpp b/source/loadzip.cpp
deleted file mode 100644
index d3e24a1..0000000
--- a/source/loadzip.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
-
- (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
- Jerremy Koot (jkoot@snes9x.com)
-
- (c) Copyright 2001 - 2004 John Weidman (jweidman@slip.net)
-
- (c) Copyright 2002 - 2004 Brad Jorsch (anomie@users.sourceforge.net),
- funkyass (funkyass@spam.shaw.ca),
- Joel Yliluoma (http://iki.fi/bisqwit/)
- Kris Bleakley (codeviolation@hotmail.com),
- Matthew Kendora,
- Nach (n-a-c-h@users.sourceforge.net),
- Peter Bortas (peter@bortas.org) and
- zones (kasumitokoduck@yahoo.com)
-
- C4 x86 assembler and some C emulation code
- (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com),
- _Demo_ (_demo_@zsnes.com), and Nach
-
- C4 C++ code
- (c) Copyright 2003 Brad Jorsch
-
- DSP-1 emulator code
- (c) Copyright 1998 - 2004 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson,
- John Weidman, neviksti (neviksti@hotmail.com),
- Kris Bleakley, Andreas Naive
-
- DSP-2 emulator code
- (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and
- Lord Nightmare (lord_nightmare@users.sourceforge.net
-
- OBC1 emulator code
- (c) Copyright 2001 - 2004 zsKnight, pagefault (pagefault@zsnes.com) and
- Kris Bleakley
- Ported from x86 assembler to C by sanmaiwashi
-
- SPC7110 and RTC C++ emulator code
- (c) Copyright 2002 Matthew Kendora with research by
- zsKnight, John Weidman, and Dark Force
-
- S-DD1 C emulator code
- (c) Copyright 2003 Brad Jorsch with research by
- Andreas Naive and John Weidman
-
- S-RTC C emulator code
- (c) Copyright 2001 John Weidman
-
- ST010 C++ emulator code
- (c) Copyright 2003 Feather, Kris Bleakley, John Weidman and Matthew Kendora
-
- Super FX x86 assembler emulator code
- (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault
-
- Super FX C emulator code
- (c) Copyright 1997 - 1999 Ivar, Gary Henderson and John Weidman
-
-
- SH assembler code partly based on x86 assembler code
- (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
-
-
- Specific ports contains the works of other authors. See headers in
- individual files.
-
- Snes9x homepage: http://www.snes9x.com
-
- Permission to use, copy, modify and distribute Snes9x in both binary and
- source form, for non-commercial purposes, is hereby granted without fee,
- providing that this license information and copyright notice appear with
- all copies and any derived work.
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event shall the authors be held liable for any damages
- arising from the use of this software.
-
- Snes9x is freeware for PERSONAL USE only. Commercial users should
- seek permission of the copyright holders first. Commercial use includes
- charging money for Snes9x or software derived from Snes9x.
-
- The copyright holders request that bug fixes and improvements to the code
- should be forwarded to them so everyone can benefit from the modifications
- in future versions.
-
- Super NES and Super Nintendo Entertainment System are trademarks of
- Nintendo Co., Limited and its subsidiary companies.
-*******************************************************************************/
-
-#ifdef UNZIP_SUPPORT
-/**********************************************************************************************/
-/* Loadzip.CPP */
-/* This file contains a function for loading a SNES ROM image from a zip file */
-/**********************************************************************************************/
-
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#include <ctype.h>
-
-#ifndef NO_INLINE_SET_GET
-#define NO_INLINE_SET_GET
-#endif
-
-#include "snes9x.h"
-#include "memmap.h"
-
-#include "unzip.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-bool8 LoadZip(const char* zipname,
- int32 *TotalFileSize,
- int32 *headers, uint8* buffer)
-{
- *TotalFileSize = 0;
- *headers = 0;
-
- unzFile file = unzOpen(zipname);
- if(file == NULL)
- return (FALSE);
-
- // find largest file in zip file (under MAX_ROM_SIZE)
- // or a file with extension .1
- char filename[132];
- int filesize = 0;
- int port = unzGoToFirstFile(file);
- unz_file_info info;
- while(port == UNZ_OK)
- {
- char name[132];
- unzGetCurrentFileInfo(file, &info, name,128, NULL,0, NULL,0);
-
- int calc_size = info.uncompressed_size & ~0x1FFF; // round to lower 0x2000
- if(!(info.uncompressed_size - calc_size == 512 || info.uncompressed_size == calc_size))
- {
- port = unzGoToNextFile(file);
- continue;
- }
-
- if(info.uncompressed_size > (CMemory::MAX_ROM_SIZE + 512))
- {
- port = unzGoToNextFile(file);
- continue;
- }
-
- if ((int) info.uncompressed_size > filesize)
- {
- strcpy(filename,name);
- filesize = info.uncompressed_size;
- }
- int len = strlen(name);
- if(name[len-2] == '.' && name[len-1] == '1')
- {
- strcpy(filename,name);
- filesize = info.uncompressed_size;
- break;
- }
- port = unzGoToNextFile(file);
- }
- if( !(port == UNZ_END_OF_LIST_OF_FILE || port == UNZ_OK) || filesize == 0)
- {
-// assert( unzClose(file) == UNZ_OK );
- return (FALSE);
- }
-
- // Find extension
- char tmp[2];
- tmp[0] = tmp[1] = 0;
- char *ext = strrchr(filename,'.');
- if(ext) ext++;
- else ext = tmp;
-
- uint8 *ptr = buffer;
- bool8 more = FALSE;
-
- unzLocateFile(file,filename,1);
- unzGetCurrentFileInfo(file, &info, filename,128, NULL,0, NULL,0);
-
- if( unzOpenCurrentFile(file) != UNZ_OK )
- {
- unzClose(file);
- return (FALSE);
- }
-
- do
- {
-// assert(info.uncompressed_size <= CMemory::MAX_ROM_SIZE + 512);
- int FileSize = info.uncompressed_size;
-
- int calc_size = FileSize & ~0x1FFF; // round to lower 0x2000
-
- int l = unzReadCurrentFile(file,ptr,FileSize);
- if(unzCloseCurrentFile(file) == UNZ_CRCERROR)
- {
- unzClose(file);
- return (FALSE);
- }
-
- if(l <= 0 || l != FileSize)
- {
- unzClose(file);
- switch(l)
- {
- case UNZ_ERRNO:
- break;
- case UNZ_EOF:
- break;
- case UNZ_PARAMERROR:
- break;
- case UNZ_BADZIPFILE:
- break;
- case UNZ_INTERNALERROR:
- break;
- case UNZ_CRCERROR:
- break;
- }
- return (FALSE);
- }
-
- if ((FileSize - calc_size == 512 && !Settings.ForceNoHeader) ||
- Settings.ForceHeader)
- {
- // memmove required: Overlapping addresses [Neb]
- // DS2 DMA notes: Can be split into 512-byte DMA blocks [Neb]
- memmove (ptr, ptr + 512, calc_size);
- (*headers)++;
- FileSize -= 512;
- }
- ptr += FileSize;
- (*TotalFileSize) += FileSize;
-
- int len;
- if (ptr - Memory.ROM < CMemory::MAX_ROM_SIZE + 0x200 &&
- (isdigit (ext [0]) && ext [1] == 0 && ext [0] < '9'))
- {
- more = TRUE;
- ext [0]++;
- }
- else if (ptr - Memory.ROM < CMemory::MAX_ROM_SIZE + 0x200 &&
- (((len = strlen (filename)) == 7 || len == 8) &&
- strncasecmp (filename, "sf", 2) == 0 &&
- isdigit (filename [2]) && isdigit (filename [3]) && isdigit (filename [4]) &&
- isdigit (filename [5]) && isalpha (filename [len - 1])))
- {
- more = TRUE;
- filename [len - 1]++;
- }
- else
- more = FALSE;
-
- if(more)
- {
- if( unzLocateFile(file,filename,1) != UNZ_OK ||
- unzGetCurrentFileInfo(file, &info, filename,128, NULL,0, NULL,0) != UNZ_OK ||
- unzOpenCurrentFile(file) != UNZ_OK)
- break;
- }
-
- } while(more);
-
- unzClose(file);
- return (TRUE);
-}
-#endif
-
diff --git a/source/memmap.cpp b/source/memmap.cpp
index 037d357..c102128 100644
--- a/source/memmap.cpp
+++ b/source/memmap.cpp
@@ -892,8 +892,7 @@ uint32 CMemory::FileLoader (uint8* buffer, const char* filename, int32 maxsize)
FILE* ROMFile;
int32 TotalFileSize = 0;
- int len = 0;
- int nFormat=DEFAULT;
+ int len = 0;
char dir [_MAX_DIR + 1];
char drive [_MAX_DRIVE + 1];
@@ -902,10 +901,6 @@ uint32 CMemory::FileLoader (uint8* buffer, const char* filename, int32 maxsize)
char fname [_MAX_PATH + 1];
unsigned long FileSize = 0;
-
-#ifdef UNZIP_SUPPORT
- unzFile file=NULL;
-#endif
_splitpath (filename, drive, dir, name, ext);
_makepath (fname, drive, dir, name, ext);
@@ -915,134 +910,83 @@ uint32 CMemory::FileLoader (uint8* buffer, const char* filename, int32 maxsize)
memmove (&ext [0], &ext[1], 4);
#endif
- if (strcasecmp (ext, "zip") == 0)
- nFormat = ZIP;
- else if (strcasecmp (ext, "rar") == 0)
- nFormat = RAR;
- else
- nFormat = DEFAULT;
+ if ((ROMFile = fopen(fname, "rb")) == NULL)
+ return (0);
+ strcpy (ROMFilename, fname);
- switch( nFormat )
- {
- case ZIP:
+ HeaderCount = 0;
+ uint8 *ptr = buffer;
+ bool8 more = FALSE;
-#ifdef UNZIP_SUPPORT
+ do
+ {
+ FileSize = fread (ptr, 1, maxsize + 0x200 - (ptr - ROM), ROMFile);
+ fclose (ROMFile);
- file = unzOpen(fname);
+ int calc_size = FileSize & ~0x1FFF; // round to the lower 0x2000
- if(file != NULL)
- {
-
- // its a valid ZIP, close it and let LoadZIP handle it.
-
- unzClose(file);
-
- if (!LoadZip (fname, &TotalFileSize, &HeaderCount, ROM))
- return (0);
-
- strcpy (ROMFilename, fname);
-
- }
- else
- {
- // its a bad zip file. Walk away
-
- S9xMessage (S9X_ERROR, S9X_ROM_INFO, "Invalid Zip Archive.");
- return (0);
- }
-#endif
- break;
-
- case RAR:
- // non existant rar loading
- S9xMessage (S9X_ERROR, S9X_ROM_INFO, "Rar Archives are not currently supported.");
- return (0);
- break;
-
- case DEFAULT:
- default:
- // any other roms go here
- if ((ROMFile = fopen(fname, "rb")) == NULL)
- return (0);
-
- strcpy (ROMFilename, fname);
-
- HeaderCount = 0;
- uint8 *ptr = buffer;
- bool8 more = FALSE;
-
- do
- {
- FileSize = fread (ptr, 1, maxsize + 0x200 - (ptr - ROM), ROMFile);
- fclose (ROMFile);
-
- int calc_size = FileSize & ~0x1FFF; // round to the lower 0x2000
-
- if ((FileSize - calc_size == 512 && !Settings.ForceNoHeader) ||
- Settings.ForceHeader)
- {
- // memmove required: Overlapping addresses [Neb]
- // DS2 DMA notes: Can be split into 512-byte DMA blocks [Neb]
+ if ((FileSize - calc_size == 512 && !Settings.ForceNoHeader) ||
+ Settings.ForceHeader)
+ {
+ // memmove required: Overlapping addresses [Neb]
+ // DS2 DMA notes: Can be split into 512-byte DMA blocks [Neb]
#ifdef DS2_DMA
- __dcache_writeback_all();
- {
- unsigned int i;
- for (i = 0; i < calc_size; i += 512)
- {
- ds2_DMAcopy_32Byte (2 /* channel: emu internal */, ptr + i, ptr + i + 512, 512);
- ds2_DMA_wait(2);
- ds2_DMA_stop(2);
- }
- }
+ __dcache_writeback_all();
+ {
+ unsigned int i;
+ for (i = 0; i < calc_size; i += 512)
+ {
+ ds2_DMAcopy_32Byte (2 /* channel: emu internal */, ptr + i, ptr + i + 512, 512);
+ ds2_DMA_wait(2);
+ ds2_DMA_stop(2);
+ }
+ }
#else
- memmove (ptr, ptr + 512, calc_size);
+ memmove (ptr, ptr + 512, calc_size);
#endif
- HeaderCount++;
- FileSize -= 512;
- }
-
- ptr += FileSize;
- TotalFileSize += FileSize;
-
+ HeaderCount++;
+ FileSize -= 512;
+ }
- // check for multi file roms
+ ptr += FileSize;
+ TotalFileSize += FileSize;
- if ((ptr - ROM) < (maxsize + 0x200) &&
- (isdigit (ext [0]) && ext [1] == 0 && ext [0] < '9'))
- {
- more = TRUE;
- ext [0]++;
+
+ // check for multi file roms
+
+ if ((ptr - ROM) < (maxsize + 0x200) &&
+ (isdigit (ext [0]) && ext [1] == 0 && ext [0] < '9'))
+ {
+ more = TRUE;
+ ext [0]++;
#ifdef __WIN32__
- // memmove required: Overlapping addresses [Neb]
- memmove (&ext [1], &ext [0], 4);
- ext [0] = '.';
+ // memmove required: Overlapping addresses [Neb]
+ memmove (&ext [1], &ext [0], 4);
+ ext [0] = '.';
#endif
- _makepath (fname, drive, dir, name, ext);
- }
- else if (ptr - ROM < maxsize + 0x200 &&
- (((len = strlen (name)) == 7 || len == 8) &&
- strncasecmp (name, "sf", 2) == 0 &&
- isdigit (name [2]) && isdigit (name [3]) && isdigit (name [4]) &&
- isdigit (name [5]) && isalpha (name [len - 1])))
- {
- more = TRUE;
- name [len - 1]++;
+ _makepath (fname, drive, dir, name, ext);
+ }
+ else if (ptr - ROM < maxsize + 0x200 &&
+ (((len = strlen (name)) == 7 || len == 8) &&
+ strncasecmp (name, "sf", 2) == 0 &&
+ isdigit (name [2]) && isdigit (name [3]) && isdigit (name [4]) &&
+ isdigit (name [5]) && isalpha (name [len - 1])))
+ {
+ more = TRUE;
+ name [len - 1]++;
#ifdef __WIN32__
- // memmove required: Overlapping addresses [Neb]
- memmove (&ext [1], &ext [0], 4);
- ext [0] = '.';
+ // memmove required: Overlapping addresses [Neb]
+ memmove (&ext [1], &ext [0], 4);
+ ext [0] = '.';
#endif
- _makepath (fname, drive, dir, name, ext);
- }
- else
- more = FALSE;
+ _makepath (fname, drive, dir, name, ext);
+ }
+ else
+ more = FALSE;
- } while (more && (ROMFile = fopen (fname, "rb")) != NULL);
+ } while (more && (ROMFile = fopen (fname, "rb")) != NULL);
- break;
- }
-
if (HeaderCount == 0)
diff --git a/source/memmap.h b/source/memmap.h
index 3fb5b9c..ff216a0 100644
--- a/source/memmap.h
+++ b/source/memmap.h
@@ -137,11 +137,6 @@
#define BIGFIRST 2
#define SMALLFIRST 3
-//File Formats go here
-#define ZIP 0
-#define RAR 1
-#define DEFAULT 2
-
class CMemory {
public:
bool8 LoadROM (const char *);
diff --git a/source/pixform.h b/source/pixform.h
index 45cf651..b8f9faf 100644
--- a/source/pixform.h
+++ b/source/pixform.h
@@ -90,39 +90,6 @@
#ifndef _PIXFORM_H_
#define _PIXFORM_H_
-#ifdef GFX_MULTI_FORMAT
-
-enum { RGB565, RGB555, BGR565, BGR555, GBR565, GBR555, RGB5551 };
-
-#define BUILD_PIXEL(R,G,B) ((*GFX.BuildPixel) (R, G, B))
-#define BUILD_PIXEL2(R,G,B) ((*GFX.BuildPixel2) (R, G, B))
-#define DECOMPOSE_PIXEL(Pixel,R,G,B) ((*GFX.DecomposePixel) (Pixel, R,G,B))
-
-extern uint32 RED_LOW_BIT_MASK;
-extern uint32 GREEN_LOW_BIT_MASK;
-extern uint32 BLUE_LOW_BIT_MASK;
-extern uint32 RED_HI_BIT_MASK;
-extern uint32 GREEN_HI_BIT_MASK;
-extern uint32 BLUE_HI_BIT_MASK;
-extern uint32 MAX_RED;
-extern uint32 MAX_GREEN;
-extern uint32 MAX_BLUE;
-extern uint32 SPARE_RGB_BIT_MASK;
-extern uint32 GREEN_HI_BIT;
-extern uint32 RGB_LOW_BITS_MASK;
-extern uint32 RGB_HI_BITS_MASK;
-extern uint32 RGB_HI_BITS_MASKx2;
-extern uint32 RGB_REMOVE_LOW_BITS_MASK;
-extern uint32 FIRST_COLOR_MASK;
-extern uint32 SECOND_COLOR_MASK;
-extern uint32 THIRD_COLOR_MASK;
-extern uint32 ALPHA_BITS_MASK;
-extern uint32 FIRST_THIRD_COLOR_MASK;
-extern uint32 TWO_LOW_BITS_MASK;
-extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
-
-#endif
-
/* RGB565 format */
#define BUILD_PIXEL_RGB565(R,G,B) (((int) (R) << 11) | ((int) (G) << 6) | (int) (B))
#define BUILD_PIXEL2_RGB565(R,G,B) (((int) (R) << 11) | ((int) (G) << 5) | (int) (B))
@@ -263,7 +230,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define THIRD_COLOR_MASK_RGB5551 0x003e
#define ALPHA_BITS_MASK_RGB5551 0x0001
-#ifndef GFX_MULTI_FORMAT
+
#define CONCAT(X,Y) X##Y
/* C pre-processor needs a two stage macro define to enable it to concat
@@ -316,7 +283,6 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define TWO_LOW_BITS_MASK (RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 1))
#define HIGH_BITS_SHIFTED_TWO_MASK (( (FIRST_COLOR_MASK | SECOND_COLOR_MASK | THIRD_COLOR_MASK) & \
~TWO_LOW_BITS_MASK ) >> 2)
-#endif
#endif
diff --git a/source/port.h b/source/port.h
index 719fc18..44a6cdf 100644
--- a/source/port.h
+++ b/source/port.h
@@ -116,12 +116,9 @@
#else
#define PIXEL_FORMAT RGB565
#endif
-#define FOREVER_16_BIT
// The above is used to disable the 16-bit graphics mode checks sprinkled
// throughout the code, if the pixel format is always 16-bit.
-// #define GFX_MULTI_FORMAT
-
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#include "zlib.h"
@@ -137,7 +134,6 @@
#undef _MAX_PATH
#undef DEBUGGER /* Apple Universal Headers sometimes #define DEBUGGER */
-#undef GFX_MULTI_FORMAT
int strncasecmp(const char *s1, const char *s2, unsigned n);
int strcasecmp(const char *s1, const char *s2 );
diff --git a/source/ppu.cpp b/source/ppu.cpp
index f5d793f..4717f1d 100644
--- a/source/ppu.cpp
+++ b/source/ppu.cpp
@@ -3093,25 +3093,15 @@ void REGISTER_2122(uint8 Byte)
{
if ((Byte & 0x7f) != (PPU.CGDATA[PPU.CGADD] >> 8))
{
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
FLUSH_REDRAW ();
PPU.CGDATA[PPU.CGADD] &= 0x00FF;
PPU.CGDATA[PPU.CGADD] |= (Byte & 0x7f) << 8;
IPPU.ColorsChanged = TRUE;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
IPPU.Blue [PPU.CGADD] = IPPU.XB [(Byte >> 2) & 0x1f];
IPPU.Green [PPU.CGADD] = IPPU.XB [(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
IPPU.ScreenColors [PPU.CGADD] = (uint16) BUILD_PIXEL (IPPU.Red [PPU.CGADD],
IPPU.Green [PPU.CGADD],
IPPU.Blue [PPU.CGADD]);
-#ifndef FOREVER_16_BIT
- }
-#endif
}
PPU.CGADD++;
}
@@ -3119,25 +3109,15 @@ void REGISTER_2122(uint8 Byte)
{
if (Byte != (uint8) (PPU.CGDATA[PPU.CGADD] & 0xff))
{
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
-#endif
FLUSH_REDRAW ();
PPU.CGDATA[PPU.CGADD] &= 0x7F00;
PPU.CGDATA[PPU.CGADD] |= Byte;
IPPU.ColorsChanged = TRUE;
-#ifndef FOREVER_16_BIT
- if (Settings.SixteenBit)
- {
-#endif
IPPU.Red [PPU.CGADD] = IPPU.XB [Byte & 0x1f];
IPPU.Green [PPU.CGADD] = IPPU.XB [(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
IPPU.ScreenColors [PPU.CGADD] = (uint16) BUILD_PIXEL (IPPU.Red [PPU.CGADD],
IPPU.Green [PPU.CGADD],
IPPU.Blue [PPU.CGADD]);
-#ifndef FOREVER_16_BIT
- }
-#endif
}
}
PPU.CGFLIP ^= 1;
diff --git a/source/snes9x.h b/source/snes9x.h
index 72780cf..95a38e3 100644
--- a/source/snes9x.h
+++ b/source/snes9x.h
@@ -342,9 +342,6 @@ struct SSettings{
bool8 FixFrequency;
/* Graphics options */
-#ifndef FOREVER_16_BIT
- bool8 SixteenBit;
-#endif
bool8 Transparency;
bool8 SupportHiRes;
bool8 Mode7Interpolate;
diff --git a/source/soundux.cpp b/source/soundux.cpp
index 49c8fbf..10e0130 100644
--- a/source/soundux.cpp
+++ b/source/soundux.cpp
@@ -261,11 +261,6 @@ END_OF_FUNCTION(S9xSetEnvelopeRate);
void S9xSetSoundVolume (int channel, short volume_left, short volume_right)
{
Channel *ch = &SoundData.channels[channel];
-#ifndef FOREVER_STEREO
- if (!so.stereo)
- volume_left = (ABS(volume_right) + ABS(volume_left)) / 2;
-#endif
-
ch->volume_left = volume_left;
ch->volume_right = volume_right;
ch-> left_vol_level = (ch->envx * volume_left) / 128;
@@ -321,10 +316,7 @@ void S9xSetEchoFeedback (int feedback)
void S9xSetEchoDelay (int delay)
{
SoundData.echo_buffer_size = (512 * delay * so.playback_rate) / 32000;
-#ifndef FOREVER_STEREO
- if (so.stereo)
-#endif
- SoundData.echo_buffer_size <<= 1;
+ SoundData.echo_buffer_size <<= 1;
if (SoundData.echo_buffer_size)
SoundData.echo_ptr %= SoundData.echo_buffer_size;
else
@@ -1356,301 +1348,6 @@ stereo_exit: ;
END_OF_FUNCTION(MixStereo);
#endif
-#ifndef FOREVER_STEREO
-static inline void MixMono (int sample_count)
-{
- static int wave[SOUND_BUFFER_SIZE];
-
- int pitch_mod = SoundData.pitch_mod & (~APU.DSP[APU_NON]);
-
- for (uint32 J = 0; J < NUM_CHANNELS; J++)
- {
- Channel *ch = &SoundData.channels[J];
- unsigned long freq0 = ch->frequency;
-
- if (ch->state == SOUND_SILENT || !(so.sound_switch & (1 << J)))
- continue;
-
- // freq0 = (unsigned long) ((double) freq0 * 0.985);
-
- bool8 mod = pitch_mod & (1 << J);
-
- if (ch->needs_decode)
- {
- DecodeBlock(ch);
- ch->needs_decode = FALSE;
- ch->sample = ch->block[0];
- ch->sample_pointer = freq0 >> FIXED_POINT_SHIFT;
- if (ch->sample_pointer == 0)
- ch->sample_pointer = 1;
- if (ch->sample_pointer > SOUND_DECODE_LENGTH)
- ch->sample_pointer = SOUND_DECODE_LENGTH - 1;
- ch->next_sample = ch->block[ch->sample_pointer];
- ch->interpolate = 0;
-
- if (Settings.InterpolatedSound && freq0 < FIXED_POINT && !mod)
- ch->interpolate = ((ch->next_sample - ch->sample) *
- (long) freq0) / (long) FIXED_POINT;
- }
- int32 V = (ch->sample * ch->left_vol_level) / 128;
-
- for (uint32 I = 0; I < (uint32) sample_count; I++)
- {
-#ifdef ACCUMULATE_JOYPAD
-/*
- * This call allows NDSSFC to synchronise the DS controller more often.
- * If porting a later version of Snes9x into NDSSFC, it is essential to
- * preserve it.
- */
- if ((I & 0x7F) == 0x7F)
- NDSSFCAccumulateJoypad ();
-#endif
- unsigned long freq = freq0;
-
- if (mod)
- freq = PITCH_MOD(freq, wave [I]);
-
- ch->env_error += ch->erate;
- if (ch->env_error >= FIXED_POINT)
- {
- uint32 step = ch->env_error >> FIXED_POINT_SHIFT;
-
- switch (ch->state)
- {
- case SOUND_ATTACK:
- ch->env_error &= FIXED_POINT_REMAINDER;
- ch->envx += step << 1;
- ch->envxx = ch->envx << ENVX_SHIFT;
-
- if (ch->envx >= 126)
- {
- ch->envx = 127;
- ch->envxx = 127 << ENVX_SHIFT;
- ch->state = SOUND_DECAY;
- if (ch->sustain_level != 8)
- {
- S9xSetEnvRate (ch, ch->decay_rate, -1,
- (MAX_ENVELOPE_HEIGHT * ch->sustain_level)
- >> 3);
- break;
- }
- ch->state = SOUND_SUSTAIN;
- S9xSetEnvRate (ch, ch->sustain_rate, -1, 0);
- }
- break;
-
- case SOUND_DECAY:
- while (ch->env_error >= FIXED_POINT)
- {
- ch->envxx = (ch->envxx >> 8) * 255;
- ch->env_error -= FIXED_POINT;
- }
- ch->envx = ch->envxx >> ENVX_SHIFT;
- if (ch->envx <= ch->envx_target)
- {
- if (ch->envx <= 0)
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- ch->state = SOUND_SUSTAIN;
- S9xSetEnvRate (ch, ch->sustain_rate, -1, 0);
- }
- break;
-
- case SOUND_SUSTAIN:
- while (ch->env_error >= FIXED_POINT)
- {
- ch->envxx = (ch->envxx >> 8) * 255;
- ch->env_error -= FIXED_POINT;
- }
- ch->envx = ch->envxx >> ENVX_SHIFT;
- if (ch->envx <= 0)
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- break;
-
- case SOUND_RELEASE:
- while (ch->env_error >= FIXED_POINT)
- {
- ch->envxx -= (MAX_ENVELOPE_HEIGHT << ENVX_SHIFT) / 256;
- ch->env_error -= FIXED_POINT;
- }
- ch->envx = ch->envxx >> ENVX_SHIFT;
- if (ch->envx <= 0)
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- break;
-
- case SOUND_INCREASE_LINEAR:
- ch->env_error &= FIXED_POINT_REMAINDER;
- ch->envx += step << 1;
- ch->envxx = ch->envx << ENVX_SHIFT;
-
- if (ch->envx >= 126)
- {
- ch->envx = 127;
- ch->envxx = 127 << ENVX_SHIFT;
- ch->state = SOUND_GAIN;
- ch->mode = MODE_GAIN;
- S9xSetEnvRate (ch, 0, -1, 0);
- }
- break;
-
- case SOUND_INCREASE_BENT_LINE:
- if (ch->envx >= (MAX_ENVELOPE_HEIGHT * 3) / 4)
- {
- while (ch->env_error >= FIXED_POINT)
- {
- ch->envxx += (MAX_ENVELOPE_HEIGHT << ENVX_SHIFT) / 256;
- ch->env_error -= FIXED_POINT;
- }
- ch->envx = ch->envxx >> ENVX_SHIFT;
- }
- else
- {
- ch->env_error &= FIXED_POINT_REMAINDER;
- ch->envx += step << 1;
- ch->envxx = ch->envx << ENVX_SHIFT;
- }
-
- if (ch->envx >= 126)
- {
- ch->envx = 127;
- ch->envxx = 127 << ENVX_SHIFT;
- ch->state = SOUND_GAIN;
- ch->mode = MODE_GAIN;
- S9xSetEnvRate (ch, 0, -1, 0);
- }
- break;
-
- case SOUND_DECREASE_LINEAR:
- ch->env_error &= FIXED_POINT_REMAINDER;
- ch->envx -= step << 1;
- ch->envxx = ch->envx << ENVX_SHIFT;
- if (ch->envx <= 0)
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- break;
-
- case SOUND_DECREASE_EXPONENTIAL:
- while (ch->env_error >= FIXED_POINT)
- {
- ch->envxx = (ch->envxx >> 8) * 255;
- ch->env_error -= FIXED_POINT;
- }
- ch->envx = ch->envxx >> ENVX_SHIFT;
- if (ch->envx <= 0)
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- break;
-
- case SOUND_GAIN:
- S9xSetEnvRate (ch, 0, -1, 0);
- break;
- }
- ch->left_vol_level = (ch->envx * ch->volume_left) / 128;
- V = (ch->sample * ch->left_vol_level) / 128;
- }
-
- ch->count += freq;
- if (ch->count >= FIXED_POINT)
- {
- V = ch->count >> FIXED_POINT_SHIFT;
- ch->sample_pointer += V;
- ch->count &= FIXED_POINT_REMAINDER;
-
- ch->sample = ch->next_sample;
- if (ch->sample_pointer >= SOUND_DECODE_LENGTH)
- {
- if (JUST_PLAYED_LAST_SAMPLE(ch))
- {
- S9xAPUSetEndOfSample (J, ch);
- goto mono_exit;
- }
- do
- {
- ch->sample_pointer -= SOUND_DECODE_LENGTH;
- if (ch->last_block)
- {
- if (!ch->loop)
- {
- ch->sample_pointer = LAST_SAMPLE;
- ch->next_sample = ch->sample;
- break;
- }
- else
- {
- ch->last_block = FALSE;
- uint8 *dir = S9xGetSampleAddress (ch->sample_number);
- ch->block_pointer = READ_WORD(dir + 2);
- S9xAPUSetEndX (J);
- }
- }
- DecodeBlock (ch);
- } while (ch->sample_pointer >= SOUND_DECODE_LENGTH);
- if (!JUST_PLAYED_LAST_SAMPLE (ch))
- ch->next_sample = ch->block [ch->sample_pointer];
- }
- else
- ch->next_sample = ch->block [ch->sample_pointer];
-
- if (ch->type == SOUND_SAMPLE)
- {
- if (Settings.InterpolatedSound && freq < FIXED_POINT && !mod)
- {
- ch->interpolate = ((ch->next_sample - ch->sample) *
- (long) freq) / (long) FIXED_POINT;
- ch->sample = (int16) (ch->sample + (((ch->next_sample - ch->sample) *
- (long) (ch->count)) / (long) FIXED_POINT));
- }
- else
- ch->interpolate = 0;
- }
- else
- {
- for (;V > 0; V--)
- if ((so.noise_gen <<= 1) & 0x80000000L)
- so.noise_gen ^= 0x0040001L;
- ch->sample = (so.noise_gen << 17) >> 17;
- ch->interpolate = 0;
- }
- V = (ch->sample * ch-> left_vol_level) / 128;
- }
- else
- {
- if (ch->interpolate)
- {
- int32 s = (int32) ch->sample + ch->interpolate;
-
- CLIP16(s);
- ch->sample = (int16) s;
- V = (ch->sample * ch-> left_vol_level) / 128;
- }
- }
-
- MixBuffer [I] += V;
- ch->echo_buf_ptr [I] += V;
-
- if (pitch_mod & (1 << (J + 1)))
- wave [I] = ch->sample * ch->envx;
- }
-mono_exit: ;
- }
-}
-#ifdef __DJGPP
-END_OF_FUNCTION(MixMono);
-#endif
-#endif // !defined FOREVER_STEREO
-
#ifdef __sun
extern uint8 int2ulaw (int);
#endif
@@ -1674,22 +1371,10 @@ void S9xMixSamples (uint8 *buffer, int sample_count)
if (SoundData.echo_enable)
memset (EchoBuffer, 0, sample_count * sizeof (EchoBuffer [0]));
memset (MixBuffer, 0, sample_count * sizeof (MixBuffer [0]));
-
-#ifndef FOREVER_STEREO
- if (so.stereo)
-#endif
- MixStereo (sample_count);
-#ifndef FOREVER_STEREO
- else
- MixMono (sample_count);
-#endif
+ MixStereo (sample_count);
}
/* Mix and convert waveforms */
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
- {
-#endif
int byte_count = sample_count << 1;
// 16-bit sound
@@ -1701,10 +1386,6 @@ void S9xMixSamples (uint8 *buffer, int sample_count)
{
if (SoundData.echo_enable && SoundData.echo_buffer_size)
{
-#ifndef FOREVER_STEREO
- if (so.stereo)
- {
-#endif
// 16-bit stereo sound with echo enabled ...
if (FilterTapDefinitionBitfield == 0)
{
@@ -1760,64 +1441,6 @@ void S9xMixSamples (uint8 *buffer, int sample_count)
((signed short *) buffer)[J] = I;
}
}
-#ifndef FOREVER_STEREO
- }
- else
- {
- // 16-bit mono sound with echo enabled...
- if (FilterTapDefinitionBitfield == 0)
- {
- // ... no filter defined
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] *
- SoundData.master_volume [0] +
- E * SoundData.echo_volume [0]) / VOL_DIV16;
- CLIP16(I);
- ((signed short *) buffer)[J] = I;
- }
- }
- else
- {
- // ... with filter defined
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Loop [(Z - 0) & 7] = E;
- E = E * FilterTaps [0];
- if (FilterTapDefinitionBitfield & 0x02) E += Loop [(Z - 1) & 7] * FilterTaps [1];
- if (FilterTapDefinitionBitfield & 0x04) E += Loop [(Z - 2) & 7] * FilterTaps [2];
- if (FilterTapDefinitionBitfield & 0x08) E += Loop [(Z - 3) & 7] * FilterTaps [3];
- if (FilterTapDefinitionBitfield & 0x10) E += Loop [(Z - 4) & 7] * FilterTaps [4];
- if (FilterTapDefinitionBitfield & 0x20) E += Loop [(Z - 5) & 7] * FilterTaps [5];
- if (FilterTapDefinitionBitfield & 0x40) E += Loop [(Z - 6) & 7] * FilterTaps [6];
- if (FilterTapDefinitionBitfield & 0x80) E += Loop [(Z - 7) & 7] * FilterTaps [7];
- E /= 128;
- Z++;
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] * SoundData.master_volume [0] +
- E * SoundData.echo_volume [0]) / VOL_DIV16;
- CLIP16(I);
- ((signed short *) buffer)[J] = I;
- }
- }
- }
-#endif
}
else
{
@@ -1832,156 +1455,6 @@ void S9xMixSamples (uint8 *buffer, int sample_count)
}
}
}
-#ifndef FOREVER_16_BIT_SOUND
- }
- else
- {
- // 8-bit sound
- if (so.mute_sound)
- {
- memset (buffer, 128, sample_count);
- }
- else
-#ifdef __sun
- if (so.encoded)
- {
- for (J = 0; J < sample_count; J++)
- {
- I = (MixBuffer [J] * SoundData.master_volume_left) / VOL_DIV16;
- CLIP16(I);
- buffer[J] = int2ulaw (I);
- }
- }
- else
-#endif
- {
- if (SoundData.echo_enable && SoundData.echo_buffer_size)
- {
- if (so.stereo)
- {
- // 8-bit stereo sound with echo enabled...
- if (FilterTapDefinitionBitfield == 0)
- {
- // ... but no filter
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] *
- SoundData.master_volume [J & 1] +
- E * SoundData.echo_volume [J & 1]) / VOL_DIV8;
- CLIP8(I);
- buffer [J] = I + 128;
- }
- }
- else
- {
- // ... with filter
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Loop [(Z - 0) & 15] = E;
- E = E * FilterTaps [0];
- if (FilterTapDefinitionBitfield & 0x02) E += Loop [(Z - 2) & 15] * FilterTaps [1];
- if (FilterTapDefinitionBitfield & 0x04) E += Loop [(Z - 4) & 15] * FilterTaps [2];
- if (FilterTapDefinitionBitfield & 0x08) E += Loop [(Z - 6) & 15] * FilterTaps [3];
- if (FilterTapDefinitionBitfield & 0x10) E += Loop [(Z - 8) & 15] * FilterTaps [4];
- if (FilterTapDefinitionBitfield & 0x20) E += Loop [(Z - 10) & 15] * FilterTaps [5];
- if (FilterTapDefinitionBitfield & 0x40) E += Loop [(Z - 12) & 15] * FilterTaps [6];
- if (FilterTapDefinitionBitfield & 0x80) E += Loop [(Z - 14) & 15] * FilterTaps [7];
- E /= 128;
- Z++;
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] *
- SoundData.master_volume [J & 1] +
- E * SoundData.echo_volume [J & 1]) / VOL_DIV8;
- CLIP8(I);
- buffer [J] = I + 128;
- }
- }
- }
- else
- {
- // 8-bit mono sound with echo enabled...
- if (FilterTapDefinitionBitfield == 0)
- {
- // ... but no filter.
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] * SoundData.master_volume [0] +
- E * SoundData.echo_volume [0]) / VOL_DIV8;
- CLIP8(I);
- buffer [J] = I + 128;
- }
- }
- else
- {
- // ... with filter.
- for (J = 0; J < sample_count; J++)
- {
- int E = Echo [SoundData.echo_ptr];
-
- Loop [(Z - 0) & 7] = E;
- E = E * FilterTaps [0];
- if (FilterTapDefinitionBitfield & 0x02) E += Loop [(Z - 1) & 7] * FilterTaps [1];
- if (FilterTapDefinitionBitfield & 0x04) E += Loop [(Z - 2) & 7] * FilterTaps [2];
- if (FilterTapDefinitionBitfield & 0x08) E += Loop [(Z - 3) & 7] * FilterTaps [3];
- if (FilterTapDefinitionBitfield & 0x10) E += Loop [(Z - 4) & 7] * FilterTaps [4];
- if (FilterTapDefinitionBitfield & 0x20) E += Loop [(Z - 5) & 7] * FilterTaps [5];
- if (FilterTapDefinitionBitfield & 0x40) E += Loop [(Z - 6) & 7] * FilterTaps [6];
- if (FilterTapDefinitionBitfield & 0x80) E += Loop [(Z - 7) & 7] * FilterTaps [7];
- E /= 128;
- Z++;
-
- Echo [SoundData.echo_ptr] = (E * SoundData.echo_feedback) / 128 +
- EchoBuffer [J];
-
- if ((SoundData.echo_ptr += 1) >= SoundData.echo_buffer_size)
- SoundData.echo_ptr = 0;
-
- I = (MixBuffer [J] * SoundData.master_volume [0] +
- E * SoundData.echo_volume [0]) / VOL_DIV8;
- CLIP8(I);
- buffer [J] = I + 128;
- }
- }
- }
- }
- else
- {
- // 8-bit mono or stereo sound, no echo
- for (J = 0; J < sample_count; J++)
- {
- I = (MixBuffer [J] *
- SoundData.master_volume [J & 1]) / VOL_DIV8;
- CLIP8(I);
- buffer [J] = I + 128;
- }
- }
- }
- }
-#endif
}
#ifdef __DJGPP
@@ -2072,12 +1545,6 @@ bool8 S9xInitSound (int mode, bool8 stereo, int buffer_size)
so.playback_rate = 0;
so.buffer_size = 0;
-#ifndef FOREVER_STEREO
- so.stereo = stereo;
-#endif
-#ifndef FOREVER_16_BIT_SOUND
- so.sixteen_bit = Settings.SixteenBitSound;
-#endif
so.encoded = FALSE;
S9xResetSound (TRUE);
@@ -2088,13 +1555,8 @@ bool8 S9xInitSound (int mode, bool8 stereo, int buffer_size)
S9xSetSoundMute (TRUE);
if (!S9xOpenSoundDevice (mode, stereo, buffer_size))
{
-#ifdef NOSOUND
- S9xMessage (S9X_WARNING, S9X_SOUND_NOT_BUILT,
- "No sound support compiled in");
-#else
S9xMessage (S9X_ERROR, S9X_SOUND_DEVICE_OPEN_FAILED,
"Sound device open failed");
-#endif
return (0);
}
diff --git a/source/soundux.h b/source/soundux.h
index fb765c6..2426070 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -125,12 +125,6 @@ typedef struct {
// int noise_gen;
// Moved to soundux.cpp's noise_gen; this doesn't need volatility! [Neb]
bool8 mute_sound;
-#ifndef FOREVER_STEREO
- int stereo;
-#endif
-#ifndef FOREVER_16_BIT_SOUND
- bool8 sixteen_bit;
-#endif
bool8 encoded;
#ifdef __sun
int last_eof;
diff --git a/source/spc7110.cpp b/source/spc7110.cpp
index 8169989..3ae0cfd 100644
--- a/source/spc7110.cpp
+++ b/source/spc7110.cpp
@@ -87,8 +87,6 @@
Nintendo Co., Limited and its subsidiary companies.
*******************************************************************************/
-//#define SPC7110_DEBUG
-
#include "spc7110.h"
#include "memmap.h"
#include <time.h>
@@ -528,9 +526,6 @@ extern "C"{
//reads SPC7110 and RTC registers.
uint8 S9xGetSPC7110(uint16 Address)
{
-#ifdef SPC7110_DEBUG
- printf("%04X read\n", Address);
-#endif
switch (Address)
{
//decompressed data read port. decrements 4809-A (with wrap)
@@ -557,9 +552,6 @@ uint8 S9xGetSPC7110(uint16 Address)
s7r.bank50Internal++;
s7r.bank50Internal%=DECOMP_BUFFER_SIZE;
-#ifdef SPC7110_DEBUG
- printf("Returned %02X\n", s7r.reg4800);
-#endif
}
return s7r.reg4800;
//table register low
@@ -721,11 +713,7 @@ uint8 S9xGetSPC7110(uint16 Address)
}
}
}
-
-#ifdef SPC7110_DEBUG
- printf("Returned %02X\n", tmp);
-#endif
-
+
i%=s7r.DataRomSize;
s7r.reg4811=i&0x00FF;
s7r.reg4812=(i&0x00FF00)>>8;
@@ -818,9 +806,6 @@ uint8 S9xGetSPC7110(uint16 Address)
}
}
}
-#ifdef SPC7110_DEBUG
- printf("Returned %02X\n", tmp);
-#endif
return tmp;
}
else return 0;
@@ -900,9 +885,6 @@ uint8 S9xGetSPC7110(uint16 Address)
uint8 tmp=rtc_f9.reg[rtc_f9.index];
rtc_f9.index++;
rtc_f9.index%=0x10;
-#ifdef SPC7110_DEBUG
- printf("$4841 returned %02X\n", tmp);
-#endif
return tmp;
}
else return 0;
@@ -913,18 +895,12 @@ uint8 S9xGetSPC7110(uint16 Address)
s7r.reg4842^=0x80;
return s7r.reg4842^0x80;
default:
-#ifdef SPC7110_DEBUG
- printf("Access to Reg %04X\n", Address);
-#endif
return 0x00;
}
}
}
void S9xSetSPC7110 (uint8 data, uint16 Address)
{
-#ifdef SPC7110_DEBUG
- printf("%04X written to, value %02X\n", Address, data);
-#endif
switch(Address)
{
//Writes to $4800 are undefined.
diff --git a/source/tile.cpp b/source/tile.cpp
index 332580a..3dcab74 100644
--- a/source/tile.cpp
+++ b/source/tile.cpp
@@ -217,244 +217,6 @@ static uint8 ConvertTile (uint8 *pCache, uint32 TileAddr)
}
#define PLOT_PIXEL(screen, pixel) (pixel)
-#ifndef FOREVER_16_BIT
-static void WRITE_4PIXELS (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
- {
- Screen [N] = (uint8) ScreenColors [Pixel];
- Depth [N] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELS_FLIPPED (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N] && (Pixel = Pixels[3 - N]))
- {
- Screen [N] = (uint8) ScreenColors [Pixel];
- Depth [N] = GFX.Z2;
- }
- }
-}
-static void WRITE_4PIXELS_HALFWIDTH (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N += 2)
- {
- if (GFX.Z1 > Depth [N] && (Pixel = Pixels[N]))
- {
- Screen [N >> 1] = (uint8) ScreenColors [Pixel];
- Depth [N >> 1] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELS_FLIPPED_HALFWIDTH (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N += 2)
- {
- if (GFX.Z1 > Depth [N] && (Pixel = Pixels[2 - N]))
- {
- Screen [N >> 1] = (uint8) ScreenColors [Pixel];
- Depth [N >> 1] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELSx2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N * 2] && (Pixel = Pixels[N]))
- {
- Screen [N * 2] = Screen [N * 2 + 1] = (uint8) ScreenColors [Pixel];
- Depth [N * 2] = Depth [N * 2 + 1] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELS_FLIPPEDx2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N * 2] && (Pixel = Pixels[3 - N]))
- {
- Screen [N * 2] = Screen [N * 2 + 1] = (uint8) ScreenColors [Pixel];
- Depth [N * 2] = Depth [N * 2 + 1] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELSx2x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N * 2] && (Pixel = Pixels[N]))
- {
- Screen [N * 2] = Screen [N * 2 + 1] = Screen [GFX.RealPitch + N * 2] = Screen [GFX.RealPitch + N * 2 + 1] = (uint8) ScreenColors [Pixel];
- Depth [N * 2] = Depth [N * 2 + 1] = Depth [GFX.RealPitch + N * 2] = Depth [GFX.RealPitch + N * 2 + 1] = GFX.Z2;
- }
- }
-}
-
-static void WRITE_4PIXELS_FLIPPEDx2x2 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
-{
- uint8 Pixel;
- uint8 *Screen = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
-
- for (uint8 N = 0; N < 4; N++)
- {
- if (GFX.Z1 > Depth [N * 2] && (Pixel = Pixels[3 - N]))
- {
- Screen [N * 2] = Screen [N * 2 + 1] = Screen [GFX.RealPitch + N * 2] = Screen [GFX.RealPitch + N * 2 + 1] = (uint8) ScreenColors [Pixel];
- Depth [N * 2] = Depth [N * 2 + 1] = Depth [GFX.RealPitch + N * 2] = Depth [GFX.RealPitch + N * 2 + 1] = GFX.Z2;
- }
- }
-}
-
-void DrawTile (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *bp;
-
- RENDER_TILE(WRITE_4PIXELS, WRITE_4PIXELS_FLIPPED, 4)
-}
-
-void DrawClippedTile (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
- register uint8 *bp;
-
- TILE_CLIP_PREAMBLE
- RENDER_CLIPPED_TILE(WRITE_4PIXELS, WRITE_4PIXELS_FLIPPED, 4)
-}
-
-void DrawTileHalfWidth (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *bp;
-
- RENDER_TILE(WRITE_4PIXELS_HALFWIDTH, WRITE_4PIXELS_FLIPPED_HALFWIDTH, 2)
-}
-
-void DrawClippedTileHalfWidth (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
- register uint8 *bp;
-
- TILE_CLIP_PREAMBLE
- RENDER_CLIPPED_TILE(WRITE_4PIXELS_HALFWIDTH, WRITE_4PIXELS_FLIPPED_HALFWIDTH, 2)
-}
-
-void DrawTilex2 (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *bp;
-
- RENDER_TILE(WRITE_4PIXELSx2, WRITE_4PIXELS_FLIPPEDx2, 8)
-}
-
-void DrawClippedTilex2 (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
- register uint8 *bp;
-
- TILE_CLIP_PREAMBLE
- RENDER_CLIPPED_TILE(WRITE_4PIXELSx2, WRITE_4PIXELS_FLIPPEDx2, 8)
-}
-
-void DrawTilex2x2 (uint32 Tile, int32 Offset, uint32 StartLine,
- uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *bp;
-
- RENDER_TILE(WRITE_4PIXELSx2x2, WRITE_4PIXELS_FLIPPEDx2x2, 8)
-}
-
-void DrawClippedTilex2x2 (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Width,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
- register uint8 *bp;
-
- TILE_CLIP_PREAMBLE
- RENDER_CLIPPED_TILE(WRITE_4PIXELSx2x2, WRITE_4PIXELS_FLIPPEDx2x2, 8)
-}
-
-void DrawLargePixel (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *sp = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
- uint8 pixel;
-
- RENDER_TILE_LARGE (((uint8) ScreenColors [pixel]), PLOT_PIXEL)
-}
-
-void DrawLargePixelHalfWidth (uint32 Tile, int32 Offset,
- uint32 StartPixel, uint32 Pixels,
- uint32 StartLine, uint32 LineCount)
-{
- TILE_PREAMBLE
-
- register uint8 *sp = GFX.S + Offset;
- uint8 *Depth = GFX.DB + Offset;
- uint8 pixel;
-
- RENDER_TILE_LARGE_HALFWIDTH (((uint8) ScreenColors [pixel]), PLOT_PIXEL)
-}
-#endif
static void WRITE_4PIXELS16 (int32 Offset, uint8 *Pixels, uint16 *ScreenColors)
{