Working on 1.01 support

This commit is contained in:
Silent 2014-08-22 00:10:23 +02:00
parent 8802f31ab6
commit cd0fa0f044
10 changed files with 69 additions and 28 deletions

View file

@ -5,7 +5,7 @@
// { EAXJMP(0x4DC340); } // { EAXJMP(0x4DC340); }
//WRAPPER HRESULT STDMETHODCALLTYPE CAEDataStream::Stat(STATSTG* pStatstg, DWORD grfStatFlag) { EAXJMP(0x4DC3A0); } //WRAPPER HRESULT STDMETHODCALLTYPE CAEDataStream::Stat(STATSTG* pStatstg, DWORD grfStatFlag) { EAXJMP(0x4DC3A0); }
static void* CAEDataStream__Initialise = AddressByVersion<void*>(0x4DC2B0, 0, 0x4E7550); static void* CAEDataStream__Initialise = AddressByVersion<void*>(0x4DC2B0, 0x4DC7A0, 0x4E7550);
WRAPPER bool CAEDataStream::Initialise() { VARJMP(CAEDataStream__Initialise); } WRAPPER bool CAEDataStream::Initialise() { VARJMP(CAEDataStream__Initialise); }
unsigned int CAEStreamingDecoder::nMallocRefCount = 0; unsigned int CAEStreamingDecoder::nMallocRefCount = 0;

View file

@ -4,18 +4,18 @@
#include "PedSA.h" #include "PedSA.h"
// Wrappers // Wrappers
static void* EntityRender = AddressByVersion<void*>(0x534310, 0, 0x545B30); static void* EntityRender = AddressByVersion<void*>(0x534310, 0x5347B0, 0x545B30);
WRAPPER void CEntity::Render() { VARJMP(EntityRender); } WRAPPER void CEntity::Render() { VARJMP(EntityRender); }
static void* varInvertRaster = AddressByVersion<void*>(0x705660, 0, 0x7497A0); static void* varInvertRaster = AddressByVersion<void*>(0x705660, 0x705E90, 0x7497A0);
WRAPPER void CShadowCamera::InvertRaster() { VARJMP(varInvertRaster); } WRAPPER void CShadowCamera::InvertRaster() { VARJMP(varInvertRaster); }
CWeaponInfo* (*CWeaponInfo::GetWeaponInfo)(eWeaponType, signed char) = AddressByVersion<CWeaponInfo*(*)(eWeaponType, signed char)>(0x743C60, 0, 0x77D940); CWeaponInfo* (*CWeaponInfo::GetWeaponInfo)(eWeaponType, signed char) = AddressByVersion<CWeaponInfo*(*)(eWeaponType, signed char)>(0x743C60, 0x744490, 0x77D940);
static RwTexture*& ms_pRemapTexture = **AddressByVersion<RwTexture***>(0x59F1BD, 0, 0x5B811D); static RwTexture*& ms_pRemapTexture = **AddressByVersion<RwTexture***>(0x59F1BD, 0x6D6E53, 0x5B811D);
static unsigned char* ms_currentCol = *AddressByVersion<unsigned char**>(0x4C84C8, 0, 0x4D2DC8); static unsigned char* ms_currentCol = *AddressByVersion<unsigned char**>(0x4C84C8, 0x4C86C8, 0x4D2DC8);
auto SetEditableMaterialsCB = AddressByVersion<RpAtomic*(*)(RpAtomic*,void*)>(0x4C83E0, 0, 0x4D2CE0); auto SetEditableMaterialsCB = AddressByVersion<RpAtomic*(*)(RpAtomic*,void*)>(0x4C83E0, 0x4C8460, 0x4D2CE0);
static void SetVehicleColour(unsigned char primaryColour, unsigned char secondaryColour, unsigned char tertiaryColour, unsigned char quaternaryColour) static void SetVehicleColour(unsigned char primaryColour, unsigned char secondaryColour, unsigned char tertiaryColour, unsigned char quaternaryColour)
{ {

View file

@ -1,15 +1,15 @@
#include "StdAfxSA.h" #include "StdAfxSA.h"
#include "ModelInfoSA.h" #include "ModelInfoSA.h"
static void* BaseModelInfoShutdown = AddressByVersion<void*>(0x4C4D50, 0, 0x4CF590); static void* BaseModelInfoShutdown = AddressByVersion<void*>(0x4C4D50, 0x4C4DD0, 0x4CF590);
WRAPPER void CBaseModelInfo::Shutdown() { VARJMP(BaseModelInfoShutdown); } WRAPPER void CBaseModelInfo::Shutdown() { VARJMP(BaseModelInfoShutdown); }
RwTexture* (*CCustomCarPlateMgr::CreatePlateTexture)(const char* pText, signed char nDesign) = AddressByVersion<RwTexture*(*)(const char*,signed char)>(0x6FDEA0, 0, 0x736AC0); RwTexture* (*CCustomCarPlateMgr::CreatePlateTexture)(const char* pText, signed char nDesign) = AddressByVersion<RwTexture*(*)(const char*,signed char)>(0x6FDEA0, 0x6FE6D0, 0x736AC0);
bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen) = AddressByVersion<bool(*)(char*,int)>(0x6FD5B0, 0, 0x7360F0); bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen) = AddressByVersion<bool(*)(char*,int)>(0x6FD5B0, 0x6FDDE0, 0x7360F0);
signed char (*CCustomCarPlateMgr::GetMapRegionPlateDesign)() = AddressByVersion<signed char(*)()>(0x6FD7A0, 0, 0x7363E0); signed char (*CCustomCarPlateMgr::GetMapRegionPlateDesign)() = AddressByVersion<signed char(*)()>(0x6FD7A0, 0x6FDFD0, 0x7363E0);
void (*CCustomCarPlateMgr::SetupMaterialPlatebackTexture)(RpMaterial* pMaterial, signed char nDesign) = AddressByVersion<void(*)(RpMaterial*,signed char)>(0x6FDE50, 0, 0x736A80); void (*CCustomCarPlateMgr::SetupMaterialPlatebackTexture)(RpMaterial* pMaterial, signed char nDesign) = AddressByVersion<void(*)(RpMaterial*,signed char)>(0x6FDE50, 0x6FE680, 0x736A80);
CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0, 0x403DB7); CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0x4C0C96, 0x403DB7);
void CVehicleModelInfo::Shutdown() void CVehicleModelInfo::Shutdown()
{ {

View file

@ -24,7 +24,7 @@ RwTexture* CPNGFile::ReadFromFile(const char* pFileName)
RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen) RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
{ {
static BYTE* pMem = AddressByVersion<BYTE*>(0x7CF9CA, 0, 0x80998A); static BYTE* pMem = AddressByVersion<BYTE*>(0x7CF9CA, 0x7D02CA, 0x80998A);
RwTexture* pTexture = nullptr; RwTexture* pTexture = nullptr;
MemoryVP::Patch<BYTE>(pMem, rwSTREAMMEMORY); MemoryVP::Patch<BYTE>(pMem, rwSTREAMMEMORY);

View file

@ -1,17 +1,17 @@
#include "StdAfxSA.h" #include "StdAfxSA.h"
#include "PedSA.h" #include "PedSA.h"
static void* varGetWeaponSkill = AddressByVersion<void*>(0x5E6580, 0, 0x6039F0); static void* varGetWeaponSkill = AddressByVersion<void*>(0x5E6580, 0x5E6DA0, 0x6039F0);
WRAPPER unsigned char CPed::GetWeaponSkill() { VARJMP(varGetWeaponSkill); } WRAPPER unsigned char CPed::GetWeaponSkill() { VARJMP(varGetWeaponSkill); }
static void* varResetGunFlashAlpha = AddressByVersion<void*>(0x5DF4E0, 0, 0x5FC210); static void* varResetGunFlashAlpha = AddressByVersion<void*>(0x5DF4E0, 0x5DFD00, 0x5FC210);
WRAPPER void CPed::ResetGunFlashAlpha() { VARJMP(varResetGunFlashAlpha); } WRAPPER void CPed::ResetGunFlashAlpha() { VARJMP(varResetGunFlashAlpha); }
static void* varSetGunFlashAlpha = AddressByVersion<void*>(0x5DF400, 0, 0x5FC120); static void* varSetGunFlashAlpha = AddressByVersion<void*>(0x5DF400, 0x5DFC20, 0x5FC120);
WRAPPER void CPed::SetGunFlashAlpha(bool bSecondWeapon) { WRAPARG(bSecondWeapon); VARJMP(varSetGunFlashAlpha); } WRAPPER void CPed::SetGunFlashAlpha(bool bSecondWeapon) { WRAPARG(bSecondWeapon); VARJMP(varSetGunFlashAlpha); }
static void* varGetTaskJetPack = AddressByVersion<void*>(0x601110, 0, 0x620E70); static void* varGetTaskJetPack = AddressByVersion<void*>(0x601110, 0x601930, 0x620E70);
WRAPPER CTaskSimpleJetPack* CPedIntelligence::GetTaskJetPack() const { VARJMP(varGetTaskJetPack); } WRAPPER CTaskSimpleJetPack* CPedIntelligence::GetTaskJetPack() const { VARJMP(varGetTaskJetPack); }
static void* varRenderJetPack = AddressByVersion<void*>(0x67F6A0, 0, 0x6AB110); static void* varRenderJetPack = AddressByVersion<void*>(0x67F6A0, 0x67FEC0, 0x6AB110);
WRAPPER void CTaskSimpleJetPack::RenderJetPack(CPed* pPed) { WRAPARG(pPed); VARJMP(varRenderJetPack); } WRAPPER void CTaskSimpleJetPack::RenderJetPack(CPed* pPed) { WRAPARG(pPed); VARJMP(varRenderJetPack); }
static RwObject* GetFirstObjectCallback(RwObject* pObject, void* pData) static RwObject* GetFirstObjectCallback(RwObject* pObject, void* pData)

View file

@ -1,7 +1,7 @@
#include "StdAfxSA.h" #include "StdAfxSA.h"
#include "ScriptSA.h" #include "ScriptSA.h"
static int* StatTypesInt = *AddressByVersion<int**>(0x55C0D8, 0, 0x574F24); static int* StatTypesInt = *AddressByVersion<int**>(0x55C0D8, 0x55C578, 0x574F24);
std::pair<int,int>* CRunningScript::GetDay_GymGlitch() std::pair<int,int>* CRunningScript::GetDay_GymGlitch()
{ {

View file

@ -1911,6 +1911,12 @@ __forceinline void Patch_SA_10()
strncpy(pScannerNames + (8*134), "????", 8); strncpy(pScannerNames + (8*134), "????", 8);
} }
__forceinline void Patch_SA_11()
{
using namespace MemoryVP;
}
__forceinline void Patch_SA_Steam() __forceinline void Patch_SA_Steam()
{ {
using namespace MemoryVP; using namespace MemoryVP;
@ -2085,7 +2091,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
hDLLModule = hinstDLL; hDLLModule = hinstDLL;
if (*(DWORD*)0x82457C == 0x94BF || *(DWORD*)0x8245BC == 0x94BF) Patch_SA_10(); if (*(DWORD*)0x82457C == 0x94BF || *(DWORD*)0x8245BC == 0x94BF) Patch_SA_10();
//else if (*(DWORD*)0x8252FC == 0x94BF || *(DWORD*)0x82533C == 0x94BF) Patch_SA_11(); else if (*(DWORD*)0x8252FC == 0x94BF || *(DWORD*)0x82533C == 0x94BF) Patch_SA_11();
else if (*(DWORD*)0x85EC4A == 0x94BF) Patch_SA_Steam(); else if (*(DWORD*)0x85EC4A == 0x94BF) Patch_SA_Steam();
else return FALSE; else return FALSE;
} }

View file

@ -1,4 +1,4 @@
#include "StdAfxSA.h" #include "StdAfxSA.h"
#include "TimerSA.h" #include "TimerSA.h"
int& CTimer::m_snTimeInMilliseconds = **AddressByVersion<int**>(0x4242D1, 0, 0x406FA1); int& CTimer::m_snTimeInMilliseconds = **AddressByVersion<int**>(0x4242D1, 0x53F6A1, 0x406FA1);

View file

@ -3,9 +3,9 @@
#include "VehicleSA.h" #include "VehicleSA.h"
#include "TimerSA.h" #include "TimerSA.h"
static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0, 0x70C0B0); static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0x6D1680, 0x70C0B0);
WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); } WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0, 0x70D8C0); static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); } WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
static RwObject* GetCurrentAtomicObjectCB(RwObject* pObject, void* data) static RwObject* GetCurrentAtomicObjectCB(RwObject* pObject, void* data)

View file

@ -80,13 +80,13 @@ inline T AddressByVersion(DWORD address10, DWORD address11, DWORD addressSteam)
if ( !address11 ) if ( !address11 )
return (T)GetDummy(); return (T)GetDummy();
// Adjust to EU 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;
else else
address11 += 0x40; address11 -= 0x40;
} }
return (T)address11; return (T)address11;
case 2: case 2:
@ -145,6 +145,41 @@ inline T AddressByRegion_10(DWORD address10)
return (T)address10; return (T)address10;
} }
template<typename T>
inline T AddressByRegion_11(DWORD address11)
{
bool* bEuropean = GetEuropean();
signed char* bVer = GetVer();
if ( *bVer == -1 )
{
if ( *(DWORD*)0x8252FC == 0x94BF )
{
*bVer = 1;
*bEuropean = false;
}
else if ( *(DWORD*)0x82533C == 0x94BF )
{
*bVer = 1;
*bEuropean = true;
}
else
{
assert(!"AddressByRegion_11 on non-1.01 EXE!");
}
}
// Adjust to US if needed
if ( !(*bEuropean) && address11 > 0x746FA0 )
{
if ( address11 < 0x7BB240 )
address11 -= 0x50;
else
address11 -= 0x40;
}
return (T)address11;
}
namespace Memory namespace Memory
{ {
template<typename T, typename AT> template<typename T, typename AT>