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_.<fn> so they
are no-ops when the module is not loaded or Unicorn is unavailable.
This commit is contained in:
Kelsi 2026-03-17 22:00:06 -07:00
parent 32497552d1
commit c870460dea

View file

@ -225,25 +225,18 @@ bool WardenModule::processCheckRequest(const std::vector<uint8_t>& 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