camera_patches: fix FOV at narrow aspect ratios

mobile gaming is back on the menu
This commit is contained in:
Hyper 2024-11-20 21:50:42 +00:00
parent 5944abe1a7
commit 49b6b0e262
2 changed files with 8 additions and 7 deletions

View file

@ -23,20 +23,20 @@ bool CameraAspectRatioMidAsmHook(PPCRegister& r31)
return newAspectRatio < m_baseAspectRatio;
}
void CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0)
bool CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0, PPCRegister& f10, PPCRegister& f12)
{
auto pCamera = (SWA::CCamera*)g_memory.Translate(r31.u32);
if (Window::s_width < Window::s_height)
{
// Use horizontal FOV for narrow aspect ratios.
f0.f32 = pCamera->m_HorzFieldOfView;
pCamera->m_VertFieldOfView = pCamera->m_HorzFieldOfView + f10.f64;
}
else
{
// Use vertical FOV for wide aspect ratios.
f0.f32 = pCamera->m_VertFieldOfView;
pCamera->m_VertFieldOfView = (f12.f64 / f0.f64) + f10.f64;
}
return true;
}
PPC_FUNC_IMPL(__imp__sub_824697B0);

View file

@ -98,8 +98,9 @@ jump_address_on_false = 0x82468EE0
[[midasm_hook]]
name = "CameraBoostAspectRatioMidAsmHook"
address = 0x8246BDA8
registers = ["r31", "f0"]
address = 0x8246BDA0
registers = ["r31", "f0", "f10", "f12"]
jump_address_on_true = 0x8246BDAC
[[midasm_hook]]
name = "CSDAspectRatioMidAsmHook"