From 7ad7901a3eb0e117b791fe1ae37c58de10c2a1a0 Mon Sep 17 00:00:00 2001 From: Silent Date: Thu, 9 May 2024 19:11:20 +0200 Subject: [PATCH] III/VC: Integrate FLA utils Makes SP's code compatible with FLA's 32-bit model IDs --- SilentPatchIII/SilentPatchIII.cpp | 3 +++ SilentPatchIII/SilentPatchIII.vcxproj | 6 ++++++ SilentPatchIII/SilentPatchIII.vcxproj.filters | 6 ++++++ SilentPatchIII/VehicleIII.h | 5 +++-- SilentPatchVC/SilentPatchVC.cpp | 3 +++ SilentPatchVC/SilentPatchVC.vcxproj | 6 ++++++ SilentPatchVC/SilentPatchVC.vcxproj.filters | 6 ++++++ SilentPatchVC/VehicleVC.h | 5 +++-- 8 files changed, 36 insertions(+), 4 deletions(-) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 86f2874..36dc328 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -7,6 +7,7 @@ #include "Desktop.h" #include "VehicleIII.h" #include "ModelInfoIII.h" +#include "TheFLAUtils.h" #include #include @@ -925,6 +926,8 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul InjectHook( match.get( 2 ), &CSimpleModelInfo::SetNearDistanceForLOD_SilentPatch, HookType::Call ); } } + + FLAUtils::Init(moduleList); } void InjectDelayedPatches_III_Common() diff --git a/SilentPatchIII/SilentPatchIII.vcxproj b/SilentPatchIII/SilentPatchIII.vcxproj index 289498e..0c4d665 100644 --- a/SilentPatchIII/SilentPatchIII.vcxproj +++ b/SilentPatchIII/SilentPatchIII.vcxproj @@ -41,6 +41,11 @@ NotUsing NotUsing + + NotUsing + NotUsing + NotUsing + NotUsing @@ -65,6 +70,7 @@ + diff --git a/SilentPatchIII/SilentPatchIII.vcxproj.filters b/SilentPatchIII/SilentPatchIII.vcxproj.filters index e1e24ef..4a511ce 100644 --- a/SilentPatchIII/SilentPatchIII.vcxproj.filters +++ b/SilentPatchIII/SilentPatchIII.vcxproj.filters @@ -54,6 +54,9 @@ Source Files + + Source Files + @@ -101,6 +104,9 @@ Header Files + + Header Files + diff --git a/SilentPatchIII/VehicleIII.h b/SilentPatchIII/VehicleIII.h index 6b0dbad..b081e98 100644 --- a/SilentPatchIII/VehicleIII.h +++ b/SilentPatchIII/VehicleIII.h @@ -2,6 +2,7 @@ #include #include "Maths.h" +#include "TheFLAUtils.h" enum eVehicleType { @@ -19,14 +20,14 @@ protected: void* __vmt; CMatrix m_matrix; uint8_t __pad2[16]; - uint16_t m_modelIndex; // TODO: THE FLA + FLAUtils::int16 m_modelIndex; uint8_t __pad1[548]; uint32_t m_dwVehicleClass; public: int32_t GetModelIndex() const - { return m_modelIndex; } + { return m_modelIndex.Get(); } const CMatrix& GetMatrix() const { return m_matrix; } diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 89cae46..cc57c74 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -9,6 +9,7 @@ #include "VehicleVC.h" #include "SVF.h" #include "RWUtils.hpp" +#include "TheFLAUtils.h" #include #include @@ -882,6 +883,8 @@ void InjectDelayedPatches_VC_Common( bool bHasDebugMenu, const wchar_t* wcModule } } } + + FLAUtils::Init(moduleList); } void InjectDelayedPatches_VC_Common() diff --git a/SilentPatchVC/SilentPatchVC.vcxproj b/SilentPatchVC/SilentPatchVC.vcxproj index 2c80236..4ad056c 100644 --- a/SilentPatchVC/SilentPatchVC.vcxproj +++ b/SilentPatchVC/SilentPatchVC.vcxproj @@ -177,6 +177,7 @@ + @@ -211,6 +212,11 @@ NotUsing NotUsing + + NotUsing + NotUsing + NotUsing + NotUsing diff --git a/SilentPatchVC/SilentPatchVC.vcxproj.filters b/SilentPatchVC/SilentPatchVC.vcxproj.filters index 20e683e..cda3132 100644 --- a/SilentPatchVC/SilentPatchVC.vcxproj.filters +++ b/SilentPatchVC/SilentPatchVC.vcxproj.filters @@ -63,6 +63,9 @@ Header Files + + Header Files + @@ -101,6 +104,9 @@ Source Files + + Source Files + diff --git a/SilentPatchVC/VehicleVC.h b/SilentPatchVC/VehicleVC.h index ffa00c0..c77e7f9 100644 --- a/SilentPatchVC/VehicleVC.h +++ b/SilentPatchVC/VehicleVC.h @@ -2,6 +2,7 @@ #include #include "Maths.h" +#include "TheFLAUtils.h" enum eVehicleType { @@ -20,7 +21,7 @@ protected: void* __vmt; CMatrix m_matrix; uint8_t __pad4[16]; - uint16_t m_modelIndex; // TODO: THE FLA + FLAUtils::int16 m_modelIndex; void* m_pFirstReference; int32_t m_audioEntityId; // TODO: This should really be CPhysical uint8_t __pad5[320]; @@ -36,7 +37,7 @@ protected: public: int32_t GetModelIndex() const - { return m_modelIndex; } + { return m_modelIndex.Get(); } const CMatrix& GetMatrix() const { return m_matrix; }