From f453201fa149d3e2a85f0b466b1c67c6c90d54e0 Mon Sep 17 00:00:00 2001 From: Dwedit Date: Fri, 30 Mar 2018 22:35:35 -0500 Subject: Add support for Audio/Video Disable flags Add support for Hard Disable Audio Fix frame discarding causing infinite loops Fix MSVC building --- libretro.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'libretro.c') diff --git a/libretro.c b/libretro.c index 47729b0..43dad13 100644 --- a/libretro.c +++ b/libretro.c @@ -428,6 +428,8 @@ static int32_t samples_to_play = 0; void retro_run(void) { bool updated = false; + int result; + bool okay; #ifndef USE_BLARGG_APU static int16_t audio_buf[2048]; #endif @@ -440,6 +442,24 @@ void retro_run(void) IPPU.RenderThisFrame = false; #endif + result = -1; + okay = environ_cb(RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE, &result); + if (okay) + { + bool audioEnabled = 0 != (result & 2); + bool videoEnabled = 0 != (result & 1); + bool hardDisableAudio = 0 != (result & 8); + IPPU.RenderThisFrame = videoEnabled; + S9xSetSoundMute(!audioEnabled || hardDisableAudio); + Settings.HardDisableAudio = hardDisableAudio; + } + else + { + IPPU.RenderThisFrame = true;; + S9xSetSoundMute(false); + Settings.HardDisableAudio = false; + } + poll_cb(); RETRO_PERFORMANCE_INIT(S9xMainLoop_func); -- cgit v1.2.3