mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-30 22:27:51 -05:00
Decomp two bag helpers that forward to asm callees
Decompile from asm: RemoveFirstUnequippedItemOfType 0x0200F798 AddItemToBagNoHeld 0x0200F874 Both are thin forwarders. AddItemToBagNoHeld tail-calls AddItemToBag with a zero second argument, which the target reaches with bx rather than bl. RemoveFirstUnequippedItemOfType feeds GetFirstUnequippedItemOfType's result straight into RemoveItemNoHoleCheck. All three callees are still asm and had no declaration anywhere in the tree, so their prototypes are provisional and declared in the new headers with the loosest types that compile. They should collapse into the callees' own headers when those land. The return types are not determined by these functions' bytes. Both forward whatever the callee returns without touching it, so declaring them void scores 0 as well. They are written as returning u32 because that is what a pass-through of a word-sized result reads as, but a reviewer should treat the return type as a guess rather than something the target settles. 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>
This commit is contained in:
@@ -1,21 +1,9 @@
|
||||
#pragma once
|
||||
.public AddMoneyCarried
|
||||
.public AreItemsEquivalent
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BulkItemToItem
|
||||
.public GetCurrentBagCapacity
|
||||
.public GetItemCategoryVeneer
|
||||
.public GetMoneyQuantity
|
||||
.public GetRankStorageSize
|
||||
.public IsItemInTimeDarkness
|
||||
.public IsItemValidVeneer
|
||||
.public IsStorableItem
|
||||
.public IsThrownItem
|
||||
.public IsTreasureBox
|
||||
.public ItemZInit
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public RemoveEmptyItems
|
||||
.public SetItemAcquired
|
||||
.public SortItemList
|
||||
.public sub_020582E0
|
||||
|
||||
7
asm/include/main_0200F7A8.inc
Normal file
7
asm/include/main_0200F7A8.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
.public AddItemToBag
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BulkItemToItem
|
||||
.public ItemZInit
|
||||
.public RemoveEmptyItems
|
||||
.public sub_020582E0
|
||||
18
asm/include/main_0200F884.inc
Normal file
18
asm/include/main_0200F884.inc
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
.public AddMoneyCarried
|
||||
.public AreItemsEquivalent
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BulkItemToItem
|
||||
.public GetCurrentBagCapacity
|
||||
.public GetMoneyQuantity
|
||||
.public GetRankStorageSize
|
||||
.public IsItemInTimeDarkness
|
||||
.public IsItemValidVeneer
|
||||
.public IsThrownItem
|
||||
.public IsTreasureBox
|
||||
.public ItemZInit
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public RemoveEmptyItems
|
||||
.public SetItemAcquired
|
||||
.public SortItemList
|
||||
1268
asm/main_0200EDFC.s
1268
asm/main_0200EDFC.s
File diff suppressed because it is too large
Load Diff
73
asm/main_0200F7A8.s
Normal file
73
asm/main_0200F7A8.s
Normal file
@@ -0,0 +1,73 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_0200F7A8.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start RemoveAllItems
|
||||
RemoveAllItems: ; 0x0200F7A8
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
ldr r0, _0200F7D8 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r5, #0
|
||||
ldr r0, [r0]
|
||||
ldr r4, [r0, #0x384]
|
||||
_0200F7BC:
|
||||
mov r0, r4
|
||||
bl ItemZInit
|
||||
add r5, r5, #1
|
||||
cmp r5, #0x32
|
||||
add r4, r4, #6
|
||||
blt _0200F7BC
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
.align 2, 0
|
||||
_0200F7D8: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end RemoveAllItems
|
||||
|
||||
arm_func_start RemoveAllItemsStartingAt
|
||||
RemoveAllItemsStartingAt: ; 0x0200F7DC
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
ldr r6, _0200F848 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r4, r0
|
||||
ldr r1, [r6]
|
||||
mov r0, #6
|
||||
ldr r1, [r1, #0x384]
|
||||
mov r5, r0
|
||||
mla r7, r4, r0, r1
|
||||
b _0200F828
|
||||
_0200F800:
|
||||
ldrb r0, [r7, #1]
|
||||
cmp r0, #0
|
||||
beq _0200F810
|
||||
bl sub_020582E0
|
||||
_0200F810:
|
||||
ldr r0, [r6]
|
||||
ldr r0, [r0, #0x384]
|
||||
mla r0, r4, r5, r0
|
||||
bl ItemZInit
|
||||
add r4, r4, #1
|
||||
add r7, r7, #6
|
||||
_0200F828:
|
||||
cmp r4, #0x32
|
||||
blt _0200F800
|
||||
ldr r0, _0200F848 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r1, #0x32
|
||||
ldr r0, [r0]
|
||||
ldr r0, [r0, #0x384]
|
||||
bl RemoveEmptyItems
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_0200F848: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end RemoveAllItemsStartingAt
|
||||
|
||||
arm_func_start SpecialProcAddItemToBag
|
||||
SpecialProcAddItemToBag: ; 0x0200F84C
|
||||
stmdb sp!, {r3, lr}
|
||||
sub sp, sp, #8
|
||||
mov r1, r0
|
||||
add r0, sp, #0
|
||||
bl BulkItemToItem
|
||||
add r0, sp, #0
|
||||
mov r1, #0
|
||||
bl AddItemToBag
|
||||
add sp, sp, #8
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end SpecialProcAddItemToBag
|
||||
1186
asm/main_0200F884.s
Normal file
1186
asm/main_0200F884.s
Normal file
File diff suppressed because it is too large
Load Diff
11
include/main_0200F798.h
Normal file
11
include/main_0200F798.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef PMDSKY_MAIN_0200F798_H
|
||||
#define PMDSKY_MAIN_0200F798_H
|
||||
|
||||
#include "item.h"
|
||||
|
||||
struct item *GetFirstUnequippedItemOfType(s16 type);
|
||||
u32 RemoveItemNoHoleCheck(struct item *item);
|
||||
|
||||
u32 RemoveFirstUnequippedItemOfType(s16 type);
|
||||
|
||||
#endif
|
||||
10
include/main_0200F874.h
Normal file
10
include/main_0200F874.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef PMDSKY_MAIN_0200F874_H
|
||||
#define PMDSKY_MAIN_0200F874_H
|
||||
|
||||
#include "item.h"
|
||||
|
||||
u32 AddItemToBag(struct item *item, u32 flag);
|
||||
|
||||
u32 AddItemToBagNoHeld(struct item *item);
|
||||
|
||||
#endif
|
||||
4
main.lsf
4
main.lsf
@@ -71,6 +71,10 @@ Static main
|
||||
Object src/main_0200ECFC.o
|
||||
Object src/main_0200EDC0.o
|
||||
Object asm/main_0200EDFC.o
|
||||
Object src/main_0200F798.o
|
||||
Object asm/main_0200F7A8.o
|
||||
Object src/main_0200F874.o
|
||||
Object asm/main_0200F884.o
|
||||
Object src/main_0201070C.o
|
||||
Object asm/main_02010724.o
|
||||
Object src/main_0201077C.o
|
||||
|
||||
6
src/main_0200F798.c
Normal file
6
src/main_0200F798.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "main_0200F798.h"
|
||||
|
||||
u32 RemoveFirstUnequippedItemOfType(s16 type)
|
||||
{
|
||||
return RemoveItemNoHoleCheck(GetFirstUnequippedItemOfType(type));
|
||||
}
|
||||
6
src/main_0200F874.c
Normal file
6
src/main_0200F874.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "main_0200F874.h"
|
||||
|
||||
u32 AddItemToBagNoHeld(struct item *item)
|
||||
{
|
||||
return AddItemToBag(item, 0);
|
||||
}
|
||||
Reference in New Issue
Block a user