docs(ai): recover numeric handler contract
This commit is contained in:
@@ -62,6 +62,21 @@ sentinel records. Поэтому `ScriptInstruction::dispatch_selector()` воз
|
|||||||
(`Handler(0)`, VA `0x10008034`) только устанавливает current context и flag
|
(`Handler(0)`, VA `0x10008034`) только устанавливает current context и flag
|
||||||
`+0x50 = 1`; это не даёт ему игрового имени и не заменяет runtime trace.
|
`+0x50 = 1`; это не даёт ему игрового имени и не заменяет runtime trace.
|
||||||
|
|
||||||
|
`Handler(1)` — второй table entry, VA `0x10007fd0`, — не создаёт игровую
|
||||||
|
команду. Он сохраняет active VM context, берёт один instruction-derived index
|
||||||
|
через current event/instruction offsets `+0x48/+0x4c`, а затем разрешает его
|
||||||
|
в varset object по `this + 0x18`. Resolver `0x10002d30` проверяет
|
||||||
|
`0 <= index < count` и возвращает record `base + index * 0x30`; invalid index
|
||||||
|
вызывает C++ exception, а не становится нулём. Полученный 48-byte record
|
||||||
|
передаётся в `0x10013190`, который возвращает x87 floating result: kinds `0`
|
||||||
|
и `4` идут через отдельный opaque conversion path, kind `1` — signed integer,
|
||||||
|
kind `2` выбирает одну из двух static scalar constants по нулевости payload,
|
||||||
|
kind `3` — float, kind `5` — unsigned integer; остальные и пустые cases дают
|
||||||
|
один fixed fallback scalar. Это доказанный numeric
|
||||||
|
bridge для VM, но пока не Rust handler: неизвестны точный disk operand slot,
|
||||||
|
ownership значения на FPU stack и следующий consumer, поэтому нельзя назвать
|
||||||
|
его арифметическим opcode или silently заменить portable `f32` execution.
|
||||||
|
|
||||||
`Handler(2)` (третья entry table, VA `0x10009610`) уже имеет статический
|
`Handler(2)` (третья entry table, VA `0x10009610`) уже имеет статический
|
||||||
contract, но ещё не Rust execution: он выбирает active event/instruction через
|
contract, но ещё не Rust execution: он выбирает active event/instruction через
|
||||||
runtime offsets `+0x48/+0x4c`, разрешает семь 32-bit slots через varset object
|
runtime offsets `+0x48/+0x4c`, разрешает семь 32-bit slots через varset object
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Emits Handler(1), the second function in the AI DLL's verified 73-entry VM table.
|
||||||
|
// Run through Ghidra headless analysis; the original PE remains read only.
|
||||||
|
import ghidra.app.decompiler.DecompInterface;
|
||||||
|
import ghidra.app.script.GhidraScript;
|
||||||
|
import ghidra.program.model.address.Address;
|
||||||
|
import ghidra.program.model.listing.Function;
|
||||||
|
|
||||||
|
public class ExportAiVmHandler1 extends GhidraScript {
|
||||||
|
private static final long ADDRESS = 0x10007fd0L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() throws Exception {
|
||||||
|
Address address = currentProgram.getAddressFactory().getDefaultAddressSpace()
|
||||||
|
.getAddress(ADDRESS);
|
||||||
|
Function function = currentProgram.getFunctionManager().getFunctionAt(address);
|
||||||
|
println("===== AI VM Handler(1) =====");
|
||||||
|
if (function == null) { println("missing"); return; }
|
||||||
|
DecompInterface decompiler = new DecompInterface();
|
||||||
|
decompiler.openProgram(currentProgram);
|
||||||
|
println(decompiler.decompileFunction(function, 60, monitor).getDecompiledFunction().getC());
|
||||||
|
decompiler.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Emits the two direct callees recovered from AI VM Handler(1).
|
||||||
|
// Run through Ghidra headless analysis; the original PE remains read only.
|
||||||
|
import ghidra.app.decompiler.DecompInterface;
|
||||||
|
import ghidra.app.script.GhidraScript;
|
||||||
|
import ghidra.program.model.address.Address;
|
||||||
|
import ghidra.program.model.listing.Function;
|
||||||
|
|
||||||
|
public class ExportAiVmHandler1Callees extends GhidraScript {
|
||||||
|
private static final long[] ADDRESSES = { 0x10002d30L, 0x10013190L };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() throws Exception {
|
||||||
|
DecompInterface decompiler = new DecompInterface();
|
||||||
|
decompiler.openProgram(currentProgram);
|
||||||
|
for (long value : ADDRESSES) {
|
||||||
|
Address address = currentProgram.getAddressFactory().getDefaultAddressSpace()
|
||||||
|
.getAddress(value);
|
||||||
|
Function function = currentProgram.getFunctionManager().getFunctionAt(address);
|
||||||
|
println("===== AI VM Handler(1) callee " + address + " =====");
|
||||||
|
if (function == null) { println("missing"); continue; }
|
||||||
|
println(decompiler.decompileFunction(function, 60, monitor).getDecompiledFunction().getC());
|
||||||
|
}
|
||||||
|
decompiler.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user