Merge branch 'fla-r28'

# Conflicts:
#	SilentPatchSA/SilentPatchSA.cpp
#	SilentPatchSA/SilentPatchSA.vcxproj
#	SilentPatchSA/SilentPatchSA.vcxproj.filters
#	SilentPatchSA/VehicleSA.cpp
This commit is contained in:
Silent 2017-06-20 18:27:50 +02:00
commit 38705cf740
7 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,15 @@
#include "TheFLAUtils.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
int32_t (*FLAUtils::GetExtendedIDFunc)(const void* ptr) = nullptr;
void FLAUtils::Init()
{
HMODULE hFLA = GetModuleHandle("$fastman92limitAdjuster.asi");
if ( hFLA != nullptr )
{
GetExtendedIDFunc = reinterpret_cast<decltype(GetExtendedIDFunc)>(GetProcAddress( hFLA, "GetExtendedIDfrom16bitBefore" ));
}
}

23
SilentPatch/TheFLAUtils.h Normal file
View File

@ -0,0 +1,23 @@
#pragma once
#include <cstdint>
class FLAUtils
{
public:
static int32_t GetExtendedID(const void* ptr)
{
if ( GetExtendedIDFunc != nullptr )
return GetExtendedIDFunc(ptr);
uint16_t uID = *static_cast<const uint16_t*>(ptr);
return uID > MAX_UINT16_ID ? *static_cast<const int16_t*>(ptr) : uID;
}
static void Init();
private:
static const int32_t MAX_UINT16_ID = 0xFFFD;
static int32_t (*GetExtendedIDFunc)(const void* ptr);
};

View File

@ -60,7 +60,7 @@ void CObject::Render()
bool bCallRestore;
std::pair<void*,int> materialRestoreData[16];
if ( m_wCarPartModelIndex != -1 && m_nObjectType == 3 && bObjectFlag7 && RwObjectGetType(m_pRwObject) == rpATOMIC )
if ( FLAUtils::GetExtendedID( &m_wCarPartModelIndex ) != -1 && m_nObjectType == 3 && bObjectFlag7 && RwObjectGetType(m_pRwObject) == rpATOMIC )
{
auto* pData = materialRestoreData;

View File

@ -13,7 +13,7 @@ void (*CCustomCarPlateMgr::SetupMaterialPlatebackTexture)(RpMaterial* pMaterial,
bool (*CCustomCarPlateMgr::GeneratePlateText)(char* pBuf, int nLen); // Read from InjectDelayedPatches
CBaseModelInfo** const ms_modelInfoPtrs = *AddressByVersion<CBaseModelInfo***>(0x509CB1, 0x4C0C96, 0x403DB7);
const uint32_t m_numModelInfoPtrs = *AddressByVersion<uint16_t*>(0x4C5956+2, 0, 0);
const uint32_t m_numModelInfoPtrs = *AddressByVersion<uint32_t*>(0x4C5956+2, 0, 0);
static RwTexture** const ms_aDirtTextures = *AddressByVersion<RwTexture***>( 0x5D5DCC + 3, 0, 0x5F259C + 3 );

View File

@ -120,6 +120,10 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="AudioHardwareSA.cpp" />
<ClCompile Include="FLACDecoderSA.cpp" />
<ClCompile Include="GeneralSA.cpp" />
@ -164,6 +168,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
<ClInclude Include="..\SilentPatch\MemoryMgr.h" />
<ClInclude Include="..\SilentPatch\Patterns.h" />
<ClInclude Include="..\SilentPatch\resource1.h" />
<ClInclude Include="..\SilentPatch\TheFLAUtils.h" />
<ClInclude Include="AudioHardwareSA.h" />
<ClInclude Include="FLACDecoderSA.h" />
<ClInclude Include="GeneralSA.h" />

View File

@ -63,6 +63,9 @@
<ClCompile Include="..\SilentPatch\Patterns.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
@ -140,6 +143,9 @@
<ClInclude Include="rwpred.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\SilentPatch\TheFLAUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Shaders.rc">

View File

@ -23,6 +23,8 @@
#include "Maths.h"
#include "rwpred.hpp"
#include "TheFLAUtils.h"
// SA operator delete
extern void (*GTAdelete)(void* data);
extern const char* (*GetFrameNodeName)(RwFrame*);