mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00: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:
parent
3c1c13e4ce
commit
554be01412
2 changed files with 40 additions and 1 deletions
|
|
@ -43,3 +43,31 @@ void CameraBoostAspectRatioMidAsmHook(PPCRegister& r31, PPCRegister& f0)
|
||||||
f0.f32 = pCamera->m_VertFieldOfView;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,4 +119,15 @@ jump_address_on_false = 0x82468EE0
|
||||||
[[midasm_hook]]
|
[[midasm_hook]]
|
||||||
name = "CameraBoostAspectRatioMidAsmHook"
|
name = "CameraBoostAspectRatioMidAsmHook"
|
||||||
address = 0x8246BDA8
|
address = 0x8246BDA8
|
||||||
registers = ["r31", "f0"]
|
registers = ["r31", "f0"]
|
||||||
|
|
||||||
|
[[midasm_hook]]
|
||||||
|
name = "CSDAspectRatioMidAsmHook"
|
||||||
|
address = 0x830C0A28
|
||||||
|
registers = ["f1", "f2"]
|
||||||
|
|
||||||
|
[[midasm_hook]]
|
||||||
|
name = "CSDOffsetMidAsmHook"
|
||||||
|
address = 0x830C0A78
|
||||||
|
registers = ["f1", "f2"]
|
||||||
|
return = true
|
||||||
Loading…
Add table
Reference in a new issue