diff --git a/data/TonyHawksProSkater4.WidescreenFix/Game/scripts/TonyHawksProSkater4.WidescreenFix.ini b/data/TonyHawksProSkater4.WidescreenFix/Game/scripts/TonyHawksProSkater4.WidescreenFix.ini index 3cd044311..e21699ab2 100644 --- a/data/TonyHawksProSkater4.WidescreenFix/Game/scripts/TonyHawksProSkater4.WidescreenFix.ini +++ b/data/TonyHawksProSkater4.WidescreenFix/Game/scripts/TonyHawksProSkater4.WidescreenFix.ini @@ -2,4 +2,5 @@ ResX = 0 ResY = 0 FixHUD = 1 +FOVFactor = 1.0 RandomSongOrderFix = 1 \ No newline at end of file diff --git a/source/TonyHawksProSkater4.WidescreenFix/dllmain.cpp b/source/TonyHawksProSkater4.WidescreenFix/dllmain.cpp index b89d07651..5b2d244d9 100644 --- a/source/TonyHawksProSkater4.WidescreenFix/dllmain.cpp +++ b/source/TonyHawksProSkater4.WidescreenFix/dllmain.cpp @@ -11,6 +11,7 @@ struct Screen float fAspectRatio; float fAspectRatioDiff; float fFieldOfView; + float fFOVFactor; float fHUDScaleX; float fHudOffset; float fHudOffsetReal; @@ -23,6 +24,7 @@ void Init() Screen.Height = iniReader.ReadInteger("MAIN", "ResY", 0); bool bFixHUD = iniReader.ReadInteger("MAIN", "FixHUD", 1) != 0; bool bRandomSongOrderFix = iniReader.ReadInteger("MAIN", "RandomSongOrderFix", 1) != 0; + Screen.fFOVFactor = iniReader.ReadFloat("MAIN", "FOVFactor", 0.0f); if (!Screen.Width || !Screen.Height) std::tie(Screen.Width, Screen.Height) = GetDesktopRes(); @@ -35,6 +37,8 @@ void Init() Screen.fHUDScaleX = 1.0f / Screen.fWidth * (Screen.fHeight / 480.0f); Screen.fHudOffset = ((480.0f * Screen.fAspectRatio) - 640.0f) / 2.0f; Screen.fHudOffsetReal = (Screen.fWidth - Screen.fHeight * (4.0f / 3.0f)) / 2.0f; + if (Screen.fFOVFactor <= 0.0f) + Screen.fFOVFactor = 1.0f; //Resolution auto pattern = hook::pattern("8B 4C B4 20 89 15"); @@ -69,9 +73,9 @@ void Init() { void operator()(injector::reg_pack& regs) { - float fov = 0.0f; - _asm {fst dword ptr[fov]} - *(float*)(regs.esi + 0xA4) = AdjustFOV(fov, Screen.fAspectRatio); + float fov = *(float*)(regs.esi + 0xA4); + float adjustedFov = AdjustFOV(fov, Screen.fAspectRatio); + *(float*)(regs.esi + 0xA0) = adjustedFov * Screen.fFOVFactor; } }; injector::MakeInline(pattern.get_first(0), pattern.get_first(6));