mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Rename and mark detour globals as static
Renamed to 'g_DetourVector' and 'g_DetourSet', marked as static.
This commit is contained in:
parent
cc67739802
commit
7cc58a642f
@ -163,7 +163,7 @@ void Systems_Init()
|
|||||||
DetourUpdateThread(GetCurrentThread());
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
|
||||||
// Hook functions
|
// Hook functions
|
||||||
for (const IDetour* pDetour : vDetour)
|
for (const IDetour* pDetour : g_DetourVector)
|
||||||
{
|
{
|
||||||
pDetour->Attach();
|
pDetour->Attach();
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void Systems_Shutdown()
|
|||||||
DetourUpdateThread(GetCurrentThread());
|
DetourUpdateThread(GetCurrentThread());
|
||||||
|
|
||||||
// Unhook functions
|
// Unhook functions
|
||||||
for (const IDetour* pDetour : vDetour)
|
for (const IDetour* pDetour : g_DetourVector)
|
||||||
{
|
{
|
||||||
pDetour->Detach();
|
pDetour->Detach();
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ void DetourInit() // Run the sigscan
|
|||||||
g_SigCache.SetDisabled((strstr(pCommandLine, "-nosmap") != nullptr));
|
g_SigCache.SetDisabled((strstr(pCommandLine, "-nosmap") != nullptr));
|
||||||
g_SigCache.LoadCache(SIGDB_FILE);
|
g_SigCache.LoadCache(SIGDB_FILE);
|
||||||
|
|
||||||
for (const IDetour* pDetour : vDetour)
|
for (const IDetour* pDetour : g_DetourVector)
|
||||||
{
|
{
|
||||||
pDetour->GetCon(); // Constants.
|
pDetour->GetCon(); // Constants.
|
||||||
pDetour->GetFun(); // Functions.
|
pDetour->GetFun(); // Functions.
|
||||||
@ -362,7 +362,7 @@ void DetourInit() // Run the sigscan
|
|||||||
void DetourAddress() // Test the sigscan results
|
void DetourAddress() // Test the sigscan results
|
||||||
{
|
{
|
||||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||||
for (const IDetour* pDetour : vDetour)
|
for (const IDetour* pDetour : g_DetourVector)
|
||||||
{
|
{
|
||||||
pDetour->GetAdr();
|
pDetour->GetAdr();
|
||||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||||
|
10
r5dev/thirdparty/detours/include/idetour.h
vendored
10
r5dev/thirdparty/detours/include/idetour.h
vendored
@ -29,17 +29,17 @@ class VDetour : public IDetour
|
|||||||
virtual void Detach(void) const { }
|
virtual void Detach(void) const { }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::vector<IDetour*> vDetour;
|
inline static std::vector<IDetour*> g_DetourVector;
|
||||||
inline std::unordered_set<IDetour*> sDetour;
|
inline static std::unordered_set<IDetour*> g_DetourSet;
|
||||||
inline std::size_t AddDetour(IDetour* pDetour, const char* pszName)
|
inline std::size_t AddDetour(IDetour* pDetour, const char* pszName)
|
||||||
{
|
{
|
||||||
IDetour* pVFTable = reinterpret_cast<IDetour**>(pDetour)[0];
|
IDetour* pVFTable = reinterpret_cast<IDetour**>(pDetour)[0];
|
||||||
auto p = sDetour.insert(pVFTable); // Only register if VFTable isn't already registered.
|
auto p = g_DetourSet.insert(pVFTable); // Only register if VFTable isn't already registered.
|
||||||
|
|
||||||
assert(p.second); // Code bug: duplicate registration!!! (called 'REGISTER(...)' from a header file?).
|
assert(p.second); // Code bug: duplicate registration!!! (called 'REGISTER(...)' from a header file?).
|
||||||
p.second ? vDetour.push_back(pDetour) : delete pDetour;
|
p.second ? g_DetourVector.push_back(pDetour) : delete pDetour;
|
||||||
|
|
||||||
return vDetour.size();
|
return g_DetourVector.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER(VDetour);
|
REGISTER(VDetour);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user