mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-27 04:38:15 -05:00
240bea143d02cbb2ac2d1fcc34e3c32a2b233b27
ov11_02307334 (0x02307334, 1624 instructions in all three regions) is the TM/HM use flow: a 42-case dense switch over *ov11_02324D8C, driving the bag inventory menu, the TM info and confirmation dialogues, the gummi/IQ path and the move-forget flow through menus, text boxes and scroll boxes. It is function 145 of 215 in asm/overlay_11_022FE5F8.s, so extract_function.py splits rather than merges: the 70 functions after it move to asm/overlay_11_02308D1C.s, the function lands in src/overlay_11_02307334.c with include/overlay_11_02307334.h, and main.lsf lists both new objects where it listed one. Unlike the last three functions on this branch there is no stale extern to reconcile. The symbol has exactly one caller, ov11_02304B4C, in the same object and still in asm; it has no external linkage today, appears in no function-pointer table, and a scan of all 512 .s files for the little-endian encoding of its address finds nothing. Three declarations elsewhere in the tree are wrong and this function is the first caller that makes them matter. RemoveItemNoHoleCheck takes an item index, not a struct item *: asm/main_0200F390.s does mov r1,#6 / smulbb r1, r0, r1, and SMULBB multiplies the low halfwords, so the argument is a signed 16-bit value scaled by sizeof(struct item). Its only other caller passes GetFirstUnequippedItemOfType, which likewise returns an index rather than a pointer, so the two errors cancelled and the pair matched by accident. ov10_022BCDA8 is declared void but its body ends in sub_02033064, which returns s32, and both of this function's call sites consume the result. All three are -W error blockers here, and the matching build confirms the fixes are byte-neutral. Case emission order is source order and is not ascending: 0, 2, 1, 3, 17..25, 33, 34, 31, 32, 35..40, 26..30, 41, then 4..16 last. Every case breaks to a single trailing return 0; case 16 returns 1, and case 15 falls through into it. The eight function-scope locals are declared in descending stack-address order because MWCC gives the first-declared local the highest address, which tiles the frame exactly to 0x5A0. The 43-instruction block shared by cases 32 and 34 is written out twice rather than factored into a helper - MWCC 2.0 does not tail-merge blocks of that size, and the target has both copies. Several shapes that read as redundant are load-bearing and reproduce the target: case 4's v1 != 8 && v1 == 4, the dead field_0x0 = 0x1a in case 38 and field_0x24e = v6->id in case 1 that the following if/else overwrites in both arms, the guard if (field_0x8 == -2) ov11_02308EDC() in case 12 that the callee performs again itself, and case 21's two search loops being written differently. struct unk_02324D8C is a placeholder for the 0x330-byte state struct MemAlloc'd by ov11_02307244, with field_0x<off> members, three identified sub-object types where the arithmetic closes, and u8 filler elsewhere. The 0x14-byte object at 0x238 has to be a real nested struct: the target holds base + 0x238 in a callee-saved register across two calls, while flat fields make MWCC round the base to #0x200 and re-offset per use. The 49 callees with no declaration anywhere are declared extern in the .c with prototypes read off their own asm; every name is established by a literal bl in the target, but the argument types are inference. Region handling: three file-scope offset macros under JAPAN cover the id families at +0x2D20 (16 sites), +0x1458 and +0x1567, and the two genuine three-way forks - the StringFromId base in case 1 and the CreateScrollBoxSingle base in case 10 - are written out per region as src/get_category_string.c and src/overlay_25_init.c already do. The asm's four #ifdef JAPAN code forks need no #if here: each exists only because exactly one of the two constants is an ARM rotated-8-bit immediate, so writing id + OFFSET and letting MWCC choose mov versus a pool word reproduces all four. EUROPE differs from NORTH_AMERICA in two constants and nothing else. Authored by Claude (Opus 5) under human direction. Confirmed by matching builds of all three regions: build/pmdsky.us/pmdsky.us.nds: OK, build/pmdsky.eu/pmdsky.eu.nds: OK, build/pmdsky.jp/pmdsky.jp.nds: OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…
…
…
…
…
…
Pokémon Mystery Dungeon: Explorers of Sky
This is a WIP disassembly of Pokémon Mystery Dungeon: Explorers of Sky. For instructions on how to set up the repository, please read INSTALL.md. For information on how to contribute changes, see CONTRIBUTING.md.
This repository builds the following ROMs:
- pmdsky.us.nds
sha1: 5fa96ca8d8dd6405d6cd2bad73ed68bc73a9d152 - pmdsky.eu.nds
sha1: c838a5adf1ed32d2da8454976e5b1a1aa189c139 - pmdsky.jp.nds
sha1: 7785138dd343b6f2d0f2c9cadc26b4aa927161d7
For contacts and other pret projects, see pret.github.io.
Description
Languages
Assembly
66.3%
C
18%
C++
7.1%
Boogie
4.3%
sed
1.5%
Other
2.8%