mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 15:07:28 +05:00
More updates to Memory
This commit is contained in:
parent
cc0280254a
commit
57d623aeae
1 changed files with 37 additions and 25 deletions
|
@ -42,9 +42,7 @@ inline AT DynBaseAddress(AT 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
|
inline void InitializeVersions()
|
||||||
template<typename T>
|
|
||||||
inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
|
||||||
{
|
{
|
||||||
signed char* bVer = GetVer();
|
signed char* bVer = GetVer();
|
||||||
|
|
||||||
|
@ -54,8 +52,17 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
else if (*(DWORD*)0x5C2130 == 0x53E58955) *bVer = 1;
|
else if (*(DWORD*)0x5C2130 == 0x53E58955) *bVer = 1;
|
||||||
else if (*(DWORD*)0x5C6FD0 == 0x53E58955) *bVer = 2;
|
else if (*(DWORD*)0x5C6FD0 == 0x53E58955) *bVer = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ( *bVer )
|
// This function initially detects III version then chooses the address basing on game version
|
||||||
|
template<typename T>
|
||||||
|
inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
|
{
|
||||||
|
InitializeVersions();
|
||||||
|
|
||||||
|
signed char bVer = *GetVer();
|
||||||
|
|
||||||
|
switch ( bVer )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
assert(address11);
|
assert(address11);
|
||||||
|
@ -71,9 +78,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
|
|
||||||
#elif defined SILENTPATCH_VC_VER
|
#elif defined SILENTPATCH_VC_VER
|
||||||
|
|
||||||
// This function initially detects VC version then chooses the address basing on game version
|
inline void InitializeVersions()
|
||||||
template<typename T>
|
|
||||||
inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
|
||||||
{
|
{
|
||||||
signed char* bVer = GetVer();
|
signed char* bVer = GetVer();
|
||||||
|
|
||||||
|
@ -83,8 +88,17 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
else if (*(DWORD*)0x667C40 == 0x53E58955) *bVer = 1;
|
else if (*(DWORD*)0x667C40 == 0x53E58955) *bVer = 1;
|
||||||
else if (*(DWORD*)0x666BA0 == 0x53E58955) *bVer = 2;
|
else if (*(DWORD*)0x666BA0 == 0x53E58955) *bVer = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ( *bVer )
|
// This function initially detects VC version then chooses the address basing on game version
|
||||||
|
template<typename T>
|
||||||
|
inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
|
{
|
||||||
|
InitializeVersions();
|
||||||
|
|
||||||
|
signed char bVer = *GetVer();
|
||||||
|
|
||||||
|
switch ( bVer )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
assert(address11);
|
assert(address11);
|
||||||
|
@ -98,7 +112,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#elif defined SILENTPATCH_SA_VER
|
||||||
|
|
||||||
inline void InitializeVersions()
|
inline void InitializeVersions()
|
||||||
{
|
{
|
||||||
|
@ -213,10 +227,10 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
{
|
{
|
||||||
InitializeVersions();
|
InitializeVersions();
|
||||||
|
|
||||||
signed char* bVer = GetVer();
|
signed char bVer = *GetVer();
|
||||||
bool* bEuropean = GetEuropean();
|
bool bEuropean = *GetEuropean();
|
||||||
|
|
||||||
switch ( *bVer )
|
switch ( bVer )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
assert(address11);
|
assert(address11);
|
||||||
|
@ -226,7 +240,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
return (T)GetDummy();
|
return (T)GetDummy();
|
||||||
|
|
||||||
// Adjust to US if needed
|
// Adjust to US if needed
|
||||||
if ( !(*bEuropean) && address11 > 0x746FA0 )
|
if ( !bEuropean && address11 > 0x746FA0 )
|
||||||
{
|
{
|
||||||
if ( address11 < 0x7BB240 )
|
if ( address11 < 0x7BB240 )
|
||||||
address11 -= 0x50;
|
address11 -= 0x50;
|
||||||
|
@ -249,7 +263,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
|
||||||
default:
|
default:
|
||||||
assert(address10);
|
assert(address10);
|
||||||
// Adjust to EU if needed
|
// Adjust to EU if needed
|
||||||
if ( *bEuropean && address10 > 0x7466D0 )
|
if ( bEuropean && address10 > 0x7466D0 )
|
||||||
{
|
{
|
||||||
if ( address10 < 0x7BA940 )
|
if ( address10 < 0x7BA940 )
|
||||||
address10 += 0x50;
|
address10 += 0x50;
|
||||||
|
@ -265,10 +279,10 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam,
|
||||||
{
|
{
|
||||||
InitializeVersions();
|
InitializeVersions();
|
||||||
|
|
||||||
signed char* bVer = GetVer();
|
signed char bVer = *GetVer();
|
||||||
bool* bEuropean = GetEuropean();
|
bool bEuropean = *GetEuropean();
|
||||||
|
|
||||||
switch ( *bVer )
|
switch ( bVer )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
assert(address11);
|
assert(address11);
|
||||||
|
@ -278,7 +292,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam,
|
||||||
return (T)GetDummy();
|
return (T)GetDummy();
|
||||||
|
|
||||||
// Adjust to US if needed
|
// Adjust to US if needed
|
||||||
if ( !(*bEuropean) && address11 > 0x746FA0 )
|
if ( bEuropean && address11 > 0x746FA0 )
|
||||||
{
|
{
|
||||||
if ( address11 < 0x7BB240 )
|
if ( address11 < 0x7BB240 )
|
||||||
address11 -= 0x50;
|
address11 -= 0x50;
|
||||||
|
@ -310,7 +324,7 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam,
|
||||||
default:
|
default:
|
||||||
assert(address10);
|
assert(address10);
|
||||||
// Adjust to EU if needed
|
// Adjust to EU if needed
|
||||||
if ( *bEuropean && address10 > 0x7466D0 )
|
if ( bEuropean && address10 > 0x7466D0 )
|
||||||
{
|
{
|
||||||
if ( address10 < 0x7BA940 )
|
if ( address10 < 0x7BA940 )
|
||||||
address10 += 0x50;
|
address10 += 0x50;
|
||||||
|
@ -326,11 +340,10 @@ inline T AddressByRegion_10(DWORD address10)
|
||||||
{
|
{
|
||||||
InitializeRegion_10();
|
InitializeRegion_10();
|
||||||
|
|
||||||
bool* bEuropean = GetEuropean();
|
bool bEuropean = *GetEuropean();
|
||||||
signed char* bVer = GetVer();
|
|
||||||
|
|
||||||
// Adjust to EU if needed
|
// Adjust to EU if needed
|
||||||
if ( *bEuropean && address10 > 0x7466D0 )
|
if ( bEuropean && address10 > 0x7466D0 )
|
||||||
{
|
{
|
||||||
if ( address10 < 0x7BA940 )
|
if ( address10 < 0x7BA940 )
|
||||||
address10 += 0x50;
|
address10 += 0x50;
|
||||||
|
@ -345,11 +358,10 @@ inline T AddressByRegion_11(DWORD address11)
|
||||||
{
|
{
|
||||||
InitializeRegion_11();
|
InitializeRegion_11();
|
||||||
|
|
||||||
bool* bEuropean = GetEuropean();
|
bool bEuropean = *GetEuropean();
|
||||||
signed char* bVer = GetVer();
|
|
||||||
|
|
||||||
// Adjust to US if needed
|
// Adjust to US if needed
|
||||||
if ( !(*bEuropean) && address11 > 0x746FA0 )
|
if ( !bEuropean && address11 > 0x746FA0 )
|
||||||
{
|
{
|
||||||
if ( address11 < 0x7BB240 )
|
if ( address11 < 0x7BB240 )
|
||||||
address11 -= 0x50;
|
address11 -= 0x50;
|
||||||
|
|
Loading…
Reference in a new issue