Disable GPS tracing for calibration build
This commit is contained in:
@@ -97,7 +97,10 @@ constexpr bool kEnableVerboseRouteObserverHooks = false;
|
||||
constexpr bool kEnableVerboseMappinRouteState = false;
|
||||
constexpr bool kEnableGpsMultiplierHooks = false;
|
||||
constexpr bool kEnableGpsCostTablePatch = true;
|
||||
constexpr bool kEnableGpsTraceHooks = false;
|
||||
constexpr bool kEnableGpsRouteJobStartTrace = false;
|
||||
constexpr bool kEnableGpsLocalSearchHooks = false;
|
||||
constexpr bool kEnableRouteUiTraceHooks = false;
|
||||
constexpr uintptr_t kGpsSystemTickRva = 0x0E6B62C;
|
||||
constexpr uintptr_t kJournalTrackEntryImplRva = 0x05944FC;
|
||||
constexpr uintptr_t kJournalListenerArrayOffset = 0x210;
|
||||
@@ -1678,7 +1681,7 @@ private:
|
||||
void LogPatch(const char* aMessage, const char* aReason)
|
||||
{
|
||||
const auto patchLogCall = NextGpsAsyncLogCall(gGpsCostTablePatchLogCount);
|
||||
if (patchLogCall >= 64)
|
||||
if (patchLogCall >= 16)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -3324,7 +3327,7 @@ bool DetourGpsRouteJobStart(void* aRouteSystem, void* aActiveEntry, float aDelta
|
||||
constexpr uint32_t kMaxCalls = 128;
|
||||
|
||||
const auto callCount = NextGpsAsyncLogCall(gGpsRouteJobStartLogCount);
|
||||
const auto shouldLog = callCount < kMaxCalls;
|
||||
const auto shouldLog = kEnableGpsRouteJobStartTrace && callCount < kMaxCalls;
|
||||
if (shouldLog)
|
||||
{
|
||||
std::ostringstream line;
|
||||
@@ -4027,6 +4030,8 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
const auto added = aSdk->gameStates->Add(aHandle, kGameStateRunning, &gRunningState);
|
||||
LogRed4ext(added ? "registered Running game-state callbacks" : "failed to register Running game-state callbacks");
|
||||
|
||||
if (kEnableGpsTraceHooks)
|
||||
{
|
||||
AttachProbeHook("RunGPSQuery body 0x29bd128", kRunGpsQueryBodyRva,
|
||||
reinterpret_cast<void*>(&DetourRunGpsQueryBody),
|
||||
reinterpret_cast<void**>(&gOriginalRunGpsQueryBody));
|
||||
@@ -4051,9 +4056,6 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
AttachProbeHook("GPSAsyncWorkerTick 0x126b28", kGpsAsyncWorkerTickRva,
|
||||
reinterpret_cast<void*>(&DetourGpsAsyncWorkerTick),
|
||||
reinterpret_cast<void**>(&gOriginalGpsAsyncWorkerTick));
|
||||
AttachProbeHook("GPSRouteJobStart 0x818928", kGpsRouteJobStartRva,
|
||||
reinterpret_cast<void*>(&DetourGpsRouteJobStart),
|
||||
reinterpret_cast<void**>(&gOriginalGpsRouteJobStart));
|
||||
AttachProbeHook("GPSRouteJobPoll 0x883cd8", kGpsRouteJobPollRva,
|
||||
reinterpret_cast<void*>(&DetourGpsRouteJobPoll),
|
||||
reinterpret_cast<void**>(&gOriginalGpsRouteJobPoll));
|
||||
@@ -4063,7 +4065,14 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
AttachProbeHook("GPSRouteJobBuild 0x818ba8", kGpsRouteJobBuildRva,
|
||||
reinterpret_cast<void*>(&DetourGpsRouteJobBuild),
|
||||
reinterpret_cast<void**>(&gOriginalGpsRouteJobBuild));
|
||||
if (kEnableGpsLocalSearchHooks)
|
||||
}
|
||||
if (kEnableGpsCostTablePatch || kEnableGpsRouteJobStartTrace)
|
||||
{
|
||||
AttachProbeHook("GPSRouteJobStart 0x818928", kGpsRouteJobStartRva,
|
||||
reinterpret_cast<void*>(&DetourGpsRouteJobStart),
|
||||
reinterpret_cast<void**>(&gOriginalGpsRouteJobStart));
|
||||
}
|
||||
if (kEnableGpsTraceHooks && kEnableGpsLocalSearchHooks)
|
||||
{
|
||||
AttachProbeHook("GPSRouteProducer 0x44cc7c", kGpsRouteProducerRva,
|
||||
reinterpret_cast<void*>(&DetourGpsRouteProducer),
|
||||
@@ -4082,6 +4091,8 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
reinterpret_cast<void*>(&DetourGpsNodeMultiplier),
|
||||
reinterpret_cast<void**>(&gOriginalGpsNodeMultiplier));
|
||||
}
|
||||
if (kEnableRouteUiTraceHooks)
|
||||
{
|
||||
AttachProbeHook("GPSSystem/Tick", kGpsSystemTickRva, reinterpret_cast<void*>(&DetourGpsSystemTick),
|
||||
reinterpret_cast<void**>(&gOriginalGpsSystemTick));
|
||||
AttachProbeHook("JournalManager::TrackEntry impl", kJournalTrackEntryImplRva,
|
||||
@@ -4192,8 +4203,11 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
reinterpret_cast<void*>(&DetourSetMappinTrackingAlternativeWrapper),
|
||||
reinterpret_cast<void**>(&gOriginalSetMappinTrackingAlternativeWrapper));
|
||||
}
|
||||
}
|
||||
|
||||
if (aReason == RED4ext::v1::EMainReason::Unload)
|
||||
{
|
||||
if (kEnableGpsTraceHooks)
|
||||
{
|
||||
DetachProbeHook("RunGPSQuery body 0x29bd128", kRunGpsQueryBodyRva);
|
||||
DetachProbeHook("UpdateGPSQuery body 0x29bd254", kUpdateGpsQueryBodyRva);
|
||||
@@ -4201,7 +4215,17 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
DetachProbeHook("GPSQueryDispatch 0x70a570", kGpsQueryDispatchRva);
|
||||
DetachProbeHook("GPSQueryResultFetch 0x7094b8", kGpsQueryResultFetchRva);
|
||||
DetachProbeHook("GPSQueryStatus 0xaa5704", kGpsQueryStatusRva);
|
||||
if (kEnableGpsLocalSearchHooks)
|
||||
DetachProbeHook("GPSDispatchAdvance 0x8d17d8", kGpsDispatchAdvanceRva);
|
||||
DetachProbeHook("GPSAsyncWorkerTick 0x126b28", kGpsAsyncWorkerTickRva);
|
||||
DetachProbeHook("GPSRouteJobPoll 0x883cd8", kGpsRouteJobPollRva);
|
||||
DetachProbeHook("GPSRouteFinish 0x11f5f60", kGpsRouteFinishRva);
|
||||
DetachProbeHook("GPSRouteJobBuild 0x818ba8", kGpsRouteJobBuildRva);
|
||||
}
|
||||
if (kEnableGpsCostTablePatch || kEnableGpsRouteJobStartTrace)
|
||||
{
|
||||
DetachProbeHook("GPSRouteJobStart 0x818928", kGpsRouteJobStartRva);
|
||||
}
|
||||
if (kEnableGpsTraceHooks && kEnableGpsLocalSearchHooks)
|
||||
{
|
||||
DetachProbeHook("GPSRouteProducer 0x44cc7c", kGpsRouteProducerRva);
|
||||
DetachProbeHook("GPSSearch 0x44f054", kGpsSearchRva);
|
||||
@@ -4212,6 +4236,8 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
DetachProbeHook("GPSAuxMultiplier 0x40bb00", kGpsAuxMultiplierRva);
|
||||
DetachProbeHook("GPSNodeMultiplier 0x40bb40", kGpsNodeMultiplierRva);
|
||||
}
|
||||
if (kEnableRouteUiTraceHooks)
|
||||
{
|
||||
DetachProbeHook("GPSSystem/Tick", kGpsSystemTickRva);
|
||||
DetachProbeHook("JournalManager::TrackEntry impl", kJournalTrackEntryImplRva);
|
||||
if (kEnableVerboseJournalListenerHooks)
|
||||
@@ -4263,6 +4289,7 @@ RED4EXT_C_EXPORT bool RED4EXT_CALL Main(RED4ext::v1::PluginHandle aHandle, RED4e
|
||||
DetachAbsoluteHook("MappinSystem::ActiveRoute slot3a8", gMappinActiveRouteTarget);
|
||||
DetachAbsoluteHook("Observer1Service::RouteLookup slot220", gObserver1ServiceRouteLookupTarget);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user