mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 23:33:02 +05:00
Compare commits
19 commits
f53acc255b
...
4a0882a55b
Author | SHA1 | Date | |
---|---|---|---|
|
4a0882a55b | ||
|
a8c40aabde | ||
|
c3570a9d89 | ||
|
9a3e90f7c9 | ||
|
6af4fcc0ee | ||
|
33c1ec00d6 | ||
|
e270bf652c | ||
|
24719bb98e | ||
|
77765c3fa5 | ||
|
4e2f4f8e03 | ||
|
cf57f43e19 | ||
|
ba76a0ed9e | ||
|
dbe21b8556 | ||
|
109e1c67f4 | ||
|
a3d9c73a8b | ||
|
84a737fb88 | ||
|
d9e8480b6d | ||
|
0bf574a5b8 | ||
|
730afa5848 |
7 changed files with 16 additions and 44 deletions
|
@ -197,11 +197,9 @@ static bool PatchIAT()
|
|||
|
||||
static bool PatchIAT_ByPointers()
|
||||
{
|
||||
using namespace Memory::VP;
|
||||
|
||||
pOrgSystemParametersInfoA = SystemParametersInfoA;
|
||||
memcpy( orgCode, reinterpret_cast<void*>(pOrgSystemParametersInfoA), sizeof(orgCode) );
|
||||
InjectHook( pOrgSystemParametersInfoA, SystemParametersInfoA_OverwritingHook, HookType::Jump );
|
||||
Memory::VP::InjectHook( pOrgSystemParametersInfoA, SystemParametersInfoA_OverwritingHook, Memory::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>1</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_BUILD_ID>0</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_COPYRIGHT>2014-2024</SILENTPATCH_COPYRIGHT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 70cab494523e76d56063b5044c34345c14803c96
|
||||
Subproject commit 95e523fa7494c0353b7ecfab408024a9d7b7e161
|
|
@ -918,7 +918,7 @@ namespace DodoKeyboardControls
|
|||
// ============= Resetting stats and variables on New Game =============
|
||||
namespace VariableResets
|
||||
{
|
||||
static void (*TimerInitialise)();
|
||||
static auto TimerInitialise = reinterpret_cast<void(*)()>(hook::get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
|
||||
using VarVariant = std::variant< bool*, int* >;
|
||||
std::vector<VarVariant> GameVariablesToReset;
|
||||
|
@ -932,6 +932,8 @@ namespace VariableResets
|
|||
}, var );
|
||||
}
|
||||
|
||||
// Functions that should have been called by the game but aren't...
|
||||
TimerInitialise();
|
||||
PurpleNinesGlitchFix();
|
||||
}
|
||||
|
||||
|
@ -951,22 +953,8 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2593,22 +2581,8 @@ 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_INLINE void (CVehicle::*orgDoHeadLightBeam)(int type, CMatrix& m, bool right);
|
||||
static 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_INLINE void (CAutomobile::*orgAutomobilePreRender)();
|
||||
static 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_INLINE void (CAutomobile::*orgSpawnFlyingComponent)(int, unsigned int);
|
||||
static 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_INLINE CVehicle* (CStoredCar::*orgRestoreCar)();
|
||||
static 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 void (*TimerInitialise)();
|
||||
static auto TimerInitialise = reinterpret_cast<void(*)()>(hook::get_pattern("83 E4 F8 68 ? ? ? ? E8", -6));
|
||||
|
||||
using VarVariant = std::variant< bool*, int* >;
|
||||
std::vector<VarVariant> GameVariablesToReset;
|
||||
|
@ -1295,6 +1295,9 @@ namespace VariableResets
|
|||
*v = {};
|
||||
}, var );
|
||||
}
|
||||
|
||||
// Functions that should have been called by the game but aren't...
|
||||
TimerInitialise();
|
||||
}
|
||||
|
||||
template<std::size_t Index>
|
||||
|
@ -1313,7 +1316,6 @@ namespace VariableResets
|
|||
void GameInitialise(const char* path)
|
||||
{
|
||||
ReInitOurVariables();
|
||||
TimerInitialise();
|
||||
orgGameInitialise(path);
|
||||
}
|
||||
}
|
||||
|
@ -2968,8 +2970,6 @@ 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>2</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_BUILD_ID>1</SILENTPATCH_BUILD_ID>
|
||||
<SILENTPATCH_COPYRIGHT>2013-2024</SILENTPATCH_COPYRIGHT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
|
|
Loading…
Reference in a new issue