mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-01-04 10:41:35 -06:00
Implemented CSD aspect ratio hooks
This only includes the centred mode, as the intention is to map out CSD classes in the API and handle the rest manually. Co-Authored-By: Michael <15317421+ActualMandM@users.noreply.github.com>
This commit is contained in:
@@ -43,3 +43,31 @@ void CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0)
|
||||
f0.f32 = pCamera->m_VertFieldOfView;
|
||||
}
|
||||
}
|
||||
|
||||
void CSDAspectRatioMidAsmHook(PPCRegister& f1, PPCRegister& f2)
|
||||
{
|
||||
auto newAspectRatio = (float)Window::s_width / (float)Window::s_height;
|
||||
|
||||
if (newAspectRatio > m_baseAspectRatio)
|
||||
{
|
||||
f1.f64 = 1280.0f / ((newAspectRatio * 720.0f) / 1280.0f);
|
||||
}
|
||||
else if (newAspectRatio < m_baseAspectRatio)
|
||||
{
|
||||
f2.f64 = 720.0f / ((1280.0f / newAspectRatio) / 720.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void CSDOffsetMidAsmHook(PPCRegister& f1, PPCRegister& f2)
|
||||
{
|
||||
auto newAspectRatio = (float)Window::s_width / (float)Window::s_height;
|
||||
|
||||
if (newAspectRatio > m_baseAspectRatio)
|
||||
{
|
||||
*(be<float>*)g_memory.Translate(0x8339C5D0) = ((newAspectRatio * 720.0f) - 1280.0f) / 2.0f / 1280.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(be<float>*)g_memory.Translate(0x8339C5D4) = ((1280.0f / newAspectRatio) - 720.0f) / 2.0f / 720.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user