Files
reverse-engineering-anything/src/domain/gamecubeDol.fixture.ts
T
Ariel Fikru Avicennaandgensokyo-dev cab78de506 feat(ghidra): analyze GameCube/Wii DOL executables through Ghidra (#6240)
* feat(domain): parse and validate GameCube/Wii DOL headers

Add a pure parser for the 0x100-byte DOL header (7 text and 11 data
slots, BSS, entry point). Used slots must lie after the header and
inside the file and the 0x80000000..0x81800000 load window; text slots
are 4-byte aligned; sections may not overlap in memory or in the file;
the entry point must be inside a text section. BSS may overlap data
sections, as .sdata/.sdata2 do in shipped DOLs.

Refs #1741

* feat(binary): admit caller-selected GameCube/Wii DOL targets

* feat(ghidra): import GameCube/Wii DOL targets through a section-map pre-script

* test(ghidra): cover DOL launcher arguments, attestation and raw profile digests

* test(ghidra): add the real verify:ghidra:dol lane and DOL docs

* fix(ghidra): read only the DOL header and section ranges instead of the whole file

* test(ghidra): derive DOL lane addresses from readelf and admit Gekko from the install catalog

* fix(ghidra): attest DOL block permissions, space, overlay and load state

* fix(ghidra): keep load-image permissions optional for older inspections

* fix(contracts): accept DOL targets in binary_session output

* fix(ghidra): adapt the DOL lane to the current upstream address schema

Validate DOL load-image coordinates with the upstream observed-address
schema, drop a duplicate import left by the rebase, and re-pin the raw
profile digests to the unmodified upstream resolver.

* fix(ghidra): preserve bridge inventory symbol provenance

* fix(ghidra): align DOL verification with shared workflow contracts

* feat(domain): parse and validate GameCube/Wii DOL headers

Add a pure parser for the 0x100-byte DOL header (7 text and 11 data
slots, BSS, entry point). Used slots must lie after the header and
inside the file and the 0x80000000..0x81800000 load window; text slots
are 4-byte aligned; sections may not overlap in memory or in the file;
the entry point must be inside a text section. BSS may overlap data
sections, as .sdata/.sdata2 do in shipped DOLs.

Refs #1741

* feat(binary): admit caller-selected GameCube/Wii DOL targets

* feat(ghidra): import GameCube/Wii DOL targets through a section-map pre-script

* test(ghidra): cover DOL launcher arguments, attestation and raw profile digests

* test(ghidra): add the real verify:ghidra:dol lane and DOL docs

* fix(ghidra): read only the DOL header and section ranges instead of the whole file

* test(ghidra): derive DOL lane addresses from readelf and admit Gekko from the install catalog

* fix(ghidra): attest DOL block permissions, space, overlay and load state

* fix(ghidra): keep load-image permissions optional for older inspections

* fix(contracts): accept DOL targets in binary_session output

* fix(ghidra): adapt the DOL lane to the current upstream address schema

Validate DOL load-image coordinates with the upstream observed-address
schema, drop a duplicate import left by the rebase, and re-pin the raw
profile digests to the unmodified upstream resolver.

* docs(ghidra): qualify the DOL memory window

* refactor(ghidra): own DOL BSS ranges in the parsed header

* docs(ghidra): record real DOL workflows and task costs

* docs(ghidra): record final DOL integration verification

* fix(mcp): share the native procedure search row contract

* docs(ghidra): record public procedure search verification

---------

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-24 17:56:31 +08:00

32 lines
1.4 KiB
TypeScript

/**
* Build a minimal valid DOL: one text section at 0x80003100 with a 32-byte body.
* Optional data and BSS ranges exercise the multi-section import path.
*/
export const buildGamecubeDol = (
options: {
readonly entryPoint?: number;
readonly textAddress?: number;
readonly data?: { readonly address: number; readonly bytes: Buffer };
readonly bss?: { readonly address: number; readonly size: number };
} = {},
): Buffer => {
const textAddress = options.textAddress ?? 0x8000_3100;
const text = Buffer.from("4e800020".repeat(8), "hex");
const data = options.data?.bytes ?? Buffer.alloc(0);
const header = Buffer.alloc(0x100);
header.writeUInt32BE(0x100, 0x00); // text slot 0 file offset
header.writeUInt32BE(textAddress, 0x48); // text slot 0 load address
header.writeUInt32BE(text.length, 0x90); // text slot 0 size
if (options.data !== undefined) {
header.writeUInt32BE(0x100 + text.length, 0x1c); // data slot 0 file offset
header.writeUInt32BE(options.data.address, 0x64); // data slot 0 load address
header.writeUInt32BE(data.length, 0xac); // data slot 0 size
}
if (options.bss !== undefined) {
header.writeUInt32BE(options.bss.address, 0xd8); // BSS load address
header.writeUInt32BE(options.bss.size, 0xdc); // BSS size
}
header.writeUInt32BE(options.entryPoint ?? textAddress, 0xe0); // entry point
return Buffer.concat([header, text, data]);
};