Decomp 17 functions, emptying eight asm files

Second cleanup batch. Eight files are now gone:

  asm/overlay_29_022E1618.s   asm/main_0202B530.s
  asm/overlay_29_022DC65C.s   asm/main_0205EC38.s
  asm/overlay_29_0232124C.s   asm/main_02051788.s
  asm/main_02042B20.s         asm/main_02065BD8.s

main.lsf falls from 1175 objects to 1167.

Twenty-two functions matched across eleven files, but only seventeen land.
FixedPoint64ToInt, GetSpriteSize and RemoveItemFromKecleonShop1 did not match,
and their files therefore cannot be emptied; landing their already-matched
siblings would have converted two two-function files into two fresh
single-function fragments, so those two are held back as well. This batch
reduces the fragment count without creating any.

Three declarations follow the tree rather than the scratch: ov29_0232119C takes
struct entity * as its first parameter, ov29_023538B4 is already declared as a
u8 array, and ov29_022DC2B8 and ov29_022DC33C are declared u8 * in their
destination file. That last one is inconsistent with poly_text.h, which declares
ov29_022DC2B8 as struct unk_ov29_022DC240_t *; the file already carried the same
split for ov29_022DC240, so its local convention was followed rather than
changing pre-existing code. Worth unifying separately.

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>
This commit is contained in:
cecilarmitais
2026-08-21 00:56:33 -07:00
parent be41c2f3d5
commit d9df74f0f6
33 changed files with 170 additions and 275 deletions

View File

@@ -1,4 +0,0 @@
#pragma once
.public GetCurrentPage
.public GetSelectedItemOnPage
.public GetWindowContents

View File

@@ -1,2 +0,0 @@
#pragma once
.public UNK_STORAGE_STRUCT_0XC

View File

@@ -1,3 +0,0 @@
#pragma once
.public _020A20B1
.public ARM9_UNKNOWN_TABLE__NA_20A20B0

View File

@@ -1,2 +0,0 @@
#pragma once
.public MISSION_DELIVER_LIST_PTR

View File

@@ -1,4 +0,0 @@
#pragma once
.public StrncpySimple
.public StrncpySimpleNoPadSafe
.public _022B7310

View File

@@ -1,4 +0,0 @@
#pragma once
.public ov29_022DC2B8
.public ov29_022DC33C
.public ov29_023538B4

View File

@@ -1,2 +0,0 @@
#pragma once

View File

@@ -1,2 +0,0 @@
#pragma once
.public ov29_0232119C

View File

@@ -1,22 +0,0 @@
.include "asm/macros.inc"
.include "main_0202B530.inc"
.text
arm_func_start sub_0202B530
sub_0202B530: ; 0x0202B530
stmdb sp!, {r3, lr}
bl GetWindowContents
add r0, r0, #4
bl GetSelectedItemOnPage
ldmia sp!, {r3, pc}
arm_func_end sub_0202B530
arm_func_start sub_0202B544
sub_0202B544: ; 0x0202B544
stmdb sp!, {r3, lr}
bl GetWindowContents
add r0, r0, #4
bl GetCurrentPage
ldmia sp!, {r3, pc}
arm_func_end sub_0202B544

View File

@@ -1,42 +0,0 @@
.include "asm/macros.inc"
.include "main_02042B20.inc"
.text
arm_func_start sub_02042B20
sub_02042B20: ; 0x02042B20
ldr r1, _02042B4C ; =UNK_STORAGE_STRUCT_0XC
mov r0, #0
ldr r3, [r1, #8]
mov r2, r0
_02042B30:
ldr r1, [r3, r2, lsl #2]
add r2, r2, #1
tst r1, #1
addne r0, r0, #1
cmp r2, #0x32
blt _02042B30
bx lr
.align 2, 0
_02042B4C: .word UNK_STORAGE_STRUCT_0XC
arm_func_end sub_02042B20
arm_func_start sub_02042B50
sub_02042B50: ; 0x02042B50
ldr r1, _02042B80 ; =UNK_STORAGE_STRUCT_0XC
mov r0, #0
ldr r2, [r1, #8]
b _02042B70
_02042B60:
ldr r1, [r2, r0, lsl #2]
tst r1, #1
bxne lr
add r0, r0, #1
_02042B70:
cmp r0, #0x32
blt _02042B60
mvn r0, #0
bx lr
.align 2, 0
_02042B80: .word UNK_STORAGE_STRUCT_0XC
arm_func_end sub_02042B50

View File

@@ -1,35 +0,0 @@
.include "asm/macros.inc"
.include "main_02051788.inc"
.text
arm_func_start sub_02051788
sub_02051788: ; 0x02051788
ldr r1, _02051794 ; =_020A20B1
ldrb r0, [r1, r0, lsl #1]
bx lr
.align 2, 0
_02051794: .word _020A20B1
arm_func_end sub_02051788
arm_func_start sub_02051798
sub_02051798: ; 0x02051798
mov ip, #0
ldr r2, _020517D0 ; =ARM9_UNKNOWN_TABLE__NA_20A20B0
b _020517C0
_020517A4:
add r1, r2, ip, lsl #1
ldrb r1, [r1, #1]
mov r3, ip, lsl #1
cmp r0, r1
ldreqb r0, [r2, r3]
bxeq lr
add ip, ip, #1
_020517C0:
cmp ip, #0x100
blt _020517A4
mov r0, #0xff
bx lr
.align 2, 0
_020517D0: .word ARM9_UNKNOWN_TABLE__NA_20A20B0
arm_func_end sub_02051798

View File

@@ -1,30 +0,0 @@
.include "asm/macros.inc"
.include "main_0205EC38.inc"
.text
arm_func_start sub_0205EC38
sub_0205EC38: ; 0x0205EC38
ldr r1, _0205EC4C ; =MISSION_DELIVER_LIST_PTR
ldr r1, [r1, #0x18]
add r1, r1, #0x320
add r0, r1, r0, lsl #5
bx lr
.align 2, 0
_0205EC4C: .word MISSION_DELIVER_LIST_PTR
arm_func_end sub_0205EC38
arm_func_start sub_0205EC50
sub_0205EC50: ; 0x0205EC50
ldr r1, _0205EC74 ; =MISSION_DELIVER_LIST_PTR
ldr r1, [r1, #0x18]
add r0, r1, r0, lsl #5
ldrb r0, [r0, #0x320]
cmp r0, #0
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_0205EC74: .word MISSION_DELIVER_LIST_PTR
arm_func_end sub_0205EC50

View File

@@ -1,51 +0,0 @@
.include "asm/macros.inc"
.include "main_02065BD8.inc"
.text
arm_func_start sub_02065BD8
sub_02065BD8: ; 0x02065BD8
ldr ip, _02065BE8 ; =StrncpySimple
mov r2, r1
ldr r1, _02065BEC ; =_022B7310
bx ip
.align 2, 0
_02065BE8: .word StrncpySimple
_02065BEC: .word _022B7310
arm_func_end sub_02065BD8
arm_func_start sub_02065BF0
sub_02065BF0: ; 0x02065BF0
ldr ip, _02065C00 ; =StrncpySimpleNoPadSafe
ldr r1, _02065C04 ; =_022B7310
mov r2, #0xa
bx ip
.align 2, 0
_02065C00: .word StrncpySimpleNoPadSafe
_02065C04: .word _022B7310
arm_func_end sub_02065BF0
arm_func_start sub_02065C08
sub_02065C08: ; 0x02065C08
ldr ip, _02065C44 ; =_022B7310
mov r3, #0
b _02065C20
_02065C14:
ldrb r2, [r0], #1
add r3, r3, #1
strb r2, [ip], #1
_02065C20:
cmp r3, r1
blt _02065C14
mov r0, #0
b _02065C38
_02065C30:
strb r0, [ip], #1
add r3, r3, #1
_02065C38:
cmp r3, #0x10
blt _02065C30
bx lr
.align 2, 0
_02065C44: .word _022B7310
arm_func_end sub_02065C08

View File

@@ -1,24 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022DC65C.inc"
.text
arm_func_start ov29_022DC65C
ov29_022DC65C: ; 0x022DC65C
ldr ip, _022DC668 ; =ov29_022DC2B8
ldr r0, _022DC66C ; =ov29_023538B4
bx ip
.align 2, 0
_022DC668: .word ov29_022DC2B8
_022DC66C: .word ov29_023538B4
arm_func_end ov29_022DC65C
arm_func_start ov29_022DC670
ov29_022DC670: ; 0x022DC670
ldr ip, _022DC67C ; =ov29_022DC33C
ldr r0, _022DC680 ; =ov29_023538B4
bx ip
.align 2, 0
_022DC67C: .word ov29_022DC33C
_022DC680: .word ov29_023538B4
arm_func_end ov29_022DC670

View File

@@ -1,16 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022E1618.inc"
.text
arm_func_start ov29_022E1618
ov29_022E1618: ; 0x022E1618
ldr r0, [r0, #0xb4]
bx lr
arm_func_end ov29_022E1618
arm_func_start ov29_022E1620
ov29_022E1620: ; 0x022E1620
ldr r0, [r0, #0xb4]
bx lr
arm_func_end ov29_022E1620

View File

@@ -1,24 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_0232124C.inc"
.text
arm_func_start ov29_0232124C
ov29_0232124C: ; 0x0232124C
ldr ip, _0232125C ; =ov29_0232119C
mov r1, #1
mov r2, r1
bx ip
.align 2, 0
_0232125C: .word ov29_0232119C
arm_func_end ov29_0232124C
arm_func_start ov29_02321260
ov29_02321260: ; 0x02321260
ldr ip, _02321270 ; =ov29_0232119C
mov r1, #0
mov r2, r1
bx ip
.align 2, 0
_02321270: .word ov29_0232119C
arm_func_end ov29_02321260

View File

@@ -6,5 +6,7 @@
void CloseSimpleMenu(s32 window_id);
u32 IsSimpleMenuActive(s32 window_id);
bool8 CheckSimpleMenuField0x1A0(s32 window_id);
s32 sub_0202B530(s32 window_id);
s32 sub_0202B544(s32 window_id);
#endif

View File

@@ -42,5 +42,7 @@ bool8 IsCollectionMenuActive(s8 a);
bool8 IsCollectionMenuState3(s8 a);
void ClearBagSelectedItemTable(void);
s32 sub_02042B20(void);
s32 sub_02042B50(void);
#endif

View File

@@ -6,5 +6,7 @@
bool8 IsSkyExclusiveDungeon(enum dungeon_id dungeon_id);
bool32 JoinedAtRangeCheck2(u8 joined_at);
u8 sub_02051788(s32 i);
u8 sub_02051798(u8 v);
#endif //PMDSKY_MAIN_02051760_H

View File

@@ -1,6 +1,10 @@
#ifndef PMDSKY_MAIN_0205EC18_H
#define PMDSKY_MAIN_0205EC18_H
#include "util.h"
void sub_0205EC18(u32 index);
u8 * sub_0205EC38(s32 i);
bool8 sub_0205EC50(s32 i);
#endif //PMDSKY_MAIN_0205EC18_H

View File

@@ -43,5 +43,8 @@ void SetRandomRequestNpcs1And2(enum monster_id random_request_npc01, enum monste
void SetRandomRequestNpc03KindVar(enum monster_id kind);
void SetAllEventNpcs(enum monster_id event_npc01, enum monster_id event_npc02, enum monster_id event_npc03, enum monster_id event_npc04);
void SetNewFriendActor(enum monster_id new_friend);
void sub_02065BD8(u8 *dst, s32 n);
void sub_02065BF0(u8 *dst);
void sub_02065C08(u8 *src, s32 n);
#endif

View File

@@ -3,5 +3,7 @@
// mem init?
void ov29_022DC61C();
void ov29_022DC65C(void);
void ov29_022DC670(void);
#endif //PMDSKY_OVERLAY_29_022DC61C_H

View File

@@ -5,5 +5,7 @@
// Given an item entity, returns the pointer to the item info struct it contains.
struct item* GetItemInfo(struct entity *item_entity);
void * ov29_022E1618(struct entity *entity);
void * ov29_022E1620(struct entity *entity);
#endif //PMDSKY_OVERLAY_29_022E1610_H

View File

@@ -6,5 +6,7 @@
#include "move.h"
void ov29_02321238(struct entity *entity);
void ov29_0232124C(struct entity *entity);
void ov29_02321260(struct entity *entity);
#endif

View File

@@ -173,7 +173,6 @@ Static main
Object src/main_0202AB40.o
Object asm/main_0202AB94.o
Object src/main_0202B4C4.o
Object asm/main_0202B530.o
Object src/main_0202B558.o
Object asm/main_0202B568.o
Object src/main_0202BA0C.o
@@ -217,7 +216,6 @@ Static main
Object src/main_0203C910.o
Object asm/main_0203CAF0.o
Object src/main_02042AF8.o
Object asm/main_02042B20.o
Object src/main_02042B84.o
Object asm/main_02042BE0.o
Object src/main_02043148.o
@@ -282,7 +280,6 @@ Static main
Object src/main_020514CC.o
Object asm/main_02051504.o
Object src/main_02051760.o
Object asm/main_02051788.o
Object src/tactics_data.o
Object asm/main_rodata_020A190C.o
Object src/monster_parameters.o
@@ -372,7 +369,6 @@ Static main
Object asm/main_0205EB00.o
Object src/main_0205EBD8.o
Object src/main_0205EC18.o
Object asm/main_0205EC38.o
Object src/main_0205EC78.o
Object asm/main_0205EC98.o
Object src/main_0205ED84.o
@@ -383,7 +379,6 @@ Static main
Object src/main_02065974.o
Object asm/main_02065998.o
Object src/main_02065B3C.o
Object asm/main_02065BD8.o
Object src/main_02065C48.o
Object asm/main_02065C84.o
Object src/main_020663C8.o
@@ -798,7 +793,6 @@ Overlay OVY_29
Object src/poly_text.o
Object asm/overlay_29_022DC314.o
Object src/overlay_29_022DC61C.o
Object asm/overlay_29_022DC65C.o
Object src/overlay_29_022DC684.o
Object asm/overlay_29_022DC7E4.o
Object src/overlay_29_022DEAB0.o
@@ -810,7 +804,6 @@ Overlay OVY_29
Object src/overlay_29_022E0A04.o
Object asm/overlay_29_022E0A18.o
Object src/overlay_29_022E1610.o
Object asm/overlay_29_022E1618.o
Object src/dungeon_util_1.o
Object asm/overlay_29_022E1640.o
Object src/dg_object.o
@@ -1067,7 +1060,6 @@ Overlay OVY_29
Object src/overlay_29_02320764.o
Object asm/overlay_29_02320788.o
Object src/overlay_29_02321238.o
Object asm/overlay_29_0232124C.o
Object src/overlay_29_02321274.o
Object asm/overlay_29_02321288.o
Object src/overlay_29_02321438.o

View File

@@ -1,4 +1,11 @@
#include "main_0202B4C4.h"
#include "main_02032558.h"
extern s32 GetCurrentPage(struct unk_02032558 *p);
extern void *GetWindowContents(s32 window_id);
extern s32 GetSelectedItemOnPage(struct unk_02032558 *p);
#include "main_0202AAA8.h"
#include "main_02001188.h"
@@ -25,3 +32,13 @@ bool8 CheckSimpleMenuField0x1A0(s32 window_id)
return menu->field_0x1A0 == 0;
}
s32 sub_0202B530(s32 window_id)
{
return GetSelectedItemOnPage(GetWindowContents(window_id) + 4);
}
s32 sub_0202B544(s32 window_id)
{
return GetCurrentPage(GetWindowContents(window_id) + 4);
}

View File

@@ -1,5 +1,7 @@
#include "main_02042AF8.h"
extern struct unk_020AFED4 UNK_STORAGE_STRUCT_0XC;
void ClearBagSelectedItemTable(void)
{
s32 i;
@@ -8,3 +10,32 @@ void ClearBagSelectedItemTable(void)
UNK_STORAGE_STRUCT_0XC.field_0x8[i] = 0;
}
}
s32 sub_02042B20(void)
{
s32 n;
s32 i;
n = 0;
for (i = 0; i < 0x32; i++) {
if (UNK_STORAGE_STRUCT_0XC.field_0x8[i] & 1) {
n++;
}
}
return n;
}
s32 sub_02042B50(void)
{
s32 i;
for (i = 0; i < 0x32; i++) {
if (UNK_STORAGE_STRUCT_0XC.field_0x8[i] & 1) {
return i;
}
}
return -1;
}

View File

@@ -1,4 +1,7 @@
#include "main_02051760.h"
extern u8 _020A20B1[];
extern u8 ARM9_UNKNOWN_TABLE__NA_20A20B0[];
#include "enums.h"
#include "util.h"
@@ -14,3 +17,21 @@ bool32 JoinedAtRangeCheck2(u8 joined_at) {
return joined_at == DUNGEON_BEACH || (joined_at >= DUNGEON_DUMMY_0xEC && DUNGEON_DUMMY_0xF0 >= joined_at);
}
u8 sub_02051788(s32 i)
{
return _020A20B1[i * 2];
}
u8 sub_02051798(u8 v)
{
s32 i;
for (i = 0; i < 0x100; i++) {
if (v == ARM9_UNKNOWN_TABLE__NA_20A20B0[i * 2 + 1]) {
return ARM9_UNKNOWN_TABLE__NA_20A20B0[i * 2];
}
}
return 0xFF;
}

View File

@@ -9,3 +9,16 @@ void sub_0205EC18(u32 index)
{
ClearMissionData((struct mission*) (MISSION_DELIVER_LIST_PTR.unk18 + 0x300 + index * 32));
}
u8 * sub_0205EC38(s32 i)
{
u8 *p;
p = MISSION_DELIVER_LIST_PTR.unk18 + 0x320;
return &p[i * 0x20];
}
bool8 sub_0205EC50(s32 i)
{
return MISSION_DELIVER_LIST_PTR.unk18[i * 0x20 + 0x320] == 0;
}

View File

@@ -1,4 +1,10 @@
#include "enums.h"
extern void StrncpySimpleNoPadSafe(u8 *dest, const u8 *src, u32 n);
extern u8 _022B7310[];
extern void StrncpySimple(u8 *dest, const u8 *src, s32 n);
#include "main_02065B3C.h"
#include "script_variable.h"
@@ -57,3 +63,32 @@ void SetNewFriendActor(enum monster_id new_friend)
{
SPECIAL_ACTORS.new_friend = new_friend;
}
void sub_02065BD8(u8 *dst, s32 n)
{
StrncpySimple(dst, _022B7310, n);
}
void sub_02065BF0(u8 *dst)
{
StrncpySimpleNoPadSafe(dst, _022B7310, 10);
}
void sub_02065C08(u8 *src, s32 n)
{
u8 *dst;
s32 i;
dst = _022B7310;
i = 0;
while (i < n) {
*dst++ = *src++;
i++;
}
while (i < 0x10) {
*dst++ = 0;
i++;
}
}

View File

@@ -1,6 +1,10 @@
#include "overlay_29_022DC61C.h"
#include "main_0200330C.h"
extern void ov29_022DC2B8(u8 *p);
extern void ov29_022DC33C(u8 *p);
extern u8 ov29_023538B4[0x0001963C];
extern u8 *ov29_023534E0;
@@ -15,3 +19,13 @@ void ov29_022DC61C()
ov29_022DC240(ov29_023538B4);
ov29_022DC314(ov29_023538B4, ov29_023534E0);
}
void ov29_022DC65C(void)
{
ov29_022DC2B8(ov29_023538B4);
}
void ov29_022DC670(void)
{
ov29_022DC33C(ov29_023538B4);
}

View File

@@ -4,3 +4,13 @@ struct item* GetItemInfo(struct entity *item_entity)
{
return item_entity->info;
}
void * ov29_022E1618(struct entity *entity)
{
return entity->info;
}
void * ov29_022E1620(struct entity *entity)
{
return entity->info;
}

View File

@@ -6,3 +6,13 @@ void ov29_02321238(struct entity *entity)
{
ov29_0232119C(entity, 0, 1);
}
void ov29_0232124C(struct entity *entity)
{
ov29_0232119C(entity, 1, 1);
}
void ov29_02321260(struct entity *entity)
{
ov29_0232119C(entity, 0, 0);
}