cecilarmitais d814f8d017 Decomp ApplyItemEffect; replace its stale extern with the new header
ApplyItemEffect (0x0231B68C, 1310 instructions in US, 1312 in EU) is the
thrown/eaten item dispatcher: an item-catcher preamble, the sticky-item
block, and then one switch (item->id) over a 183-entry jump table with 85
distinct case bodies, a shared tail that walks
APPLES_AND_BERRIES_ITEM_IDS, and EnemyEvolution. It is the last of ten
functions in asm/overlay_29_0231B33C.s and the next object in main.lsf is
src/overlay_29_0231CBC8.o, so extract_function.py merges rather than
splits and main.lsf is unchanged.

src/dungeon_projectile_throw.c declared ApplyItemEffect itself, with a
live call site. That extern is removed and the file now includes the new
header instead. It is a landed, already-matching object and parameters 1-3
are exactly where a wrong spelling would surface, so its rebuild in all
three regions is a check on the signature rather than tidying.

case ITEM_NOTHING is written explicitly above default even though the jump
table sends id 0 there. The dispatch is cmp r0,#0 / addge pc,pc,r0,lsl #2
with no rebase, and a survey of all 786 such dispatches in asm/ shows
MWCC's table spans the minimum to maximum LABELLED case: 104 of the 105
rebased tables have a real case at index 0, rebases occur for offsets as
small as 3, yet 40 tables have 3-7 leading default entries un-rebased and
82 have trailing default entries, which padding cannot explain. Leading
and trailing default entries are therefore explicit case labels sharing
default's body.

The category-5/10 test that skips the switch is an if/else whose else arm
is the entire switch; both arms fall into the shared tail. Case emission
order is source order and is not ascending (8 before 7, 77 before 74, 136
before 113, 182 before 104, default last).

The 41 callees that are still asm are declared extern in the .c with
prototypes read off their own asm, as the sibling files do, and so are the
28 rodata data symbols - const, with ov10_022C4864 as s32 where the other
25 scalars are s16, which is what makes its load a 32-bit ldr. Two
prototypes deliberately differ from pmdsky-debug: ApplyKeyEffect takes one
parameter, not two, and CalcDamageFixedNoCategory's fifth parameter points
at a one-byte object, not a struct damage_data.

Region handling: seven message ids are file-scope defines at US - 0x2C1
under JAPAN, and one EU-only call to ov29_022FB920 sits inside an
ifdef EUROPE with its prototype. The JP fork of the
exclusive_item_effect_flags offset needs nothing - the header already
models the 4-byte JP struct monster shrink.

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>
2026-09-18 23:12:41 -07:00
2026-08-22 20:45:50 -04:00
…
2026-09-04 13:13:23 -07:00
…
…
…
…
…
…

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:

For contacts and other pret projects, see pret.github.io.

Description
Decompilation of Pokémon Mystery Dungeon: Explorers of Sky
Readme 335 MiB
Languages
Assembly 66.3%
C 18%
C++ 7.1%
Boogie 4.3%
sed 1.5%
Other 2.8%