libretro: Fix runtime aspect ratio changes not applying

This commit is contained in:
Connor McLaughlin 2020-10-28 17:32:59 +10:00
parent 0b84433533
commit 451c48406d
3 changed files with 13 additions and 1 deletions

View File

@ -89,6 +89,7 @@ public:
virtual void SetVSync(bool enabled) = 0; virtual void SetVSync(bool enabled) = 0;
const s32 GetDisplayTopMargin() const { return m_display_top_margin; } const s32 GetDisplayTopMargin() const { return m_display_top_margin; }
const float GetDisplayAspectRatio() const { return m_display_aspect_ratio; }
void ClearDisplayTexture() void ClearDisplayTexture()
{ {

View File

@ -103,6 +103,8 @@ bool LibretroHostInterface::Initialize()
LoadSettings(); LoadSettings();
FixIncompatibleSettings(true); FixIncompatibleSettings(true);
UpdateLogging(); UpdateLogging();
m_last_aspect_ratio = Settings::GetDisplayAspectRatioValue(g_settings.display_aspect_ratio);
return true; return true;
} }
@ -226,7 +228,7 @@ void LibretroHostInterface::GetSystemAVInfo(struct retro_system_av_info* info, b
std::memset(info, 0, sizeof(*info)); std::memset(info, 0, sizeof(*info));
info->geometry.aspect_ratio = Settings::GetDisplayAspectRatioValue(g_settings.display_aspect_ratio); info->geometry.aspect_ratio = m_last_aspect_ratio;
info->geometry.base_width = 320; info->geometry.base_width = 320;
info->geometry.base_height = 240; info->geometry.base_height = 240;
info->geometry.max_width = GPU::VRAM_WIDTH * resolution_scale; info->geometry.max_width = GPU::VRAM_WIDTH * resolution_scale;
@ -334,6 +336,13 @@ void LibretroHostInterface::retro_run_frame()
System::RunFrame(); System::RunFrame();
const float aspect_ratio = m_display->GetDisplayAspectRatio();
if (aspect_ratio != m_last_aspect_ratio)
{
m_last_aspect_ratio = aspect_ratio;
UpdateGeometry();
}
m_display->Render(); m_display->Render();
} }

View File

@ -97,6 +97,8 @@ private:
bool m_rumble_interface_valid = false; bool m_rumble_interface_valid = false;
bool m_supports_input_bitmasks = false; bool m_supports_input_bitmasks = false;
bool m_interfaces_initialized = false; bool m_interfaces_initialized = false;
float m_last_aspect_ratio = 4.0f / 3.0f;
}; };
extern LibretroHostInterface g_libretro_host_interface; extern LibretroHostInterface g_libretro_host_interface;