summaryrefslogtreecommitdiff
path: root/libretro
diff options
context:
space:
mode:
authoraliaspider2015-11-13 01:31:23 +0100
committeraliaspider2015-11-13 01:31:23 +0100
commit3ee8270a6cf4f6291ceb85e001e1dd147e4d53da (patch)
tree20a9bbbe8dccac1ba556bd53f583366449b04cda /libretro
parentfeb7ddabab930359c045128134d942894ff5f4f8 (diff)
downloadsnes9x2002-3ee8270a6cf4f6291ceb85e001e1dd147e4d53da.tar.gz
snes9x2002-3ee8270a6cf4f6291ceb85e001e1dd147e4d53da.tar.bz2
snes9x2002-3ee8270a6cf4f6291ceb85e001e1dd147e4d53da.zip
can be built and run for non arm platforms, gfx not working.
Diffstat (limited to 'libretro')
-rw-r--r--libretro/libretro.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/libretro/libretro.c b/libretro/libretro.c
index 930053b..1f409d7 100644
--- a/libretro/libretro.c
+++ b/libretro/libretro.c
@@ -247,8 +247,9 @@ static void snes_init (void)
Settings.TurboSkipFrames = 15;
Settings.ThreadSound = FALSE;
Settings.SoundSync = FALSE;
+#ifdef ASMCPU
Settings.asmspc700 = TRUE;
-// Settings.asmspc700 = FALSE;
+#endif
Settings.SpeedHacks = TRUE;
Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
@@ -306,16 +307,21 @@ static void snes_init (void)
GFX.Pitch = use_overscan ? 1024 : 2048;
+ const int safety = 128;
// hack to make sure GFX.Delta is always (2048 * 512 * 2) >> 1, needed for tile16_t.h
#ifdef _3DS
- GFX.Screen = (uint8 *) linearMemAlign(2048 * 512 * 2 * 2, 0x80);
+ GFX.Screen_buffer = (uint8 *) linearMemAlign(2048 * 512 * 2 * 2 + safety, 0x80);
memset(GFX.Screen, 0x0, 2048 * 512 * 2 * 2);
#else
- GFX.Screen = (uint8 *) calloc(1, 2048 * 512 * 2 * 2);
+ GFX.Screen_buffer = (uint8 *) calloc(1, 2048 * 512 * 2 * 2 + safety);
#endif
+ GFX.Screen = GFX.Screen_buffer + safety;
+
GFX.SubScreen = GFX.Screen + 2048 * 512 * 2;
- GFX.ZBuffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
- GFX.SubZBuffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
+ GFX.ZBuffer_buffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16) + safety);
+ GFX.ZBuffer = GFX.ZBuffer_buffer + safety;
+ GFX.SubZBuffer_buffer = (uint8 *) calloc(1, GFX.Pitch * 512 * sizeof(uint16) + safety);
+ GFX.SubZBuffer = GFX.SubZBuffer_buffer + safety;
GFX.Delta = 1048576; //(GFX.SubScreen - GFX.Screen) >> 1;
if (GFX.Delta != ((GFX.SubScreen - GFX.Screen) >> 1))
@@ -356,13 +362,25 @@ void retro_deinit(void)
MemoryDeinit();
S9xGraphicsDeinit();
//S9xUnmapAllControls();
- if(GFX.Screen)
+ if(GFX.Screen_buffer)
#ifdef _3DS
- linearFree(GFX.Screen);
+ linearFree(GFX.Screen_buffer);
#else
- free(GFX.Screen);
+ free(GFX.Screen_buffer);
#endif
+ GFX.Screen_buffer = NULL;
GFX.Screen = NULL;
+ GFX.SubScreen = NULL;
+
+ if(GFX.ZBuffer_buffer)
+ free(GFX.ZBuffer_buffer);
+ GFX.ZBuffer_buffer = NULL;
+
+ if(GFX.SubZBuffer_buffer)
+ free(GFX.SubZBuffer_buffer);
+
+ GFX.SubZBuffer_buffer = NULL;
+
}
@@ -510,7 +528,6 @@ bool retro_load_game(const struct retro_game_info *game)
//S9xGraphicsInit();
S9xReset();
-// Settings.asmspc700 = false;
CPU.APU_APUExecuting = Settings.APUEnabled = 1;
Settings.SixteenBitSound = true;
so.stereo = Settings.Stereo;