Skip to content

Commit

Permalink
THPS4: Add the option to change the fov scale
Browse files Browse the repository at this point in the history
  • Loading branch information
mallgrab committed Nov 19, 2023
1 parent 2431f31 commit bd590e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
ResX = 0
ResY = 0
FixHUD = 1
FovScale = 1
RandomSongOrderFix = 1
11 changes: 11 additions & 0 deletions source/TonyHawksProSkater4.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct Screen
float fAspectRatio;
float fAspectRatioDiff;
float fFieldOfView;
float fFovScale;
float fHUDScaleX;
float fHudOffset;
float fHudOffsetReal;
Expand All @@ -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.fFovScale = iniReader.ReadFloat("MAIN", "FovScale", 1);

if (!Screen.Width || !Screen.Height)
std::tie(Screen.Width, Screen.Height) = GetDesktopRes();
Expand Down Expand Up @@ -75,6 +77,15 @@ void Init()
}
}; injector::MakeInline<FovHook>(pattern.get_first(0), pattern.get_first(6));

//FovScale
pattern = hook::pattern("d9 05 ? ? ? ? c3 90 90 90 90 90 90 90 90 90 8b 4c 24");
float* fovscaleAddress = *pattern.get_first<float*>(2);

pattern = hook::pattern("D9 1D ? ? ? ? 7E 4F 8B 15 ? ? ? ? 33 C9 33 C0");
injector::MakeNOP(pattern.get_first(0), 6, true);

*fovscaleAddress = Screen.fFovScale;

//HUD
if (bFixHUD)
{
Expand Down

0 comments on commit bd590e1

Please sign in to comment.