# ghidra-export

> **Tool `scripts/ghidra-export.sh`** (script, Scripts). Analyse one or more binaries with Ghidra (no window) and export them as text an agent can search: decomp.c, functions.tsv, strings.txt, imports.txt, exports.txt per binary.

Run it as `scripts/ghidra-export.sh`. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/scripts/ghidra-export.sh).

## Its own help

This is the help text in the tool itself, as `./gameframe tool ghidra-export` prints it.

```text
Analyse one or more binaries with Ghidra (no window) and export them as text an agent can
search: decomp.c, functions.tsv, strings.txt, imports.txt, exports.txt per binary.

  scripts/ghidra-export.sh [--project DIR] [--out DIR] [--labels FILE] BINARY [BINARY ...]

Defaults: the Ghidra project in analysis/ghidra-project, the export in analysis/export/<binary>/.
--labels FILE applies a labels TSV (address, name) before the export: named functions are
created where Ghidra missed them (for example from tools/dos/tdinfo.py labels).
Import the game's executable and its own DLLs together, so calls between them are resolved.
A large game takes 10-30 minutes; it prints only progress lines and writes the full log to
analysis/headless.log. Set GHIDRA_CPUS (default 6) and MAXMEM (default 8G) to tune it.
Ghidra does not search the disk for imported libraries (-loader-libraryLoadDepth 0): pass every
binary you want. The search can crash the import, for example when a 16-bit NE program imports
a module (RTM) whose file next to it (RTM.EXE) is a plain DOS program.
```

## Named by

Skills: [re-setup](/skills/re-setup), [re-start](/skills/re-start), [re-ghidra](/skills/re-ghidra).
