aboutsummaryrefslogtreecommitdiff
path: root/tools/ghidra/ExportAniMeshControlCaller.java
blob: 083d27fd4d93799b37eb77251ad6a58fa2e85068 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Emits the function containing the observed AniMesh Control-loader sequence.
import ghidra.app.decompiler.DecompInterface;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Function;

public class ExportAniMeshControlCaller extends GhidraScript {
    @Override
    public void run() throws Exception {
        Address address = currentProgram.getAddressFactory().getDefaultAddressSpace()
            .getAddress(0x100032e7L);
        Function function = currentProgram.getFunctionManager().getFunctionContaining(address);
        println("===== AniMesh Control caller =====");
        if (function == null) { println("missing"); return; }
        println("entry=" + function.getEntryPoint());
        DecompInterface decompiler = new DecompInterface();
        decompiler.openProgram(currentProgram);
        println(decompiler.decompileFunction(function, 60, monitor).getDecompiledFunction().getC());
        decompiler.dispose();
    }
}