void
dump_method(
void
* klass)
{
outFile <<
"// Namespace: "
<< il2cpp_class_get_namespace(klass) <<
"\n"
;
outFile <<
"\n\t// Methods\n"
;
void
* iter = 0;
while
(
void
* method = il2cpp_class_get_methods(klass, &iter))
{
LOGI(
"0x%x"
, method);
uintptr_t
p =
reinterpret_cast
<
uintptr_t
*>(method)[0];
if
(p) {
outFile <<
"\t// RVA: 0x"
;
outFile << std::hex << (uint64_t)p - base;
outFile <<
" VA: 0x"
;
outFile << std::hex << (uint64_t)p;
}
else
{
outFile <<
"\t// RVA: 0x VA: 0x0"
;
}
outFile <<
"\n\t"
;
outFile << il2cpp_method_get_name(method) <<
"(...){ };\n"
;
}
}
void
il2cpp_vm_SetupMethodsLocked_Hook(
void
* klass,
void
* lock)
{
klazzs.push_back(klass);
return
CALL_ORIGIN(il2cpp_vm_SetupMethodsLocked_Hook, klass, lock);
}
void
il2cpp_dump()
{
DisableLogReport();
HookManager::install(il2cpp_vm_SetupMethodsLocked, il2cpp_vm_SetupMethodsLocked_Hook);
int
a;
std::cin >> a;
for
(
const
auto
& klass : klazzs) {
dump_method(klass);
}
}