cecilarmitais dae72255ff Rephrase eight matched functions; drop index casts and magic numbers
Re-land eight already-matching functions in more idiomatic C. Every one was
verified at score 0 in each region it has a target for BEFORE landing, and by
a matching US build AFTER landing, one function at a time.

  CreateGridCellConnections  320 -> 278   eight (u32) index casts removed
  GenerateExtraHallways      170 -> 161   terrain_flags & 3 -> GetTerrainType
  ActivateEndOfTurnEffects   538 -> 533   MAX_HP_LIMIT for the 999 literals
  ApplyDamageAndEffects      316 -> 314
  CalcDamage                 635 -> 631   one volatile local dropped
  ApplyDamage                807 -> 818
  ov11_022ED69C              242 -> 240   const void * -> typed pointers
  ov11_02307334              733 -> 735   three redundant (u8 *) casts dropped

The CreateGridCellConnections index casts had been recorded as load-bearing.
They are not. MWCC keys common-subexpression elimination on the address
expression INCLUDING integer conversion nodes, so an `int` alias of an `s32`
index splits the use-set exactly as a cast does, while a same-type copy is
erased by copy propagation. An identity (s32) cast is byte-identical to the
(u32) one, and casting every site is byte-identical to casting none, which is
what shows the lever is the split rather than the cast.

overlay_29_0233C9E8.c gains #include "dungeon.h" and "dungeon_util_static.h"
for TERRAIN_TYPE_*, DUNGEON_MAX_SIZE_* and GetTerrainType. All three were
already in the tree; no name is introduced here.

Three candidate rephrasings were rejected on measurement and are not included:
one scored 1195 in EUROPE against a landed baseline of 10, one carried an
artificial `damage_data++; damage_data--;` pair, and one did not match at all.

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

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 23:12:42 -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%