Changed the resolution scaling variable to a safer one

Improves compatibility with wsfix HUD scaling
This commit is contained in:
Silent 2024-10-10 21:02:57 +02:00
parent 5cb14580b5
commit b6450d1853
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
3 changed files with 16 additions and 16 deletions

View file

@ -101,14 +101,14 @@ auto WorldRemove = reinterpret_cast<void(*)(void*)>(hook::get_pattern("8A 4
float GetWidthMult()
{
static const float& ResolutionWidthMult = **AddressByVersion<float**>(0x57E956, 0x57ECA6, 0x57EBA6);
return ResolutionWidthMult;
static float** ResolutionWidthMult = hook::get_pattern<float*>("D8 0D ? ? ? ? 89 54 24 0C", 2);
return **ResolutionWidthMult;
}
float GetHeightMult()
{
static const float& ResolutionHeightMult = **AddressByVersion<float**>(0x57E940, 0x57EC90, 0x57EB90);
return ResolutionHeightMult;
static float** ResolutionHeightMult = hook::get_pattern<float*>("D8 0D ? ? ? ? 89 44 24 04 50 D8 0D", 2);
return **ResolutionHeightMult;
}
void ShowRadarTrace(float fX, float fY, unsigned int nScale, BYTE r, BYTE g, BYTE b, BYTE a)

View file

@ -490,27 +490,27 @@ namespace ScalingInternals
// 1.0 - fast math uses a scaling multiplier
float ScaleX_Multiplier(float val)
{
static const float& ResolutionWidthMult = **(float**)(0x43CF57 + 2);
return val * RsGlobal->MaximumWidth * ResolutionWidthMult;
static float** ResolutionWidthMult = (float**)(0x5733FD + 2);
return val * RsGlobal->MaximumWidth * **ResolutionWidthMult;
}
float ScaleY_Multiplier(float val)
{
static const float& ResolutionHeightMult = **(float**)(0x43CF47 + 2);
return val * RsGlobal->MaximumHeight * ResolutionHeightMult;
static float** ResolutionHeightMult = (float**)(0x57342D + 2);
return val * RsGlobal->MaximumHeight * **ResolutionHeightMult;
}
// New binaries - precise math uses a scaling divisor
float ScaleX_Divisor(float val)
{
static const double& ResolutionWidthDiv = **hook::get_pattern<double*>("DC 35 ? ? ? ? DC 0D ? ? ? ? DE E9 D9 5D F0", 2);
return static_cast<float>(val * RsGlobal->MaximumWidth / ResolutionWidthDiv);
static double** ResolutionWidthDiv = hook::get_pattern<double*>("DC 35 ? ? ? ? DC 0D ? ? ? ? DE E9 D9 5D F0", 2);
return static_cast<float>(val * RsGlobal->MaximumWidth / **ResolutionWidthDiv);
}
float ScaleY_Divisor(float val)
{
static const double& ResolutionHeightDiv = **hook::get_pattern<double*>("50 DC 35 ? ? ? ? DC 0D", 1 + 2);
return static_cast<float>(val * RsGlobal->MaximumHeight / ResolutionHeightDiv);
static double** ResolutionHeightDiv = hook::get_pattern<double*>("50 DC 35 ? ? ? ? DC 0D", 1 + 2);
return static_cast<float>(val * RsGlobal->MaximumHeight / **ResolutionHeightDiv);
}
}

View file

@ -74,14 +74,14 @@ int32_t& numModelInfos = *hook::get_pattern<int32_t>("81 FD ? ? ? ? 7C B7", 2);
float GetWidthMult()
{
static const float& ResolutionWidthMult = **AddressByVersion<float**>(0x5FA15E, 0x5FA17E, 0x5F9DBE);
return ResolutionWidthMult;
static float** ResolutionWidthMult = hook::get_pattern<float*>("D8 0D ? ? ? ? D1 F8 52", 2);
return **ResolutionWidthMult;
}
float GetHeightMult()
{
static const float& ResolutionHeightMult = **AddressByVersion<float**>(0x5FA148, 0x5FA168, 0x5F9DA8);
return ResolutionHeightMult;
static float** ResolutionHeightMult = hook::get_pattern<float*>("D8 0D ? ? ? ? D1 F8 C7 44 24 ? 00 00 00 00 89 04 24", 2);
return **ResolutionHeightMult;
}
static bool bGameInFocus = true;