and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

You need to sign in or sign up before continuing.
...
 
Commits (2)
......@@ -123,8 +123,10 @@ short CAEVehicleAudioEntity::RequestBankSlot(short bankId)
for (auto i = 0; i < NUM_DUMMY_ENGINE_SLOTS; ++i)
{
auto& dummyEng = CAEVehicleAudioEntity::s_DummyEngineSlots[i];
if (dummyEng.m_nBankId == bankId)
if (dummyEng.m_nBankId == bankId) {
dummyEng.m_nUsageCount++;
return i + 7;
}
if (dummyEng.m_nUsageCount <= 0)
freeSlot = i;
......
#include "StdInc.h"
void ReversibleHooks::UnHook(const std::string& className, const char* functionName)
{
if (className.empty())
return;
const auto& allHooks = GetAllHooks();
if (functionName) {
for (auto& classHooks : allHooks) {
if (classHooks.first == className) {
for (auto& hook : classHooks.second) {
if (hook->m_bIsHooked && strcmp(hook->m_sFunctionName.c_str(), functionName) == 0) {
hook->Switch();
printf("UnHooked %s::%s\n", className.c_str(), functionName);
return;
}
}
}
}
} else {
for (auto& classHooks : allHooks) {
if (classHooks.first == className) {
for (auto& hook : classHooks.second) {
if (hook->m_bIsHooked)
hook->Switch();
}
printf("UnHooked class %s\n", className.c_str());
return;
}
}
}
}
void ReversibleHooks::HookInstall(const std::string& sIdentifier, const std::string& sFuncName, unsigned int installAddress, void* addressToJumpTo, int iJmpCodeSize, bool bDisableByDefault)
{
assert(!GetHook(sIdentifier, sFuncName));
......
......@@ -78,6 +78,7 @@ public:
return ReversibleHooks::GetInstance().m_HooksMap;
}
static void UnHook(const std::string& className, const char* functionName = nullptr);
private:
void HookInstall(const std::string& sIdentifier, const std::string& sFuncName, unsigned int installAddress, void* addressToJumpTo, int iJmpCodeSize = 5, bool bDisableByDefault = false);
void HookInstallVirtual(const std::string& sIdentifier, const std::string& sFuncName, void* libVTableAddress, const std::vector<uint32_t>& vecAddressesToHook);
......