Skip to content

Add tools/split_gaps.py - #128

Open
vagnertxr wants to merge 1 commit into
doldecomp:mainfrom
vagnertxr:tools/split-gaps
Open

Add tools/split_gaps.py#128
vagnertxr wants to merge 1 commit into
doldecomp:mainfrom
vagnertxr:tools/split-gaps

Conversation

@vagnertxr

Copy link
Copy Markdown

Reports the .text ranges that splits.txt does not claim yet, and which data each one references.

Carving a translation unit out of an auto_* blob is the first step of every new decomp, and the hard part is proving where the unit ends. Data that no other block touches settles it: a hole whose constants belong to nobody else is a translation unit.

Two things it gets right that a naive version does not:

  • Exclusivity is decided per symbol, not per hole. A single hole in .sdata2 routinely holds constants for several units, so testing the hole as a whole reports everything as shared and hides every boundary in it.
  • Assembly left behind by dtk when a unit disappears from splits.txt is skipped, since a stale .s looks like a second user of every constant it mentions.

On RSBE01_02 today it finds 44 unclaimed ranges, 42 of which own data outright. The smallest is 0x8002F188-0x8002F5B8 between gf_task_scheduler and gf_thread: 1072 bytes, 2 functions, owning .sdata2 at 0x805A1570, whose contents are the BT.601 coefficients (1.164 / 1.596 / 0.391 / 0.813 / 2.018) — a YUY2 to RGBA8 tile converter.

python tools/split_gaps.py
python tools/split_gaps.py --min-size 1024 --exclusive-only

Needs a build first, so build/<version>/asm exists and matches splits.txt.

Reports the .text ranges that splits.txt does not claim yet, and which data
each one references.

Carving a translation unit out of an auto_* blob is the first step of every
new decomp, and the hard part is proving where the unit ends. Data that no
other block touches settles it: a hole whose constants belong to nobody else
is a translation unit.

Exclusivity is decided per symbol rather than per hole. A single hole in
.sdata2 routinely holds constants for several units, so testing the hole as a
whole reports everything as shared and hides every boundary in it.

Assembly left behind by dtk when a unit disappears from splits.txt is skipped,
since a stale .s looks like a second user of every constant it mentions.

On RSBE01_02 today: 44 unclaimed ranges, 42 of which own data outright.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant