cecilarmitais fdbc544fcb Decomp GetNbItemsInBag and IsItemInBag
Decompile from asm:

  GetNbItemsInBag  0x0200EDFC
  IsItemInBag      0x0200EEE0

Both walk the active inventory with a cursor rather than indexing, with the
index and the cursor both advanced in the for clause, which is what puts the two
adds at the top of the loop body as the target has them.

GetNbItemsInBag's existence test goes through an explicit boolean:
(item->flags & ITEM_FLAG_EXISTS) != 0 assigned to a bool8 before the branch.
That is what produces the target's tst / movne / moveq / tst #0xff sequence;
testing the masked value directly collapses it.

IsItemInBag returns early on the first match, which the target reaches with
bxeq lr mid-loop, and falls through to a single return of zero.

GetNbItemsInBag lands in the existing src/main_0200EDC0.c, which already
includes item.h; IsItemInBag needs a new file and declares
BAG_ITEMS_PTR_MIRROR alongside it, matching how the other bag sources in this
tree declare it.

No comments are added to any pmd-sky file.

Authored by Claude (Opus 5) under human direction. Confirmed by a matching
build: build/pmdsky.us/pmdsky.us.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 16:48:08 -07:00
…
2026-08-01 12:46:55 -04:00
2026-07-16 07:36:58 -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%