From c870460dea768609844721d4e81da8911f784637 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 17 Mar 2026 22:00:06 -0700 Subject: [PATCH] fix: wire Warden module tick, generateRC4Keys, and unload callbacks The funcList_ dispatchers were populated by initializeModule() but the public tick(), generateRC4Keys(), and unload() methods had their actual call sites commented out as TODOs. - tick(): now calls funcList_.tick(deltaMs) so the emulated module can run its internal periodic scheduler. - generateRC4Keys(): now calls funcList_.generateRC4Keys(packet) so the Warden crypto stream is re-keyed as the module expects. - unload(): now calls funcList_.unload(nullptr) before freeing module memory, allowing the module to clean up its own state. All three paths already guard on !loaded_ || !funcList_. so they are no-ops when the module is not loaded or Unicorn is unavailable. --- src/game/warden_module.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/game/warden_module.cpp b/src/game/warden_module.cpp index f93dc300..eea0f0ee 100644 --- a/src/game/warden_module.cpp +++ b/src/game/warden_module.cpp @@ -225,25 +225,18 @@ bool WardenModule::processCheckRequest(const std::vector& checkData, return false; } -uint32_t WardenModule::tick([[maybe_unused]] uint32_t deltaMs) { +uint32_t WardenModule::tick(uint32_t deltaMs) { if (!loaded_ || !funcList_.tick) { - return 0; // No tick needed + return 0; } - - // TODO: Call module's Tick function - // return funcList_.tick(deltaMs); - - return 0; + return funcList_.tick(deltaMs); } -void WardenModule::generateRC4Keys([[maybe_unused]] uint8_t* packet) { +void WardenModule::generateRC4Keys(uint8_t* packet) { if (!loaded_ || !funcList_.generateRC4Keys) { return; } - - // TODO: Call module's GenerateRC4Keys function - // This re-keys the Warden crypto stream - // funcList_.generateRC4Keys(packet); + funcList_.generateRC4Keys(packet); } void WardenModule::unload() { @@ -251,8 +244,7 @@ void WardenModule::unload() { // Call module's Unload() function if loaded if (loaded_ && funcList_.unload) { LOG_INFO("WardenModule: Calling module unload callback..."); - // TODO: Implement callback when execution layer is complete - // funcList_.unload(nullptr); + funcList_.unload(nullptr); } // Free executable memory region