diff options
-rw-r--r-- | libretro.c | 22 | ||||
-rw-r--r-- | source/ppu.c | 5 |
2 files changed, 26 insertions, 1 deletions
@@ -273,8 +273,11 @@ void init_sfc_setting(void) Settings.Transparency = TRUE; Settings.SupportHiRes = TRUE; Settings.ThreadSound = FALSE; - Settings.SoundSync = TRUE; +#ifdef USE_BLARGG_APU + Settings.SoundSync = FALSE; +#else Settings.ApplyCheats = TRUE; +#endif Settings.StretchScreenshots = 1; Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX; @@ -286,6 +289,20 @@ void S9xAutoSaveSRAM() SaveSRAM(S9xGetFilename("srm")); } +#ifdef USE_BLARGG_APU +static void S9xAudioCallback() +{ + size_t avail; + /* Just pick a big buffer. We won't use it all. */ + static int16_t audio_buf[0x10000]; + + S9xFinalizeSamples(); + avail = S9xGetSampleCount(); + S9xMixSamples(audio_buf, avail); + audio_batch_cb(audio_buf, avail >> 1); +} +#endif + void retro_init(void) { struct retro_log_callback log; @@ -308,6 +325,7 @@ void retro_init(void) S9xInitGFX(); #ifdef USE_BLARGG_APU S9xInitSound(16, 0); + S9xSetSamplesAvailableCallback(S9xAudioCallback); #else S9xInitSound(Settings.SoundPlaybackRate, TRUE, @@ -386,6 +404,7 @@ void retro_run(void) S9xMainLoop(); RETRO_PERFORMANCE_STOP(S9xMainLoop_func); +#ifndef USE_BLARGG_APU static int16_t audio_buf[2048]; samples_to_play += samples_per_frame; @@ -396,6 +415,7 @@ void retro_run(void) audio_batch_cb(audio_buf, (int)samples_to_play); samples_to_play -= (int)samples_to_play; } +#endif #ifdef NO_VIDEO_OUTPUT return; diff --git a/source/ppu.c b/source/ppu.c index bc28114..03b8949 100644 --- a/source/ppu.c +++ b/source/ppu.c @@ -898,6 +898,8 @@ void S9xSetPPU(uint8 Byte, uint16 Address) IAPU.WaitCounter++; #endif #endif // SPCTOOL +#else + S9xAPUWritePort(Address & 3, Byte); #endif // #ifndef USE_BLARGG_APU break; case 0x2180: @@ -1323,6 +1325,9 @@ uint8 S9xGetPPU(uint16 Address) return ((r >> 3) & 0xff); } return (Memory.FillRAM[Address]); + +#else + return (S9xAPUReadPort(Address & 3)); #endif // SPCTOOL case 0x2180: |