I see that there are no standard ways to tell a core that video or audio is disabled, so I’d like to add that in. What would be the best way to standardize this?
Edit: just made this up:
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
case RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE:
{
int result = 0;
if (!audio_driver_is_suspended())
{
result |= 2;
}
if (video_driver_is_active())
{
result |= 1;
}
if (data != NULL)
{
int* result_p = (int*)data;
*result_p = result;
}
}
break;
Then I made this change to Snes9x:
int result = -1;
bool okay = environ_cb(RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE, &result);
if (okay && result != -1)
{
bool audioEnabled = 0 != (result & 2);
bool videoEnabled = 0 != (result & 1);
IPPU.RenderThisFrame = videoEnabled;
S9xSetSoundMute(!audioEnabled);
}
During times when audio and video were suspended, I got a performance boost. Nice.