From df919faa574499cb52b3d38d582d25542ba21d9b Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Fri, 18 Oct 2024 08:59:30 +0100 Subject: [PATCH] Update vertical aspect ratio for proper VERT+ support --- UnleashedRecomp/game.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/UnleashedRecomp/game.cpp b/UnleashedRecomp/game.cpp index b605763..88f600c 100644 --- a/UnleashedRecomp/game.cpp +++ b/UnleashedRecomp/game.cpp @@ -25,9 +25,15 @@ bool CameraAspectRatioMidAsmHook(PPCRegister& r31) auto pCamera = (SWA::CCamera*)g_memory.Translate(r31.u32); auto newAspectRatio = (float)Window::s_width / (float)Window::s_height; - // Dynamically adjust aspect ratio to window dimensions. + // Dynamically adjust horizontal aspect ratio to window dimensions. pCamera->m_HorzAspectRatio = newAspectRatio; + if (auto s_pVertAspectRatio = (be*)g_memory.Translate(0x82028FE0)) + { + // Dynamically adjust vertical aspect ratio for VERT+. + *s_pVertAspectRatio = 2.0f * atan(tan(45.0f / 2.0f) * (m_baseAspectRatio / newAspectRatio)); + } + // Jump to 4:3 code for VERT+ adjustments if using a narrow aspect ratio. return newAspectRatio < m_baseAspectRatio; } @@ -43,7 +49,7 @@ void CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0) } else { - // Use vertical FOV for normal aspect ratios. + // Use vertical FOV for wide aspect ratios. f0.f32 = pCamera->m_VertFieldOfView; } }