mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-28 05:07:58 -05:00
Decompile from asm, all of them accessors on ADVENTURE_LOG_PTR: SetAdventureLogStructLocation SetAdventureLogCompleted IncrementNbEvolutions SetAdventureLogDungeonFloor GetAdventureLogCompleted GetNbEvolutions GetAdventureLogDungeonFloor IsAdventureLogNotEmpty IncrementNbEggsHatched IncrementNbDungeonsCleared GetNbDungeonsCleared GetNbEggsHatched IncrementNbFriendRescues GetNbFriendRescues GetNbPokemonJoined GetNbMovesLearned SetVictoriesOnOneFloor GetVictoriesOnOneFloor GetNbPokemonBattled IncrementNbBigTreasureWins SetNbBigTreasureWins GetNbBigTreasureWins SetNbRecycled GetNbRecycled IncrementNbSkyGiftsSent SetNbSkyGiftsSent GetNbSkyGiftsSent IncrementNbFainted GetNbFainted GetSentryDutyGamePoints No new types. struct adventure_log already exists in include/adventure_log.h with every field these touch named and offset-commented, and struct dungeon_floor_pair in dungeon.h; every offset in the asm lands on a named field. That header is the reason a batch this size was tractable: the only modelling needed was reading which field each function touches. Two orderings decided four of the thirty, both instances of the rule added to MATCHING_TIPS in the previous commit. IsAdventureLogNotEmpty needed its loop index declared before the pointer local, not after -- with the pointer first the two land in swapped registers, at 35. The three Set functions needed the completion-flag write placed before the clamp rather than after: written in the obvious order the clamp is emitted ahead of the first pointer load and the two literal-pool words come out reversed, at 250 each. Reordering the statement fixed all three. The counters clamp at 0x000F423F, decimal 999999, and each function sets one bit of completion_flags[0]. The exact shape differs per function and is reproduced rather than normalised: three increment then clamp, two clamp then increment, and the three setters write the flag before storing the value. Those differences are what the target does. The clamp comparisons are signed even though the fields are u32, so each is written with an explicit (s32) cast rather than retyping a shared struct. ADVENTURE_LOG_PTR and _022AB69C move into adventure_log.h. src/main_0204FDFC.c declared the pointer itself, from before any of this was decompiled; that line is replaced by the header it already includes, and the object rebuilds unchanged. Nine adventure-log functions remain in asm and are not in this commit: ClearAdventureLogStruct, ComputeSpecialCounters, CopyLogTo, CopyLogFrom, SetItemAcquired, GetNbItemAcquired, SetChallengeLetterCleared, SetPokemonBattled and SetSentryDutyGamePoints. 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>
9 lines
234 B
C++
9 lines
234 B
C++
#pragma once
|
|
.public ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS
|
|
.public ADVENTURE_LOG_PTR
|
|
.public GetBaseFormCastformCherrimDeoxys
|
|
.public GetDexNumberVeneer
|
|
.public IsRealMove
|
|
.public SetAdventureLogCompleted
|
|
.public TEAM_MEMBER_TABLE_PTR
|