mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-09 03:45:56 -05:00
Decomp twelve game-state and recycle-shop accessors
Decompile from asm: AddMoneyStored 0x02010758 SetEggSpecies 0x02010794 SetUnkGameState0x13a6 0x020107C4 SetEggHatchTimer 0x020107F4 DecrementEggHatchTimer 0x0201080C GetRecycleItemId 0x02011DF0 RecycleItemHasTradeTypePrizeTicket 0x02011DFC GetRecycleItemBonusOdds 0x02011E18 ClearRecycleShopOffer 0x02011F14 GetGameStateRecycleCount 0x02011F30 GetRankForRecycleShop 0x02011F48 GetRecycleOfferCooldown 0x0201227C Nine of these reach BAG_ITEMS_PTR_MIRROR. Five are the setters matching getters already landed; the other four use offsets past them, so struct bag_items gains four more fields, up to 0x13B4. As with the previous extension they are appended past the end, and the field at 0x13AC is left to align naturally rather than declaring a byte at 0x13AB that nothing reads. AddMoneyStored tail-calls SetMoneyStored, which is still asm; its prototype is provisional. DecrementEggHatchTimer only decrements a non-zero timer, which the target expresses with predicated subne/strneh rather than a branch. The remaining three take a pointer to a pointer to a small struct with fields at 0x0, 0x4 and 0x12. No existing type matches that layout, so it is introduced as struct unk_02011DF0, named for the lowest-addressed function that takes it, with placeholder fields. The bytes between 0x8 and 0x12 are unexamined and left as filler. Every one of the twelve matched on the first candidate. 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,2 +0,0 @@
|
||||
#pragma once
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
@@ -1,80 +1,26 @@
|
||||
#pragma once
|
||||
.public _0209889C
|
||||
.public _020988A4
|
||||
.public _020988A8
|
||||
.public _020988D0
|
||||
.public _020988D4
|
||||
.public _020988D8
|
||||
.public _02098CB4
|
||||
.public _02098CCC
|
||||
.public _02098D24
|
||||
.public _02098D48
|
||||
.public _02098D68
|
||||
.public _02098DE4
|
||||
.public _02098DF4
|
||||
.public _02098E04
|
||||
.public _02098E0C
|
||||
.public _02098E14
|
||||
.public _02098E58
|
||||
.public _02098E9C
|
||||
.public _020A1878
|
||||
.public _020AF6D0
|
||||
.public _020AF700
|
||||
.public _022A4BD8
|
||||
.public _s32_div_f
|
||||
.public ApplyExclusiveItemStatBoosts
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BitstreamDebug
|
||||
.public CALCIUM_STAT_BOOST
|
||||
.public ConvertStorageItemAtIdxToBulkItem
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public CountNbItemsOfTypeInBag
|
||||
.public CountNbItemsOfTypeInStorage
|
||||
.public CountNbOfItemsInStorage
|
||||
.public Debug_Print0
|
||||
.public DUNGEON_MOVE_TABLES
|
||||
.public CountValidRecycleShopItems
|
||||
.public EXCLUSIVE_ITEM_EFFECT_DATA
|
||||
.public ExclusiveItemEffectFlagTest
|
||||
.public FemaleToMaleForm
|
||||
.public GetBaseFormCastformDeoxysCherrim
|
||||
.public GINSENG_CHANCE_3
|
||||
.public GUMMI_STAT_BOOST
|
||||
.public GetCurrentBagCapacity
|
||||
.public GetDungeonResultString
|
||||
.public GetEquivBulkItemIdxInStorage
|
||||
.public GetExclusiveItem
|
||||
.public GetExclusiveItemOffset
|
||||
.public GetExclusiveItemParameter
|
||||
.public GetExclusiveItemType
|
||||
.public GetFamilyIndex
|
||||
.public GetFirstUnequippedItemOfType
|
||||
.public GetItemAtIdx
|
||||
.public GetItemCategory
|
||||
.public GetItemCategoryVeneer
|
||||
.public GetMaxPp
|
||||
.public GetMoveBasePowerGround
|
||||
.public GetMoveMaxGinsengBoostGround
|
||||
.public GetNbItemsInBag
|
||||
.public GetPartyMembers
|
||||
.public GetRank
|
||||
.public GetScenarioBalance
|
||||
.public GetTeamMember
|
||||
.public GetType
|
||||
.public GINSENG_CHANCE_3
|
||||
.public GUMMI_STAT_BOOST
|
||||
.public HasMonsterBeenAttackedInDungeons
|
||||
.public InitBitstreamForRead
|
||||
.public InitBitstreamForWrite
|
||||
.public InitBulkItem
|
||||
.public IQ_GUMMI_GAIN_TABLE
|
||||
.public IRON_STAT_BOOST
|
||||
.public Is2TurnsMove
|
||||
.public IsGummi
|
||||
.public IsMonsterValid
|
||||
.public IsTicketItem
|
||||
.public LIFE_SEED_HP_BOOST
|
||||
.public LoadFileFromRom
|
||||
.public LoadScriptVariableValue
|
||||
.public MaybeUpdateStorage
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public MemZero
|
||||
@@ -82,30 +28,16 @@
|
||||
.public ModifyHpStat
|
||||
.public ModifyIqStat
|
||||
.public ModifyOffensiveStat
|
||||
.public OpenWaza
|
||||
.public PROTEIN_STAT_BOOST
|
||||
.public Rand16Bit
|
||||
.public RandInt
|
||||
.public RandIntSafe
|
||||
.public RandRange
|
||||
.public RECYCLE_SHOP_ITEM_LIST
|
||||
.public RemoveEmptyItemsInBag
|
||||
.public RemoveItem
|
||||
.public RemoveItemAtIdxInStorage
|
||||
.public ReturnEggExclusiveItem
|
||||
.public SaveScriptVariableValue
|
||||
.public SelectWaza
|
||||
.public SetExclusiveItemEffect
|
||||
.public SetNbRecycled
|
||||
.public SITRUS_BERRY_FULL_HP_BOOST
|
||||
.public StringFromId
|
||||
.public sub_0200D1F0
|
||||
.public sub_02010044
|
||||
.public SYNTH_BIN_FILE_PTR
|
||||
.public TYPE_SPECIFIC_EXCLUSIVE_ITEMS
|
||||
.public UnloadFile
|
||||
.public vsprintf
|
||||
.public SaveScriptVariableValue
|
||||
.public SetExclusiveItemEffect
|
||||
.public WONDER_GUMMI_IQ_GAIN
|
||||
.public WONDER_GUMMI_STAT_BOOST
|
||||
.public ZINC_STAT_BOOST
|
||||
.public ZInit8
|
||||
.public _0209889C
|
||||
.public _020A1878
|
||||
.public sub_0200D1F0
|
||||
.public sub_0201297C
|
||||
|
||||
15
asm/include/main_02011F60.inc
Normal file
15
asm/include/main_02011F60.inc
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public CountValidRecycleShopItems
|
||||
.public FreeRecycleOfferItems
|
||||
.public GetRank
|
||||
.public GetScenarioBalance
|
||||
.public LoadScriptVariableValue
|
||||
.public RECYCLE_SHOP_ITEM_LIST
|
||||
.public Rand16Bit
|
||||
.public SaveScriptVariableValue
|
||||
.public SetNbRecycled
|
||||
.public _020988A4
|
||||
.public _020988A8
|
||||
.public _s32_div_f
|
||||
.public sub_02011B3C
|
||||
70
asm/include/main_02012294.inc
Normal file
70
asm/include/main_02012294.inc
Normal file
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
.public BAG_ITEMS_PTR_MIRROR
|
||||
.public BitstreamDebug
|
||||
.public ConvertStorageItemAtIdxToBulkItem
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public CountNbItemsOfTypeInBag
|
||||
.public CountNbItemsOfTypeInStorage
|
||||
.public CountNbOfItemsInStorage
|
||||
.public DUNGEON_MOVE_TABLES
|
||||
.public Debug_Print0
|
||||
.public FemaleToMaleForm
|
||||
.public GetBaseFormCastformDeoxysCherrim
|
||||
.public GetDungeonResultString
|
||||
.public GetEquivBulkItemIdxInStorage
|
||||
.public GetExclusiveItem
|
||||
.public GetFirstUnequippedItemOfType
|
||||
.public GetItemAtIdx
|
||||
.public GetItemCategoryVeneer
|
||||
.public GetMaxPp
|
||||
.public GetNbItemsInBag
|
||||
.public GetPartyMembers
|
||||
.public GetScenarioBalance
|
||||
.public GetTeamMember
|
||||
.public GetType
|
||||
.public HasMonsterBeenAttackedInDungeons
|
||||
.public InitBitstreamForRead
|
||||
.public InitBitstreamForWrite
|
||||
.public InitBulkItem
|
||||
.public Is2TurnsMove
|
||||
.public IsMonsterValid
|
||||
.public IsTicketItem
|
||||
.public LoadFileFromRom
|
||||
.public MaybeUpdateStorage
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public OpenWaza
|
||||
.public RECYCLE_SHOP_ITEM_LIST
|
||||
.public RandInt
|
||||
.public RandRange
|
||||
.public RemoveEmptyItemsInBag
|
||||
.public RemoveItem
|
||||
.public RemoveItemAtIdxInStorage
|
||||
.public ReturnEggExclusiveItem
|
||||
.public SYNTH_BIN_FILE_PTR
|
||||
.public SelectWaza
|
||||
.public StringFromId
|
||||
.public TYPE_SPECIFIC_EXCLUSIVE_ITEMS
|
||||
.public UnloadFile
|
||||
.public ZInit8
|
||||
.public _020988D0
|
||||
.public _020988D4
|
||||
.public _020988D8
|
||||
.public _02098CB4
|
||||
.public _02098CCC
|
||||
.public _02098D24
|
||||
.public _02098D48
|
||||
.public _02098D68
|
||||
.public _02098DE4
|
||||
.public _02098DF4
|
||||
.public _02098E04
|
||||
.public _02098E0C
|
||||
.public _02098E14
|
||||
.public _02098E58
|
||||
.public _02098E9C
|
||||
.public _020AF6D0
|
||||
.public _020AF700
|
||||
.public _022A4BD8
|
||||
.public sub_02010044
|
||||
.public vsprintf
|
||||
@@ -21,17 +21,3 @@ _0201073C:
|
||||
_02010750: .word 0x0098967F
|
||||
_02010754: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end SetMoneyStored
|
||||
|
||||
arm_func_start AddMoneyStored
|
||||
AddMoneyStored: ; 0x02010758
|
||||
ldr r1, _02010774 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr ip, _02010778 ; =SetMoneyStored
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1000
|
||||
ldr r1, [r1, #0x3a0]
|
||||
add r0, r1, r0
|
||||
bx ip
|
||||
.align 2, 0
|
||||
_02010774: .word BAG_ITEMS_PTR_MIRROR
|
||||
_02010778: .word SetMoneyStored
|
||||
arm_func_end AddMoneyStored
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02010794.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start SetEggSpecies
|
||||
SetEggSpecies: ; 0x02010794
|
||||
ldr r1, _020107A8 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1300
|
||||
strh r0, [r1, #0xa4]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_020107A8: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end SetEggSpecies
|
||||
@@ -1,15 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_020107C4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start SetUnkGameState0x13a6
|
||||
SetUnkGameState0x13a6: ; 0x020107C4
|
||||
ldr r1, _020107D8 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1300
|
||||
strh r0, [r1, #0xa6]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_020107D8: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end SetUnkGameState0x13a6
|
||||
@@ -1,33 +1,8 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_020107F4.inc"
|
||||
.include "main_02010830.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start SetEggHatchTimer
|
||||
SetEggHatchTimer: ; 0x020107F4
|
||||
ldr r1, _02010808 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1300
|
||||
strh r0, [r1, #0xa8]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02010808: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end SetEggHatchTimer
|
||||
|
||||
arm_func_start DecrementEggHatchTimer
|
||||
DecrementEggHatchTimer: ; 0x0201080C
|
||||
ldr r0, _0201082C ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
ldrh r1, [r0, #0xa8]
|
||||
cmp r1, #0
|
||||
subne r1, r1, #1
|
||||
strneh r1, [r0, #0xa8]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_0201082C: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end DecrementEggHatchTimer
|
||||
|
||||
arm_func_start RemoveInvalidKecleonShop1Items
|
||||
RemoveInvalidKecleonShop1Items: ; 0x02010830
|
||||
ldr r1, _02010868 ; =BAG_ITEMS_PTR_MIRROR
|
||||
@@ -212,7 +187,7 @@ _02010A58:
|
||||
cmp r4, #8
|
||||
blt _02010A58
|
||||
ldr r0, _02010AC0 ; =KECLEON_SHOP_ITEM_TABLE_LISTS_1
|
||||
ldr r5, _02010AC4 ; =0x0000270F
|
||||
ldr r5, _02010AC4
|
||||
ldr r6, [r0, r8, lsl #2]
|
||||
mov r7, #0
|
||||
_02010A7C:
|
||||
@@ -461,7 +436,7 @@ _02010D64:
|
||||
ldr r0, _02010DC4 ; =KECLEON_SHOP_ITEM_TABLE_LISTS_2
|
||||
mov r7, #0
|
||||
ldr r6, [r0, r5, lsl #2]
|
||||
ldr r5, _02010DC8 ; =0x0000270F
|
||||
ldr r5, _02010DC8
|
||||
_02010D88:
|
||||
mov r0, r5
|
||||
bl RandIntSafe
|
||||
2070
asm/main_02010FC4.s
2070
asm/main_02010FC4.s
File diff suppressed because it is too large
Load Diff
88
asm/main_02011E24.s
Normal file
88
asm/main_02011E24.s
Normal file
@@ -0,0 +1,88 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02011E24.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start CountTradedRecycleItems
|
||||
CountTradedRecycleItems: ; 0x02011E24
|
||||
mov ip, #0
|
||||
mov r3, ip
|
||||
b _02011E58
|
||||
_02011E30:
|
||||
ldr r2, [r0]
|
||||
mov r1, r3, lsl #2
|
||||
add r2, r2, #0x14
|
||||
ldrsh r1, [r2, r1]
|
||||
add r2, r2, r3, lsl #2
|
||||
cmp r1, #0
|
||||
beq _02011E60
|
||||
ldrsh r1, [r2, #2]
|
||||
add r3, r3, #1
|
||||
add ip, ip, r1
|
||||
_02011E58:
|
||||
cmp r3, #4
|
||||
blt _02011E30
|
||||
_02011E60:
|
||||
mov r0, ip
|
||||
bx lr
|
||||
arm_func_end CountTradedRecycleItems
|
||||
|
||||
arm_func_start sub_02011E68
|
||||
sub_02011E68: ; 0x02011E68
|
||||
stmdb sp!, {r3, lr}
|
||||
mov lr, #0
|
||||
b _02011EB4
|
||||
_02011E74:
|
||||
ldr r2, [r0]
|
||||
mov r1, lr, lsl #2
|
||||
add r2, r2, #0x14
|
||||
ldrsh r1, [r2, r1]
|
||||
add ip, r2, lr, lsl #2
|
||||
cmp r1, #0
|
||||
beq _02011EBC
|
||||
add r1, r0, lr, lsl #1
|
||||
ldrsh r3, [r1, #4]
|
||||
ldrsh r2, [r1, #0xc]
|
||||
ldrsh r1, [ip, #2]
|
||||
add r2, r3, r2
|
||||
cmp r2, r1
|
||||
movlt r0, #0
|
||||
ldmltia sp!, {r3, pc}
|
||||
add lr, lr, #1
|
||||
_02011EB4:
|
||||
cmp lr, #4
|
||||
blt _02011E74
|
||||
_02011EBC:
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, pc}
|
||||
arm_func_end sub_02011E68
|
||||
|
||||
arm_func_start RecycleShopTradeIsNonspecific
|
||||
RecycleShopTradeIsNonspecific: ; 0x02011EC4
|
||||
ldr r1, [r0]
|
||||
ldr r0, _02011EE4 ; =0x00000578
|
||||
ldrsh r1, [r1, #0x14]
|
||||
cmp r1, r0
|
||||
moveq r0, #1
|
||||
movne r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02011EE4: .word 0x00000578
|
||||
arm_func_end RecycleShopTradeIsNonspecific
|
||||
|
||||
arm_func_start RecycleShopOfferExists
|
||||
RecycleShopOfferExists: ; 0x02011EE8
|
||||
ldr r0, _02011F10 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mvn r1, #0
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
ldrsh r0, [r0, #0xb2]
|
||||
cmp r0, r1
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02011F10: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end RecycleShopOfferExists
|
||||
233
asm/main_02011F60.s
Normal file
233
asm/main_02011F60.s
Normal file
@@ -0,0 +1,233 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02011F60.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start IncrementRecycleCountVar
|
||||
IncrementRecycleCountVar: ; 0x02011F60
|
||||
stmdb sp!, {r4, lr}
|
||||
mov r0, #0
|
||||
mov r1, #0x6c
|
||||
bl LoadScriptVariableValue
|
||||
add r4, r0, #1
|
||||
ldr r1, _02011F9C ; =0x000F423F
|
||||
mov r0, #0
|
||||
cmp r4, r1
|
||||
movgt r4, r1
|
||||
mov r2, r4
|
||||
mov r1, #0x6c
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, r4
|
||||
bl SetNbRecycled
|
||||
ldmia sp!, {r4, pc}
|
||||
.align 2, 0
|
||||
_02011F9C: .word 0x000F423F
|
||||
arm_func_end IncrementRecycleCountVar
|
||||
|
||||
arm_func_start UpdateRecycleShop
|
||||
UpdateRecycleShop: ; 0x02011FA0
|
||||
stmdb sp!, {r3, r4, r5, r6, lr}
|
||||
sub sp, sp, #4
|
||||
mov r0, #0
|
||||
mov r1, #0x71
|
||||
bl LoadScriptVariableValue
|
||||
and r0, r0, #0xff
|
||||
cmp r0, #1
|
||||
bne _0201207C
|
||||
ldr r1, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r0, #3
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1000
|
||||
ldrb r6, [r1, #0x3aa]
|
||||
ldr r5, [r1, #0x3ac]
|
||||
mov r1, r6
|
||||
mov r2, r5
|
||||
bl CountValidRecycleShopItems
|
||||
mov r4, r0
|
||||
mov r1, r6
|
||||
mov r2, r5
|
||||
mov r0, #2
|
||||
bl CountValidRecycleShopItems
|
||||
sub r4, r4, r0
|
||||
mov r0, #0
|
||||
mov r1, #0x6c
|
||||
bl LoadScriptVariableValue
|
||||
ldr r1, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, [r1]
|
||||
add r1, r1, #0x1000
|
||||
str r0, [r1, #0x3ac]
|
||||
bl GetRank
|
||||
ldr r2, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, [r2]
|
||||
add r1, r1, #0x1000
|
||||
strb r0, [r1, #0x3aa]
|
||||
ldr r1, [r2]
|
||||
mov r0, #3
|
||||
add r1, r1, #0x1000
|
||||
ldr r5, [r1, #0x3ac]
|
||||
ldrb r6, [r1, #0x3aa]
|
||||
mov r2, r5
|
||||
mov r1, r6
|
||||
bl CountValidRecycleShopItems
|
||||
mov r1, r6
|
||||
mov r2, r5
|
||||
mov r5, r0
|
||||
mov r0, #2
|
||||
bl CountValidRecycleShopItems
|
||||
sub r0, r5, r0
|
||||
cmp r0, r4
|
||||
ble _0201207C
|
||||
mov r0, #0
|
||||
mov r1, #0x6a
|
||||
mov r2, #1
|
||||
bl SaveScriptVariableValue
|
||||
_0201207C:
|
||||
mov r0, #0
|
||||
mov r1, #0x6b
|
||||
bl LoadScriptVariableValue
|
||||
tst r0, #0xff
|
||||
bne _02012104
|
||||
mov r0, #0
|
||||
mov r1, #0x6d
|
||||
bl LoadScriptVariableValue
|
||||
mov r4, r0
|
||||
cmp r4, #5
|
||||
bge _02012104
|
||||
ldr r0, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r1, _02012218 ; =_020988A4
|
||||
ldr r0, [r0]
|
||||
ldr r1, [r1, r4, lsl #3]
|
||||
add r0, r0, #0x1000
|
||||
ldr r0, [r0, #0x3ac]
|
||||
cmp r0, r1
|
||||
blt _02012104
|
||||
bl GetScenarioBalance
|
||||
ldr r1, _0201221C ; =_020988A8
|
||||
mov r2, r4, lsl #3
|
||||
ldrsh r1, [r1, r2]
|
||||
and r1, r1, #0xff
|
||||
cmp r0, r1
|
||||
blo _02012104
|
||||
add r2, r4, #1
|
||||
mov r0, #0
|
||||
mov r1, #0x6d
|
||||
bl SaveScriptVariableValue
|
||||
mov r0, #0
|
||||
mov r1, #0x6b
|
||||
mov r2, #1
|
||||
bl SaveScriptVariableValue
|
||||
_02012104:
|
||||
ldr r0, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mvn r1, #0
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
ldrsh r0, [r0, #0xb2]
|
||||
cmp r0, r1
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
tst r0, #0xff
|
||||
beq _0201213C
|
||||
bl IsRecycleOfferCooldownOver
|
||||
cmp r0, #0
|
||||
moveq r2, #0
|
||||
beq _02012200
|
||||
_0201213C:
|
||||
ldr r1, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r0, #2
|
||||
ldr r1, [r1]
|
||||
add r2, r1, #0x1000
|
||||
ldrb r1, [r2, #0x3aa]
|
||||
ldr r2, [r2, #0x3ac]
|
||||
bl sub_02011B3C
|
||||
mov r4, r0
|
||||
str r4, [sp]
|
||||
ldr r0, [r4, #4]
|
||||
cmp r0, #0
|
||||
bne _02012184
|
||||
ldr r0, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mvn r1, #0
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
strh r1, [r0, #0xb2]
|
||||
b _020121E0
|
||||
_02012184:
|
||||
bl Rand16Bit
|
||||
ldr r1, [r4, #4]
|
||||
bl _s32_div_f
|
||||
mov r0, #0x18
|
||||
mul r0, r1, r0
|
||||
ldr r1, [r4]
|
||||
ldr r2, _02012220 ; =RECYCLE_SHOP_ITEM_LIST
|
||||
ldr r1, [r1, r0]
|
||||
mov r3, #0
|
||||
b _020121C4
|
||||
_020121AC:
|
||||
cmp r2, r1
|
||||
beq _020121D0
|
||||
add r0, r3, #1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r3, r0, asr #0x10
|
||||
add r2, r2, #0x24
|
||||
_020121C4:
|
||||
cmp r3, #0x18
|
||||
blt _020121AC
|
||||
mvn r3, #0
|
||||
_020121D0:
|
||||
ldr r0, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
strh r3, [r0, #0xb2]
|
||||
_020121E0:
|
||||
add r0, sp, #0
|
||||
bl FreeRecycleOfferItems
|
||||
ldr r0, _02012214 ; =BAG_ITEMS_PTR_MIRROR
|
||||
mov r1, #2
|
||||
ldr r0, [r0]
|
||||
mov r2, #1
|
||||
add r0, r0, #0x1300
|
||||
strh r1, [r0, #0xb0]
|
||||
_02012200:
|
||||
cmp r2, #0
|
||||
bne _0201220C
|
||||
bl DecrementRecycleOfferCooldown
|
||||
_0201220C:
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r3, r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_02012214: .word BAG_ITEMS_PTR_MIRROR
|
||||
_02012218: .word _020988A4
|
||||
_0201221C: .word _020988A8
|
||||
_02012220: .word RECYCLE_SHOP_ITEM_LIST
|
||||
arm_func_end UpdateRecycleShop
|
||||
|
||||
arm_func_start DecrementRecycleOfferCooldown
|
||||
DecrementRecycleOfferCooldown: ; 0x02012224
|
||||
stmdb sp!, {r3, lr}
|
||||
bl IsRecycleOfferCooldownOver
|
||||
cmp r0, #0
|
||||
ldmneia sp!, {r3, pc}
|
||||
ldr r0, _02012250 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
ldrsh r1, [r0, #0xb0]
|
||||
sub r1, r1, #1
|
||||
strh r1, [r0, #0xb0]
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_02012250: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end DecrementRecycleOfferCooldown
|
||||
|
||||
arm_func_start IsRecycleOfferCooldownOver
|
||||
IsRecycleOfferCooldownOver: ; 0x02012254
|
||||
ldr r0, _02012278 ; =BAG_ITEMS_PTR_MIRROR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x1300
|
||||
ldrsh r0, [r0, #0xb0]
|
||||
cmp r0, #0
|
||||
moveq r0, #1
|
||||
movne r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02012278: .word BAG_ITEMS_PTR_MIRROR
|
||||
arm_func_end IsRecycleOfferCooldownOver
|
||||
1691
asm/main_02012294.s
Normal file
1691
asm/main_02012294.s
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1660,6 +1660,10 @@ struct bag_items {
|
||||
s16 field_0x13A4;
|
||||
u16 field_0x13A6;
|
||||
u16 field_0x13A8;
|
||||
u8 field_0x13AA;
|
||||
u32 field_0x13AC;
|
||||
s16 field_0x13B0;
|
||||
s16 field_0x13B2;
|
||||
};
|
||||
|
||||
struct bulk_item
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef PMDSKY_MAIN_0201077C_H
|
||||
#define PMDSKY_MAIN_0201077C_H
|
||||
|
||||
void AddMoneyStored(s32 amount);
|
||||
s16 GetEggSpecies(void);
|
||||
void SetEggSpecies(s16 species);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#define PMDSKY_MAIN_020107AC_H
|
||||
|
||||
u16 GetUnkGameState0x13a6(void);
|
||||
void SetUnkGameState0x13a6(u16 value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
#define PMDSKY_MAIN_020107DC_H
|
||||
|
||||
u16 GetEggHatchTimer(void);
|
||||
void SetEggHatchTimer(u16 timer);
|
||||
void DecrementEggHatchTimer(void);
|
||||
|
||||
#endif
|
||||
|
||||
18
include/main_02011DF0.h
Normal file
18
include/main_02011DF0.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef PMDSKY_MAIN_02011DF0_H
|
||||
#define PMDSKY_MAIN_02011DF0_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
struct unk_02011DF0 {
|
||||
s16 field_0x0;
|
||||
s32 field_0x4;
|
||||
u8 field_0x8[0xA];
|
||||
u16 field_0x12;
|
||||
};
|
||||
|
||||
|
||||
s16 GetRecycleItemId(struct unk_02011DF0** p);
|
||||
bool8 RecycleItemHasTradeTypePrizeTicket(struct unk_02011DF0** p);
|
||||
u16 GetRecycleItemBonusOdds(struct unk_02011DF0** p);
|
||||
|
||||
#endif
|
||||
8
include/main_02011F14.h
Normal file
8
include/main_02011F14.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef PMDSKY_MAIN_02011F14_H
|
||||
#define PMDSKY_MAIN_02011F14_H
|
||||
|
||||
void ClearRecycleShopOffer(void);
|
||||
u32 GetGameStateRecycleCount(void);
|
||||
u8 GetRankForRecycleShop(void);
|
||||
|
||||
#endif
|
||||
6
include/main_0201227C.h
Normal file
6
include/main_0201227C.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef PMDSKY_MAIN_0201227C_H
|
||||
#define PMDSKY_MAIN_0201227C_H
|
||||
|
||||
s16 GetRecycleOfferCooldown(void);
|
||||
|
||||
#endif
|
||||
10
main.lsf
10
main.lsf
@@ -85,13 +85,17 @@ Static main
|
||||
Object src/main_0201070C.o
|
||||
Object asm/main_02010724.o
|
||||
Object src/main_0201077C.o
|
||||
Object asm/main_02010794.o
|
||||
Object src/main_020107AC.o
|
||||
Object asm/main_020107C4.o
|
||||
Object src/main_020107DC.o
|
||||
Object asm/main_020107F4.o
|
||||
Object asm/main_02010830.o
|
||||
Object src/exclusive_item.o
|
||||
Object asm/main_02010FC4.o
|
||||
Object src/main_02011DF0.o
|
||||
Object asm/main_02011E24.o
|
||||
Object src/main_02011F14.o
|
||||
Object asm/main_02011F60.o
|
||||
Object src/main_0201227C.o
|
||||
Object asm/main_02012294.o
|
||||
Object src/moves_1.o
|
||||
Object src/moves_2.o
|
||||
Object asm/main_02013884.o
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
#include "main_0201077C.h"
|
||||
#include "item.h"
|
||||
|
||||
void SetMoneyStored(s32 money);
|
||||
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
|
||||
|
||||
void AddMoneyStored(s32 amount)
|
||||
{
|
||||
SetMoneyStored(BAG_ITEMS_PTR_MIRROR->field_0x13A0 + amount);
|
||||
}
|
||||
|
||||
|
||||
s16 GetEggSpecies(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13A4;
|
||||
}
|
||||
|
||||
void SetEggSpecies(s16 species)
|
||||
{
|
||||
BAG_ITEMS_PTR_MIRROR->field_0x13A4 = species;
|
||||
}
|
||||
|
||||
@@ -7,3 +7,8 @@ u16 GetUnkGameState0x13a6(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13A6;
|
||||
}
|
||||
|
||||
void SetUnkGameState0x13a6(u16 value)
|
||||
{
|
||||
BAG_ITEMS_PTR_MIRROR->field_0x13A6 = value;
|
||||
}
|
||||
|
||||
@@ -7,3 +7,15 @@ u16 GetEggHatchTimer(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13A8;
|
||||
}
|
||||
|
||||
void SetEggHatchTimer(u16 timer)
|
||||
{
|
||||
BAG_ITEMS_PTR_MIRROR->field_0x13A8 = timer;
|
||||
}
|
||||
|
||||
void DecrementEggHatchTimer(void)
|
||||
{
|
||||
if (BAG_ITEMS_PTR_MIRROR->field_0x13A8 != 0) {
|
||||
BAG_ITEMS_PTR_MIRROR->field_0x13A8--;
|
||||
}
|
||||
}
|
||||
|
||||
16
src/main_02011DF0.c
Normal file
16
src/main_02011DF0.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "main_02011DF0.h"
|
||||
|
||||
s16 GetRecycleItemId(struct unk_02011DF0** p)
|
||||
{
|
||||
return (*p)->field_0x0;
|
||||
}
|
||||
|
||||
bool8 RecycleItemHasTradeTypePrizeTicket(struct unk_02011DF0** p)
|
||||
{
|
||||
return (*p)->field_0x4 == 1;
|
||||
}
|
||||
|
||||
u16 GetRecycleItemBonusOdds(struct unk_02011DF0** p)
|
||||
{
|
||||
return (*p)->field_0x12;
|
||||
}
|
||||
19
src/main_02011F14.c
Normal file
19
src/main_02011F14.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "main_02011F14.h"
|
||||
#include "item.h"
|
||||
|
||||
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
|
||||
|
||||
void ClearRecycleShopOffer(void)
|
||||
{
|
||||
BAG_ITEMS_PTR_MIRROR->field_0x13B2 = -1;
|
||||
}
|
||||
|
||||
u32 GetGameStateRecycleCount(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13AC;
|
||||
}
|
||||
|
||||
u8 GetRankForRecycleShop(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13AA;
|
||||
}
|
||||
9
src/main_0201227C.c
Normal file
9
src/main_0201227C.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "main_0201227C.h"
|
||||
#include "item.h"
|
||||
|
||||
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
|
||||
|
||||
s16 GetRecycleOfferCooldown(void)
|
||||
{
|
||||
return BAG_ITEMS_PTR_MIRROR->field_0x13B0;
|
||||
}
|
||||
Reference in New Issue
Block a user