Skip to content

Instantly share code, notes, and snippets.

@TheIndra55
Last active January 9, 2024 11:42
Show Gist options
  • Save TheIndra55/c58300173ac47b500bb25e1d5fb5156c to your computer and use it in GitHub Desktop.
Save TheIndra55/c58300173ac47b500bb25e1d5fb5156c to your computer and use it in GitHub Desktop.
EventDebug
struct EventVar
{
char* name;
int offset; // offset in eventvars array
};
struct UnsavedVar
{
char* name;
int* var;
};
// ...
auto level = *(Level**)(GAMETRACKER + 8);
if (level)
{
// get the level reloc module
auto reloc = level->reloc;
auto eventVars = reinterpret_cast<EventVar*>(RELOC_GetProcAddress(reloc, "EventDebug"));
if (eventVars)
{
// global event vars
auto eventVarVals = *(int**)(0x007C8A50 /* GlobalData */ + 0xE8 /* event vars */);
int i = 0;
while (true)
{
auto var = eventVars[i++];
if (var.name == nullptr)
break;
ImGui::Text("%s %d", var.name, eventVarVals[var.offset]);
}
auto unsavedVars = (UnsavedVar*)eventVars;
while (true)
{
auto var = unsavedVars[i++];
if (var.name == nullptr || var.var == nullptr)
break;
ImGui::Text("%s %d", var.name, *var.var);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment