start menu helpers decomp

This commit is contained in:
DizzyEggg 2018-05-14 23:03:40 +02:00
parent d1df98361f
commit 7735fb2ad3
3 changed files with 401 additions and 756 deletions

View File

@ -5,764 +5,8 @@
.text
thumb_func_start ResetVramOamAndBgCntRegs
ResetVramOamAndBgCntRegs: @ 8121DA0
push {r4,lr}
sub sp, 0xC
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0xE
movs r1, 0
bl SetGpuReg
movs r0, 0xC
movs r1, 0
bl SetGpuReg
movs r0, 0xA
movs r1, 0
bl SetGpuReg
movs r0, 0x8
movs r1, 0
bl SetGpuReg
mov r1, sp
movs r0, 0
strh r0, [r1]
movs r1, 0xC0
lsls r1, 19
ldr r2, =0x0100c000
mov r0, sp
bl CpuSet
movs r4, 0
str r4, [sp, 0x4]
add r0, sp, 0x4
movs r1, 0xE0
lsls r1, 19
ldr r2, =0x05000100
bl CpuSet
add r0, sp, 0x8
strh r4, [r0]
movs r1, 0xA0
lsls r1, 19
ldr r2, =0x01000200
bl CpuSet
add sp, 0xC
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ResetVramOamAndBgCntRegs
thumb_func_start ResetAllBgsCoordinates
ResetAllBgsCoordinates: @ 8121E10
push {lr}
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgY
pop {r0}
bx r0
thumb_func_end ResetAllBgsCoordinates
thumb_func_start SetVBlankHBlankCallbacksToNull
@ void SetVBlankHBlankCallbacksToNull()
SetVBlankHBlankCallbacksToNull: @ 8121E68
push {lr}
movs r0, 0
bl SetVBlankCallback
movs r0, 0
bl SetHBlankCallback
pop {r0}
bx r0
thumb_func_end SetVBlankHBlankCallbacksToNull
thumb_func_start DisplayMessageAndContinueTask
@ void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 windowBorderFirstTileNum, u8 windowBorderPalette, u8 fontId, u8 speed, u8 *str, void ( *callback)(u8 taskId))
DisplayMessageAndContinueTask: @ 8121E7C
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x10
ldr r4, [sp, 0x28]
ldr r5, [sp, 0x2C]
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r1, 24
lsrs r1, 24
adds r6, r1, 0
lsls r2, 16
lsrs r2, 16
lsls r3, 24
lsrs r3, 24
lsls r4, 24
lsrs r7, r4, 24
lsls r5, 24
lsrs r5, 24
ldr r0, =gUnknown_0203A140
strb r6, [r0]
adds r0, r6, 0
movs r1, 0x1
bl sub_8197B1C
ldr r4, =gStringVar4
ldr r0, [sp, 0x30]
cmp r0, r4
beq _08121EC0
adds r0, r4, 0
ldr r1, [sp, 0x30]
bl StringExpandPlaceholders
_08121EC0:
ldr r2, =gTextFlags
ldrb r0, [r2]
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
movs r0, 0
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0x1
str r0, [sp, 0x8]
movs r0, 0x3
str r0, [sp, 0xC]
adds r0, r6, 0
adds r1, r7, 0
adds r2, r4, 0
adds r3, r5, 0
bl AddTextPrinterParameterized
ldr r1, =gUnknown_0300117C
ldr r0, [sp, 0x34]
str r0, [r1]
ldr r1, =gTasks
mov r2, r8
lsls r0, r2, 2
add r0, r8
lsls r0, 3
adds r0, r1
ldr r1, =Task_ContinueTaskAfterMessagePrints
str r1, [r0]
add sp, 0x10
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end DisplayMessageAndContinueTask
thumb_func_start RunTextPrintersRetIsActive
RunTextPrintersRetIsActive: @ 8121F20
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl RunTextPrinters
adds r0, r4, 0
bl IsTextPrinterActive
lsls r0, 16
lsrs r0, 16
pop {r4}
pop {r1}
bx r1
thumb_func_end RunTextPrintersRetIsActive
thumb_func_start Task_ContinueTaskAfterMessagePrints
@ void Task_ContinueTaskAfterMessagePrints(u8 taskId)
Task_ContinueTaskAfterMessagePrints: @ 8121F3C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_0203A140
ldrb r0, [r0]
bl RunTextPrintersRetIsActive
lsls r0, 16
cmp r0, 0
bne _08121F5A
ldr r0, =gUnknown_0300117C
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
_08121F5A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end Task_ContinueTaskAfterMessagePrints
thumb_func_start sub_8121F68
sub_8121F68: @ 8121F68
lsls r0, 24
lsrs r0, 24
ldr r3, =gUnknown_0203A138
ldr r2, [r1, 0x4]
ldr r1, [r1]
str r1, [r3]
str r2, [r3, 0x4]
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r0, =Task_CallYesOrNoCallback
str r0, [r1]
bx lr
.pool
thumb_func_end sub_8121F68
thumb_func_start CreateYesNoMenuWithCallbacks
@ void CreateYesNoMenuWithCallbacks(u8 taskId, struct WindowTemplate *windowTemplate, int a3, int a4, int a5, u16 borderFirstTileNum, u8 borderPalette, void ( **callbacks)(u8 taskId))
CreateYesNoMenuWithCallbacks: @ 8121F94
push {r4,r5,lr}
adds r4, r0, 0
adds r0, r1, 0
ldr r1, [sp, 0x10]
ldr r2, [sp, 0x14]
ldr r5, [sp, 0x18]
lsls r4, 24
lsrs r4, 24
lsls r1, 16
lsrs r1, 16
lsls r2, 24
lsrs r2, 24
movs r3, 0
bl CreateYesNoMenu
ldr r2, =gUnknown_0203A138
ldr r0, [r5]
ldr r1, [r5, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =Task_CallYesOrNoCallback
str r1, [r0]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end CreateYesNoMenuWithCallbacks
thumb_func_start Task_CallYesOrNoCallback
@ void Task_CallYesOrNoCallback(u8 taskId)
Task_CallYesOrNoCallback: @ 8121FDC
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl ProcessMenuInputNoWrap_
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
beq _08122002
cmp r1, 0
bgt _08121FFC
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _08122018
b _08122028
_08121FFC:
cmp r1, 0x1
beq _08122018
b _08122028
_08122002:
movs r0, 0x5
bl PlaySE
ldr r0, =gUnknown_0203A138
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
b _08122028
.pool
_08122018:
movs r0, 0x5
bl PlaySE
ldr r0, =gUnknown_0203A138
ldr r1, [r0, 0x4]
adds r0, r4, 0
bl _call_via_r1
_08122028:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end Task_CallYesOrNoCallback
thumb_func_start AdjustQuantityAccordingToDPadInput
@ bool8 AdjustQuantityAccordingToDPadInput(u16 *quantity, u16 maxQuantity)
AdjustQuantityAccordingToDPadInput: @ 8122034
push {r4-r6,lr}
adds r2, r0, 0
lsls r1, 16
lsrs r1, 16
adds r5, r1, 0
ldrh r4, [r2]
adds r6, r4, 0
ldr r0, =gMain
ldrh r0, [r0, 0x30]
movs r3, 0xF0
ands r3, r0
cmp r3, 0x40
bne _0812206C
adds r0, r4, 0x1
strh r0, [r2]
movs r3, 0
ldrsh r0, [r2, r3]
cmp r0, r1
ble _0812205E
movs r0, 0x1
strh r0, [r2]
_0812205E:
movs r0, 0
ldrsh r1, [r2, r0]
_08122062:
lsls r0, r4, 16
b _081220B6
.pool
_0812206C:
cmp r3, 0x80
bne _08122082
subs r0, r4, 0x1
strh r0, [r2]
lsls r0, 16
cmp r0, 0
bgt _0812207C
strh r1, [r2]
_0812207C:
movs r3, 0
ldrsh r1, [r2, r3]
b _08122062
_08122082:
cmp r3, 0x10
bne _0812209C
adds r0, r4, 0
adds r0, 0xA
strh r0, [r2]
movs r1, 0
ldrsh r0, [r2, r1]
cmp r0, r5
ble _08122096
strh r5, [r2]
_08122096:
movs r3, 0
ldrsh r1, [r2, r3]
b _08122062
_0812209C:
cmp r3, 0x20
bne _081220C6
adds r0, r4, 0
subs r0, 0xA
strh r0, [r2]
lsls r0, 16
cmp r0, 0
bgt _081220B0
movs r0, 0x1
strh r0, [r2]
_081220B0:
movs r0, 0
ldrsh r1, [r2, r0]
lsls r0, r6, 16
_081220B6:
asrs r0, 16
cmp r1, r0
beq _081220C6
movs r0, 0x5
bl PlaySE
movs r0, 0x1
b _081220C8
_081220C6:
movs r0, 0
_081220C8:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end AdjustQuantityAccordingToDPadInput
thumb_func_start GetLRKeysState
GetLRKeysState: @ 81220D0
push {lr}
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r0, [r0, 0x13]
cmp r0, 0x1
bne _08122106
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x80
lsls r0, 2
ands r0, r1
cmp r0, 0
beq _081220F8
movs r0, 0x1
b _08122108
.pool
_081220F8:
movs r0, 0x80
lsls r0, 1
ands r0, r1
cmp r0, 0
beq _08122106
movs r0, 0x2
b _08122108
_08122106:
movs r0, 0
_08122108:
pop {r1}
bx r1
thumb_func_end GetLRKeysState
thumb_func_start sub_812210C
sub_812210C: @ 812210C
push {lr}
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r0, [r0, 0x13]
cmp r0, 0x1
bne _08122142
ldr r0, =gMain
ldrh r1, [r0, 0x30]
movs r0, 0x80
lsls r0, 2
ands r0, r1
cmp r0, 0
beq _08122134
movs r0, 0x1
b _08122144
.pool
_08122134:
movs r0, 0x80
lsls r0, 1
ands r0, r1
cmp r0, 0
beq _08122142
movs r0, 0x2
b _08122144
_08122142:
movs r0, 0
_08122144:
pop {r1}
bx r1
thumb_func_end sub_812210C
thumb_func_start sub_8122148
sub_8122148: @ 8122148
push {lr}
lsls r0, 16
lsrs r0, 16
cmp r0, 0xAF
bne _08122174
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
ldr r0, =0x00001919
cmp r1, r0
beq _08122166
bl InUnionRoom
cmp r0, 0x1
bne _08122174
_08122166:
movs r0, 0
b _08122176
.pool
_08122174:
movs r0, 0x1
_08122176:
pop {r1}
bx r1
thumb_func_end sub_8122148
thumb_func_start itemid_80BF6D8_mail_related
itemid_80BF6D8_mail_related: @ 812217C
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
bl is_c1_link_related_active
cmp r0, 0x1
beq _08122192
bl InUnionRoom
cmp r0, 0x1
bne _081221A4
_08122192:
adds r0, r4, 0
bl ItemIsMail
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081221A4
movs r0, 0
b _081221A6
_081221A4:
movs r0, 0x1
_081221A6:
pop {r4}
pop {r1}
bx r1
thumb_func_end itemid_80BF6D8_mail_related
thumb_func_start sub_81221AC
sub_81221AC: @ 81221AC
push {lr}
bl is_c1_link_related_active
cmp r0, 0x1
beq _081221BE
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0x1
bne _081221C8
_081221BE:
movs r0, 0x1
b _081221CA
.pool
_081221C8:
movs r0, 0
_081221CA:
pop {r1}
bx r1
thumb_func_end sub_81221AC
thumb_func_start sub_81221D0
sub_81221D0: @ 81221D0
push {lr}
bl sub_81221AC
lsls r0, 24
cmp r0, 0
beq _081221E6
bl sub_8087598
lsls r0, 24
lsrs r0, 24
b _081221E8
_081221E6:
movs r0, 0
_081221E8:
pop {r1}
bx r1
thumb_func_end sub_81221D0
thumb_func_start sub_81221EC
sub_81221EC: @ 81221EC
push {lr}
bl sub_81221D0
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _08122202
bl sub_800B504
cmp r0, 0x1
bne _08122206
_08122202:
movs r0, 0x1
b _08122208
_08122206:
movs r0, 0
_08122208:
pop {r1}
bx r1
thumb_func_end sub_81221EC
thumb_func_start sub_812220C
sub_812220C: @ 812220C
push {r4-r6,lr}
adds r6, r2, 0
ldr r2, [sp, 0x10]
lsls r1, 24
lsls r2, 24
lsrs r5, r2, 24
adds r4, r0, 0
movs r0, 0
strb r0, [r3]
movs r2, 0
lsrs r1, 24
cmp r2, r1
bcs _08122240
_08122226:
lsls r0, r2, 2
adds r0, r4
ldrh r0, [r0]
cmp r0, 0
beq _08122236
ldrb r0, [r3]
adds r0, 0x1
strb r0, [r3]
_08122236:
adds r0, r2, 0x1
lsls r0, 16
lsrs r2, r0, 16
cmp r2, r1
bcc _08122226
_08122240:
ldrb r0, [r3]
adds r1, r0, 0x1
strb r1, [r3]
lsls r0, r1, 24
lsrs r0, 24
cmp r0, r5
bls _08122252
strb r5, [r6]
b _08122254
_08122252:
strb r1, [r6]
_08122254:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_812220C
thumb_func_start sub_812225C
sub_812225C: @ 812225C
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
lsls r2, 24
lsrs r2, 24
lsls r3, 24
lsrs r3, 24
ldrh r0, [r4]
cmp r0, 0
beq _0812227A
adds r0, r2
cmp r0, r3
ble _0812227A
subs r0, r3, r2
strh r0, [r4]
_0812227A:
ldrh r0, [r4]
ldrh r1, [r5]
adds r0, r1
cmp r0, r3
blt _08122290
cmp r3, 0
bne _0812228C
strh r3, [r5]
b _08122290
_0812228C:
subs r0, r3, 0x1
strh r0, [r5]
_08122290:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_812225C
thumb_func_start sub_8122298
sub_8122298: @ 8122298
push {r4-r7,lr}
adds r5, r0, 0
adds r4, r1, 0
ldr r0, [sp, 0x14]
lsls r2, 24
lsrs r7, r2, 24
lsls r3, 24
lsrs r6, r3, 24
lsls r2, r0, 24
lsrs r0, r2, 24
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _081222F0
lsrs r2, 25
ldrh r0, [r4]
cmp r0, r2
bcc _08122322
movs r1, 0
subs r0, r2
cmp r1, r0
bge _08122322
ldrh r0, [r5]
adds r0, r7
cmp r0, r6
beq _08122322
_081222CC:
ldrh r0, [r4]
subs r0, 0x1
strh r0, [r4]
ldrh r0, [r5]
adds r0, 0x1
strh r0, [r5]
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
ldrh r0, [r4]
subs r0, r2
cmp r1, r0
bge _08122322
ldrh r0, [r5]
adds r0, r7
cmp r0, r6
bne _081222CC
b _08122322
_081222F0:
ldrh r3, [r4]
lsrs r2, 25
adds r0, r2, 0x1
cmp r3, r0
blt _08122322
movs r1, 0
subs r0, r3, r2
b _08122316
_08122300:
ldrh r0, [r4]
subs r0, 0x1
strh r0, [r4]
ldrh r0, [r5]
adds r0, 0x1
strh r0, [r5]
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
ldrh r0, [r4]
subs r0, r2
_08122316:
cmp r1, r0
bgt _08122322
ldrh r0, [r5]
adds r0, r7
cmp r0, r6
bne _08122300
_08122322:
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8122298
thumb_func_start LoadListMenuArrowsGfx
LoadListMenuArrowsGfx: @ 8122328
push {lr}
ldr r0, =gUnknown_0859F514
bl LoadCompressedObjectPic
ldr r0, =gUnknown_0859F51C
bl LoadCompressedObjectPalette
pop {r0}
bx r0
.pool
thumb_func_end LoadListMenuArrowsGfx
thumb_func_start sub_8122344
sub_8122344: @ 8122344

View File

@ -163,6 +163,7 @@ SECTIONS {
src/mon_markings.o(.text);
src/mauville_old_man.o(.text);
src/mail.o(.text);
src/menu_helpers.o(.text);
asm/menu_helpers.o(.text);
src/dewford_trend.o(.text);
src/heal_location.o(.text);

400
src/menu_helpers.c Normal file
View File

@ -0,0 +1,400 @@
#include "global.h"
#include "task.h"
#include "window.h"
#include "menu.h"
#include "menu_helpers.h"
#include "gpu_regs.h"
#include "bg.h"
#include "main.h"
#include "text.h"
#include "link.h"
#include "string_util.h"
#include "sound.h"
#include "mail.h"
#include "overworld.h"
#include "decompress.h"
#include "constants/songs.h"
#include "constants/items.h"
#include "constants/maps.h"
extern u8 gUnknown_0203A140;
extern TaskFunc gUnknown_0300117C;
extern struct YesNoFuncTable gUnknown_0203A138;
extern const struct CompressedSpriteSheet gUnknown_0859F514;
extern const struct CompressedSpritePalette gUnknown_0859F51C;
extern bool32 InUnionRoom(void);
extern bool32 sub_800B504(void);
// this file's functions
void Task_ContinueTaskAfterMessagePrints(u8 taskId);
void Task_CallYesOrNoCallback(u8 taskId);
// code
void ResetVramOamAndBgCntRegs(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG3CNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
CpuFill16(0, (void*) VRAM, VRAM_SIZE);
CpuFill32(0, (void*) OAM, OAM_SIZE);
CpuFill16(0, (void*) PLTT, PLTT_SIZE);
}
void ResetAllBgsCoordinates(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
}
void SetVBlankHBlankCallbacksToNull(void)
{
SetVBlankCallback(NULL);
SetHBlankCallback(NULL);
}
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc)
{
gUnknown_0203A140 = windowId;
sub_8197B1C(windowId, TRUE, arg2, arg3);
if (string != gStringVar4)
StringExpandPlaceholders(gStringVar4, string);
gTextFlags.flag_0 = 1;
AddTextPrinterParameterized(windowId, fontId, gStringVar4, textSpeed, NULL, 2, 1, 3);
gUnknown_0300117C = taskFunc;
gTasks[taskId].func = Task_ContinueTaskAfterMessagePrints;
}
bool16 RunTextPrintersRetIsActive(u8 textPrinterId)
{
RunTextPrinters();
return IsTextPrinterActive(textPrinterId);
}
void Task_ContinueTaskAfterMessagePrints(u8 taskId)
{
if (!RunTextPrintersRetIsActive(gUnknown_0203A140))
gUnknown_0300117C(taskId);
}
void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data)
{
gUnknown_0203A138 = *data;
gTasks[taskId].func = Task_CallYesOrNoCallback;
}
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo)
{
CreateYesNoMenu(template, tileStart, palette, 0);
gUnknown_0203A138 = *yesNo;
gTasks[taskId].func = Task_CallYesOrNoCallback;
}
void Task_CallYesOrNoCallback(u8 taskId)
{
switch (ProcessMenuInputNoWrap_())
{
case 0:
PlaySE(SE_SELECT);
gUnknown_0203A138.yesFunc(taskId);
break;
case 1:
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
gUnknown_0203A138.noFunc(taskId);
break;
}
}
bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
{
s16 valBefore = (*arg0);
if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
{
(*arg0)++;
if ((*arg0) > arg1)
(*arg0) = 1;
if ((*arg0) == valBefore)
{
return FALSE;
}
else
{
PlaySE(SE_SELECT);
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
{
(*arg0)--;
if ((*arg0) <= 0)
(*arg0) = arg1;
if ((*arg0) == valBefore)
{
return FALSE;
}
else
{
PlaySE(SE_SELECT);
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT)
{
(*arg0) += 10;
if ((*arg0) > arg1)
(*arg0) = arg1;
if ((*arg0) == valBefore)
{
return FALSE;
}
else
{
PlaySE(SE_SELECT);
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT)
{
(*arg0) -= 10;
if ((*arg0) <= 0)
(*arg0) = 1;
if ((*arg0) == valBefore)
{
return FALSE;
}
else
{
PlaySE(SE_SELECT);
return TRUE;
}
}
return FALSE;
}
u8 GetLRKeysState(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newKeys & L_BUTTON)
return 1;
if (gMain.newKeys & R_BUTTON)
return 2;
}
return 0;
}
u8 sub_812210C(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newAndRepeatedKeys & L_BUTTON)
return 1;
if (gMain.newAndRepeatedKeys & R_BUTTON)
return 2;
}
return 0;
}
bool8 sub_8122148(u16 itemId)
{
if (itemId != ITEM_ENIGMA_BERRY)
return TRUE;
else if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRADE_CENTER) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRADE_CENTER))
return FALSE;
else if (InUnionRoom() != TRUE)
return TRUE;
else
return FALSE;
}
bool8 itemid_80BF6D8_mail_related(u16 itemId)
{
if (is_c1_link_related_active() != TRUE && InUnionRoom() != TRUE)
return TRUE;
else if (ItemIsMail(itemId) != TRUE)
return TRUE;
else
return FALSE;
}
bool8 sub_81221AC(void)
{
if (is_c1_link_related_active() == TRUE || gReceivedRemoteLinkPlayers == 1)
return TRUE;
else
return FALSE;
}
static bool8 sub_81221D0(void)
{
if (!sub_81221AC())
return FALSE;
else
return sub_8087598();
}
bool8 sub_81221EC(void)
{
if (sub_81221D0() == TRUE)
return TRUE;
else if (sub_800B504() != TRUE)
return FALSE;
else
return TRUE;
}
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount)
{
u16 i;
struct ItemSlot *slots_ = slots;
(*usedSlotsCount) = 0;
for (i = 0; i < count; i++)
{
if (slots_[i].itemId != ITEM_NONE)
(*usedSlotsCount)++;
}
(*usedSlotsCount)++;
if ((*usedSlotsCount) > maxUsedSlotsCount)
*arg2 = maxUsedSlotsCount;
else
*arg2 = (*usedSlotsCount);
}
void sub_812225C(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3)
{
if ((*arg0) != 0 && (*arg0) + arg2 > arg3)
(*arg0) = arg3 - arg2;
if ((*arg0) + (*arg1) >= arg3)
{
if (arg3 == 0)
(*arg1) = 0;
else
(*arg1) = arg3 - 1;
}
}
#ifdef NONMATCHING
void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4)
{
if (arg2 & 1)
{
}
else
{
}
}
#else
NAKED
void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4)
{
asm_unified("\n\
push {r4-r7,lr}\n\
adds r5, r0, 0\n\
adds r4, r1, 0\n\
ldr r0, [sp, 0x14]\n\
lsls r2, 24\n\
lsrs r7, r2, 24\n\
lsls r3, 24\n\
lsrs r6, r3, 24\n\
lsls r2, r0, 24\n\
lsrs r0, r2, 24\n\
movs r1, 0x1\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _081222F0\n\
lsrs r2, 25\n\
ldrh r0, [r4]\n\
cmp r0, r2\n\
bcc _08122322\n\
movs r1, 0\n\
subs r0, r2\n\
cmp r1, r0\n\
bge _08122322\n\
ldrh r0, [r5]\n\
adds r0, r7\n\
cmp r0, r6\n\
beq _08122322\n\
_081222CC:\n\
ldrh r0, [r4]\n\
subs r0, 0x1\n\
strh r0, [r4]\n\
ldrh r0, [r5]\n\
adds r0, 0x1\n\
strh r0, [r5]\n\
adds r0, r1, 0x1\n\
lsls r0, 24\n\
lsrs r1, r0, 24\n\
ldrh r0, [r4]\n\
subs r0, r2\n\
cmp r1, r0\n\
bge _08122322\n\
ldrh r0, [r5]\n\
adds r0, r7\n\
cmp r0, r6\n\
bne _081222CC\n\
b _08122322\n\
_081222F0:\n\
ldrh r3, [r4]\n\
lsrs r2, 25\n\
adds r0, r2, 0x1\n\
cmp r3, r0\n\
blt _08122322\n\
movs r1, 0\n\
subs r0, r3, r2\n\
b _08122316\n\
_08122300:\n\
ldrh r0, [r4]\n\
subs r0, 0x1\n\
strh r0, [r4]\n\
ldrh r0, [r5]\n\
adds r0, 0x1\n\
strh r0, [r5]\n\
adds r0, r1, 0x1\n\
lsls r0, 24\n\
lsrs r1, r0, 24\n\
ldrh r0, [r4]\n\
subs r0, r2\n\
_08122316:\n\
cmp r1, r0\n\
bgt _08122322\n\
ldrh r0, [r5]\n\
adds r0, r7\n\
cmp r0, r6\n\
bne _08122300\n\
_08122322:\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0");
}
#endif // NONMATCHING
void LoadListMenuArrowsGfx(void)
{
LoadCompressedObjectPic(&gUnknown_0859F514);
LoadCompressedObjectPalette(&gUnknown_0859F51C);
}