mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Compare commits
19 commits
dc04c3ca39
...
a8c40aabde
Author | SHA1 | Date | |
---|---|---|---|
|
a8c40aabde | ||
|
c3570a9d89 | ||
|
9a3e90f7c9 | ||
|
6af4fcc0ee | ||
|
33c1ec00d6 | ||
|
e270bf652c | ||
|
24719bb98e | ||
|
77765c3fa5 | ||
|
4e2f4f8e03 | ||
|
cf57f43e19 | ||
|
ba76a0ed9e | ||
|
dbe21b8556 | ||
|
109e1c67f4 | ||
|
a3d9c73a8b | ||
|
84a737fb88 | ||
|
d9e8480b6d | ||
|
0bf574a5b8 | ||
|
730afa5848 | ||
|
50c3a47cd3 |
2 changed files with 70 additions and 63 deletions
|
@ -4652,7 +4652,6 @@ BOOL InjectDelayedPatches_10()
|
|||
|
||||
// Fix some big messages staying on screen longer at high resolutions due to a cut sliding text feature
|
||||
// Also since we're touching it, optionally allow to re-enable this feature.
|
||||
|
||||
if (const int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"SlidingMissionTitleText", -1, wcModulePath); INIoption != -1)
|
||||
{
|
||||
using namespace SlidingTextsScalingFixes;
|
||||
|
@ -4748,6 +4747,31 @@ BOOL InjectDelayedPatches_10()
|
|||
}
|
||||
|
||||
|
||||
// Fix credits not scaling to resolution
|
||||
// Moved here for compatibility with wshps.asi
|
||||
if (MemEquals(0x5A8679, {0xD8, 0xC1, 0xD8, 0x05}) && MemEquals(0x5A8679+8, {0xD8, 0x64, 0x24, 0x18, 0xD9, 0x54, 0x24, 0x14})) // Verify wshps.asi isn't already patching the credits
|
||||
{
|
||||
using namespace CreditsScalingFixes;
|
||||
|
||||
std::array<uintptr_t, 2> creditPrintString = { 0x5A8707, 0x5A8785 };
|
||||
|
||||
HookEach_PrintString(creditPrintString, InterceptCall);
|
||||
InterceptCall(0x5A86C0, orgSetScale, SetScale_ScaleToRes);
|
||||
|
||||
// Fix the credits cutting off on the bottom early, they don't do that in III
|
||||
// but it regressed in VC and SA
|
||||
static const float topMargin = 1.0f;
|
||||
static const float bottomMargin = -(**(float**)(0x5A869A + 2));
|
||||
|
||||
Patch(0x5A8689 + 2, &topMargin);
|
||||
Patch(0x5A869A + 2, &bottomMargin);
|
||||
|
||||
// As we now scale everything on PrintString time, the resolution height checks need to be unscaled.
|
||||
Patch(0x5A8660 + 2, &FIXED_RES_HEIGHT_SCALE);
|
||||
Patch(0x5AF8C9 + 2, &FIXED_RES_HEIGHT_SCALE);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
if ( const int QPCDays = GetPrivateProfileIntW(L"Debug", L"AddDaysToQPC", 0, wcModulePath); QPCDays != 0 )
|
||||
{
|
||||
|
@ -5289,6 +5313,46 @@ BOOL InjectDelayedPatches_NewBinaries()
|
|||
TXN_CATCH();
|
||||
|
||||
|
||||
// Fix credits not scaling to resolution
|
||||
// Moved here for compatibility with wshps.asi
|
||||
try
|
||||
{
|
||||
using namespace CreditsScalingFixes;
|
||||
|
||||
// Verify wshps.asi isn't already patching the credits
|
||||
(void)get_pattern("DE C2 D9 45 18 DE EA", 1);
|
||||
|
||||
std::array<void*, 2> creditPrintString = {
|
||||
get_pattern("E8 ? ? ? ? 83 C4 0C 80 7D 1C 00"),
|
||||
get_pattern("D9 1C 24 E8 ? ? ? ? DD 05 ? ? ? ? 83 C4 0C 5E", 3),
|
||||
};
|
||||
|
||||
auto setScale = get_pattern("D9 1C 24 E8 ? ? ? ? 83 C4 08 68 FF 00 00 00 6A 00 6A 00 6A 00", 3);
|
||||
|
||||
// Fix the credits cutting off on the bottom early, they don't do that in III
|
||||
// but it regressed in VC and SA
|
||||
auto positionOffset = get_pattern("DE C2 D9 45 18 DE EA D9 C9 D9 5D 14 D9 05", 12 + 2);
|
||||
|
||||
// As we now scale everything on PrintString time, the resolution height checks need to be unscaled.
|
||||
void* resHeightScales[] = {
|
||||
get_pattern("DB 05 ? ? ? ? 57 8B 7D 14", 2),
|
||||
get_pattern("A1 ? ? ? ? 03 45 FC 89 45 F4", 1)
|
||||
};
|
||||
|
||||
static const float topMargin = 1.0f;
|
||||
Patch(positionOffset, &topMargin);
|
||||
|
||||
HookEach_PrintString(creditPrintString, InterceptCall);
|
||||
InterceptCall(setScale, orgSetScale, SetScale_ScaleToRes);
|
||||
|
||||
for (void* addr : resHeightScales)
|
||||
{
|
||||
Patch(addr, &FIXED_RES_HEIGHT_SCALE);
|
||||
}
|
||||
}
|
||||
TXN_CATCH();
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -6356,29 +6420,6 @@ void Patch_SA_10(HINSTANCE hInstance)
|
|||
}
|
||||
|
||||
|
||||
// Fix credits not scaling to resolution
|
||||
{
|
||||
using namespace CreditsScalingFixes;
|
||||
|
||||
std::array<uintptr_t, 2> creditPrintString = { 0x5A8707, 0x5A8785 };
|
||||
|
||||
HookEach_PrintString(creditPrintString, InterceptCall);
|
||||
InterceptCall(0x5A86C0, orgSetScale, SetScale_ScaleToRes);
|
||||
|
||||
// Fix the credits cutting off on the bottom early, they don't do that in III
|
||||
// but it regressed in VC and SA
|
||||
static const float topMargin = 1.0f;
|
||||
static const float bottomMargin = -(**(float**)(0x5A869A + 2));
|
||||
|
||||
Patch(0x5A8689 + 2, &topMargin);
|
||||
Patch(0x5A869A + 2, &bottomMargin);
|
||||
|
||||
// As we now scale everything on PrintString time, the resolution height checks need to be unscaled.
|
||||
Patch(0x5A8660 + 2, &FIXED_RES_HEIGHT_SCALE);
|
||||
Patch(0x5AF8C9 + 2, &FIXED_RES_HEIGHT_SCALE);
|
||||
}
|
||||
|
||||
|
||||
// Fix some big messages staying on screen longer at high resolutions due to a cut sliding text feature
|
||||
// Also since we're touching it, optionally allow to re-enable this feature.
|
||||
{
|
||||
|
@ -8509,40 +8550,6 @@ void Patch_SA_NewBinaries_Common(HINSTANCE hInstance)
|
|||
TXN_CATCH();
|
||||
|
||||
|
||||
// Fix credits not scaling to resolution
|
||||
{
|
||||
using namespace CreditsScalingFixes;
|
||||
|
||||
std::array<void*, 2> creditPrintString = {
|
||||
get_pattern("E8 ? ? ? ? 83 C4 0C 80 7D 1C 00"),
|
||||
get_pattern("D9 1C 24 E8 ? ? ? ? DD 05 ? ? ? ? 83 C4 0C 5E", 3),
|
||||
};
|
||||
|
||||
auto setScale = get_pattern("D9 1C 24 E8 ? ? ? ? 83 C4 08 68 FF 00 00 00 6A 00 6A 00 6A 00", 3);
|
||||
|
||||
// Fix the credits cutting off on the bottom early, they don't do that in III
|
||||
// but it regressed in VC and SA
|
||||
auto positionOffset = get_pattern("DE C2 D9 45 18 DE EA D9 C9 D9 5D 14 D9 05", 12 + 2);
|
||||
|
||||
// As we now scale everything on PrintString time, the resolution height checks need to be unscaled.
|
||||
void* resHeightScales[] = {
|
||||
get_pattern("DB 05 ? ? ? ? 57 8B 7D 14", 2),
|
||||
get_pattern("A1 ? ? ? ? 03 45 FC 89 45 F4", 1)
|
||||
};
|
||||
|
||||
static const float topMargin = 1.0f;
|
||||
Patch(positionOffset, &topMargin);
|
||||
|
||||
HookEach_PrintString(creditPrintString, InterceptCall);
|
||||
InterceptCall(setScale, orgSetScale, SetScale_ScaleToRes);
|
||||
|
||||
for (void* addr : resHeightScales)
|
||||
{
|
||||
Patch(addr, &FIXED_RES_HEIGHT_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fix some big messages staying on screen longer at high resolutions due to a cut sliding text feature
|
||||
// Also since we're touching it, optionally allow to re-enable this feature.
|
||||
try
|
||||
|
|
|
@ -302,7 +302,7 @@ public:
|
|||
|
||||
private:
|
||||
template<std::size_t Index>
|
||||
STATIC_INLINE void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
|
||||
static void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
|
||||
|
||||
template<std::size_t Index>
|
||||
void DoHeadLightBeam_LightBeamFixSaveObj(int type, CMatrix& m, bool right)
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
|
||||
public:
|
||||
template<std::size_t Index>
|
||||
STATIC_INLINE void (CAutomobile::*orgAutomobilePreRender)();
|
||||
static void (CAutomobile::*orgAutomobilePreRender)();
|
||||
|
||||
template<std::size_t Index>
|
||||
void PreRender_SilentPatch()
|
||||
|
@ -352,7 +352,7 @@ public:
|
|||
void HideDestroyedWheels_SilentPatch(void (CAutomobile::*spawnFlyingComponentCB)(int, unsigned int), int nodeID, unsigned int modelID);
|
||||
|
||||
template<std::size_t Index>
|
||||
STATIC_INLINE void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
|
||||
static void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
|
||||
|
||||
template<std::size_t Index>
|
||||
void SpawnFlyingComponent_HideWheels(int nodeID, unsigned int modelID)
|
||||
|
@ -448,7 +448,7 @@ private:
|
|||
|
||||
private:
|
||||
template<std::size_t Index>
|
||||
STATIC_INLINE CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||
static CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||
|
||||
template<std::size_t Index>
|
||||
CVehicle* RestoreCar_SilentPatch()
|
||||
|
|
Loading…
Reference in a new issue