tools(ghidra): export Control ABI decompilation
This commit is contained in:
@@ -228,6 +228,17 @@ buffers и передаёт собранную settings-структуру да
|
||||
`ret 0x0c`; `CreateCollManager` и `CreateCollObject` возвращают interface
|
||||
pointer с поправкой `+4` после внутренней инициализации.
|
||||
|
||||
Headless Ghidra 12.1.2 decompile GOG binary подтверждает ABI формой экспортов
|
||||
`LoadControlSystem(char*, char*, char*, char*, char*, u32, void*, i32)`,
|
||||
`LoadPhysicalModel(u32, u32, u32)`, `CreateCollManager(u32)` и
|
||||
`CreateCollObject(u32, u32)`. Первые пять параметров Control loader — строки,
|
||||
а mode передаётся последним; decompiler не восстанавливает предметные имена
|
||||
остальных слов. `InitializeSettings` получает `CreateGameSettings()` из
|
||||
World3D и делает virtual call slot `+0x24` с literal `0x15` и строкой по RVA
|
||||
`0x42478`. Reproducible extractor находится в
|
||||
`tools/ghidra/ExportControlFunctions.java`; он декомпилирует только эти exports
|
||||
в локальном Ghidra project и не изменяет оригинальную DLL.
|
||||
|
||||
Именно update methods этих private objects, а не пять exports, остаются
|
||||
следующим объектом динамической трассировки. Поэтому reference movement в
|
||||
новом runtime намеренно не использует неподтверждённые параметры Control.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Emits decompiled C for the stable public Control.dll exports.
|
||||
// Run only through Ghidra headless analysis; it does not modify the input PE.
|
||||
import ghidra.app.decompiler.DecompInterface;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Function;
|
||||
|
||||
public class ExportControlFunctions extends GhidraScript {
|
||||
private static final String[] NAMES = {
|
||||
"InitializeSettings", "LoadControlSystem", "LoadPhysicalModel",
|
||||
"CreateCollManager", "CreateCollObject"
|
||||
};
|
||||
private static final long[] ADDRESSES = {
|
||||
0x10032260L, 0x10032280L, 0x10032580L, 0x100325d0L, 0x10032600L
|
||||
};
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
DecompInterface decompiler = new DecompInterface();
|
||||
decompiler.openProgram(currentProgram);
|
||||
for (int index = 0; index < NAMES.length; index++) {
|
||||
Address address = currentProgram.getAddressFactory()
|
||||
.getDefaultAddressSpace().getAddress(ADDRESSES[index]);
|
||||
Function function = currentProgram.getFunctionManager().getFunctionAt(address);
|
||||
println("\n===== " + NAMES[index] + " =====");
|
||||
if (function == null) {
|
||||
println("missing");
|
||||
continue;
|
||||
}
|
||||
println(decompiler.decompileFunction(function, 60, monitor)
|
||||
.getDecompiledFunction().getC());
|
||||
}
|
||||
decompiler.dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user