From 14c23438b4cf1b65e1885f9e6898b8f06e972cb7 Mon Sep 17 00:00:00 2001 From: cecilarmitais Date: Wed, 22 Jul 2026 02:33:28 -0700 Subject: [PATCH 1/2] Decomp UFixedPoint64CmpLt Decompile UFixedPoint64CmpLt (0x02001A30) from asm. It compares two 64-bit values held as high/low word pairs and returns whether the first is less than the second. asm/main_02001A30.s held only this function, so the file and its .inc are removed rather than split, the function merges into the adjacent src/main_020018D0.c, and main.lsf drops asm/main_02001A30.o. Three details of the interface are read off the target rather than assumed, each tested with the others held fixed. The four words arrive as separate parameters: a 2-word struct passed by value makes the compiler push all four argument registers and reload them, which the target does not do. Those parameters are unsigned: the comparisons select movlo/movhi, where signed high words give movlt/movgt. The return is word-sized: a u8-width return such as bool8 appends and r0, r0, #0xff, which the target does not have. BOOL is used rather than int because it is the tree's word-sized boolean, and it produces the same bytes. src/main_02001BB4.c declared this function from its call site, before it was decompiled. That declaration is replaced by an include of the header. It was never visible to the compiler at the same time as the definition, so the two disagreeing prototypes could not be caught by a build; its parameter types were signed, which does not describe this function. No comments are added to any pmd-sky file. Authored by Claude (Opus 4.8, amended by Opus 5) under human direction. Confirmed by a matching build: build/pmdsky.us/pmdsky.us.nds: OK. Co-Authored-By: Claude Opus 4.8 Co-Authored-By: Claude Opus 5 --- asm/include/main_02001A30.inc | 2 -- asm/main_02001A30.s | 18 ------------------ include/main_020018D0.h | 1 + main.lsf | 1 - src/main_020018D0.c | 11 +++++++++++ src/main_02001BB4.c | 3 +-- 6 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 asm/include/main_02001A30.inc delete mode 100644 asm/main_02001A30.s diff --git a/asm/include/main_02001A30.inc b/asm/include/main_02001A30.inc deleted file mode 100644 index 3f59c932..00000000 --- a/asm/include/main_02001A30.inc +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once - diff --git a/asm/main_02001A30.s b/asm/main_02001A30.s deleted file mode 100644 index f2d576cd..00000000 --- a/asm/main_02001A30.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "main_02001A30.inc" - - .text - -; https://decomp.me/scratch/bOtSO - arm_func_start UFixedPoint64CmpLt -UFixedPoint64CmpLt: ; 0x02001A30 - cmp r0, r2 - movlo r0, #1 - bxlo lr - movhi r0, #0 - bxhi lr - cmp r1, r3 - movlo r0, #1 - movhs r0, #0 - bx lr - arm_func_end UFixedPoint64CmpLt diff --git a/include/main_020018D0.h b/include/main_020018D0.h index 253ac59a..7cf5cb6f 100644 --- a/include/main_020018D0.h +++ b/include/main_020018D0.h @@ -3,5 +3,6 @@ s32 SinAbs4096(s32 x); s32 CosAbs4096(s32 x); +BOOL UFixedPoint64CmpLt(u32 a_hi, u32 a_lo, u32 b_hi, u32 b_lo); #endif //PMDSKY_MAIN_020018D0_H diff --git a/main.lsf b/main.lsf index 6de52d4a..c9019054 100644 --- a/main.lsf +++ b/main.lsf @@ -17,7 +17,6 @@ Static main Object src/main_02001894.o Object asm/main_020018A4.o Object src/main_020018D0.o - Object asm/main_02001A30.o Object src/main_02001A54.o Object asm/main_02001B0C.o Object src/main_02001BB4.o diff --git a/src/main_020018D0.c b/src/main_020018D0.c index 8b37bc75..8f90c44c 100644 --- a/src/main_020018D0.c +++ b/src/main_020018D0.c @@ -36,3 +36,14 @@ s32 CosAbs4096(s32 x) return 0; } } + +BOOL UFixedPoint64CmpLt(u32 a_hi, u32 a_lo, u32 b_hi, u32 b_lo) +{ + if (a_hi < b_hi) { + return TRUE; + } + if (a_hi > b_hi) { + return FALSE; + } + return a_lo < b_lo; +} diff --git a/src/main_02001BB4.c b/src/main_02001BB4.c index 8032a27b..f5d3a288 100644 --- a/src/main_02001BB4.c +++ b/src/main_02001BB4.c @@ -1,7 +1,6 @@ +#include "main_020018D0.h" #include "main_02001BB4.h" -extern s32 UFixedPoint64CmpLt(s32, u32, s32, u32); - u32 sub_02001BB4(s32 x, s32 y) { u32 var_r4; From 7cd066bd009eb8d11b67c81e867c347d18dfbed0 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 1 Aug 2026 12:46:55 -0400 Subject: [PATCH 2/2] Synced from pmdsky-debug --- asm/include/overlay_03_0233CA98.inc | 2 +- asm/include/overlay_11_022EE5E4.inc | 2 +- asm/include/overlay_31_023838E4.inc | 2 +- asm/main_0202A3E4.s | 6 +++--- asm/overlay_03_0233CA98.s | 2 +- asm/overlay_11_022EE5E4.s | 2 +- asm/overlay_31_023838E4.s | 2 +- tools/sync_pmdsky_debug/symbol_details.py | 16 ++++++++-------- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/asm/include/overlay_03_0233CA98.inc b/asm/include/overlay_03_0233CA98.inc index d851ffc8..eedd7d57 100644 --- a/asm/include/overlay_03_0233CA98.inc +++ b/asm/include/overlay_03_0233CA98.inc @@ -194,6 +194,7 @@ .public RandInt .public RollRandomItemReward .public SetQuestionMarks +.public SetWindowTitle .public ShowKeyboard .public StrcpyName .public StringFromId @@ -210,7 +211,6 @@ .public sub_0202836C .public sub_02029F88 .public sub_02029FBC -.public sub_02030A2C .public sub_02037468 .public sub_02037570 .public sub_020376EC diff --git a/asm/include/overlay_11_022EE5E4.inc b/asm/include/overlay_11_022EE5E4.inc index a13620f8..70d44c92 100644 --- a/asm/include/overlay_11_022EE5E4.inc +++ b/asm/include/overlay_11_022EE5E4.inc @@ -785,6 +785,7 @@ .public SetNewFriendActor .public SetParentMenuState7 .public SetSpriteIdForAnimationControl +.public SetWindowTitle .public ShowDialogueBox .public ShowKeyboard .public ShowStringIdInDialogueBox @@ -871,7 +872,6 @@ .public sub_0202F3F8 .public sub_0202F954 .public sub_020307EC -.public sub_02030A2C .public sub_02034840 .public sub_0203559C .public sub_02035CE4 diff --git a/asm/include/overlay_31_023838E4.inc b/asm/include/overlay_31_023838E4.inc index 2942e128..b08f6894 100644 --- a/asm/include/overlay_31_023838E4.inc +++ b/asm/include/overlay_31_023838E4.inc @@ -234,6 +234,7 @@ .public SetAdvancedTextBoxState5 .public SetMonsterActionFields .public SetPreprocessorArgsIdVal +.public SetWindowTitle .public ShowStringInDialogueBox .public SortItemsInBag .public SpecificRecruitCheck @@ -253,7 +254,6 @@ .public sub_0202F474 .public sub_0202F954 .public sub_020307EC -.public sub_02030A2C .public sub_0203F150 .public sub_0203F398 .public sub_0203F990 diff --git a/asm/main_0202A3E4.s b/asm/main_0202A3E4.s index 7d9e6a72..9189010c 100644 --- a/asm/main_0202A3E4.s +++ b/asm/main_0202A3E4.s @@ -7769,14 +7769,14 @@ GetWindowIdPageStart: ; 0x02030A18 ldmia sp!, {r3, pc} arm_func_end GetWindowIdPageStart - arm_func_start sub_02030A2C -sub_02030A2C: ; 0x02030A2C + arm_func_start SetWindowTitle +SetWindowTitle: ; 0x02030A2C stmdb sp!, {r4, lr} mov r4, r1 bl GetWindowContents strh r4, [r0, #0x20] ldmia sp!, {r4, pc} - arm_func_end sub_02030A2C + arm_func_end SetWindowTitle arm_func_start GetAdvancedTextBoxFlags2 GetAdvancedTextBoxFlags2: ; 0x02030A40 diff --git a/asm/overlay_03_0233CA98.s b/asm/overlay_03_0233CA98.s index 3f334662..48ffb97a 100644 --- a/asm/overlay_03_0233CA98.s +++ b/asm/overlay_03_0233CA98.s @@ -9229,7 +9229,7 @@ ov03_02344970: ; 0x02344970 mov r1, r0, lsl #0x10 mov r0, r4 mov r1, r1, lsr #0x10 - bl sub_02030A2C + bl SetWindowTitle #if defined(EUROPE) add r0, r5, #0x5c add r0, r0, #0x3c00 diff --git a/asm/overlay_11_022EE5E4.s b/asm/overlay_11_022EE5E4.s index e530962e..cb442fdd 100644 --- a/asm/overlay_11_022EE5E4.s +++ b/asm/overlay_11_022EE5E4.s @@ -34084,7 +34084,7 @@ ov11_0230A2D0: ; 0x0230A2D0 mov r1, r4, lsl #3 ldrh r1, [r0, r1] mov r0, r5 - bl sub_02030A2C + bl SetWindowTitle #if defined(EUROPE) add r0, r4, #0xc3 add r0, r0, #0x3f00 diff --git a/asm/overlay_31_023838E4.s b/asm/overlay_31_023838E4.s index ea845a59..71e9ef27 100644 --- a/asm/overlay_31_023838E4.s +++ b/asm/overlay_31_023838E4.s @@ -6911,7 +6911,7 @@ DrawDungeonHintContents: ; 0x023891A8 mov r1, r4, lsl #3 ldrh r1, [r0, r1] mov r0, r5 - bl sub_02030A2C + bl SetWindowTitle #if defined(EUROPE) add r0, r4, #0xb2 add r0, r0, #0x3f00 diff --git a/tools/sync_pmdsky_debug/symbol_details.py b/tools/sync_pmdsky_debug/symbol_details.py index 71f5b3aa..ae8210d5 100644 --- a/tools/sync_pmdsky_debug/symbol_details.py +++ b/tools/sync_pmdsky_debug/symbol_details.py @@ -31,7 +31,13 @@ NONMATCHING_SYMBOLS_ARM9 = { 'CTRDGi_RestoreAccessCycle': 'Ctrdgi_RestoreAccessCycle', 'CTRDGi_SendtoPxi': 'Ctrdgi_SendtoPxi', 'CTRDGi_UnlockByProcessor': 'Ctrdgi_UnlockByProcessor', + 'DGT_Hash2GetDigest': 'Dgt_Hash2GetDigest', + 'DGT_Hash2Reset': 'Dgt_Hash2Reset', + 'DGT_Hash2SetSource': 'Dgt_Hash2SetSource', 'disableBankForX_': 'DisableBankForX', + 'FifoCtrlInit': 'FIFO_CTRL_INIT', + 'fsi_arc_rom': 'FSI_ARC_ROM', + 'fsi_digest_key_len': 'FSI_DIGEST_KEY_LEN', 'FX_AtanIdxTable_': 'FX_ATAN_IDX_TABLE', 'G2x_ChangeBlendBrightness_': 'G2x_ChangeBlendBrightness', 'G2x_SetBlendAlpha_': 'G2x_SetBlendAlpha', @@ -132,7 +138,9 @@ NONMATCHING_SYMBOLS_ARM9 = { 'PXI_SetFifoRecvCallback': 'Pxi_SetFifoRecvCallback', 'PXIi_HandlerRecvFifoNotEmpty': 'Pxii_HandlerRecvFifoNotEmpty', 'resetBankForX_': 'EnableVramBanksInSet', + 'sCallbackTable': 'CALLBACK_TABLE', 'sClrImg': 'CLR_IMG', + 'sDayOfYear': 'DAY_OF_YEAR', 'sDispMode': 'DISP_MODE', 'sIsDispOn': 'IS_DISP_ON', 'SND_CommandInit': 'Snd_CommandInit', @@ -153,14 +161,6 @@ NONMATCHING_SYMBOLS_ARM9 = { 'VEC_DotProduct': 'Vec_DotProduct', 'VEC_Normalize': 'Vec_Normalize', 'VolumeTable': 'VOLUME_TABLE', - 'DGT_Hash2GetDigest': 'Dgt_Hash2GetDigest', - 'DGT_Hash2Reset': 'Dgt_Hash2Reset', - 'DGT_Hash2SetSource': 'Dgt_Hash2SetSource', - 'fsi_digest_key_len': 'FSI_DIGEST_KEY_LEN', - 'sDayOfYear': 'DAY_OF_YEAR', - 'FifoCtrlInit': 'FIFO_CTRL_INIT', - 'fsi_arc_rom': 'FSI_ARC_ROM', - 'sCallbackTable': 'CALLBACK_TABLE', } NONMATCHING_SYMBOLS_ARM7 = {