mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-19 14:32:19 +00:00
Update vertical aspect ratio for proper VERT+ support
This commit is contained in:
parent
52f751c6c8
commit
df919faa57
1 changed files with 8 additions and 2 deletions
|
|
@ -25,9 +25,15 @@ bool CameraAspectRatioMidAsmHook(PPCRegister& r31)
|
||||||
auto pCamera = (SWA::CCamera*)g_memory.Translate(r31.u32);
|
auto pCamera = (SWA::CCamera*)g_memory.Translate(r31.u32);
|
||||||
auto newAspectRatio = (float)Window::s_width / (float)Window::s_height;
|
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;
|
pCamera->m_HorzAspectRatio = newAspectRatio;
|
||||||
|
|
||||||
|
if (auto s_pVertAspectRatio = (be<float>*)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.
|
// Jump to 4:3 code for VERT+ adjustments if using a narrow aspect ratio.
|
||||||
return newAspectRatio < m_baseAspectRatio;
|
return newAspectRatio < m_baseAspectRatio;
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +49,7 @@ void CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use vertical FOV for normal aspect ratios.
|
// Use vertical FOV for wide aspect ratios.
|
||||||
f0.f32 = pCamera->m_VertFieldOfView;
|
f0.f32 = pCamera->m_VertFieldOfView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue