mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 07:13:02 +05:00
Compare commits
19 commits
a8c40aabde
...
c6885c4d03
Author | SHA1 | Date | |
---|---|---|---|
|
c6885c4d03 | ||
|
c2e58d36e8 | ||
|
d6f3ea8b0a | ||
|
1b174a3724 | ||
|
d3e5495666 | ||
|
50b1c1353d | ||
|
77f5e908c0 | ||
|
4ba23dbf75 | ||
|
80b4fa1ece | ||
|
acc4af21bd | ||
|
940c68983d | ||
|
1af97eef26 | ||
|
04f74335c1 | ||
|
58905270bc | ||
|
b5483bbf59 | ||
|
fe6f98c314 | ||
|
c15fbc549d | ||
|
f33f5c131b | ||
|
2a597da1bc |
7 changed files with 44 additions and 16 deletions
|
@ -197,9 +197,11 @@ static bool PatchIAT()
|
|||
|
||||
static bool PatchIAT_ByPointers()
|
||||
{
|
||||
using namespace Memory::VP;
|
||||
|
||||
pOrgSystemParametersInfoA = SystemParametersInfoA;
|
||||
memcpy( orgCode, reinterpret_cast<void*>(pOrgSystemParametersInfoA), sizeof(orgCode) );
|
||||
Memory::VP::InjectHook( pOrgSystemParametersInfoA, SystemParametersInfoA_OverwritingHook, Memory::HookType::Jump );
|
||||
InjectHook( pOrgSystemParametersInfoA, SystemParametersInfoA_OverwritingHook, HookType::Jump );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<SILENTPATCH_EXT>.dll</SILENTPATCH_EXT>
|
||||
<SILENTPATCH_FULL_NAME>SilentPatch DDraw Component</SILENTPATCH_FULL_NAME>
|
||||
<SILENTPATCH_REVISION_ID>6</SILENTPATCH_REVISION_ID>
|
||||
<SILENTPATCH_BUILD_ID>0</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_BUILD_ID>1</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_COPYRIGHT>2014-2024</SILENTPATCH_COPYRIGHT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 95e523fa7494c0353b7ecfab408024a9d7b7e161
|
||||
Subproject commit 70cab494523e76d56063b5044c34345c14803c96
|
|
@ -918,7 +918,7 @@ namespace DodoKeyboardControls
|
|||
// ============= Resetting stats and variables on New Game =============
|
||||
namespace VariableResets
|
||||
{
|
||||
static auto TimerInitialise = reinterpret_cast<void(*)()>(hook::get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
static void (*TimerInitialise)();
|
||||
|
||||
using VarVariant = std::variant< bool*, int* >;
|
||||
std::vector<VarVariant> GameVariablesToReset;
|
||||
|
@ -932,8 +932,6 @@ namespace VariableResets
|
|||
}, var );
|
||||
}
|
||||
|
||||
// Functions that should have been called by the game but aren't...
|
||||
TimerInitialise();
|
||||
PurpleNinesGlitchFix();
|
||||
}
|
||||
|
||||
|
@ -953,8 +951,22 @@ namespace VariableResets
|
|||
void GameInitialise(const char* path)
|
||||
{
|
||||
ReInitOurVariables();
|
||||
TimerInitialise();
|
||||
orgGameInitialise(path);
|
||||
}
|
||||
|
||||
static void (__fastcall* DestroyAllGameCreatedEntities)(void* DMAudio);
|
||||
|
||||
template<std::size_t Index>
|
||||
static void (__fastcall* orgService)(void* DMAudio);
|
||||
|
||||
template<std::size_t Index>
|
||||
static void __fastcall Service_AndDestroyEntities(void* DMAudio)
|
||||
{
|
||||
DestroyAllGameCreatedEntities(DMAudio);
|
||||
orgService<Index>(DMAudio);
|
||||
}
|
||||
HOOK_EACH_INIT(Service, orgService, Service_AndDestroyEntities);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2581,8 +2593,22 @@ void Patch_III_Common()
|
|||
get_pattern("C6 05 ? ? ? ? ? E8 ? ? ? ? C7 05", 7)
|
||||
};
|
||||
|
||||
TimerInitialise = reinterpret_cast<decltype(TimerInitialise)>(get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
|
||||
// In GTA III, we also need to backport one more fix from VC to avoid issues with looping audio entities:
|
||||
// CMenuManager::DoSettingsBeforeStartingAGame needs to call cDMAudio::DestroyAllGameCreatedEntities
|
||||
DestroyAllGameCreatedEntities = reinterpret_cast<decltype(DestroyAllGameCreatedEntities)>(ReadCallFrom(
|
||||
get_pattern("B9 ? ? ? ? E8 ? ? ? ? 31 DB BD ? ? ? ? 8D 40 00", 5)));
|
||||
|
||||
auto audio_service = pattern("B9 ? ? ? ? E8 ? ? ? ? B9 ? ? ? ? C6 05 ? ? ? ? ? E8").count(2);
|
||||
std::array<void*, 2> audio_service_instances = {
|
||||
audio_service.get(0).get<void>(5),
|
||||
audio_service.get(1).get<void>(5),
|
||||
};
|
||||
|
||||
InterceptCall(game_initialise, orgGameInitialise, GameInitialise);
|
||||
HookEach_ReInitGameObjectVariables(reinit_game_object_variables, InterceptCall);
|
||||
HookEach_Service(audio_service_instances, InterceptCall);
|
||||
|
||||
// Variables to reset
|
||||
GameVariablesToReset.emplace_back(*get_pattern<bool*>("80 3D ? ? ? ? ? 74 2A", 2)); // Free resprays
|
||||
|
|
|
@ -302,7 +302,7 @@ public:
|
|||
|
||||
private:
|
||||
template<std::size_t Index>
|
||||
static void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
|
||||
STATIC_INLINE void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
|
||||
|
||||
template<std::size_t Index>
|
||||
void DoHeadLightBeam_LightBeamFixSaveObj(int type, CMatrix& m, bool right)
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
|
||||
public:
|
||||
template<std::size_t Index>
|
||||
static void (CAutomobile::*orgAutomobilePreRender)();
|
||||
STATIC_INLINE void (CAutomobile::*orgAutomobilePreRender)();
|
||||
|
||||
template<std::size_t Index>
|
||||
void PreRender_SilentPatch()
|
||||
|
@ -352,7 +352,7 @@ public:
|
|||
void HideDestroyedWheels_SilentPatch(void (CAutomobile::*spawnFlyingComponentCB)(int, unsigned int), int nodeID, unsigned int modelID);
|
||||
|
||||
template<std::size_t Index>
|
||||
static void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
|
||||
STATIC_INLINE void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
|
||||
|
||||
template<std::size_t Index>
|
||||
void SpawnFlyingComponent_HideWheels(int nodeID, unsigned int modelID)
|
||||
|
@ -448,7 +448,7 @@ private:
|
|||
|
||||
private:
|
||||
template<std::size_t Index>
|
||||
static CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||
STATIC_INLINE CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||
|
||||
template<std::size_t Index>
|
||||
CVehicle* RestoreCar_SilentPatch()
|
||||
|
@ -477,4 +477,4 @@ static_assert(sizeof(CVehicle) == 0x5A0, "Wrong size: CVehicle");
|
|||
static_assert(sizeof(CAutomobile) == 0x988, "Wrong size: CAutomobile");
|
||||
static_assert(sizeof(CStoredCar) == 0x40, "Wrong size: CStoredCar");
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1282,7 +1282,7 @@ namespace IsPlayerTargettingCharFix
|
|||
// ============= Resetting stats and variables on New Game =============
|
||||
namespace VariableResets
|
||||
{
|
||||
static auto TimerInitialise = reinterpret_cast<void(*)()>(hook::get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
static void (*TimerInitialise)();
|
||||
|
||||
using VarVariant = std::variant< bool*, int* >;
|
||||
std::vector<VarVariant> GameVariablesToReset;
|
||||
|
@ -1295,9 +1295,6 @@ namespace VariableResets
|
|||
*v = {};
|
||||
}, var );
|
||||
}
|
||||
|
||||
// Functions that should have been called by the game but aren't...
|
||||
TimerInitialise();
|
||||
}
|
||||
|
||||
template<std::size_t Index>
|
||||
|
@ -1316,6 +1313,7 @@ namespace VariableResets
|
|||
void GameInitialise(const char* path)
|
||||
{
|
||||
ReInitOurVariables();
|
||||
TimerInitialise();
|
||||
orgGameInitialise(path);
|
||||
}
|
||||
}
|
||||
|
@ -2970,6 +2968,8 @@ void Patch_VC_Common()
|
|||
get_pattern("C6 05 ? ? ? ? ? E8 ? ? ? ? C7 05", 7)
|
||||
};
|
||||
|
||||
TimerInitialise = reinterpret_cast<decltype(TimerInitialise)>(get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
|
||||
InterceptCall(game_initialise, orgGameInitialise, GameInitialise);
|
||||
HookEach_ReInitGameObjectVariables(reinit_game_object_variables, InterceptCall);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<SILENTPATCH_EXT>.asi</SILENTPATCH_EXT>
|
||||
<SILENTPATCH_FULL_NAME>SilentPatch for Vice City</SILENTPATCH_FULL_NAME>
|
||||
<SILENTPATCH_REVISION_ID>11</SILENTPATCH_REVISION_ID>
|
||||
<SILENTPATCH_BUILD_ID>1</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_BUILD_ID>2</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_COPYRIGHT>2013-2024</SILENTPATCH_COPYRIGHT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
|
|
Loading…
Reference in a new issue