Libretro: Prevent resolution change on startup

This commit is contained in:
Sour 2018-01-10 17:24:40 -05:00
parent 4306320f80
commit 6ee1f23fd2
2 changed files with 26 additions and 2 deletions

View file

@ -48,7 +48,7 @@ public:
}
}
void GetSystemAudioVideoInfo(retro_system_av_info &info, int32_t maxHeight = 0, int32_t maxWidth = 0)
void GetSystemAudioVideoInfo(retro_system_av_info &info, int32_t maxWidth = 0, int32_t maxHeight = 0)
{
info.timing.fps = Console::GetModel() == NesModel::NTSC ? 60.098811862348404716732985230828 : 50.006977968268290848936010226333;
info.timing.sample_rate = 48000;
@ -70,6 +70,11 @@ public:
info.geometry.max_width = maxWidth;
info.geometry.max_height = maxHeight;
if(maxHeight > 0 && maxWidth > 0) {
_previousWidth = maxWidth;
_previousHeight = maxHeight;
}
}
void SetCallbacks(retro_video_refresh_t sendFrame, retro_environment_t retroEnv)

View file

@ -12,6 +12,7 @@
#include "../Core/VideoRenderer.h"
#include "../Core/EmulationSettings.h"
#include "../Core/CheatManager.h"
#include "../Core/HdData.h"
#include "../Core/DebuggerTypes.h"
#include "../Utilities/FolderUtilities.h"
#include "../Utilities/HexUtilities.h"
@ -973,7 +974,25 @@ extern "C" {
RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info)
{
_renderer->GetSystemAudioVideoInfo(*info, 256, 240);
uint32_t scale = 1;
switch(EmulationSettings::GetVideoFilterType()) {
case VideoFilterType::NTSC: scale = 2; break;
case VideoFilterType::BisqwitNtscQuarterRes: scale = 2; break;
case VideoFilterType::BisqwitNtscHalfRes: scale = 4; break;
case VideoFilterType::BisqwitNtsc: scale = 8; break;
default: scale = 1; break;
}
HdPackData* hdData = Console::GetHdData();
if(hdData != nullptr) {
scale = hdData->Scale;
}
if(scale <= 2) {
_renderer->GetSystemAudioVideoInfo(*info, NES_NTSC_OUT_WIDTH(256), 240 * 2);
} else {
_renderer->GetSystemAudioVideoInfo(*info, 256 * scale, 240 * scale);
}
}
RETRO_API void *retro_get_memory_data(unsigned id)