Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
e287761
Regions: place functions by the shift of their placed neighbours
emmkay440 Nov 21, 2026
a6953e9
Regions: compile shared EU sources with -DREGION_USA; USA player layout
emmkay440 Nov 22, 2026
4f5deb3
USA: player and save record layouts in shared sources; region search …
emmkay440 Nov 22, 2026
8214651
USA: 34 more shared functions through the regional layout macros
emmkay440 Nov 22, 2026
b6e10c9
USA: enemy record stride in 12 shared functions; BL alias for data-us…
emmkay440 Nov 22, 2026
eca79c9
USA: struct PlayerW12 through the player layout macros
emmkay440 Nov 22, 2026
bcfc144
USA: four more shared functions through the player layout macros
emmkay440 Nov 22, 2026
7a11fea
USA: 115 more shared functions through layout macros and nearby addre…
emmkay440 Nov 22, 2026
bf554ef
USA: seven more shared functions through the layout macros
emmkay440 Nov 22, 2026
c18bbd9
USA: literal RAM addresses through their symbols (21 more shared func…
emmkay440 Nov 22, 2026
418be56
USA: RES_ID for resource ids USA numbers 4 lower (45 more shared func…
emmkay440 Nov 22, 2026
6adf276
USA: player views with p<hex> pads and the Sz332 stride (19 more shar…
emmkay440 Nov 22, 2026
7df0f81
USA: TEXT_HEADER and paired macro search (8 more shared functions)
emmkay440 Nov 22, 2026
e24761d
USA: region_structs also scans modules without a literal 0x14C (1 mor…
emmkay440 Nov 22, 2026
658bd0b
USA: enemy record layout ENEMY_FIELD (13 more shared functions)
emmkay440 Nov 22, 2026
968f45a
USA: autofix accepts exact matches near the guessed address (10 more …
emmkay440 Nov 22, 2026
aec1ff6
USA: partial record views and whole-macro search (14 more shared func…
emmkay440 Nov 22, 2026
9c29aa6
USA: player strides through PLAYER_SIZE in macros; TEXT_HEADER for al…
emmkay440 Nov 22, 2026
ae1b5af
USA: autofix also searches inline helpers and macros a function uses …
emmkay440 Nov 22, 2026
378fa04
USA: PLAYER_SIZE strides in unplaced functions, then struct views and…
emmkay440 Nov 23, 2026
36b7900
USA: autofix accepts suffixed literals and large functions (1 more sh…
emmkay440 Nov 23, 2026
c1c5e2b
USA: ENEMY_SIZE and SAVE_FIELD in shared inline helpers (2 more share…
emmkay440 Nov 23, 2026
5ac118c
USA: player gap moved to EU +0x30, save/enemy pads, USA task stack si…
emmkay440 Nov 23, 2026
a19563b
docs: PLAYER_FIELD boundary at EU +0x30
emmkay440 Nov 23, 2026
75867b7
USA: item record layout (ITEM_FIELD, ITEM_KIND) and save offsets (4 m…
emmkay440 Nov 23, 2026
5200005
USA: ITEM_KIND reads, enemy combat context, item cluster fixes, USA s…
emmkay440 Nov 23, 2026
9cc3c3d
region_symbols: drop overlapping placements instead of aborting
emmkay440 Nov 23, 2026
3053389
USA: player-stride aliases and structs crossing the 0x30 gap (3 more …
emmkay440 Nov 23, 2026
fd7a304
USA: region_structs knows header struct sizes; enemy strides in unpla…
emmkay440 Nov 23, 2026
30dd254
USA: autofix round after stride fixes (9 more shared functions)
emmkay440 Nov 23, 2026
7e7178c
USA: negative enemy-slot offsets and enemy view pads in code_08068670…
emmkay440 Nov 23, 2026
3107d61
USA: autofix tries offset-only macro moves; Player026E4 layout (2 mor…
emmkay440 Nov 23, 2026
8f2c478
USA: autofix round with offset-only moves (2 more shared functions)
emmkay440 Nov 23, 2026
7f5dd16
USA: place functions with assembler-resolved references; pin PC-relat…
emmkay440 Nov 23, 2026
7b7e259
USA: Thumb B relocations in region_symbols; global __clz_tab (3 more …
emmkay440 Nov 23, 2026
62ef8fd
USA: player stat offset in sub_08068F9C (1 more shared function)
emmkay440 Nov 23, 2026
8f89876
USA: enemy fields and resource id in sub_0806441C (1 more shared func…
emmkay440 Nov 23, 2026
00c3a9e
USA: save offsets in sub_08060E44 (1 more shared function)
emmkay440 Nov 23, 2026
49d8f6e
USA: region_diff also guesses addresses from whole-ROM matches
emmkay440 Nov 23, 2026
37f522b
USA: player fields and key register in sub_08043850 (1 more shared fu…
emmkay440 Nov 23, 2026
cd4bb90
USA: player layout in sub_080A66E0 (1 more shared function)
emmkay440 Nov 23, 2026
69d1ae6
USA: player layout in code_080A9680 projectile hits (2 more shared fu…
emmkay440 Nov 23, 2026
9fc049e
USA: player layout in sub_080AC2E8 (1 more shared function)
emmkay440 Nov 23, 2026
b725ae0
USA: player fields in actor-mark helpers; key register in sub_0803AE6…
emmkay440 Nov 23, 2026
80dc09e
USA: actor register choices in sub_0804BC38 (1 more shared function)
emmkay440 Nov 23, 2026
06f3a13
USA: actor key register in sub_0803E638 (1 more shared function)
emmkay440 Nov 23, 2026
78ba9dd
USA: actor key register in sub_080376CC (1 more shared function)
emmkay440 Nov 23, 2026
0d26927
USA: actor key registers and player fields in script modules (2 more …
emmkay440 Nov 23, 2026
e0f9e29
USA: actor search registers in sub_08041030 and sub_080445E8 (2 more …
emmkay440 Nov 23, 2026
72044d9
USA: enemy-slot form in sub_08047474 (1 more shared function)
emmkay440 Nov 23, 2026
063a9be
USA: enemy-slot form in actor-mark code (5 more shared functions)
emmkay440 Nov 23, 2026
9bafad9
USA: enemy-slot form and layout macros in sub_0803BC3C and sub_08032D…
emmkay440 Nov 23, 2026
7d5c6f4
USA: layout macros in nearest076398 and RX_ENT
emmkay440 Nov 23, 2026
7171a9e
USA: save offsets in sub_08080A78 (1 more shared function)
emmkay440 Nov 23, 2026
aeadb23
USA: player position stores in code_08087CC0 exits (3 more shared fun…
emmkay440 Nov 23, 2026
6a26872
USA: base register in exit position stores (3 more shared functions)
emmkay440 Nov 23, 2026
5897864
USA: base register in more exit position stores (2 more shared functi…
emmkay440 Nov 23, 2026
7f5dd10
USA: multi-line exit position stores in code_08087CC0
emmkay440 Nov 23, 2026
edcc58f
USA: player fields in sub_0808AD90 (1 more shared function)
emmkay440 Nov 23, 2026
7b5188a
USA: position stores and checks in sub_0808A380/sub_0808A830 (2 more …
emmkay440 Nov 23, 2026
65423cc
USA: enemy state field and argument registers in sub_08069080 (1 more…
emmkay440 Nov 23, 2026
e73edb8
USA: enemy record sizes in 0x2E0-sized structs (1 more shared function)
emmkay440 Nov 23, 2026
0792f76
USA: player layout in sub_080A6258 (1 more shared function)
emmkay440 Nov 23, 2026
1a2fa64
USA: save and enemy-record offsets in sub_0801E46C; player structs (1…
emmkay440 Nov 23, 2026
388cf93
USA: autofix skips the sub_080663A4 false match
emmkay440 Nov 23, 2026
337a0a2
USA: NameChar (halfword names) and save layout in sub_0807A378 (1 mor…
emmkay440 Nov 23, 2026
9c5d62f
USA: name packet in sub_08065D50 copies halfword names with CpuSet (1…
emmkay440 Nov 23, 2026
7e11ee1
USA: equipment record layout (EQUIP_FIELD, EquipLevel) in head/body c…
emmkay440 Nov 23, 2026
e42707a
USA: glove record layout in sub_0805D2E0 (1 more shared function)
emmkay440 Nov 23, 2026
9b40a74
USA: item and equipment record offsets in price/repair cost (2 more s…
emmkay440 Nov 23, 2026
fa6237a
USA: player and save offsets in sub_0805AD18 (1 more shared function)
emmkay440 Nov 23, 2026
7fb50d2
USA: TextChar halfword strings in sub_0801A764 (1 more shared function)
emmkay440 Nov 23, 2026
1cfb656
USA: indexed enemy slots in sub_0801A1C8 (1 more shared function)
emmkay440 Nov 23, 2026
8e41370
USA: enemy pool size in sub_08016114 (1 more shared function)
emmkay440 Nov 23, 2026
cd3036f
USA: indexed enemy object in sub_080169C8 (1 more shared function)
emmkay440 Nov 23, 2026
a633e40
USA: enemy AI and save layout in sub_08016F28 structs
emmkay440 Nov 23, 2026
e2e856b
USA: TEXT_CTRL control codes; TextChar in sub_080850C0
emmkay440 Nov 23, 2026
2f1f186
USA: player layout in sub_0801FD64 (1 more shared function)
emmkay440 Nov 23, 2026
96fd892
USA: halfword name restore in sub_0807A4B4 (1 more shared function)
emmkay440 Nov 23, 2026
ca176fd
USA: single-language resource ids in sub_0805F020/sub_0805F07C (2 mor…
emmkay440 Nov 23, 2026
b7f720b
USA: halfword item names per language in sub_080655CC (1 more shared …
emmkay440 Nov 23, 2026
861a50f
USA: halfword name strides in sub_0805FFBC
emmkay440 Nov 23, 2026
3b5c724
USA: base register in sub_0808A294/A744/A984 (3 more shared functions)
emmkay440 Nov 23, 2026
e135876
USA: enemy struct size in sub_08051BFC (1 more shared function)
emmkay440 Nov 23, 2026
a9d5706
USA: enemy record sizes in more structs
emmkay440 Nov 23, 2026
62f3036
USA: player layout in movement scripts (1 more shared function)
emmkay440 Nov 23, 2026
2814a16
USA: player layout in sub_0802996C (1 more shared function)
emmkay440 Nov 23, 2026
4e03850
USA: player layout in five more structs
emmkay440 Nov 23, 2026
7a4f6b1
USA: region_structs pass (1 more shared function)
emmkay440 Nov 23, 2026
21512b5
USA: register use in sub_080B64A4 (1 more shared function)
emmkay440 Nov 23, 2026
9d232a7
USA: ENEMY_DATA_FIELD for enemy data records; sub_08019F60 (1 more sh…
emmkay440 Nov 23, 2026
05ae7b7
USA: player flags offset in exit scripts
emmkay440 Nov 23, 2026
13c568f
USA: player record store order in sub_080226A4 (6 diffs left)
emmkay440 Nov 24, 2026
42b9e05
USA: player layout and resource ids in sub_0806ABC0 (1 more shared fu…
emmkay440 Nov 24, 2026
9625a6f
USA: player layout in three skill structs
emmkay440 Nov 24, 2026
ffa30af
USA: item record sizes and set layout in sub_0801B74C (1 more shared …
emmkay440 Nov 24, 2026
7a32b8a
USA: equipment set records in sub_0801B8A8 (1 more shared function)
emmkay440 Nov 24, 2026
efb5d9f
USA: player flags and table register in sub_08048A74/sub_0804B100 (2 …
emmkay440 Nov 24, 2026
92601ab
USA: indexed enemy entity in sub_0801D7AC (1 more shared function)
emmkay440 Nov 24, 2026
8ec6b1d
USA: enemy slot multiply in sub_08016D40 (1 more shared function)
emmkay440 Nov 24, 2026
170739e
USA: background loader without the stale free in sub_08009138 (1 more…
emmkay440 Nov 24, 2026
096b3b7
USA: enemy data offset in sub_080A230C (1 more shared function)
emmkay440 Nov 24, 2026
a1390b6
USA: enemy data and player history strides in sub_080A1FF4/sub_080A68…
emmkay440 Nov 24, 2026
f0b0c73
USA: partial register shape of sub_080A47A0
emmkay440 Nov 24, 2026
0c0a85e
USA: player word stride in sub_080A9680 (1 more shared function)
emmkay440 Nov 24, 2026
d56c6b0
USA: player word strides in two more functions
emmkay440 Nov 24, 2026
d53754d
USA: single-language resource and player fields in sub_0808CB58 (1 mo…
emmkay440 Nov 24, 2026
f985c36
USA: record sizes and six text tables in the resource locator sub_080…
emmkay440 Nov 24, 2026
695a076
USA: single message frame resource in sub_0805DF38 (1 more shared fun…
emmkay440 Nov 24, 2026
c82f70f
USA: UI asset ids and single language in sub_0805F1B0 (1 more shared …
emmkay440 Nov 24, 2026
5e43884
USA: single-language resource switches
emmkay440 Nov 24, 2026
feafa2c
USA: single language and zero store in sub_0808B978 (1 more shared fu…
emmkay440 Nov 24, 2026
ddabc36
USA: register shape of sub_08089AE4 (3 diffs left)
emmkay440 Nov 24, 2026
57c6708
USA: register shape of sub_08089CA0 (partial)
emmkay440 Nov 24, 2026
bb1aba9
USA: halfword player name marker and save template in sub_080135C4 (1…
emmkay440 Nov 24, 2026
351538f
USA: embedded enemy data and resource id in sub_0808F1E4 (1 more shar…
emmkay440 Nov 24, 2026
3187c61
USA: embedded enemy data fields in sub_0808D654
emmkay440 Nov 24, 2026
16dd63b
USA: enemy data record size in sub_0801623C (1 more shared function)
emmkay440 Nov 24, 2026
3dc5e54
USA: enemy data records in sub_0801641C (1 more shared function)
emmkay440 Nov 24, 2026
4ada7f9
USA: enemy, data and player offsets in drop roll sub_0805C620 (1 more…
emmkay440 Nov 24, 2026
18530d2
USA: item record, save and resource offsets in sub_0805B688
emmkay440 Nov 24, 2026
6383418
USA: autofix round 28 (2 more shared functions)
emmkay440 Nov 24, 2026
0791c59
USA: register order in sub_08089AE4 and sub_080226A4 (2 more shared f…
emmkay440 Nov 24, 2026
2b49f96
USA: region_symbols scans the neighbour gap when twins defeat the win…
emmkay440 Nov 24, 2026
cb85cd5
USA: 16-bit name lookup sub_0802A9B0; save and resource offsets in su…
emmkay440 Nov 24, 2026
8eb1db0
USA: enemy data offsets in field-object hit tests sub_0801F99C/FB14/F…
emmkay440 Nov 24, 2026
bfac0c8
USA: player, enemy, item and save offsets in damage handlers sub_0801…
emmkay440 Nov 24, 2026
78eccb9
USA: regional attacker/target views and save offsets in damage formul…
emmkay440 Nov 24, 2026
c2a49e2
USA: save, item and player offsets in player-target damage formula su…
emmkay440 Nov 24, 2026
ecb9c1c
USA: save and item offsets in equipment stat lookup sub_0801CCC8; reg…
emmkay440 Nov 24, 2026
98a2892
USA: 16-bit glyph pages in text row drawer sub_0801A3D0 (1 more share…
emmkay440 Nov 24, 2026
a500897
USA: 16-bit glyph counter becomes the REGION_USA form of shared sub_0…
emmkay440 Nov 24, 2026
3503c3e
USA: 16-bit text rows and names in scrolling message sub_0802A644 (1 …
emmkay440 Nov 24, 2026
9efb086
USA: enemy slot 0 indexing in sub_0804EABC (1 more shared function)
emmkay440 Nov 24, 2026
3ef5101
USA: partial register and enemy-slot forms for sub_08073EE8/sub_08074…
emmkay440 Nov 24, 2026
db4d301
USA: item and enemy offsets, timer register in sub_08079458 (1 more s…
emmkay440 Nov 24, 2026
c7b8da5
USA: resource ids and enemy box offsets in sub_08079948 (1 more share…
emmkay440 Nov 24, 2026
ef3e29f
USA: enemy, player, item and save offsets in enemy attack handler sub…
emmkay440 Nov 24, 2026
6b9e421
USA: player and actor layouts in sub_0809F018 (1 more shared function)
emmkay440 Nov 24, 2026
376b51b
USA: six-language equipment-set records and 16-bit names in sub_08082…
emmkay440 Nov 24, 2026
79426fd
USA: player and save offsets in stat comparison panel sub_080811E0 (1…
emmkay440 Nov 24, 2026
8799ed3
USA: enemy record, item and player layouts in status-effect tick sub_…
emmkay440 Nov 24, 2026
92bf92e
USA: 16-bit number-in-text drawer sub_08081518 (1 more shared function)
emmkay440 Nov 25, 2026
f2220cd
USA: enemy target stores in sub_08028AAC found with a USA-target perm…
emmkay440 Nov 25, 2026
13bbf31
USA: level constant temp in sub_0806E7D4 (USA-target permuter) (1 mor…
emmkay440 Nov 25, 2026
b583e45
USA: player pointer alias and declaration order in sub_08072390 (USA-…
emmkay440 Nov 25, 2026
9ce000b
USA: enemy pointer alias in sub_08075088 (USA-target permuter) (1 mor…
emmkay440 Nov 25, 2026
9d2a020
tools: region_permute.py runs decomp-permuter against regional ROM bytes
emmkay440 Nov 25, 2026
cad37ff
USA: operand order and u16 cast in sub_0808D654 (USA-target permuter)…
emmkay440 Nov 25, 2026
690b4de
USA: embedded record fields of sub_080AD534 at the USA offset (1 more…
emmkay440 Nov 25, 2026
5453eb7
USA: embedded enemy record and player pads in boss actor structs (5 m…
emmkay440 Nov 25, 2026
7cb9b40
USA: enemy slot form in sub_08074398 (USA-target permuter), item kind…
emmkay440 Nov 25, 2026
cee8e08
USA: item kind, resource ids and enemy fields in sub_080AF3F4 and sub…
emmkay440 Nov 25, 2026
aca083f
USA: ally slot offset in sub_0809AEE8 as three enemy strides (1 more …
emmkay440 Nov 25, 2026
d02d46a
USA: palette offset expression in sub_080AB2F8 (USA-target permuter) …
emmkay440 Nov 25, 2026
a3984b9
USA: palette field of the embedded record in sub_080A705C (1 more sha…
emmkay440 Nov 25, 2026
c28ad83
USA: second-actor record and flag offsets in sub_080A9950 (1 more sha…
emmkay440 Nov 25, 2026
2569463
USA: address-taken zero argument in sub_080A6BE8 (USA-target permuter…
emmkay440 Nov 25, 2026
a000eef
USA: item kind, resource ids and record fields in sub_080B0FC4 (1 mor…
emmkay440 Nov 25, 2026
94090e6
USA: record fields and inline palette field reads in sub_080A1208 (1 …
emmkay440 Nov 25, 2026
5a51b5a
USA: inline palette field reads in sub_080A27B8 (1 more shared function)
emmkay440 Nov 25, 2026
44c6bfc
USA: inline palette field reads in sub_080A4D08 (1 more shared function)
emmkay440 Nov 25, 2026
0ae355c
USA: record fields and inline palette field reads in sub_0809D878 (1 …
emmkay440 Nov 25, 2026
d104959
USA: enemy record accessor offsets in sub_08098108, sub_08099838, sub…
emmkay440 Nov 25, 2026
733ad97
USA: inline palette field reads in sub_080B4C34 (1 more shared function)
emmkay440 Nov 25, 2026
a1a3719
USA: save, inventory and item fields in sub_0801D34C; SubCC2C record …
emmkay440 Nov 25, 2026
635fa8c
USA: reset registers of the enemy pass in sub_08073EE8 (1 more shared…
emmkay440 Nov 25, 2026
3c12c44
USA: direction table and angle registers in sub_0807414C (1 more shar…
emmkay440 Nov 25, 2026
1a1804a
USA: item kind and record data copy in sub_080AE420 (1 more shared fu…
emmkay440 Nov 25, 2026
8dedd44
USA: save, item and equipment fields in sub_0808441C (partial, 657 ->…
emmkay440 Nov 26, 2026
132389a
USA: enemy layout, item field and resource ids in sub_08077508/sub_08…
emmkay440 Nov 26, 2026
f8e4a7d
USA: enemy layout in Ene61A4/Ene6BA0/T072DEEnemy/T75En structs (no ne…
emmkay440 Nov 26, 2026
d5a52a6
USA: save block layout and size in sub_08013850 (1 more shared function)
emmkay440 Nov 26, 2026
f3185fd
USA: player, save and item-record layout in consumable handler sub_08…
emmkay440 Nov 26, 2026
797ea69
USA: enemy field and slot form in sub_0806CDF0 (partial, 334 -> 320 d…
emmkay440 Nov 26, 2026
07c5bed
USA: single 16-bit ASCII text converter in sub_08091F9C (1 more share…
emmkay440 Nov 26, 2026
1d05914
USA: player pair copies and literal 0x14C offsets in save writer sub_…
emmkay440 Nov 26, 2026
bd66773
USA: enemy data stride, player layout, resource id and text header in…
emmkay440 Nov 26, 2026
4f94c3b
USA: save, item/equipment/job record layouts, signed kinds and the 99…
emmkay440 Nov 26, 2026
b47d738
USA: 16-bit player names, item/enemy-data/save fields and enemy slot …
emmkay440 Nov 26, 2026
752c9b9
USA: save counters and player field in sub_0806CDF0 (partial)
emmkay440 Nov 26, 2026
d764483
USA: player layout, single-language graphics, resource ids and item f…
emmkay440 Nov 26, 2026
a2818a2
USA: item/equipment icon fields and coordinate register in sub_0805FC…
emmkay440 Nov 28, 2026
6ab94ee
USA: enemy-id compare operand order and non-volatile slot offset in l…
emmkay440 Nov 28, 2026
6ecc959
USA: plain coordinate narrowing in icon draw sub_0805FC80 (1 more sha…
emmkay440 Nov 28, 2026
c3f7583
USA: one player-array symbol (shared base CSE) and text header in inv…
emmkay440 Nov 28, 2026
dd1abd9
USA: title-screen task sub_0800232C without the language menu (second…
emmkay440 Nov 28, 2026
cb7a1b2
USA: title-mode selection task sub_08002694 (single-language animatio…
emmkay440 Nov 28, 2026
cfb09ab
USA: 16-bit scrolling text, new cursor layout and fixed two-line foot…
emmkay440 Nov 28, 2026
1157684
USA: 16-bit save-record names, single-language sprite, text headers a…
emmkay440 Nov 28, 2026
e4fcdd1
USA: declaration order of the resource pointer (spill-slot order) in …
emmkay440 Nov 28, 2026
84bdb29
USA: register priority of the position pair in straight projectile su…
emmkay440 Nov 30, 2026
9488b82
USA: loop-index priority and spill-slot order in staggered cone abili…
emmkay440 Nov 30, 2026
17d1f95
USA: compound heal update and player field offset in area recovery su…
emmkay440 Nov 30, 2026
54704f2
USA: place area recovery sub_0806CDF0 in the symbol table (1 more sha…
emmkay440 Nov 30, 2026
90dec15
USA: plain saved-position copy and player flag offset in scene setup …
emmkay440 Nov 30, 2026
3d7631b
USA: pursuit actor sub_0809CC2C without the EU loop-depth wrapper (1 …
emmkay440 Nov 30, 2026
2b34c81
USA: enemy record offset and plain actor access in homing projectile …
emmkay440 Nov 30, 2026
155ebbc
USA: loop-hoisted hit-box pointer in thrown item flight sub_0805B688 …
emmkay440 Nov 30, 2026
3cf5dd0
USA: natural form of item attribute randomizer sub_0805C208 (1 more s…
emmkay440 Nov 30, 2026
c7afb0d
USA: loop-hoisted zero and flag pointer in map scene update sub_08089…
emmkay440 Nov 30, 2026
34840b1
Fix sub_08089CA0: restore the call order and the full USA symbol table
emmkay440 Nov 30, 2026
c028349
USA: natural typed form of ability area hits sub_08068A00 (1 more sha…
emmkay440 Nov 30, 2026
422b35a
USA: larger resource record in destructible sprites sub_08027C1C (1 m…
emmkay440 Nov 30, 2026
94ad256
USA: single-language battle team setup sub_0808C0C4 (1 more shared fu…
emmkay440 Nov 30, 2026
d919384
USA: larger attack template and target search loop in spread projecti…
emmkay440 Nov 30, 2026
bf60b8b
USA: 16-bit text form of the item menu message sub_08083AE8 (1 more s…
emmkay440 Nov 30, 2026
107a60e
USA: 16-bit text form of the message panel sub_0808381C (1 more share…
emmkay440 Nov 30, 2026
61eaede
USA: 16-bit text form of the message box sub_08087A5C (1 more shared …
emmkay440 Nov 30, 2026
620cf00
USA: save layout in the stat and skill menu sub_0807A5D4 (1 more shar…
emmkay440 Nov 30, 2026
9a60b87
USA: save layout in the item menu interaction state sub_0807C29C (1 m…
emmkay440 Nov 30, 2026
9434395
USA: typed form of the item fusion sub_0808441C (1 more shared function)
emmkay440 Nov 30, 2026
74a1e54
USA: single-language form of the item collection menu sub_08082BB0 (1…
emmkay440 Nov 30, 2026
137447f
USA: natural form of actor neighbor separation sub_08017C6C (1 more s…
emmkay440 Nov 30, 2026
fd1bc1c
USA: indexed enemy scan in table-driven enemy actions sub_08016F28 (1…
emmkay440 Nov 30, 2026
2e84b76
USA: 16-bit text form of the item name drawing sub_0805FFBC (1 more s…
emmkay440 Nov 30, 2026
a3f48c1
USA: single-language form of the pause ring menu sub_080624D8 (1 more…
emmkay440 Nov 30, 2026
b60683a
USA: larger attack template in player attack contacts sub_0801FDD0 (1…
emmkay440 Nov 30, 2026
409d4a3
USA: named song table in the sound test sub_080904A4 (1 more shared f…
emmkay440 Nov 30, 2026
46dad5d
USA: item-table names in the monster card catalog sub_080855D4 (1 mor…
emmkay440 Nov 30, 2026
bddaf42
USA: target search loop in the orbiting familiar sub_080710DC (1 more…
emmkay440 Nov 30, 2026
1cc5f68
USA: target search loop in the spinning familiar sub_0806FF1C (1 more…
emmkay440 Nov 30, 2026
5aba06e
USA: natural form of the directional attachment sprite sub_080A47A0 (…
emmkay440 Nov 30, 2026
75b53b7
USA: spill slot order in the player aura attack sub_08078BCC (1 more …
emmkay440 Nov 30, 2026
cb6d489
USA: status HUD without matching pins sub_08014170 (1 more shared fun…
emmkay440 Nov 30, 2026
7a1e168
USA: larger attack template in guided projectile sub_08075778 (1 more…
emmkay440 Nov 30, 2026
8864633
USA: larger attack template in piercing projectile sub_080761A4 (1 mo…
emmkay440 Nov 30, 2026
78b64c8
USA: area status effect without precomputed duration sub_08072D5C (1 …
emmkay440 Nov 30, 2026
76444a4
USA: item detail panel with 16-bit text sub_080815F4 and sub_080850C0…
emmkay440 Nov 30, 2026
a478a57
USA: player main task sub_0800D368 (1 more shared function)
emmkay440 Nov 30, 2026
0c57422
USA: enemy actor task sub_0801801C (1 more shared function)
emmkay440 Nov 30, 2026
447af99
USA: character setup and name entry task sub_08003984 (1 more shared …
emmkay440 Nov 30, 2026
4f4fcc1
USA: dialogue script window task sub_0805E0C4 (1 more shared function)
emmkay440 Nov 30, 2026
1f4374a
USA: active actor id lookup sub_08019D34 and region-only docs (1 more…
emmkay440 Nov 30, 2026
63b1acc
USA: place sub_08019D34 through a prototype definition (1 more shared…
emmkay440 Nov 30, 2026
c4a5b51
Region symbols: test that in-object references move with the function
emmkay440 Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ CC1 := tools/agbcc/bin/agbcc

ASFLAGS := -mcpu=arm7tdmi -I .
NM_FLAGS :=
CPPFLAGS := -nostdinc -I tools/agbcc/include -iquote include -undef -std=gnu17 $(NM_FLAGS)
# Regional builds (tools/scripts/region_build.py) compile the EU sources once more with -DREGION_USA/-DREGION_JP.
REGION_CPPFLAGS :=
CPPFLAGS := -nostdinc -I tools/agbcc/include -iquote include -undef -std=gnu17 $(NM_FLAGS) $(REGION_CPPFLAGS)
CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -O2 -fhex-asm -fprologue-bugfix

SHELL := /bin/bash -o pipefail
Expand Down
76 changes: 68 additions & 8 deletions docs/agents/REGIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ SHA-256 values are pinned in `tools/config/rom_regions.json`.

## Coverage and limitations

The verified USA build contains 1,257 compiler-backed C intervals (16 same-address
EU, 1,237 relocated EU, 4 region-only) totaling 165,148 bytes; Japan contains
1,250 (16, 1,207 and 27) totaling 162,924 bytes. Consult each generated report for the actual current counts, canonical EU symbols, addresses,
The verified USA build contains 1,983 compiler-backed C intervals (16 same-address
EU, 1,965 relocated EU, 2 region-only) totaling 753,274 bytes; Japan contains
1,272 (16, 1,229 and 27) totaling 164,414 bytes. Consult each generated report for the actual current counts, canonical EU symbols, addresses,
sizes and per-function hashes. The admitted intervals include complete function
literal pools. Top-level assembly and `INCLUDE_ASM` fallbacks receive no C credit.

Expand Down Expand Up @@ -148,15 +148,69 @@ python3 tools/scripts/region_symbols.py --region jp
`region_symbols.py` pairs each EU C function with the regional address where all
non-relocated bytes are identical (tracking the running address shift, with a
unique-match search nearby and a pass for functions located by their callers' BL
targets). It then solves each relocation for the regional value of its symbol.
targets, and a pass that retries the shift of the placed functions on either
side). It then solves each relocation for the regional value of its symbol.
A symbol with two different regional values is dropped, together with every
function that needs it. Functions whose assembly uses a symbol the assembler
resolved inside the EU object (no relocation) are skipped. The tables hold
addresses only, never ROM bytes.

Functions that are not listed still come from the reference ROM. Their code
differs from EU, for example through 16-bit text handling, the 0x454-byte
enemy records or the Japanese player layout.
enemy records or the regional player layouts.

## Regional layouts in shared EU sources

The regional build compiles every `src/*.c` a second time with `-DREGION_USA`
or `-DREGION_JP` (`build/regions/<region>/variant`, EU link order, Makefile
variable `REGION_CPPFLAGS`). `region_symbols.py` pairs and `region_build.py`
relocates the functions of that build, so a layout difference written once in
the shared source moves every function that uses it. The EU build defines
neither macro and must stay byte-identical (`make compare`).

`include/region.h` holds the differences, as EU-offset mapping macros:

| Macro | EU | USA |
| --- | --- | --- |
| `PLAYER_SIZE` | 0x14C | 0x158 |
| `PLAYER_FIELD(o)` | `o` | `o` below 0x0C, `o + 10` below 0x30, then `o + 12` (+0x2E -> +0x38, flags +0x30 -> +0x3C) |
| `ENEMY_SIZE` | 0x2E0 | 0x454 (enemy actor records at `*gUnk_030056F4`) |
| `ENEMY_FIELD(o)` | o | o below 0x206, else o + 0x174 (USA inserts 0x174 bytes at enemy +0x206) |
| `RES_ID(id)` | id | id - 4 (resource ids that USA numbers 4 lower, e.g. 0x5008C; not every archive 5 id moves, so only verified uses) |
| `TEXT_HEADER` | 2 | 4 (header before the string of a text record from `sub_08007290`) |
| `SAVE_FIELD(o)` | `o` | character save record (`gUnk_030034E0`): `o` below 0x0A, `o + 10` below 0x10, then `o + 12` |
| `NameChar` | u8 | u16 (the ten-character name at save +0; source of `SAVE_FIELD`'s first shift) |
| `ITEM_FIELD(o)`, `ITEM_KIND(r)` | `o`, u8 at +0x9B | `o + 0xD8`, u16 at +0x174 (item records of archive 0xB) |
| `EQUIP_FIELD(o)`, `EquipLevel` | `o`, u8 | `o + 0xDC`, u16 (equipment records of archives 0xC/0xD/0xE; glove class/level fields differ, see `sub_0805D2E0`) |
| `TextChar` | u8 (ends 0xFD) | u16 (ends 0xFFFD, bit 15 = control) |
| `TEXT_CTRL(c)` | `c` | `0xFF00 | c` (text control codes) |
| `ENEMY_DATA_FIELD(o)` | `o` | `o + 0x174` (enemy data records: level, experience, ...) |
| `GLOVE_SIZE` | 0xB8 | `EQUIP_FIELD(0xB8) + 4` (archive 0xE records) |

`struct Player` is written with these macros. Raw offsets into a player record
must be written `PLAYER_FIELD(0x9C)`, its stride `PLAYER_SIZE`, so the USA
build sees the USA layout. Japan is not described yet (player 0x154 bytes,
flags at +0x38).

Tools (USA; each run after `region_symbols.py --region usa`, then rerun it and
`make REGION=usa compare`):

- `region_diff.py [FUNC]`: unplaced EU C functions ranked by differing
halfwords against their guessed USA address, or a disassembly diff of FUNC.
- `region_autofix.py [--max-diff N] [FUNC...]`: greedy search wrapping integer
literals of a function in `PLAYER_FIELD`/`SAVE_FIELD`/`PLAYER_SIZE`; keeps a
rewrite only when the variant object equals the USA bytes.
- `region_structs.py [MODULE...]`: resizes the pad arrays of 0x14C-byte struct
views of the player record; keeps a rewrite only when no exact function is
lost and the module moves closer to the USA bytes.
- `region_autofix.py --addresses FILE`: overrides the guessed address with
`NAME 0xADDR` lines (the guess is often wrong after a run of unplaced
functions; pair them with the function starts in the regional gap instead).
- `region_permute.py FUNC ADDR [--time S] [--jobs N]`: decomp-permuter against
the regional bytes of FUNC for register/stack-slot near misses of the same
size; transfer the winning change into an `#ifdef REGION_USA` block by hand.

The macros are the identity in EU, so these rewrites cannot change the EU ROM.

## Region-only C sources

Expand All @@ -178,17 +232,23 @@ Naming is the address, as for `sub_`/`gUnk_` in EU:

The report lists these intervals separately as `region_only_functions`.

USA (AU2E) currently has four region-only functions in
USA (AU2E) currently has two region-only functions in
`src/regions/usa/usa_only.c`, found by aligning the ordered EU and USA function
lists (link order is preserved; 2029 of 2033 USA functions pair with an EU
function):

| USA address | Size | EU relation |
| --- | ---: | --- |
| `0801A1C8` | 0x32 | 16-bit-text form of `CountRenderableScriptGlyphs` (`sub_0801A638`); USA text uses halfword glyphs ending in `0xFFFD` |
| `0805E02C` | 0x1B0 | No EU counterpart; unreferenced dialogue-task starter with caller-supplied window layout |
| `08067CA4` | 0x5C | `EnqueueLinkEntityPosition` (`sub_080663A4`) moved in link order; USA enemy records are 0x454 bytes (EU 0x2E0) |
| `080813D8` | 0xC0 | 16-bit-text form of `ExpandEncodedTextUnsignedNumberToken` (`sub_080850C0`) |

The 16-bit-text forms of `CountRenderableScriptGlyphs` (USA `0801A1C8`) and
`ExpandEncodedTextUnsignedNumberToken` (USA `080813D8`) are the `REGION_USA`
branches of `sub_0801A638` and `sub_080850C0` themselves.

Three EU functions have no USA counterpart (their USA neighbours are adjacent):
`sub_0800B7DC` and its wrapper `sub_0800BCFC` (language-offset graphics loader)
and `sub_08091F20` (byte-text number append).

Most other USA functions differ from EU only in literal-pool addresses; they
are built from the EU source through the relocation table described in
Expand Down
2 changes: 1 addition & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ s32 sub_0801DF8C(void);
u32 sub_08067D74();
s32 sub_08016C88(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u16 arg4);
u32 sub_08019DE0(u32 value);
void sub_0801A764(const u8 *script, u16 x, u16 y);
void sub_0801A764(const TextChar *script, u16 x, u16 y);
void sub_0805A874();
s32 sub_08028830();
void sub_0805A9F4();
Expand Down
1 change: 1 addition & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "gba/gba.h"
#include "m2c_macros.h"
#include "region.h"
#include "m4a.h"
#include "structs.h"
#include "variables.h"
Expand Down
72 changes: 72 additions & 0 deletions include/region.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#ifndef GUARD_REGION_H
#define GUARD_REGION_H

// Regional layout differences of shared EU sources (docs/agents/REGIONS.md).
// The EU build defines neither REGION_USA nor REGION_JP; make REGION=usa compare additionally
// compiles every src/*.c with -DREGION_USA and takes relocated functions from that build.

// Player record (array gUnk_03003CE0): EU 0x14C bytes, USA 0x158. USA inserts 10 bytes
// before EU +0x0C and 2 more before the u32 flags word (EU +0x2E -> USA +0x38, EU +0x30 -> +0x3C).
// PLAYER_FIELD(o) maps an EU offset to the regional one; a pad that starts right after a member
// ending at such a boundary starts at PLAYER_FIELD(boundary - 1) + 1, not PLAYER_FIELD(boundary).
// Enemy actor records (array at *gUnk_030056F4): EU 0x2E0 bytes, USA 0x454 (ENEMY_SIZE). USA inserts
// 0x174 bytes at EU +0x206 (inside the block at +0x204); ENEMY_FIELD(o) maps EU offsets.
// Character save record (pointer gUnk_030034E0): USA inserts 10 bytes before EU +0x0A and
// keeps the word-aligned block at EU +0x10 (USA +0x1C) aligned. SAVE_FIELD(o) maps EU offsets.
// Resource ids (archive << 16 | entry): many USA archive 5/6/8 entries are numbered 4 lower
// (EU 0x5008C = USA 0x50088), but not all of them; RES_ID(id) marks the uses verified per function.
// Item data records (archive 0xB, sub_08007290): the USA name area is longer; fields from EU +0x9C
// move by 0xD8 (ITEM_FIELD) and the EU u8 kind at +0x9B is a u16 at USA +0x174 (ITEM_KIND).
// Character names (save +0, ten characters) are NameChar strings: bytes in EU, halfwords in USA,
// which is where SAVE_FIELD's 10-byte shift comes from.
// Encoded text strings are TextChar (u8 EU, u16 USA); control codes are TEXT_CTRL(0xFD) etc.
// (EU 0xFD, USA 0xFFFD).
// Enemy data records (stats such as level/experience): ENEMY_DATA_FIELD (USA +0x174, the same
// insertion as ENEMY_FIELD's block).
// Equipment records of archives 0xC/0xD/0xE: EQUIP_FIELD (USA +0xDC); the level requirement
// at EQUIP_FIELD(0xA0) is an EquipLevel (u8 EU, u16 USA).
// Text records (sub_08007290): the string starts after a 2-byte EU, 4-byte USA header (TEXT_HEADER).
#ifdef REGION_USA
#define PLAYER_SIZE 0x158
#define PLAYER_FIELD(o) ((o) < 0x0C ? (o) : (o) < 0x30 ? (o) + 10 : (o) + 12)
#define SAVE_FIELD(o) ((o) < 0x0A ? (o) : (o) < 0x10 ? (o) + 10 : (o) + 12)
#define ENEMY_SIZE 0x454
#define ENEMY_FIELD(o) ((o) < 0x206 ? (o) : (o) + 0x174)
#define RES_ID(id) ((id) - 4)
#define TEXT_HEADER 4
#define ITEM_FIELD(o) ((o) + 0xD8)
#define ITEM_KIND_OFF 0x174
typedef u16 ItemKind;
#define ITEM_KIND(r) (*(ItemKind *)((u8 *)(r) + ITEM_KIND_OFF))
typedef u16 NameChar;
typedef u16 TextChar;
#define TEXT_CTRL(c) (0xFF00 | (c))
#define EQUIP_FIELD(o) ((o) + 0xDC)
/* Archive 0xE records: fields from 0xA4 on sit 0xE0 later (0xA0 widens to a word at +0xDC). */
#define EQUIP_E_FIELD(o) ((o) + 0xE0)
#define GLOVE_SIZE (EQUIP_FIELD(0xB8) + 4)
#define ENEMY_DATA_FIELD(o) ((o) + 0x174)
typedef u16 EquipLevel;
#else
#define PLAYER_SIZE 0x14C
#define PLAYER_FIELD(o) (o)
#define SAVE_FIELD(o) (o)
#define ENEMY_SIZE 0x2E0
#define ENEMY_FIELD(o) (o)
#define RES_ID(id) (id)
#define TEXT_HEADER 2
#define ITEM_FIELD(o) (o)
#define ITEM_KIND_OFF 0x9B
typedef u8 ItemKind;
#define ITEM_KIND(r) (*(ItemKind *)((u8 *)(r) + ITEM_KIND_OFF))
typedef u8 NameChar;
typedef u8 TextChar;
#define TEXT_CTRL(c) (c)
#define EQUIP_FIELD(o) (o)
#define EQUIP_E_FIELD(o) (o)
#define GLOVE_SIZE 0xB8
#define ENEMY_DATA_FIELD(o) (o)
typedef u8 EquipLevel;
#endif

#endif // GUARD_REGION_H
27 changes: 14 additions & 13 deletions include/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct DmaEntry {
// placeholder structs: array element of N bytes
struct Sz24 { u8 b[24]; };
struct Sz40 { u8 b[40]; };
struct Sz332 { u8 b[332]; };
struct Sz332 { u8 b[PLAYER_SIZE]; };

// Tilemap / layer system state (gUnk_03003170)
struct Layer {
Expand Down Expand Up @@ -71,12 +71,13 @@ struct LevelEntry {
};

// Character / party member (array gUnk_03003CE0, 0x14C bytes each)
// Offsets are EU; USA moves them through PLAYER_FIELD (include/region.h).
struct Player {
char unk_0[0x20];
char unk_0[PLAYER_FIELD(0x20)];
u16 state; // 0x20
char unk_22[0xE];
char unk_22[PLAYER_FIELD(0x30) - PLAYER_FIELD(0x22)];
u32 flags; // 0x30
char unk_34[0x14C - 0x34];
char unk_34[PLAYER_SIZE - PLAYER_FIELD(0x34)];
};

// placeholder structs: array element of N bytes
Expand Down Expand Up @@ -122,26 +123,26 @@ struct V2W12 { s32 x, y; };

// Full view of struct Player (0x14C bytes) used by code_0800CF58 (worker 12)
struct PlayerW12 {
u8 pad0[0x1C];
u8 pad0[PLAYER_FIELD(0x1C)];
u16 w1C; // 0x1C
u8 pad1E[2];
u8 pad1E[PLAYER_FIELD(0x20) - PLAYER_FIELD(0x1E)];
u16 state; // 0x20
u8 pad22[2];
u8 pad22[PLAYER_FIELD(0x24) - PLAYER_FIELD(0x22)];
s16 w24; // 0x24
u16 w26; // 0x26
u16 w28; // 0x28
u8 pad2A[6];
u8 pad2A[PLAYER_FIELD(0x30) - (PLAYER_FIELD(0x28) + 0x2)];
u32 flags; // 0x30
u8 pad34[0xC];
u8 pad34[PLAYER_FIELD(0x40) - PLAYER_FIELD(0x34)];
s16 w40; // 0x40
u8 pad42[0x4A];
u8 pad42[PLAYER_FIELD(0x8C) - PLAYER_FIELD(0x42)];
struct V2W12 pos8C; // 0x8C
struct V2W12 pos94; // 0x94
u8 pad9C[0x1A];
u8 pad9C[PLAYER_FIELD(0xB6) - PLAYER_FIELD(0x9C)];
u16 wB6; // 0xB6
u8 padB8[0x6A];
u8 padB8[PLAYER_FIELD(0x122) - PLAYER_FIELD(0xB8)];
u16 w122; // 0x122
u8 pad124[0x14C - 0x124];
u8 pad124[PLAYER_SIZE - PLAYER_FIELD(0x124)];
};

#endif // GUARD_STRUCTS_H
Expand Down
4 changes: 4 additions & 0 deletions src/code_08001A50.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ void sub_08001B78(void)
sub_08001AA4();
sub_0805F1B0();
sub_08092094();
#ifdef REGION_USA
gUnk_03003470 = 1; /* USA starts with this state set */
#else
gUnk_03003470 = 0;
#endif
sub_080003F0();
sub_080003F0();
sub_080003F0();
Expand Down
Loading
Loading