III/VC: Integrate FLA utils

Makes SP's code compatible with FLA's 32-bit model IDs
This commit is contained in:
Silent 2024-05-09 19:11:20 +02:00
parent 2a5f9f439c
commit 7ad7901a3e
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
8 changed files with 36 additions and 4 deletions

View file

@ -7,6 +7,7 @@
#include "Desktop.h" #include "Desktop.h"
#include "VehicleIII.h" #include "VehicleIII.h"
#include "ModelInfoIII.h" #include "ModelInfoIII.h"
#include "TheFLAUtils.h"
#include <array> #include <array>
#include <memory> #include <memory>
@ -925,6 +926,8 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul
InjectHook( match.get<void>( 2 ), &CSimpleModelInfo::SetNearDistanceForLOD_SilentPatch, HookType::Call ); InjectHook( match.get<void>( 2 ), &CSimpleModelInfo::SetNearDistanceForLOD_SilentPatch, HookType::Call );
} }
} }
FLAUtils::Init(moduleList);
} }
void InjectDelayedPatches_III_Common() void InjectDelayedPatches_III_Common()

View file

@ -41,6 +41,11 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\SilentPatch\Timer.cpp" /> <ClCompile Include="..\SilentPatch\Timer.cpp" />
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp"> <ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
@ -65,6 +70,7 @@
<ClInclude Include="..\SilentPatch\StdAfx.h" /> <ClInclude Include="..\SilentPatch\StdAfx.h" />
<ClInclude Include="..\SilentPatch\StoredCar.h" /> <ClInclude Include="..\SilentPatch\StoredCar.h" />
<ClInclude Include="..\SilentPatch\SVF.h" /> <ClInclude Include="..\SilentPatch\SVF.h" />
<ClInclude Include="..\SilentPatch\TheFLAUtils.h" />
<ClInclude Include="..\SilentPatch\Timer.h" /> <ClInclude Include="..\SilentPatch\Timer.h" />
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.GTA.h" /> <ClInclude Include="..\SilentPatch\Utils\MemoryMgr.GTA.h" />
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.h" /> <ClInclude Include="..\SilentPatch\Utils\MemoryMgr.h" />

View file

@ -54,6 +54,9 @@
<ClCompile Include="..\SilentPatch\Desktop.cpp"> <ClCompile Include="..\SilentPatch\Desktop.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\SilentPatch\Timer.h"> <ClInclude Include="..\SilentPatch\Timer.h">
@ -101,6 +104,9 @@
<ClInclude Include="..\SilentPatch\Desktop.h"> <ClInclude Include="..\SilentPatch\Desktop.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\SilentPatch\TheFLAUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc"> <ResourceCompile Include="..\SilentPatch\SilentPatch.rc">

View file

@ -2,6 +2,7 @@
#include <cstdint> #include <cstdint>
#include "Maths.h" #include "Maths.h"
#include "TheFLAUtils.h"
enum eVehicleType enum eVehicleType
{ {
@ -19,14 +20,14 @@ protected:
void* __vmt; void* __vmt;
CMatrix m_matrix; CMatrix m_matrix;
uint8_t __pad2[16]; uint8_t __pad2[16];
uint16_t m_modelIndex; // TODO: THE FLA FLAUtils::int16 m_modelIndex;
uint8_t __pad1[548]; uint8_t __pad1[548];
uint32_t m_dwVehicleClass; uint32_t m_dwVehicleClass;
public: public:
int32_t GetModelIndex() const int32_t GetModelIndex() const
{ return m_modelIndex; } { return m_modelIndex.Get(); }
const CMatrix& GetMatrix() const const CMatrix& GetMatrix() const
{ return m_matrix; } { return m_matrix; }

View file

@ -9,6 +9,7 @@
#include "VehicleVC.h" #include "VehicleVC.h"
#include "SVF.h" #include "SVF.h"
#include "RWUtils.hpp" #include "RWUtils.hpp"
#include "TheFLAUtils.h"
#include <array> #include <array>
#include <memory> #include <memory>
@ -882,6 +883,8 @@ void InjectDelayedPatches_VC_Common( bool bHasDebugMenu, const wchar_t* wcModule
} }
} }
} }
FLAUtils::Init(moduleList);
} }
void InjectDelayedPatches_VC_Common() void InjectDelayedPatches_VC_Common()

View file

@ -177,6 +177,7 @@
<ClInclude Include="..\SilentPatch\StdAfx.h" /> <ClInclude Include="..\SilentPatch\StdAfx.h" />
<ClInclude Include="..\SilentPatch\StoredCar.h" /> <ClInclude Include="..\SilentPatch\StoredCar.h" />
<ClInclude Include="..\SilentPatch\SVF.h" /> <ClInclude Include="..\SilentPatch\SVF.h" />
<ClInclude Include="..\SilentPatch\TheFLAUtils.h" />
<ClInclude Include="..\SilentPatch\Timer.h" /> <ClInclude Include="..\SilentPatch\Timer.h" />
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.GTA.h" /> <ClInclude Include="..\SilentPatch\Utils\MemoryMgr.GTA.h" />
<ClInclude Include="..\SilentPatch\Utils\MemoryMgr.h" /> <ClInclude Include="..\SilentPatch\Utils\MemoryMgr.h" />
@ -211,6 +212,11 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Shipping|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\SilentPatch\Timer.cpp" /> <ClCompile Include="..\SilentPatch\Timer.cpp" />
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp"> <ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>

View file

@ -63,6 +63,9 @@
<ClInclude Include="..\SilentPatch\Desktop.h"> <ClInclude Include="..\SilentPatch\Desktop.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\SilentPatch\TheFLAUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\SilentPatch\Timer.cpp"> <ClCompile Include="..\SilentPatch\Timer.cpp">
@ -101,6 +104,9 @@
<ClCompile Include="..\SilentPatch\Desktop.cpp"> <ClCompile Include="..\SilentPatch\Desktop.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\SilentPatch\TheFLAUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc"> <ResourceCompile Include="..\SilentPatch\SilentPatch.rc">

View file

@ -2,6 +2,7 @@
#include <cstdint> #include <cstdint>
#include "Maths.h" #include "Maths.h"
#include "TheFLAUtils.h"
enum eVehicleType enum eVehicleType
{ {
@ -20,7 +21,7 @@ protected:
void* __vmt; void* __vmt;
CMatrix m_matrix; CMatrix m_matrix;
uint8_t __pad4[16]; uint8_t __pad4[16];
uint16_t m_modelIndex; // TODO: THE FLA FLAUtils::int16 m_modelIndex;
void* m_pFirstReference; void* m_pFirstReference;
int32_t m_audioEntityId; // TODO: This should really be CPhysical int32_t m_audioEntityId; // TODO: This should really be CPhysical
uint8_t __pad5[320]; uint8_t __pad5[320];
@ -36,7 +37,7 @@ protected:
public: public:
int32_t GetModelIndex() const int32_t GetModelIndex() const
{ return m_modelIndex; } { return m_modelIndex.Get(); }
const CMatrix& GetMatrix() const const CMatrix& GetMatrix() const
{ return m_matrix; } { return m_matrix; }