finish unk_02018424.c

This commit is contained in:
PikalaxALT 2024-10-19 22:33:58 -04:00
parent 3972bb6026
commit 7fbde01287
No known key found for this signature in database
GPG Key ID: 7774E96AA69E5B61
10 changed files with 211 additions and 1046 deletions

View File

@ -1,19 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public SysTask_CreateOnMainQueue
.public SysTask_Destroy
.public AllocFromHeap
.public FreeToHeap
.public SysTaskQueue_GetArenaSize
.public SysTaskQueue_PlacementNew
.public SysTaskQueue_RunTasks
.public SysTaskQueue_InsertTask
.public GF_AssertFail
.public sub_0203DF8C
.public MIi_CpuClear32
.public Field3dObjectTaskManager_Create
.public Field3dObjectTaskManager_Delete
.public Field3dObjectTaskManager_RunDrawTasks
.public Field3dObjectTaskManager_CreateTask
.public Field3dObjectTask_Delete
.public Field3dObjectTask_GetData

View File

@ -1,76 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public PaletteData_BlendPalette
.public NARC_New
.public NARC_Delete
.public NewString_ReadMsgData
.public BufferBoxMonNickname
.public BufferIntegerAsString
.public StringExpandPlaceholders
.public sub_0200CEB0
.public SpriteRenderer_LoadCharResObjFromOpenNarc
.public sub_0200D68C
.public SpriteRenderer_LoadCellResObjFromOpenNarc
.public SpriteRenderer_LoadAnimResObjFromOpenNarc
.public SpriteRenderer_LoadResourcesAndCreateSprite
.public GfGfxHandler_GetPlttNumById
.public SpriteGfxHandler_UnloadCharObjById
.public SpriteGfxHandler_UnloadCellObjById
.public SpriteGfxHandler_UnloadAnimObjById
.public UnkImageStruct_Delete
.public TickSpriteAnimation1Frame
.public UnkImageStruct_SetSpriteVisibleFlag
.public UnkImageStruct_SetSpritePalIndex
.public UnkImageStruct_SetSpritePriority
.public Sprite_SetPositionXY
.public UnkImageStruct_SetSpritePositionXY
.public UnkImageStruct_GetSpritePositionXY
.public SysTask_CreateOnMainQueue
.public SysTask_Destroy
.public AllocFromHeap
.public FreeToHeap
.public AddTextWindowTopLeftCorner
.public RemoveWindow
.public GF_SinDegNoWrap
.public AddTextPrinterParameterizedWithColorAndSpacing
.public Sprite_SetAnimActiveFlag
.public Sprite_SetAnimCtrlCurrentFrame
.public Sprite_GetImageProxy
.public GF_AssertFail
.public String_New
.public String_Delete
.public Mon_GetBoxMon
.public HpBar_GetColorIdx
.public MIi_CpuCopy16
.public MI_CpuFill8
.public abs
.public _ll_mul
.public _s32_div_f
.public _u32_div_f
.public BattleSystem_GetBgConfig
.public BattleSystem_GetBattleType
.public BattleSystem_GetPartyMon
.public BattleSystem_GetSpriteRenderer
.public BattleSystem_GetGfxHandler
.public BattleSystem_GetHpNumPrinter
.public BattleSystem_GetLevelNumPrinter
.public BattleSystem_GetMessageData
.public BattleSystem_GetPaletteData
.public BattleSystem_GetMessageFormat
.public ov12_0226498C
.public BattleHpBar_LoadResources
.public BattleHpBar_FreeResources
.public ov12_02264C84
.public ov12_02264DCC
.public ov12_02264E00
.public ov12_02264E34
.public ov12_02264E68
.public ov12_02264E84
.public ov12_02264EB4
.public ov12_02264EE0
.public BattleHpBar_SetEnabled
.public ov12_02264FB0
.public BattleHpBar_Util_GetBarTypeFromBattlerSide
.public BattleHpBar_BeginExpBarFullFlashEffect
.public ov12_02265D70
.public ov12_02265D74

View File

@ -1,9 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public ConvertUIntToDecimalString
.public sub_0200CDAC
.public PrintUIntOnWindow
.public sub_0200CE7C
.public sub_0200CEB0
.public MIi_CpuCopy32
.public MI_CpuFill8

View File

@ -1,43 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public FontID_String_GetWidth
.public PaletteData_LoadPalette
.public PlaySE
.public GfGfxLoader_LoadFromNarc
.public SysTask_CreateOnVWaitQueue
.public SysTask_Destroy
.public MenuInputStateMgr_GetState
.public MenuInputStateMgr_SetState
.public sub_02018424
.public sub_02018474
.public sub_020185FC
.public sub_02018620
.public sub_02018648
.public sub_02018674
.public sub_02018680
.public sub_02018694
.public sub_020186A4
.public AllocFromHeap
.public AllocFromHeapAtEnd
.public FreeToHeap
.public BG_LoadCharTilesData
.public FillBgTilemapRect
.public AllocWindows
.public AddWindowParameterized
.public WindowArray_Delete
.public ScheduleWindowCopyToVram
.public ClearWindowTilemapAndScheduleTransfer
.public FillWindowPixelBuffer
.public ScheduleBgTilemapBufferTransfer
.public AddTextPrinterParameterizedWithColor
.public TouchscreenHitbox_FindRectAtTouchNew
.public GF_AssertFail
.public NNS_G2dGetUnpackedBGCharacterData
.public NNS_G2dGetUnpackedPaletteData
.public GX_LoadBGPltt
.public GXS_LoadBGPltt
.public DC_FlushRange
.public MI_CpuFill8
.public MI_CpuCopy8
.public _s32_div_f
.public gSystem

View File

@ -1,25 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public AllocFromHeap
.public FreeToHeap
.public GF_CreateNewVramTransferTask
.public ObjPlttTransfer_Init
.public ObjPlttTransfer_SetReservedRegion
.public ObjPlttTransfer_Destroy
.public ObjPlttTransfer_Reset
.public ObjPlttTransfer_CreateTaskAndDoTransferFromTemplate_HandleExtPltt
.public ObjPlttTransfer_CreateTaskAndDoTransferFromTemplate_ExtPlttBanned
.public ObjPlttTransfer_CreateTransferTask
.public ObjPlttTransfer_FreeTaskByID
.public ObjPlttTransfer_GetPlttProxyByID
.public ObjPlttTransfer_GetPlttProxyByID_UpdateRefProxyExtFlag
.public ObjPlttTransfer_GetPaletteVramOffset
.public GF_AssertFail
.public NNS_G2dInitImagePaletteProxy
.public NNS_G2dGetImagePaletteLocation
.public NNS_G2dLoadPalette
.public GX_GetBankForOBJExtPltt
.public GX_GetBankForSubOBJExtPltt
.public MIi_CpuClear32
.public memset
.public _u32_div_f

View File

@ -1,20 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public Math_CalcArraySum
.public _MonEncryptSegment
.public _MonDecryptSegment
.public GF_AssertFail
.public SaveArray_Get
.public Pokedex_CheckMonCaughtFlag
.public GameStats_sizeof
.public GameStats_Init
.public Save_GameStats_Get
.public GameStats_SetCapped
.public GameStats_UpdateBounded
.public GameStats_Inc
.public GameStats_Add
.public GameStats_GetCapped
.public GameStats_AddScore
.public GameStats_GetScore
.public GameStats_IncSpeciesCaught
.public MIi_CpuClear32

View File

@ -1,848 +0,0 @@
.include "asm/macros.inc"
.include "unk_020183F0.inc"
.include "global.inc"
.text
.extern sub_02018498
thumb_func_start sub_020189AC
sub_020189AC: ; 0x020189AC
push {r3, r4, r5, r6, r7, lr}
sub sp, #0x18
add r5, r0, #0
ldrb r0, [r5, #0x18]
ldrh r4, [r5, #0xc]
sub r0, r0, #1
str r0, [sp, #0x10]
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
cmp r0, #0
bne _020189C6
add r4, #0xc
_020189C6:
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r3, r5, #0
lsl r2, r4, #0x10
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
add r3, #0x28
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r1, [r5, #6]
ldrb r3, [r3]
ldr r0, [r5, #0x14]
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r3, r5, #0
add r2, r4, #1
str r0, [sp]
add r0, r5, #0
add r0, #0x26
ldrb r0, [r0]
add r3, #0x28
lsl r2, r2, #0x10
str r0, [sp, #4]
mov r0, #1
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r3, #1
lsl r3, r3, #0x18
lsr r3, r3, #0x18
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r3, r5, #0
add r2, r4, #2
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsl r2, r2, #0x10
add r3, #0x28
str r0, [sp, #0xc]
ldrb r4, [r3]
add r3, r5, #0
add r3, #0x26
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r4, r3
add r3, r3, #1
lsl r3, r3, #0x18
lsr r2, r2, #0x10
lsr r3, r3, #0x18
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x24
ldrh r4, [r5, #0xc]
ldrb r1, [r0]
ldr r0, [sp, #0x10]
add r4, #9
cmp r1, r0
bne _02018A62
add r4, #0xc
_02018A62:
add r0, r5, #0
add r0, #0x29
ldrb r1, [r5, #0x18]
ldrb r2, [r0]
add r3, r5, #0
lsl r0, r1, #1
add r0, r1, r0
add r0, r2, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsl r2, r4, #0x10
add r3, #0x28
str r0, [sp, #0xc]
ldrb r1, [r5, #6]
ldrb r3, [r3]
ldr r0, [r5, #0x14]
lsr r2, r2, #0x10
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
ldrb r1, [r5, #0x18]
ldrb r2, [r0]
add r3, r5, #0
lsl r0, r1, #1
add r0, r1, r0
add r0, r2, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
add r0, r5, #0
add r0, #0x26
ldrb r0, [r0]
add r2, r4, #1
lsl r2, r2, #0x10
str r0, [sp, #4]
mov r0, #1
str r0, [sp, #8]
ldrb r0, [r5, #7]
add r3, #0x28
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r3, #1
lsl r3, r3, #0x18
lsr r3, r3, #0x18
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
add r3, r5, #0
ldrb r1, [r5, #0x18]
ldrb r2, [r0]
add r3, #0x28
lsl r0, r1, #1
add r0, r1, r0
add r0, r2, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
add r2, r4, #2
lsl r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r4, [r3]
add r3, r5, #0
add r3, #0x26
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r4, r3
add r3, r3, #1
lsl r3, r3, #0x18
lsr r2, r2, #0x10
lsr r3, r3, #0x18
bl FillBgTilemapRect
ldrb r1, [r5, #0x18]
mov r6, #0
sub r0, r1, #1
cmp r0, #0
ble _02018BFE
ldr r0, [sp, #0x10]
add r7, r6, #0
sub r0, r0, #1
str r0, [sp, #0x14]
_02018B22:
ldrh r0, [r5, #0xc]
add r4, r0, #6
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
cmp r0, #0
bne _02018B34
cmp r6, #0
beq _02018B38
_02018B34:
cmp r0, r6
bne _02018B3C
_02018B38:
add r4, #0xc
b _02018B50
_02018B3C:
ldr r1, [sp, #0x10]
cmp r0, r1
bne _02018B48
ldr r1, [sp, #0x14]
cmp r6, r1
beq _02018B4E
_02018B48:
add r1, r6, #1
cmp r0, r1
bne _02018B50
_02018B4E:
add r4, #0x12
_02018B50:
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r1, r7, #3
add r3, r5, #0
add r0, r1, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
add r3, #0x28
lsl r2, r4, #0x10
str r0, [sp, #0xc]
ldrb r1, [r5, #6]
ldrb r3, [r3]
ldr r0, [r5, #0x14]
lsr r2, r2, #0x10
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r1, r7, #3
add r3, r5, #0
add r0, r1, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
add r0, r5, #0
add r0, #0x26
ldrb r0, [r0]
add r3, #0x28
add r2, r4, #1
str r0, [sp, #4]
mov r0, #1
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsl r2, r2, #0x10
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r3, #1
lsl r3, r3, #0x18
lsr r3, r3, #0x18
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
add r3, r5, #0
add r2, r4, #2
ldrb r0, [r0]
add r1, r7, #3
add r3, #0x28
add r0, r1, r0
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsl r2, r2, #0x10
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r4, [r3]
add r3, r5, #0
add r3, #0x26
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r4, r3
add r3, r3, #1
lsl r3, r3, #0x18
lsr r3, r3, #0x18
bl FillBgTilemapRect
ldrb r1, [r5, #0x18]
add r6, r6, #1
add r7, r7, #3
sub r0, r1, #1
cmp r6, r0
blt _02018B22
_02018BFE:
mov r7, #0
cmp r1, #0
ble _02018C8C
add r6, r7, #0
_02018C06:
ldrh r0, [r5, #0xc]
add r4, r0, #3
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
cmp r0, r7
bne _02018C16
add r4, #0xc
_02018C16:
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r3, r5, #0
lsl r2, r4, #0x10
add r0, r0, r6
add r0, r0, #1
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
mov r0, #2
str r0, [sp, #8]
ldrb r0, [r5, #7]
add r3, #0x28
lsr r2, r2, #0x10
str r0, [sp, #0xc]
ldrb r1, [r5, #6]
ldrb r3, [r3]
ldr r0, [r5, #0x14]
bl FillBgTilemapRect
add r0, r5, #0
add r0, #0x29
ldrb r0, [r0]
add r3, r5, #0
add r2, r4, #2
add r0, r0, r6
add r0, r0, #1
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
mov r0, #2
str r0, [sp, #8]
ldrb r0, [r5, #7]
lsl r2, r2, #0x10
add r3, #0x28
str r0, [sp, #0xc]
ldrb r4, [r3]
add r3, r5, #0
add r3, #0x26
ldrb r3, [r3]
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
add r3, r4, r3
add r3, r3, #1
lsl r3, r3, #0x18
lsr r2, r2, #0x10
lsr r3, r3, #0x18
bl FillBgTilemapRect
ldrb r0, [r5, #0x18]
add r7, r7, #1
add r6, r6, #3
cmp r7, r0
blt _02018C06
_02018C8C:
add sp, #0x18
pop {r3, r4, r5, r6, r7, pc}
thumb_func_end sub_020189AC
thumb_func_start sub_02018C90
sub_02018C90: ; 0x02018C90
push {r4, r5, r6, r7, lr}
sub sp, #0x14
add r5, r0, #0
add r0, #0x26
ldrb r0, [r0]
mov r7, #0
lsl r0, r0, #3
str r0, [sp, #0x10]
ldrb r0, [r5, #0x18]
cmp r0, #0
ble _02018CFA
add r6, r7, #0
add r4, r7, #0
_02018CAA:
ldrb r0, [r5, #4]
lsl r0, r0, #0x18
lsr r0, r0, #0x19
bne _02018CB6
ldrb r3, [r5, #5]
b _02018CC8
_02018CB6:
ldr r1, [r5, #0x10]
mov r0, #4
ldr r1, [r1, r6]
mov r2, #0
bl FontID_String_GetWidth
ldr r1, [sp, #0x10]
sub r0, r1, r0
lsr r3, r0, #1
_02018CC8:
mov r0, #0
str r0, [sp]
mov r0, #0xff
str r0, [sp, #4]
ldr r0, _02018D08 ; =0x00010203
mov r1, #4
str r0, [sp, #8]
mov r0, #0
str r0, [sp, #0xc]
ldr r2, [r5, #0x10]
ldr r0, [r5, #0x1c]
ldr r2, [r2, r6]
add r0, r0, r4
bl AddTextPrinterParameterizedWithColor
ldr r0, [r5, #0x1c]
add r0, r0, r4
bl ScheduleWindowCopyToVram
ldrb r0, [r5, #0x18]
add r7, r7, #1
add r6, #8
add r4, #0x10
cmp r7, r0
blt _02018CAA
_02018CFA:
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
bl ScheduleBgTilemapBufferTransfer
add sp, #0x14
pop {r4, r5, r6, r7, pc}
nop
_02018D08: .word 0x00010203
thumb_func_end sub_02018C90
thumb_func_start sub_02018D0C
sub_02018D0C: ; 0x02018D0C
push {r3, r4, r5, r6, r7, lr}
sub sp, #0x18
add r5, r0, #0
add r4, r1, #0
cmp r2, #0
beq _02018D20
mov r0, #6
ldr r7, _02018D88 ; =0x00040506
str r0, [sp, #0x14]
b _02018D26
_02018D20:
mov r0, #3
ldr r7, _02018D8C ; =0x00010203
str r0, [sp, #0x14]
_02018D26:
add r0, r5, #0
add r0, #0x26
ldrb r0, [r0]
lsl r6, r0, #3
ldrb r0, [r5, #4]
lsl r0, r0, #0x18
lsr r0, r0, #0x19
bne _02018D3C
ldrb r0, [r5, #5]
str r0, [sp, #0x10]
b _02018D50
_02018D3C:
ldr r2, [r5, #0x10]
lsl r1, r4, #3
ldr r1, [r2, r1]
mov r0, #4
mov r2, #0
bl FontID_String_GetWidth
sub r0, r6, r0
lsr r0, r0, #1
str r0, [sp, #0x10]
_02018D50:
ldr r0, [r5, #0x1c]
lsl r6, r4, #4
ldr r1, [sp, #0x14]
add r0, r0, r6
bl FillWindowPixelBuffer
mov r1, #0
str r1, [sp]
mov r0, #0xff
str r0, [sp, #4]
str r7, [sp, #8]
str r1, [sp, #0xc]
ldr r0, [r5, #0x1c]
ldr r3, [r5, #0x10]
lsl r2, r4, #3
ldr r2, [r3, r2]
ldr r3, [sp, #0x10]
add r0, r0, r6
mov r1, #4
bl AddTextPrinterParameterizedWithColor
ldr r0, [r5, #0x1c]
add r0, r0, r6
bl ScheduleWindowCopyToVram
add sp, #0x18
pop {r3, r4, r5, r6, r7, pc}
nop
_02018D88: .word 0x00040506
_02018D8C: .word 0x00010203
thumb_func_end sub_02018D0C
thumb_func_start sub_02018D90
sub_02018D90: ; 0x02018D90
push {r4, r5, r6, lr}
sub sp, #0x10
add r5, r0, #0
ldrb r0, [r5, #0x18]
mov r6, #0
cmp r0, #0
ble _02018DB2
add r4, r6, #0
_02018DA0:
ldr r0, [r5, #0x1c]
add r0, r0, r4
bl ClearWindowTilemapAndScheduleTransfer
ldrb r0, [r5, #0x18]
add r6, r6, #1
add r4, #0x10
cmp r6, r0
blt _02018DA0
_02018DB2:
add r1, r5, #0
add r1, #0x29
ldrb r1, [r1]
add r3, r5, #0
add r3, #0x28
str r1, [sp]
add r1, r5, #0
add r1, #0x26
ldrb r1, [r1]
mov r2, #0
add r1, r1, #2
lsl r1, r1, #0x18
lsr r1, r1, #0x18
str r1, [sp, #4]
lsl r1, r0, #1
add r0, r0, r1
add r0, r0, #1
lsl r0, r0, #0x18
lsr r0, r0, #0x18
str r0, [sp, #8]
ldrb r0, [r5, #7]
str r0, [sp, #0xc]
ldrb r1, [r5, #6]
ldrb r3, [r3]
ldr r0, [r5, #0x14]
bl FillBgTilemapRect
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
bl ScheduleBgTilemapBufferTransfer
add sp, #0x10
pop {r4, r5, r6, pc}
thumb_func_end sub_02018D90
thumb_func_start sub_02018DF4
sub_02018DF4: ; 0x02018DF4
push {r4, lr}
add r4, r0, #0
bl sub_020189AC
ldrb r1, [r4, #6]
ldr r0, [r4, #0x14]
bl ScheduleBgTilemapBufferTransfer
pop {r4, pc}
.balign 4, 0
thumb_func_end sub_02018DF4
thumb_func_start sub_02018E08
sub_02018E08: ; 0x02018E08
push {r4, r5, r6, lr}
add r5, r0, #0
ldr r0, [r5, #0x20]
add r4, r1, #0
bl TouchscreenHitbox_FindRectAtTouchNew
add r6, r0, #0
mov r0, #0
mvn r0, r0
cmp r6, r0
bne _02018E24
mov r1, #0
str r1, [r4]
pop {r4, r5, r6, pc}
_02018E24:
lsl r0, r6, #0x18
mov r2, #1
lsr r1, r0, #0x18
add r0, r5, #0
str r2, [r4]
add r0, #0x24
strb r1, [r0]
add r0, r5, #0
bl sub_02018D0C
add r0, r5, #0
bl sub_020189AC
ldrb r1, [r5, #6]
ldr r0, [r5, #0x14]
bl ScheduleBgTilemapBufferTransfer
add r0, r5, #0
mov r1, #1
add r0, #0x25
strb r1, [r0]
add r0, r5, #0
mov r1, #8
add r0, #0x2b
strb r1, [r0]
add r0, r5, #0
add r0, #0x2a
strb r6, [r0]
add r0, r5, #0
add r0, #0x27
ldrb r1, [r0]
mov r0, #0xfe
bic r1, r0
mov r0, #2
orr r1, r0
add r0, r5, #0
add r0, #0x27
strb r1, [r0]
ldr r1, _02018E88 ; =0x000005DC
add r0, r5, #0
bl sub_02018FE8
add r0, r5, #0
mov r1, #2
bl sub_02018FFC
mov r0, #0
mvn r0, r0
pop {r4, r5, r6, pc}
nop
_02018E88: .word 0x000005DC
thumb_func_end sub_02018E08
thumb_func_start sub_02018E8C
sub_02018E8C: ; 0x02018E8C
push {r3, r4, r5, lr}
add r5, r0, #0
ldr r0, _02018FDC ; =gSystem
ldr r1, [r0, #0x48]
ldr r0, _02018FE0 ; =0x00000CF3
tst r0, r1
beq _02018EAA
add r0, r5, #0
add r0, #0x27
ldrb r1, [r0]
mov r0, #0xfe
bic r1, r0
add r0, r5, #0
add r0, #0x27
strb r1, [r0]
_02018EAA:
ldr r0, _02018FDC ; =gSystem
mov r1, #2
ldr r0, [r0, #0x48]
tst r1, r0
beq _02018ECA
ldr r1, _02018FE4 ; =0x000005DC
add r0, r5, #0
bl sub_02018FE8
add r0, r5, #0
mov r1, #3
bl sub_02018FFC
mov r0, #1
mvn r0, r0
pop {r3, r4, r5, pc}
_02018ECA:
mov r2, #1
add r1, r0, #0
tst r1, r2
beq _02018F10
add r1, r5, #0
add r1, #0x24
ldrb r1, [r1]
add r0, r5, #0
bl sub_02018D0C
add r0, r5, #0
mov r1, #1
add r0, #0x25
strb r1, [r0]
add r0, r5, #0
mov r1, #8
add r0, #0x2b
strb r1, [r0]
add r0, r5, #0
add r0, #0x24
ldrb r1, [r0]
add r0, r5, #0
add r0, #0x2a
strb r1, [r0]
ldr r1, _02018FE4 ; =0x000005DC
add r0, r5, #0
bl sub_02018FE8
add r0, r5, #0
mov r1, #2
bl sub_02018FFC
mov r0, #0
mvn r0, r0
pop {r3, r4, r5, pc}
_02018F10:
add r1, r5, #0
add r1, #0x24
ldrb r4, [r1]
mov r1, #0x40
tst r0, r1
beq _02018F6E
ldrb r0, [r5, #4]
lsl r0, r0, #0x1f
lsr r0, r0, #0x1f
beq _02018F36
ldrb r1, [r5, #0x18]
sub r0, r1, #1
add r0, r4, r0
bl _s32_div_f
add r0, r5, #0
add r0, #0x24
strb r1, [r0]
b _02018F48
_02018F36:
cmp r4, #0
beq _02018F48
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
sub r1, r0, #1
add r0, r5, #0
add r0, #0x24
strb r1, [r0]
_02018F48:
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
cmp r4, r0
beq _02018F6E
ldr r1, _02018FE4 ; =0x000005DC
add r0, r5, #0
bl sub_02018FE8
add r0, r5, #0
mov r1, #1
bl sub_02018FFC
add r1, r5, #0
add r1, #0x24
ldrb r1, [r1]
add r0, r5, #0
bl sub_02018DF4
_02018F6E:
ldr r0, _02018FDC ; =gSystem
ldr r1, [r0, #0x48]
mov r0, #0x80
tst r0, r1
beq _02018FD6
ldrb r0, [r5, #4]
lsl r0, r0, #0x1f
lsr r0, r0, #0x1f
beq _02018F96
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
ldrb r1, [r5, #0x18]
add r0, r0, #1
bl _s32_div_f
add r0, r5, #0
add r0, #0x24
strb r1, [r0]
b _02018FB2
_02018F96:
add r0, r5, #0
add r0, #0x24
ldrb r1, [r0]
ldrb r0, [r5, #0x18]
sub r0, r0, #1
cmp r1, r0
bge _02018FB2
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
add r1, r0, #1
add r0, r5, #0
add r0, #0x24
strb r1, [r0]
_02018FB2:
add r0, r5, #0
add r0, #0x24
ldrb r0, [r0]
cmp r4, r0
beq _02018FD6
ldr r1, _02018FE4 ; =0x000005DC
add r0, r5, #0
bl sub_02018FE8
add r0, r5, #0
mov r1, #1
bl sub_02018FFC
add r0, r5, #0
add r5, #0x24
ldrb r1, [r5]
bl sub_02018DF4
_02018FD6:
mov r0, #0
mvn r0, r0
pop {r3, r4, r5, pc}
.balign 4, 0
_02018FDC: .word gSystem
_02018FE0: .word 0x00000CF3
_02018FE4: .word 0x000005DC
thumb_func_end sub_02018E8C
thumb_func_start sub_02018FE8
sub_02018FE8: ; 0x02018FE8
push {r3, lr}
add r0, #0x27
ldrb r0, [r0]
lsl r0, r0, #0x1f
lsr r0, r0, #0x1f
bne _02018FFA
add r0, r1, #0
bl PlaySE
_02018FFA:
pop {r3, pc}
thumb_func_end sub_02018FE8
thumb_func_start sub_02018FFC
sub_02018FFC: ; 0x02018FFC
push {r4, lr}
ldr r4, [r0, #0x30]
add r3, r1, #0
cmp r4, #0
beq _02019010
add r1, r0, #0
add r1, #0x24
ldrb r1, [r1]
ldr r2, [r0, #0x34]
blx r4
_02019010:
pop {r4, pc}
.balign 4, 0
thumb_func_end sub_02018FFC

View File

@ -60,7 +60,6 @@ Static main
Object src/unk_02018380.o
Object src/unk_020183F0.o
Object src/unk_02018424.o
Object asm/unk_020183F0_s.o
Object src/camera_translation.o
Object asm/unk_020192D0.o
Object src/system.o

View File

@ -2,6 +2,16 @@
set -euo pipefail
if [ "$(uname -s)" = "Darwin" ]; then
if ! type brew &>/dev/null; then
echo "ERR: running on macOS requires homebrew" 1>&2
exit 255
fi
SED="$(brew --prefix)/bin/gsed"
else
SED=sed
fi
dry_run=
usage="usage: $(basename $0) [OPTIONS]
@ -35,10 +45,19 @@ if ! [ -n "$dry_run" ]; then
exit 255
fi
read -r -a to_remove < <(comm -23 <(cd asm/include; find . -name "*.inc" | sed -r 's/\.\///' | sort -u) <(git grep -E "\.include \".+\"" | grep -oE "\"\S+\.inc\"" | sed 's/"//g' | sort -u)) || {
function get_includes () {
comm -23 \
<(cd asm/include; find . -name "*.inc" | $SED -r 's/\.\///' | sort -u) \
<(git grep -E "\.include \".+\"" | grep -oE "\"\S+\.inc\"" | $SED -r 's/"//g' | sort -u) \
| $SED -r 's#^#asm/include/#g'
}
to_remove=($(get_includes))
if [ ${#to_remove[@]} -eq 0 ] ; then
echo -e "nothing to do"
exit 0
}
fi
if [ "$dry_run" = "no" ]; then
git rm -f "${to_remove[@]}"

View File

@ -8,6 +8,8 @@
#include "gf_gfx_loader.h"
#include "palette.h"
#include "sys_task_api.h"
#include "text.h"
#include "unk_02005D10.h"
UnkStruct_020185FC *sub_02018498(UnkStruct_02018424 *a0, Ov122_021E7488 *a1, u8 a2, u8 a3, u8 a4, u8 a5, u8 a6, UnkFunc_020185FC a7, void *a8, BOOL a9, int a10);
void sub_02018744(UnkStruct_02018424 *a0, Ov122_021E7488 *a1, PaletteData *paletteData, HeapID heapId);
@ -17,12 +19,12 @@ void sub_02018890(UnkStruct_020185FC *a0);
void sub_02018998(UnkStruct_020185FC *a0);
void sub_020189AC(UnkStruct_020185FC *a0);
void sub_02018C90(UnkStruct_020185FC *a0);
void sub_02018D0C(UnkStruct_020185FC *a0, u8 a1, BOOL a2);
void sub_02018D90(UnkStruct_020185FC *a0);
void sub_02018D0C(UnkStruct_020185FC *a0, int a1, int a2);
void sub_02018DF4(UnkStruct_020185FC *a0, int a1);
int sub_02018E08(UnkStruct_020185FC *a0, int *a1);
int sub_02018E08(UnkStruct_020185FC *a0, BOOL *a1);
int sub_02018E8C(UnkStruct_020185FC *a0);
void sub_02018FE8(UnkStruct_020185FC *a0, int a1);
void sub_02018FE8(UnkStruct_020185FC *a0, u16 a1);
void sub_02018FFC(UnkStruct_020185FC *a0, int a1);
UnkStruct_02018424 *sub_02018424(HeapID heapId, PaletteData *a1) {
@ -238,3 +240,188 @@ void sub_02018998(UnkStruct_020185FC *a0) {
FreeToHeap(a0->touchscreenHitboxes);
WindowArray_Delete(a0->windows, a0->unk_04.numWindows);
}
void sub_020189AC(UnkStruct_020185FC *a0) {
int i;
int r4;
int sp10;
sp10 = a0->unk_04.numWindows - 1;
// top row
r4 = a0->unk_04.unk0.charOffset;
if (a0->unk_24 == 0) {
r4 += 12;
}
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4, a0->x, a0->y, 1, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 1, a0->x + 1, a0->y, a0->width, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 2, a0->x + a0->width + 1, a0->y, 1, 1, a0->unk_04.unk0.plttOffset);
// bottom row
r4 = a0->unk_04.unk0.charOffset + 9;
if (a0->unk_24 == sp10) {
r4 += 12;
}
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4, a0->x, a0->y + a0->unk_04.numWindows * 3, 1, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 1, a0->x + 1, a0->y + a0->unk_04.numWindows * 3, a0->width, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 2, a0->x + a0->width + 1, a0->y + a0->unk_04.numWindows * 3, 1, 1, a0->unk_04.unk0.plttOffset);
// between each button
for (i = 0; i < a0->unk_04.numWindows - 1; ++i) {
r4 = a0->unk_04.unk0.charOffset + 6;
if ((a0->unk_24 == 0 && i == 0) || a0->unk_24 == i) {
r4 += 12;
} else if ((a0->unk_24 == sp10 && i == sp10 - 1) || a0->unk_24 == i + 1) {
r4 += 18;
}
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4, a0->x, a0->y + i * 3 + 3, 1, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 1, a0->x + 1, a0->y + i * 3 + 3, a0->width, 1, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 2, a0->x + a0->width + 1, a0->y + i * 3 + 3, 1, 1, a0->unk_04.unk0.plttOffset);
}
// left and right borders
for (i = 0; i < a0->unk_04.numWindows; ++i) {
r4 = a0->unk_04.unk0.charOffset + 3;
if (a0->unk_24 == i) {
r4 += 12;
}
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4, a0->x, a0->y + i * 3 + 1, 1, 2, a0->unk_04.unk0.plttOffset);
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, r4 + 2, a0->x + a0->width + 1, a0->y + i * 3 + 1, 1, 2, a0->unk_04.unk0.plttOffset);
}
}
void sub_02018C90(UnkStruct_020185FC *a0) {
int i;
u32 x;
u32 width;
width = a0->width * 8;
for (i = 0; i < a0->unk_04.numWindows; ++i) {
if (a0->unk_04.unk0.unk0_1 == 0) {
x = a0->unk_04.unk0.unk1;
} else {
x = (width - FontID_String_GetWidth(4, a0->unk_04.listMenuItems[i].text, 0)) / 2;
}
AddTextPrinterParameterizedWithColor(&a0->windows[i], 4, a0->unk_04.listMenuItems[i].text, x, 0, TEXT_SPEED_NOTRANSFER, MAKE_TEXT_COLOR(1, 2, 3), NULL);
ScheduleWindowCopyToVram(&a0->windows[i]);
}
ScheduleBgTilemapBufferTransfer(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId);
}
void sub_02018D0C(UnkStruct_020185FC *a0, u8 a1, BOOL a2) {
u32 x;
u32 width;
u32 textColor;
u8 fillValue;
if (a2) {
textColor = MAKE_TEXT_COLOR(4, 5, 6);
fillValue = 6;
} else {
textColor = MAKE_TEXT_COLOR(1, 2, 3);
fillValue = 3;
}
width = a0->width * 8;
if (a0->unk_04.unk0.unk0_1 == 0) {
x = a0->unk_04.unk0.unk1;
} else {
x = (width - FontID_String_GetWidth(4, a0->unk_04.listMenuItems[a1].text, 0)) / 2;
}
FillWindowPixelBuffer(&a0->windows[a1], fillValue);
AddTextPrinterParameterizedWithColor(&a0->windows[a1], 4, a0->unk_04.listMenuItems[a1].text, x, 0, TEXT_SPEED_NOTRANSFER, textColor, NULL);
ScheduleWindowCopyToVram(&a0->windows[a1]);
}
void sub_02018D90(UnkStruct_020185FC *a0) {
for (int i = 0; i < a0->unk_04.numWindows; ++i) {
ClearWindowTilemapAndScheduleTransfer(&a0->windows[i]);
}
FillBgTilemapRect(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId, 0, a0->x, a0->y, a0->width + 2, a0->unk_04.numWindows * 3 + 1, a0->unk_04.unk0.plttOffset);
ScheduleBgTilemapBufferTransfer(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId);
}
void sub_02018DF4(UnkStruct_020185FC *a0, int a1) {
sub_020189AC(a0);
ScheduleBgTilemapBufferTransfer(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId);
}
int sub_02018E08(UnkStruct_020185FC *a0, BOOL *a1) {
int hitbox = TouchscreenHitbox_FindRectAtTouchNew(a0->touchscreenHitboxes);
if (hitbox == -1) {
*a1 = FALSE;
return -1;
}
*a1 = TRUE;
a0->unk_24 = hitbox;
sub_02018D0C(a0, hitbox, TRUE);
sub_020189AC(a0);
ScheduleBgTilemapBufferTransfer(a0->unk_04.bgConfig, a0->unk_04.unk0.bgId);
a0->unk_25 = 1;
a0->unk_2B = 8;
a0->unk_2A = hitbox;
a0->unk_27_1 = 1;
sub_02018FE8(a0, SEQ_SE_DP_SELECT);
sub_02018FFC(a0, 2);
return -1;
}
int sub_02018E8C(UnkStruct_020185FC *a0) {
u8 prev;
if (gSystem.newKeys & (PAD_BUTTON_X | PAD_BUTTON_Y | PAD_KEY_UP | PAD_KEY_DOWN | PAD_KEY_LEFT | PAD_KEY_RIGHT | PAD_BUTTON_A | PAD_BUTTON_B)) {
a0->unk_27_1 = 0;
}
if (gSystem.newKeys & PAD_BUTTON_B) {
sub_02018FE8(a0, SEQ_SE_DP_SELECT);
sub_02018FFC(a0, 3);
return -2;
}
if (gSystem.newKeys & PAD_BUTTON_A) {
sub_02018D0C(a0, a0->unk_24, TRUE);
a0->unk_25 = 1;
a0->unk_2B = 8;
a0->unk_2A = a0->unk_24;
sub_02018FE8(a0, SEQ_SE_DP_SELECT);
sub_02018FFC(a0, 2);
return -1;
}
prev = a0->unk_24;
if (gSystem.newKeys & PAD_KEY_UP) {
if (a0->unk_04.unk0.unk0_0) {
a0->unk_24 = (a0->unk_24 + (a0->unk_04.numWindows - 1)) % a0->unk_04.numWindows;
} else if (a0->unk_24 > 0) {
--a0->unk_24;
}
if (prev != a0->unk_24) {
sub_02018FE8(a0, SEQ_SE_DP_SELECT);
sub_02018FFC(a0, 1);
sub_02018DF4(a0, a0->unk_24);
}
}
if (gSystem.newKeys & PAD_KEY_DOWN) {
if (a0->unk_04.unk0.unk0_0) {
a0->unk_24 = (a0->unk_24 + 1) % a0->unk_04.numWindows;
} else if (a0->unk_24 < a0->unk_04.numWindows - 1) {
++a0->unk_24;
}
if (prev != a0->unk_24) {
sub_02018FE8(a0, SEQ_SE_DP_SELECT);
sub_02018FFC(a0, 1);
sub_02018DF4(a0, a0->unk_24);
}
}
return -1;
}
void sub_02018FE8(UnkStruct_020185FC *a0, u16 a1) {
if (!a0->unk_27_0) {
PlaySE(a1);
}
}
void sub_02018FFC(UnkStruct_020185FC *a0, int a1) {
if (a0->callback != NULL) {
a0->callback(a0, a0->unk_24, a0->callbackArg, a1);
}
}