diff --git a/DDraw/DDraw.vcxproj b/DDraw/DDraw.vcxproj
index 288c7c9..8ad8860 100644
--- a/DDraw/DDraw.vcxproj
+++ b/DDraw/DDraw.vcxproj
@@ -59,7 +59,15 @@
-
+
+ ddraw
+
+
+ ddraw
+
+
+ ddraw
+
Level4
@@ -150,7 +158,7 @@ copy /y "$(TargetPath)" "D:\Steam\steamapps\common\Grand Theft Auto Vice City\dd
-
+
@@ -158,7 +166,7 @@ copy /y "$(TargetPath)" "D:\Steam\steamapps\common\Grand Theft Auto Vice City\dd
-
+
diff --git a/DDraw/DDraw.vcxproj.filters b/DDraw/DDraw.vcxproj.filters
index 16560bd..3c214fe 100644
--- a/DDraw/DDraw.vcxproj.filters
+++ b/DDraw/DDraw.vcxproj.filters
@@ -21,7 +21,7 @@
Source Files
-
+
Source Files
@@ -32,7 +32,7 @@
Header Files
-
+
Header Files
diff --git a/DDraw/dllmain.cpp b/DDraw/dllmain.cpp
index 8979a21..8906259 100644
--- a/DDraw/dllmain.cpp
+++ b/DDraw/dllmain.cpp
@@ -9,7 +9,7 @@
#include "MemoryMgr.h"
#include "Patterns.h"
-#include "Common.h"
+#include "Common_ddraw.h"
#pragma comment(lib, "shlwapi.lib")
diff --git a/SilentPatch/Common.cpp b/SilentPatch/Common.cpp
index 9bbd48d..2341583 100644
--- a/SilentPatch/Common.cpp
+++ b/SilentPatch/Common.cpp
@@ -1,200 +1,24 @@
#include "Common.h"
-#include
-#include
#include "MemoryMgr.h"
#include "Patterns.h"
-
-#pragma comment(lib, "shlwapi.lib")
-
-extern char** ppUserFilesDir;
+#include "StoredCar.h"
namespace Common {
- char* GetMyDocumentsPath()
- {
- static char cUserFilesPath[MAX_PATH];
-
- if ( cUserFilesPath[0] == '\0' )
- {
- SHGetFolderPathA(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, cUserFilesPath);
- PathAppendA(cUserFilesPath, *ppUserFilesDir);
- CreateDirectoryA(cUserFilesPath, nullptr);
- }
- return cUserFilesPath;
- }
-
namespace Patches {
-
- bool FixRwcseg_Patterns()
- {
- using namespace hook;
-
- auto begin = pattern( "55 8B EC 50 53 51 52 8B 5D 14 8B 4D 10 8B 45 0C 8B 55 08" );
- auto end = pattern( "9B D9 3D ? ? ? ? 81 25 ? ? ? ? FF FC FF FF 83 0D ? ? ? ? 3F" );
-
- if ( begin.count_hint(1).size() == 1 && end.count_hint(1).size() == 1 )
- {
- const ptrdiff_t size = (intptr_t)end.get_first( 24 ) - (intptr_t)begin.get_first();
- if ( size > 0 )
- {
- DWORD dwProtect;
- VirtualProtect( begin.get_first(), size, PAGE_EXECUTE_READ, &dwProtect );
- return true;
- }
- }
- return false;
- }
-
- // ================= III =================
- void DDraw_III_10( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x580BB0, GetMyDocumentsPath, PATCH_JUMP);
-
- Patch(0x581E5E, desktop.right);
- Patch(0x581E68, desktop.bottom);
- Patch(0x581E72, 32);
- Patch(0x581EA8, desktopText);
-
- // No 12mb vram check
- Patch(0x581411, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x5812D6, 0xB8);
- Patch(0x5812D7, 0x900);
- }
-
- void DDraw_III_11( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x580F00, GetMyDocumentsPath, PATCH_JUMP);
-
- Patch(0x58219E, desktop.right);
- Patch(0x5821A8, desktop.bottom);
- Patch(0x5821B2, 32);
- Patch(0x5821E8, desktopText);
-
- // No 12mb vram check
- Patch(0x581753, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x581620, 0xB8);
- Patch(0x581621, 0x900);
- }
-
- void DDraw_III_Steam( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x580E00, GetMyDocumentsPath, PATCH_JUMP);
-
- Patch(0x58208E, desktop.right);
- Patch(0x582098, desktop.bottom);
- Patch(0x5820A2, 32);
- Patch(0x5820D8, desktopText);
-
- // No 12mb vram check
- Patch(0x581653, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x581520, 0xB8);
- Patch(0x581521, 0x900);
- }
-
- // ================= VC =================
- void DDraw_VC_10( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x602240, GetMyDocumentsPath, PATCH_JUMP);
-
- InjectHook(0x601A40, GetMyDocumentsPath, PATCH_CALL);
- InjectHook(0x601A45, 0x601B2F, PATCH_JUMP);
-
- Patch(0x600E7E, desktop.right);
- Patch(0x600E88, desktop.bottom);
- Patch(0x600E92, 32);
- Patch(0x600EC8, desktopText);
-
- // No 12mb vram check
- Patch(0x601E26, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x601CA0, 0xB8);
- Patch(0x601CA1, 0x900);
- }
-
- void DDraw_VC_11( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x602220, GetMyDocumentsPath, PATCH_JUMP);
-
- InjectHook(0x601A70, GetMyDocumentsPath, PATCH_CALL);
- InjectHook(0x601A75, 0x601B5F, PATCH_JUMP);
-
- Patch(0x600E9E, desktop.right);
- Patch(0x600EA8, desktop.bottom);
- Patch(0x600EB2, 32);
- Patch(0x600EE8, desktopText);
-
- // No 12mb vram check
- Patch(0x601E56, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x601CD0, 0xB8);
- Patch(0x601CD1, 0x900);
- }
-
-
- void DDraw_VC_Steam( const RECT& desktop, const char* desktopText )
- {
- using namespace Memory;
-
- InjectHook(0x601E60, GetMyDocumentsPath, PATCH_JUMP);
-
- InjectHook(0x6016B0, GetMyDocumentsPath, PATCH_CALL);
- InjectHook(0x6016B5, 0x60179F, PATCH_JUMP);
-
- Patch(0x600ADE, desktop.right);
- Patch(0x600AE8, desktop.bottom);
- Patch(0x600AF2, 32);
- Patch(0x600B28, desktopText);
-
- // No 12mb vram check
- Patch(0x601A96, 0xEB);
-
- // No DirectPlay dependency
- Patch(0x601910, 0xB8);
- Patch(0x601911, 0x900);
- }
-
- // ================= COMMON =================
- void DDraw_Common()
+ void III_VC_Common()
{
using namespace Memory;
using namespace hook;
- // Remove FILE_FLAG_NO_BUFFERING from CdStreams
+ // Fixed bomb ownership/bombs saving for bikes
{
- auto mem = pattern( "81 7C 24 04 00 08 00 00" ).count_hint(1);
- if ( mem.size() == 1 )
- {
- Patch( mem.get_first( 0x12 ), 0xEB );
- }
- }
+ auto addr = get_pattern( "83 3C 33 00 74 19 89 F9 E8", 8 );
-
- // No censorships
- {
- auto addr = pattern( "83 FB 07 74 0A 83 FD 07 74 05 83 FE 07 75 15" ).count_hint(1);
- if ( addr.size() == 1 )
- {
- Patch( addr.get_first(), { 0xEB, 0x5E } );
- }
-
+ void* pRestoreCar;
+ ReadCall( addr, pRestoreCar );
+ CStoredCar::orgRestoreCar = *(decltype(CStoredCar::orgRestoreCar)*)&pRestoreCar;
+ InjectHook( addr, &CStoredCar::RestoreCar_SilentPatch );
}
}
}
diff --git a/SilentPatch/Common.h b/SilentPatch/Common.h
index f3964e3..a0ed8d6 100644
--- a/SilentPatch/Common.h
+++ b/SilentPatch/Common.h
@@ -1,27 +1,9 @@
#pragma once
-#define WIN32_LEAN_AND_MEAN
-
-#define WINVER 0x0501
-#define _WIN32_WINNT 0x0501
-#define NOMINMAX
-
-#include
-
namespace Common
{
namespace Patches
{
- bool FixRwcseg_Patterns();
-
- void DDraw_III_10( const RECT& desktop, const char* desktopText );
- void DDraw_III_11( const RECT& desktop, const char* desktopText );
- void DDraw_III_Steam( const RECT& desktop, const char* desktopText );
-
- void DDraw_VC_10( const RECT& desktop, const char* desktopText );
- void DDraw_VC_11( const RECT& desktop, const char* desktopText );
- void DDraw_VC_Steam( const RECT& desktop, const char* desktopText );
-
- void DDraw_Common();
+ void III_VC_Common();
}
};
\ No newline at end of file
diff --git a/SilentPatch/Common_ddraw.cpp b/SilentPatch/Common_ddraw.cpp
new file mode 100644
index 0000000..9fa6bea
--- /dev/null
+++ b/SilentPatch/Common_ddraw.cpp
@@ -0,0 +1,201 @@
+#include "Common_ddraw.h"
+
+#include
+#include
+#include "MemoryMgr.h"
+#include "Patterns.h"
+
+#pragma comment(lib, "shlwapi.lib")
+
+extern char** ppUserFilesDir;
+
+namespace Common {
+ char* GetMyDocumentsPath()
+ {
+ static char cUserFilesPath[MAX_PATH];
+
+ if ( cUserFilesPath[0] == '\0' )
+ {
+ SHGetFolderPathA(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, cUserFilesPath);
+ PathAppendA(cUserFilesPath, *ppUserFilesDir);
+ CreateDirectoryA(cUserFilesPath, nullptr);
+ }
+ return cUserFilesPath;
+ }
+
+ namespace Patches {
+
+ bool FixRwcseg_Patterns()
+ {
+ using namespace hook;
+
+ auto begin = pattern( "55 8B EC 50 53 51 52 8B 5D 14 8B 4D 10 8B 45 0C 8B 55 08" );
+ auto end = pattern( "9B D9 3D ? ? ? ? 81 25 ? ? ? ? FF FC FF FF 83 0D ? ? ? ? 3F" );
+
+ if ( begin.count_hint(1).size() == 1 && end.count_hint(1).size() == 1 )
+ {
+ const ptrdiff_t size = (intptr_t)end.get_first( 24 ) - (intptr_t)begin.get_first();
+ if ( size > 0 )
+ {
+ DWORD dwProtect;
+ VirtualProtect( begin.get_first(), size, PAGE_EXECUTE_READ, &dwProtect );
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // ================= III =================
+ void DDraw_III_10( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x580BB0, GetMyDocumentsPath, PATCH_JUMP);
+
+ Patch(0x581E5E, desktop.right);
+ Patch(0x581E68, desktop.bottom);
+ Patch(0x581E72, 32);
+ Patch(0x581EA8, desktopText);
+
+ // No 12mb vram check
+ Patch(0x581411, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x5812D6, 0xB8);
+ Patch(0x5812D7, 0x900);
+ }
+
+ void DDraw_III_11( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x580F00, GetMyDocumentsPath, PATCH_JUMP);
+
+ Patch(0x58219E, desktop.right);
+ Patch(0x5821A8, desktop.bottom);
+ Patch(0x5821B2, 32);
+ Patch(0x5821E8, desktopText);
+
+ // No 12mb vram check
+ Patch(0x581753, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x581620, 0xB8);
+ Patch(0x581621, 0x900);
+ }
+
+ void DDraw_III_Steam( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x580E00, GetMyDocumentsPath, PATCH_JUMP);
+
+ Patch(0x58208E, desktop.right);
+ Patch(0x582098, desktop.bottom);
+ Patch(0x5820A2, 32);
+ Patch(0x5820D8, desktopText);
+
+ // No 12mb vram check
+ Patch(0x581653, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x581520, 0xB8);
+ Patch(0x581521, 0x900);
+ }
+
+ // ================= VC =================
+ void DDraw_VC_10( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x602240, GetMyDocumentsPath, PATCH_JUMP);
+
+ InjectHook(0x601A40, GetMyDocumentsPath, PATCH_CALL);
+ InjectHook(0x601A45, 0x601B2F, PATCH_JUMP);
+
+ Patch(0x600E7E, desktop.right);
+ Patch(0x600E88, desktop.bottom);
+ Patch(0x600E92, 32);
+ Patch(0x600EC8, desktopText);
+
+ // No 12mb vram check
+ Patch(0x601E26, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x601CA0, 0xB8);
+ Patch(0x601CA1, 0x900);
+ }
+
+ void DDraw_VC_11( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x602220, GetMyDocumentsPath, PATCH_JUMP);
+
+ InjectHook(0x601A70, GetMyDocumentsPath, PATCH_CALL);
+ InjectHook(0x601A75, 0x601B5F, PATCH_JUMP);
+
+ Patch(0x600E9E, desktop.right);
+ Patch(0x600EA8, desktop.bottom);
+ Patch(0x600EB2, 32);
+ Patch(0x600EE8, desktopText);
+
+ // No 12mb vram check
+ Patch(0x601E56, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x601CD0, 0xB8);
+ Patch(0x601CD1, 0x900);
+ }
+
+
+ void DDraw_VC_Steam( const RECT& desktop, const char* desktopText )
+ {
+ using namespace Memory;
+
+ InjectHook(0x601E60, GetMyDocumentsPath, PATCH_JUMP);
+
+ InjectHook(0x6016B0, GetMyDocumentsPath, PATCH_CALL);
+ InjectHook(0x6016B5, 0x60179F, PATCH_JUMP);
+
+ Patch(0x600ADE, desktop.right);
+ Patch(0x600AE8, desktop.bottom);
+ Patch(0x600AF2, 32);
+ Patch(0x600B28, desktopText);
+
+ // No 12mb vram check
+ Patch(0x601A96, 0xEB);
+
+ // No DirectPlay dependency
+ Patch(0x601910, 0xB8);
+ Patch(0x601911, 0x900);
+ }
+
+ // ================= COMMON =================
+ void DDraw_Common()
+ {
+ using namespace Memory;
+ using namespace hook;
+
+ // Remove FILE_FLAG_NO_BUFFERING from CdStreams
+ {
+ auto mem = pattern( "81 7C 24 04 00 08 00 00" ).count_hint(1);
+ if ( mem.size() == 1 )
+ {
+ Patch( mem.get_first( 0x12 ), 0xEB );
+ }
+ }
+
+
+ // No censorships
+ {
+ auto addr = pattern( "83 FB 07 74 0A 83 FD 07 74 05 83 FE 07 75 15" ).count_hint(1);
+ if ( addr.size() == 1 )
+ {
+ Patch( addr.get_first(), { 0xEB, 0x5E } );
+ }
+
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SilentPatch/Common_ddraw.h b/SilentPatch/Common_ddraw.h
new file mode 100644
index 0000000..f3964e3
--- /dev/null
+++ b/SilentPatch/Common_ddraw.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN
+
+#define WINVER 0x0501
+#define _WIN32_WINNT 0x0501
+#define NOMINMAX
+
+#include
+
+namespace Common
+{
+ namespace Patches
+ {
+ bool FixRwcseg_Patterns();
+
+ void DDraw_III_10( const RECT& desktop, const char* desktopText );
+ void DDraw_III_11( const RECT& desktop, const char* desktopText );
+ void DDraw_III_Steam( const RECT& desktop, const char* desktopText );
+
+ void DDraw_VC_10( const RECT& desktop, const char* desktopText );
+ void DDraw_VC_11( const RECT& desktop, const char* desktopText );
+ void DDraw_VC_Steam( const RECT& desktop, const char* desktopText );
+
+ void DDraw_Common();
+ }
+};
\ No newline at end of file
diff --git a/SilentPatch/General.h b/SilentPatch/General.h
index d6e0a1c..8ddaa74 100644
--- a/SilentPatch/General.h
+++ b/SilentPatch/General.h
@@ -34,4 +34,48 @@ public:
{}
};
+class CVector
+{
+public:
+ float x, y, z;
+
+ CVector()
+ {}
+
+ constexpr CVector(float fX, float fY, float fZ=0.0f)
+ : x(fX), y(fY), z(fZ)
+ {}
+
+
+ CVector& operator+=(const CVector& vec)
+ { x += vec.x; y += vec.y; z += vec.z;
+ return *this; }
+ CVector& operator-=(const CVector& vec)
+ { x -= vec.x; y -= vec.y; z -= vec.z;
+ return *this; }
+
+ inline float Magnitude() const
+ { return sqrt(x * x + y * y + z * z); }
+ inline constexpr float MagnitudeSqr() const
+ { return x * x + y * y + z * z; }
+ inline CVector& Normalize()
+ { float fInvLen = 1.0f / Magnitude(); x *= fInvLen; y *= fInvLen; z *= fInvLen; return *this; }
+
+ friend inline float DotProduct(const CVector& vec1, const CVector& vec2)
+ { return vec1.x * vec2.x + vec1.x * vec2.y + vec1.z * vec2.z; }
+ friend inline CVector CrossProduct(const CVector& vec1, const CVector& vec2)
+ { return CVector( vec1.y * vec2.z - vec1.z * vec2.y,
+ vec1.z * vec2.x - vec1.x * vec2.z,
+ vec1.x * vec2.y - vec1.y * vec2.x); }
+
+ friend inline CVector operator*(const CVector& in, float fMul)
+ { return CVector(in.x * fMul, in.y * fMul, in.z * fMul); }
+ friend inline CVector operator+(const CVector& vec1, const CVector& vec2)
+ { return CVector(vec1.x + vec2.x, vec1.y + vec2.y, vec1.z + vec2.z); }
+ friend inline CVector operator-(const CVector& vec1, const CVector& vec2)
+ { return CVector(vec1.x - vec2.x, vec1.y - vec2.y, vec1.z - vec2.z); }
+ friend inline CVector operator-(const CVector& vec)
+ { return CVector(-vec.x, -vec.y, -vec.z); }
+};
+
#endif
\ No newline at end of file
diff --git a/SilentPatch/StdAfx.h b/SilentPatch/StdAfx.h
index 8ddc57a..b75d12c 100644
--- a/SilentPatch/StdAfx.h
+++ b/SilentPatch/StdAfx.h
@@ -10,47 +10,4 @@
#include "MemoryMgr.h"
-class CVector
-{
-public:
- float x, y, z;
-
- CVector()
- {}
-
- constexpr CVector(float fX, float fY, float fZ=0.0f)
- : x(fX), y(fY), z(fZ)
- {}
-
- CVector& operator+=(const CVector& vec)
- { x += vec.x; y += vec.y; z += vec.z;
- return *this; }
- CVector& operator-=(const CVector& vec)
- { x -= vec.x; y -= vec.y; z -= vec.z;
- return *this; }
-
- inline float Magnitude() const
- { return sqrt(x * x + y * y + z * z); }
- inline constexpr float MagnitudeSqr() const
- { return x * x + y * y + z * z; }
- inline CVector& Normalize()
- { float fInvLen = 1.0f / Magnitude(); x *= fInvLen; y *= fInvLen; z *= fInvLen; return *this; }
-
- friend inline float DotProduct(const CVector& vec1, const CVector& vec2)
- { return vec1.x * vec2.x + vec1.x * vec2.y + vec1.z * vec2.z; }
- friend inline CVector CrossProduct(const CVector& vec1, const CVector& vec2)
- { return CVector( vec1.y * vec2.z - vec1.z * vec2.y,
- vec1.z * vec2.x - vec1.x * vec2.z,
- vec1.x * vec2.y - vec1.y * vec2.x); }
-
- friend inline CVector operator*(const CVector& in, float fMul)
- { return CVector(in.x * fMul, in.y * fMul, in.z * fMul); }
- friend inline CVector operator+(const CVector& vec1, const CVector& vec2)
- { return CVector(vec1.x + vec2.x, vec1.y + vec2.y, vec1.z + vec2.z); }
- friend inline CVector operator-(const CVector& vec1, const CVector& vec2)
- { return CVector(vec1.x - vec2.x, vec1.y - vec2.y, vec1.z - vec2.z); }
- friend inline CVector operator-(const CVector& vec)
- { return CVector(-vec.x, -vec.y, -vec.z); }
-};
-
#define DISABLE_FLA_DONATION_WINDOW 0
diff --git a/SilentPatch/StoredCar.cpp b/SilentPatch/StoredCar.cpp
new file mode 100644
index 0000000..78159d4
--- /dev/null
+++ b/SilentPatch/StoredCar.cpp
@@ -0,0 +1,33 @@
+#include "StdAfx.h"
+
+#include "StoredCar.h"
+#include "Patterns.h"
+
+#if _GTA_III
+static auto FindPlayerPed = hook::get_pattern( "6B C0 4F 8B 04 85 ? ? ? ? C3", -7 );
+#elif _GTA_VC
+static auto FindPlayerPed = hook::get_pattern( "6B C0 2E 8B 04 C5 ? ? ? ? C3", -7 );
+#endif
+
+CVehicle* (CStoredCar::*CStoredCar::orgRestoreCar)();
+
+CVehicle* CStoredCar::RestoreCar_SilentPatch()
+{
+ CVehicle* vehicle = (this->*(orgRestoreCar))();
+ if ( vehicle == nullptr ) return nullptr;
+ if ( m_bombType != 0 )
+ {
+ // Fixup bomb stuff
+#if _GTA_VC
+ if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
+ {
+ vehicle->SetBombOnBoard( m_bombType );
+ vehicle->SetBombOwner( FindPlayerPed() );
+ }
+#elif _GTA_III
+ static_cast(vehicle)->SetBombOwner( FindPlayerPed() );
+#endif
+ }
+
+ return vehicle;
+}
\ No newline at end of file
diff --git a/SilentPatch/StoredCar.h b/SilentPatch/StoredCar.h
new file mode 100644
index 0000000..8009f31
--- /dev/null
+++ b/SilentPatch/StoredCar.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "General.h"
+
+#if _GTA_III
+#include "../SilentPatchIII/VehicleIII.h"
+#elif _GTA_VC
+#include "../SilentPatchVC/VehicleVC.h"
+#endif
+
+class CStoredCar
+{
+private:
+ int32_t m_modelIndex;
+ CVector m_position;
+ CVector m_angle;
+ uint32_t m_handlingFlags;
+ uint8_t m_nPrimaryColor;
+ uint8_t m_nSecondaryColor;
+ int8_t m_nRadioStation;
+ int8_t m_anCompsToUse[2];
+ uint8_t m_bombType;
+
+public:
+ static CVehicle* (CStoredCar::*orgRestoreCar)();
+
+ CVehicle* RestoreCar_SilentPatch();
+};
+
+static_assert(sizeof(CStoredCar) == 0x28, "Wrong size: CStoredCar");
\ No newline at end of file
diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp
index 2647559..362d5f2 100644
--- a/SilentPatchIII/SilentPatchIII.cpp
+++ b/SilentPatchIII/SilentPatchIII.cpp
@@ -4,6 +4,7 @@
#include "Timer.h"
#include "Patterns.h"
#include "Common.h"
+#include "Common_ddraw.h"
#include
@@ -813,7 +814,7 @@ void Patch_III_Common()
// For NICK007J
// Uncomment this to get rid of "treadable hack" in CCarCtrl::PickNextNodeToChaseCar (to mirror VC behaviour)
- //InjectHook( funcAddr + 0x2A, funcAddr + 0x182, PATCH_JUMP );
+ InjectHook( funcAddr + 0x2A, funcAddr + 0x182, PATCH_JUMP );
}
@@ -844,6 +845,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) Patch_III_Steam(desktop);
Patch_III_Common();
+ Common::Patches::III_VC_Common();
Common::Patches::DDraw_Common();
}
diff --git a/SilentPatchIII/SilentPatchIII.vcxproj b/SilentPatchIII/SilentPatchIII.vcxproj
index 13eed4d..c78e858 100644
--- a/SilentPatchIII/SilentPatchIII.vcxproj
+++ b/SilentPatchIII/SilentPatchIII.vcxproj
@@ -20,11 +20,17 @@
NotUsing
NotUsing
+
+ NotUsing
+ NotUsing
+ NotUsing
+
NotUsing
NotUsing
NotUsing
+
@@ -34,11 +40,15 @@
+
+
+
+
@@ -105,7 +115,7 @@
Disabled
MultiThreadedDebug
_HAS_EXCEPTIONS=0;PATTERNS_USE_HINTS=1;_GTA_III;%(PreprocessorDefinitions)
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
@@ -140,7 +150,7 @@
Speed
true
_HAS_EXCEPTIONS=0;PATTERNS_USE_HINTS=1;_GTA_III;%(PreprocessorDefinitions)
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
@@ -177,7 +187,7 @@
Speed
true
_HAS_EXCEPTIONS=0;PATTERNS_USE_HINTS=1;_GTA_III;NDEBUG;%(PreprocessorDefinitions)
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
diff --git a/SilentPatchIII/SilentPatchIII.vcxproj.filters b/SilentPatchIII/SilentPatchIII.vcxproj.filters
index f856ff4..5a496fa 100644
--- a/SilentPatchIII/SilentPatchIII.vcxproj.filters
+++ b/SilentPatchIII/SilentPatchIII.vcxproj.filters
@@ -30,6 +30,12 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
@@ -47,6 +53,18 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
diff --git a/SilentPatchIII/VehicleIII.h b/SilentPatchIII/VehicleIII.h
new file mode 100644
index 0000000..143a50f
--- /dev/null
+++ b/SilentPatchIII/VehicleIII.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include
+
+enum eVehicleType
+{
+ VEHICLE_AUTOMOBILE,
+ VEHICLE_BOAT,
+ VEHICLE_TRAIN,
+ VEHICLE_HELI,
+ VEHICLE_PLANE
+};
+
+class CVehicle
+{
+private:
+ uint8_t __pad1[644];
+ uint32_t m_dwVehicleClass;
+
+
+public:
+ uint32_t GetClass() const
+ { return m_dwVehicleClass; }
+};
+
+class CAutomobile : public CVehicle
+{
+private:
+ uint8_t __pad2[593];
+ uint8_t m_BombOnBoard : 3;
+ class CEntity* m_pBombOwner;
+ uint8_t __pad33[200];
+
+
+public:
+ void SetBombOnBoard( uint32_t bombOnBoard )
+ { m_BombOnBoard = bombOnBoard; }
+ void SetBombOwner( class CEntity* owner )
+ { m_pBombOwner = owner; }
+};
+
+
+static_assert(sizeof(CVehicle) == 0x288, "Wrong size: CVehicle");
+static_assert(sizeof(CAutomobile) == 0x5A8, "Wrong size: CAutomobile");
\ No newline at end of file
diff --git a/SilentPatchSA/PoolsSA.h b/SilentPatchSA/PoolsSA.h
index 7774e37..106aca7 100644
--- a/SilentPatchSA/PoolsSA.h
+++ b/SilentPatchSA/PoolsSA.h
@@ -88,7 +88,6 @@ public:
};
// Type definitions for specific pool types
-#include "General.h"
typedef CPool CObjectPool;
diff --git a/SilentPatchSA/SilentPatchSA.vcxproj b/SilentPatchSA/SilentPatchSA.vcxproj
index a40cfb7..46fc247 100644
--- a/SilentPatchSA/SilentPatchSA.vcxproj
+++ b/SilentPatchSA/SilentPatchSA.vcxproj
@@ -76,7 +76,7 @@
Disabled
MultiThreadedDebug
_HAS_EXCEPTIONS=0;_GTA_SA;%(PreprocessorDefinitions)
- D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include
+ D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include;%(AdditionalIncludeDirectories)
Use
StdAfxSA.h
NoExtensions
@@ -114,7 +114,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
_HAS_EXCEPTIONS=0;_GTA_SA;%(PreprocessorDefinitions)
true
MultiThreaded
- D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include
+ D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include;%(AdditionalIncludeDirectories)
Use
StdAfxSA.h
NoExtensions
@@ -154,7 +154,7 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
_HAS_EXCEPTIONS=0;_GTA_SA;NDEBUG;_SECURE_SCL=0;%(PreprocessorDefinitions)
true
MultiThreaded
- D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include
+ D:\RWSDK\Graphics\rwsdk\include\d3d9;..\SilentPatch;$(DXSDK_DIR)\include;%(AdditionalIncludeDirectories)
Use
StdAfxSA.h
NoExtensions
diff --git a/SilentPatchSA/VehicleSA.cpp b/SilentPatchSA/VehicleSA.cpp
index 7c1abc8..6cc84b9 100644
--- a/SilentPatchSA/VehicleSA.cpp
+++ b/SilentPatchSA/VehicleSA.cpp
@@ -466,12 +466,16 @@ void CAutomobile::ProcessNewsvan()
CVehicle* CStoredCar::RestoreCar_SilentPatch()
{
CVehicle* vehicle = (this->*(orgRestoreCar))();
+ if ( vehicle == nullptr ) return nullptr;
- // Fixup bomb stuff
- if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
+ if ( m_bombType != 0 )
{
- vehicle->SetBombOnBoard( m_bombType );
- vehicle->SetBombOwner( FindPlayerPed(-1) );
+ // Fixup bomb stuff
+ if ( vehicle->GetClass() == VEHICLE_AUTOMOBILE || vehicle->GetClass() == VEHICLE_BIKE )
+ {
+ vehicle->SetBombOnBoard( m_bombType );
+ vehicle->SetBombOwner( FindPlayerPed(-1) );
+ }
}
return vehicle;
diff --git a/SilentPatchSA/VehicleSA.h b/SilentPatchSA/VehicleSA.h
index fd2c37a..205f68a 100644
--- a/SilentPatchSA/VehicleSA.h
+++ b/SilentPatchSA/VehicleSA.h
@@ -128,8 +128,8 @@ protected:
float m_fGasPedal;
float m_fBrakePedal;
uint8_t m_VehicleCreatedBy;
- uint32_t m_BombOnBoard : 3;
- BYTE __pad6[32];
+ uint8_t m_BombOnBoard : 3;
+ BYTE __pad6[35];
CEntity* m_pBombOwner;
signed int m_nTimeTillWeNeedThisCar;
BYTE __pad4[56];
diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp
index 8878414..f942569 100644
--- a/SilentPatchVC/SilentPatchVC.cpp
+++ b/SilentPatchVC/SilentPatchVC.cpp
@@ -3,6 +3,8 @@
#include "Timer.h"
#include "Patterns.h"
#include "Common.h"
+#include "Common_ddraw.h"
+#include "General.h"
#include
@@ -659,6 +661,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
else if (*(DWORD*)0x601048 == 0x5E5F5D60) Patch_VC_JP();
Patch_VC_Common();
+ Common::Patches::III_VC_Common();
Common::Patches::DDraw_Common();
}
diff --git a/SilentPatchVC/SilentPatchVC.vcxproj b/SilentPatchVC/SilentPatchVC.vcxproj
index 3564255..e3a90c3 100644
--- a/SilentPatchVC/SilentPatchVC.vcxproj
+++ b/SilentPatchVC/SilentPatchVC.vcxproj
@@ -76,7 +76,7 @@
Disabled
_HAS_EXCEPTIONS=0;PATTERNS_USE_HINTS=1;_GTA_VC;%(PreprocessorDefinitions)
MultiThreadedDebug
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
@@ -109,7 +109,7 @@
AnySuitable
Speed
true
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
@@ -144,7 +144,7 @@
AnySuitable
Speed
true
- ..\SilentPatch
+ ..\SilentPatch;%(AdditionalIncludeDirectories)
Use
StdAfx.h
NoExtensions
@@ -168,11 +168,14 @@
+
+
+
@@ -180,11 +183,17 @@
NotUsing
NotUsing
+
+ NotUsing
+ NotUsing
+ NotUsing
+
NotUsing
NotUsing
NotUsing
+
diff --git a/SilentPatchVC/SilentPatchVC.vcxproj.filters b/SilentPatchVC/SilentPatchVC.vcxproj.filters
index 720a12e..c0ca74b 100644
--- a/SilentPatchVC/SilentPatchVC.vcxproj.filters
+++ b/SilentPatchVC/SilentPatchVC.vcxproj.filters
@@ -30,6 +30,15 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
@@ -47,6 +56,12 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
diff --git a/SilentPatchVC/VehicleVC.h b/SilentPatchVC/VehicleVC.h
new file mode 100644
index 0000000..d8a3170
--- /dev/null
+++ b/SilentPatchVC/VehicleVC.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include
+
+enum eVehicleType
+{
+ VEHICLE_AUTOMOBILE,
+ VEHICLE_BOAT,
+ VEHICLE_TRAIN,
+ VEHICLE_HELI,
+ VEHICLE_PLANE,
+ VEHICLE_BIKE
+};
+
+class CVehicle
+{
+private:
+ uint8_t __pad1[510];
+ uint8_t m_BombOnBoard : 3;
+ uint8_t __pad2[17];
+ class CEntity* m_pBombOwner;
+ uint8_t __pad3[136];
+ uint32_t m_dwVehicleClass;
+
+
+public:
+ uint32_t GetClass() const
+ { return m_dwVehicleClass; }
+
+ void SetBombOnBoard( uint32_t bombOnBoard )
+ { m_BombOnBoard = bombOnBoard; }
+ void SetBombOwner( class CEntity* owner )
+ { m_pBombOwner = owner; }
+};
+
+static_assert(sizeof(CVehicle) == 0x2A0, "Wrong size: CVehicle");
\ No newline at end of file