Skip to content

Commit 7bd947d

Browse files
committed
VM: Fix DD2 update crash (fallback scan for invoke table)
1 parent e447a20 commit 7bd947d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

shared/sdk/REContext.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,25 @@ namespace sdk {
260260
}
261261
}
262262
if (!method_inside_invoke_tbl) {
263-
spdlog::info("[VM::update_pointers] Unable to find method inside invoke table.");
263+
spdlog::info("[VM::update_pointers] Unable to find method inside invoke table. Trying fallback scan...");
264+
const auto anchor = utility::scan(mod, "8D 56 FF 48 8B CF E8 ? ? ? ?");
265+
266+
if (!anchor) {
267+
spdlog::info("[VM::update_pointers] Unable to find anchor for invoke table.");
268+
return;
269+
}
270+
271+
const auto lea_rdx = utility::scan_reverse(*anchor, 0x100, "48 8D 15 ? ? ? ?");
272+
273+
if (!lea_rdx) {
274+
spdlog::info("[VM::update_pointers] Unable to find lea rdx for invoke table.");
275+
return;
276+
}
277+
278+
s_invoke_tbl = (sdk::InvokeMethod*)utility::resolve_displacement(*lea_rdx).value_or(0);
279+
280+
spdlog::info("[VM::update_pointers] s_invoke_tbl: {:x}", (uintptr_t)s_invoke_tbl);
281+
264282
return;
265283
}
266284

0 commit comments

Comments
 (0)