mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 13:32:36 +01:00
Fixed widescreen patch for 1.0, 3.0 and newsteam
This commit is contained in:
parent
260d6a2339
commit
24800b17e2
@ -2328,7 +2328,8 @@ void Patch_SA_10()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Unlocked widescreen resolutions
|
// Unlocked widescreen resolutions
|
||||||
Patch<DWORD>(0x745B71, 0x9090687D);
|
//Patch<DWORD>(0x745B71, 0x9090687D);
|
||||||
|
Patch<DWORD>(0x745B81, 0x9090587D);
|
||||||
Patch<DWORD>(0x74596C, 0x9090127D);
|
Patch<DWORD>(0x74596C, 0x9090127D);
|
||||||
Nop(0x745970, 2);
|
Nop(0x745970, 2);
|
||||||
Nop(0x745B75, 2);
|
Nop(0x745B75, 2);
|
||||||
@ -2797,7 +2798,8 @@ void Patch_SA_Steam()
|
|||||||
Patch<const void*>(0x734DF0, &dSunMult);
|
Patch<const void*>(0x734DF0, &dSunMult);
|
||||||
|
|
||||||
// Unlocked widescreen resolutions
|
// Unlocked widescreen resolutions
|
||||||
Patch<WORD>(0x77F9F0, 0x6E7d);
|
//Patch<WORD>(0x77F9F0, 0x6E7D);
|
||||||
|
Patch<WORD>(0x77F9FC, 0x627D);
|
||||||
Patch<DWORD>(0x77F80B, 0x9090127D);
|
Patch<DWORD>(0x77F80B, 0x9090127D);
|
||||||
Nop(0x77F80F, 2);
|
Nop(0x77F80F, 2);
|
||||||
Nop(0x77F880, 2);
|
Nop(0x77F880, 2);
|
||||||
@ -2957,7 +2959,8 @@ void Patch_SA_NewSteam()
|
|||||||
Patch<BYTE>(0x53EC4A, 6);
|
Patch<BYTE>(0x53EC4A, 6);
|
||||||
|
|
||||||
// Unlocked widescreen resolutions
|
// Unlocked widescreen resolutions
|
||||||
Patch<WORD>(0x779BAD, 0x607D);
|
//Patch<WORD>(0x779BAD, 0x607D);
|
||||||
|
Patch<WORD>(0x779BB8, 0x557D);
|
||||||
// TODO: Do the rest
|
// TODO: Do the rest
|
||||||
|
|
||||||
// Disable re-initialization of DirectInput mouse device by the game
|
// Disable re-initialization of DirectInput mouse device by the game
|
||||||
@ -2988,11 +2991,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||||||
{
|
{
|
||||||
hDLLModule = hinstDLL;
|
hDLLModule = hinstDLL;
|
||||||
|
|
||||||
if ( *(DWORD*)(GetModule()+0x458D21) == 0x3539F633) Patch_SA_NewSteam();
|
if (*(DWORD*)DynBaseAddress(0x82457C) == 0x94BF || *(DWORD*)DynBaseAddress(0x8245BC) == 0x94BF) Patch_SA_10();
|
||||||
|
else if (*(DWORD*)DynBaseAddress(0x8252FC) == 0x94BF || *(DWORD*)DynBaseAddress(0x82533C) == 0x94BF) Patch_SA_11();
|
||||||
|
else if (*(DWORD*)DynBaseAddress(0x85EC4A) == 0x94BF) Patch_SA_Steam();
|
||||||
|
|
||||||
else if (*(DWORD*)0x82457C == 0x94BF || *(DWORD*)0x8245BC == 0x94BF) Patch_SA_10();
|
else if ( *(DWORD*)DynBaseAddress(0x858D21) == 0x3539F633) Patch_SA_NewSteam();
|
||||||
else if (*(DWORD*)0x8252FC == 0x94BF || *(DWORD*)0x82533C == 0x94BF) Patch_SA_11();
|
|
||||||
else if (*(DWORD*)0x85EC4A == 0x94BF) Patch_SA_Steam();
|
|
||||||
|
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,12 @@ inline ptrdiff_t GetModule()
|
|||||||
return (ptrdiff_t)hModule;
|
return (ptrdiff_t)hModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename AT>
|
||||||
|
inline AT DynBaseAddress(AT address)
|
||||||
|
{
|
||||||
|
return GetModule() - 0x400000 + address;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined SILENTPATCH_III_VER
|
#if defined SILENTPATCH_III_VER
|
||||||
|
|
||||||
// This function initially detects III version then chooses the address basing on game version
|
// This function initially detects III version then chooses the address basing on game version
|
||||||
@ -110,33 +116,33 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
|||||||
|
|
||||||
if ( *bVer == -1 )
|
if ( *bVer == -1 )
|
||||||
{
|
{
|
||||||
if ( *(DWORD*)(GetModule()+0x458D21) == 0x3539F633 )
|
if ( *(DWORD*)DynBaseAddress(0x858D21) == 0x3539F633 )
|
||||||
{
|
{
|
||||||
*bVer = 3;
|
*bVer = 3;
|
||||||
*bEuropean = false;
|
*bEuropean = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( *(DWORD*)0x82457C == 0x94BF )
|
else if ( *(DWORD*)DynBaseAddress(0x82457C) == 0x94BF )
|
||||||
{
|
{
|
||||||
*bVer = 0;
|
*bVer = 0;
|
||||||
*bEuropean = false;
|
*bEuropean = false;
|
||||||
}
|
}
|
||||||
else if ( *(DWORD*)0x8245BC == 0x94BF )
|
else if ( *(DWORD*)DynBaseAddress(0x8245BC) == 0x94BF )
|
||||||
{
|
{
|
||||||
*bVer = 0;
|
*bVer = 0;
|
||||||
*bEuropean = true;
|
*bEuropean = true;
|
||||||
}
|
}
|
||||||
else if ( *(DWORD*)0x8252FC == 0x94BF )
|
else if ( *(DWORD*)DynBaseAddress(0x8252FC) == 0x94BF )
|
||||||
{
|
{
|
||||||
*bVer = 1;
|
*bVer = 1;
|
||||||
*bEuropean = false;
|
*bEuropean = false;
|
||||||
}
|
}
|
||||||
else if ( *(DWORD*)0x82533C == 0x94BF )
|
else if ( *(DWORD*)DynBaseAddress(0x82533C) == 0x94BF )
|
||||||
{
|
{
|
||||||
*bVer = 1;
|
*bVer = 1;
|
||||||
*bEuropean = true;
|
*bEuropean = true;
|
||||||
}
|
}
|
||||||
else if (*(DWORD*)0x85EC4A == 0x94BF )
|
else if (*(DWORD*)DynBaseAddress(0x85EC4A) == 0x94BF )
|
||||||
{
|
{
|
||||||
*bVer = 2;
|
*bVer = 2;
|
||||||
*bEuropean = false;
|
*bEuropean = false;
|
||||||
@ -288,7 +294,7 @@ namespace Memory
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(DWORD*)((DWORD)address + 1) = dwHook - (DWORD)address - 5;
|
*(ptrdiff_t*)((DWORD)address + 1) = dwHook - (DWORD)address - 5;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -337,7 +343,7 @@ namespace MemoryVP
|
|||||||
mov dwHook, eax
|
mov dwHook, eax
|
||||||
}
|
}
|
||||||
|
|
||||||
*(DWORD*)((DWORD)address + 1) = (DWORD)dwHook - (DWORD)address - 5;
|
*(ptrdiff_t*)((DWORD)address + 1) = (DWORD)dwHook - (DWORD)address - 5;
|
||||||
if ( nType == PATCH_NOTHING )
|
if ( nType == PATCH_NOTHING )
|
||||||
VirtualProtect((void*)((DWORD)address + 1), 4, dwProtect[0], &dwProtect[1]);
|
VirtualProtect((void*)((DWORD)address + 1), 4, dwProtect[0], &dwProtect[1]);
|
||||||
else
|
else
|
||||||
@ -349,19 +355,19 @@ namespace MemoryVP
|
|||||||
template<typename T, typename AT>
|
template<typename T, typename AT>
|
||||||
inline void Patch(AT address, T value)
|
inline void Patch(AT address, T value)
|
||||||
{
|
{
|
||||||
MemoryVP::Patch(GetModule() - 0x400000 + address, value);
|
MemoryVP::Patch(DynBaseAddress(address), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename AT>
|
template<typename AT>
|
||||||
inline void Nop(AT address, unsigned int nCount)
|
inline void Nop(AT address, unsigned int nCount)
|
||||||
{
|
{
|
||||||
MemoryVP::Nop(GetModule() - 0x400000 + address, nCount);
|
MemoryVP::Nop(DynBaseAddress(address), nCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename AT, typename HT>
|
template<typename AT, typename HT>
|
||||||
inline void InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
|
inline void InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
|
||||||
{
|
{
|
||||||
MemoryVP::InjectHook(GetModule() - 0x400000 + address, hook, nType);
|
MemoryVP::InjectHook(DynBaseAddress(address), hook, nType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user