More decompiled and cleanup

This commit is contained in:
Phlosioneer 2019-03-05 22:32:28 -05:00
parent c3594f982d
commit 4345ba8e6c
6 changed files with 226 additions and 263 deletions

View File

@ -6,212 +6,6 @@
.text
thumb_func_start sub_81D1F84
sub_81D1F84: @ 81D1F84
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r8, r0
str r1, [sp]
mov r9, r2
movs r7, 0
_081D1F98:
lsls r4, r7, 2
ldr r1, [sp]
adds r0, r4, r1
ldrh r1, [r0]
lsls r5, r1, 8
mov r2, r9
adds r0, r4, r2
ldrh r0, [r0]
subs r0, r1
lsls r0, 8
movs r1, 0xA
bl __divsi3
adds r6, r0, 0
movs r3, 0
adds r7, 0x1
mov r10, r7
mov r12, r4
_081D1FBC:
lsls r0, r3, 2
adds r0, r3
lsls r0, 2
add r0, r12
add r0, r8
asrs r2, r5, 8
asrs r1, r5, 7
movs r7, 0x1
ands r1, r7
adds r2, r1
adds r0, 0x64
strh r2, [r0]
adds r5, r6
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
cmp r3, 0x8
bls _081D1FBC
lsls r0, r3, 2
adds r0, r3
lsls r0, 2
adds r0, r4, r0
add r0, r8
mov r1, r9
adds r2, r4, r1
ldrh r1, [r2]
adds r0, 0x64
strh r1, [r0]
ldr r7, [sp]
adds r0, r4, r7
ldrh r1, [r0, 0x2]
lsls r5, r1, 8
ldrh r0, [r2, 0x2]
subs r0, r1
lsls r0, 8
movs r1, 0xA
bl __divsi3
adds r6, r0, 0
movs r3, 0
str r4, [sp, 0x4]
movs r0, 0x1
mov r12, r0
_081D2012:
lsls r0, r3, 2
adds r0, r3
lsls r0, 2
ldr r1, [sp, 0x4]
adds r0, r1, r0
add r0, r8
asrs r2, r5, 8
asrs r1, r5, 7
mov r7, r12
ands r1, r7
adds r2, r1
adds r0, 0x66
strh r2, [r0]
adds r5, r6
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
cmp r3, 0x8
bls _081D2012
lsls r0, r3, 2
adds r0, r3
lsls r0, 2
adds r0, r4, r0
add r0, r8
mov r2, r9
adds r1, r4, r2
ldrh r1, [r1, 0x2]
adds r0, 0x66
strh r1, [r0]
mov r7, r10
lsls r0, r7, 16
lsrs r7, r0, 16
cmp r7, 0x4
bls _081D1F98
ldr r1, =0x00000352
add r1, r8
movs r0, 0
strh r0, [r1]
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81D1F84
thumb_func_start sub_81D2074
sub_81D2074: @ 81D2074
push {r4,lr}
adds r1, r0, 0
ldr r0, =0x00000352
adds r4, r1, r0
ldrh r0, [r4]
cmp r0, 0x9
bls _081D208C
movs r0, 0
b _081D20A6
.pool
_081D208C:
adds r0, r1, 0
bl sub_81D2230
ldrh r1, [r4]
adds r1, 0x1
strh r1, [r4]
lsls r1, 16
lsrs r1, 16
movs r0, 0xA
eors r1, r0
negs r0, r1
orrs r0, r1
lsrs r0, 31
_081D20A6:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81D2074
thumb_func_start sub_81D20AC
sub_81D20AC: @ 81D20AC
ldr r1, =0x00000355
adds r0, r1
movs r1, 0
strb r1, [r0]
bx lr
.pool
thumb_func_end sub_81D20AC
thumb_func_start sub_81D20BC
sub_81D20BC: @ 81D20BC
push {r4,r5,lr}
sub sp, 0xC
ldr r1, =0x00000355
adds r4, r0, r1
ldrb r0, [r4]
cmp r0, 0
beq _081D20D4
cmp r0, 0x1
beq _081D20E2
b _081D20FA
.pool
_081D20D4:
bl ScanlineEffect_Clear
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
movs r0, 0x1
b _081D20FC
_081D20E2:
mov r0, sp
ldr r1, =gUnknown_08625404
ldm r1!, {r2,r3,r5}
stm r0!, {r2,r3,r5}
ldr r0, [sp]
ldr r1, [sp, 0x4]
ldr r2, [sp, 0x8]
bl ScanlineEffect_SetParams
ldrb r0, [r4]
adds r0, 0x1
strb r0, [r4]
_081D20FA:
movs r0, 0
_081D20FC:
add sp, 0xC
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_81D20BC
thumb_func_start sub_81D2108
sub_81D2108: @ 81D2108
push {r4-r7,lr}

View File

@ -3,14 +3,6 @@
.section .rodata
@ ScanlineEffectParams
gUnknown_08625404:: @ 8625404
.4byte 0x04000040 @ REG_ADDR_WIN0H
.4byte 0xA6600001 @ SCANLINE_EFFECT_DMACNT_32BIT
.byte 1 @ initState
.byte 0 @ unused9
.byte 0, 0 @ Padding
gUnknown_08625410:: @ 8625410
.byte 4, 5, 6, 7, 8, 9, 9, 0xA, 0xA, 0xB, 0xB, 0xC, 0xC, 0xD, 0xD, 0xD, 0xD, 0xE, 0xE, 0xE, 0xE, 0xF, 0xF, 0xF, 0xF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23

View File

@ -18,7 +18,8 @@ struct UnknownStruct_81D1ED4
u8 unk13C[0x216];
u16 unk352;
u8 unk354;
u8 unk355[0x23];
u8 unk355;
u8 unk356[0x22];
};
bool8 sub_81D1C44(u8 a0);
@ -33,6 +34,7 @@ void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0);
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(struct UnknownStruct_81D1ED4 *arg0, void *arg1);

View File

@ -2,7 +2,6 @@
#define GUARD_POKENAV_H
#include "list_menu.h"
bool8 sub_81D20BC(void *arg0);
bool8 sub_81D312C(void *arg0);
bool8 sub_81D4A58(struct EventObject*);
void MoveRelearnerPrintText(u8 *);

View File

@ -9,72 +9,76 @@
#include "string_util.h"
#include "window.h"
#include "constants/songs.h"
#include "scanline_effect.h"
#define WINDOW_UNK_0 0
#define WINDOW_UNK_1 1
#define WINDOW_UNK_2 2
extern struct ListMenuItem *gUnknown_0203CF4C;
extern u8 gUnknown_0203CF48[3];
EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0};
EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL;
void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list);
const struct WindowTemplate gUnknown_086253E8[] =
static const struct WindowTemplate sUnknown_086253E8[] =
{
[WINDOW_UNK_0] = {
//0x08010100,
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 8,
//0x00080F02,
.height = 2,
.paletteNum = 0xF,
.baseBlock = 0x8
},
[WINDOW_UNK_1] = {
//0x08 01 15 00,
.bg = 0,
.tilemapLeft = 21,
.tilemapTop = 1,
.width = 8,
//0x0018 0F 12,
.height = 18,
.paletteNum = 0xF,
.baseBlock = 0x18
},
[WINDOW_UNK_2] = {
//0x0B 01 01 00
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 11,
//0x0018 0F 08
.height = 8,
.paletteNum = 0xF,
.baseBlock = 0x18
}
};
const u8 gUnknown_08625400[] = {
static const u8 sUnknown_08625400[] =
{
1, 2, 3
};
static const u8 sEmptyItemName[] = _("");
static const struct ScanlineEffectParams sUnknown_08625404 =
{
.dmaDest = (void*)REG_ADDR_WIN0H,
.dmaControl = SCANLINE_EFFECT_DMACNT_32BIT,
.initState = 1,
.unused9 = 0
};
bool8 sub_81D1C44(u8 count)
{
u32 i;
struct ListMenuItem **v1;
v1 = &gUnknown_0203CF4C;
v1 = &sUnknown_0203CF4C;
*v1 = Alloc(count * sizeof(struct ListMenuItem) + sizeof(struct ListMenuItem));
if (gUnknown_0203CF4C == NULL)
if (sUnknown_0203CF4C == NULL)
return FALSE;
for (i = 0; i < ARRAY_COUNT(gUnknown_0203CF48); i = (u8)(i + 1))
for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i = (u8)(i + 1))
{
gUnknown_0203CF48[i] |= 0xFF;
sUnknown_0203CF48[i] |= 0xFF;
}
return TRUE;
@ -84,7 +88,7 @@ u8 sub_81D1C84(u8 a0)
{
struct WindowTemplate template;
u8 windowId = gUnknown_0203CF48[a0];
u8 windowId = sUnknown_0203CF48[a0];
if (windowId == 0xFF)
{
if (a0 == WINDOW_UNK_2)
@ -93,31 +97,31 @@ u8 sub_81D1C84(u8 a0)
u32 v2;
s32 v3;
template = gUnknown_086253E8[WINDOW_UNK_2];
template = sUnknown_086253E8[WINDOW_UNK_2];
v3 = GetMaxWidthInMenuTable(&gMailboxMailOptions[0], 4);
template.width = v3;
gUnknown_0203CF48[WINDOW_UNK_2] = AddWindow(&template);
sUnknown_0203CF48[WINDOW_UNK_2] = AddWindow(&template);
}
else
{
gUnknown_0203CF48[a0] = AddWindow(&gUnknown_086253E8[a0]);
sUnknown_0203CF48[a0] = AddWindow(&sUnknown_086253E8[a0]);
}
SetStandardWindowBorderStyle(gUnknown_0203CF48[a0], 0);
SetStandardWindowBorderStyle(sUnknown_0203CF48[a0], 0);
}
return gUnknown_0203CF48[a0];
return sUnknown_0203CF48[a0];
}
void sub_81D1D04(u8 a0)
{
sub_8198070(gUnknown_0203CF48[a0], 0);
ClearWindowTilemap(gUnknown_0203CF48[a0]);
RemoveWindow(gUnknown_0203CF48[a0]);
gUnknown_0203CF48[a0] = 0xFF;
sub_8198070(sUnknown_0203CF48[a0], 0);
ClearWindowTilemap(sUnknown_0203CF48[a0]);
RemoveWindow(sUnknown_0203CF48[a0]);
sUnknown_0203CF48[a0] = 0xFF;
}
u8 sub_81D1D34(u8 a0)
{
return gUnknown_0203CF48[a0];
return sUnknown_0203CF48[a0];
}
void sub_81D1D44(u8 windowId, s32 itemId, u8 y)
@ -133,7 +137,7 @@ void sub_81D1D44(u8 windowId, s32 itemId, u8 y)
length = StringLength(buffer);
if (length <= 5)
ConvertInternationalString(buffer, LANGUAGE_JAPANESE);
AddTextPrinterParameterized4(windowId, 1, 8, y, 0, 0, gUnknown_08625400, -1, buffer);
AddTextPrinterParameterized4(windowId, 1, 8, y, 0, 0, sUnknown_08625400, -1, buffer);
}
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page)
@ -141,16 +145,16 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page)
u16 i;
for (i = 0; i < page->count; i++)
{
gUnknown_0203CF4C[i].name = sEmptyItemName;
gUnknown_0203CF4C[i].id = i;
sUnknown_0203CF4C[i].name = sEmptyItemName;
sUnknown_0203CF4C[i].id = i;
}
gUnknown_0203CF4C[i].name = gText_Cancel2;
gUnknown_0203CF4C[i].id = LIST_CANCEL;
sUnknown_0203CF4C[i].name = gText_Cancel2;
sUnknown_0203CF4C[i].id = LIST_CANCEL;
gMultiuseListMenuTemplate.items = gUnknown_0203CF4C;
gMultiuseListMenuTemplate.items = sUnknown_0203CF4C;
gMultiuseListMenuTemplate.totalItems = page->count + 1;
gMultiuseListMenuTemplate.windowId = gUnknown_0203CF48[1];
gMultiuseListMenuTemplate.windowId = sUnknown_0203CF48[1];
gMultiuseListMenuTemplate.header_X = 0;
gMultiuseListMenuTemplate.item_X = 8;
gMultiuseListMenuTemplate.cursor_X = 0;
@ -182,40 +186,216 @@ void sub_81D1E90(struct PlayerPCItemPageStruct *page)
void sub_81D1EC0(void)
{
Free(gUnknown_0203CF4C);
Free(sUnknown_0203CF4C);
}
void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0)
{
u8 j;
u8 i;
u8 v1;
for (j = 0; j < 5; j++)
{
for (i = 0; i < 10; i++)
{
// u16
a0->unk64[i][j].unk0 = 0;
a0->unk64[i][j].unk2 = 0;
}
for (i = 0; i < 4; i++)
{
// u8
a0->unk0[i][j] = 0;
// u16
a0->unk14[i][j].unk0 = 0x9B;
a0->unk14[i][j].unk2 = 0x5B;
}
// u16
a0->unk12C[j].unk0 = 0;
a0->unk12C[j].unk2 = 0;
}
// u8
a0->unk354 = 0;
// u16
a0->unk352 = 0;
}
NAKED
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 arg1[4][5], struct UnknownSubStruct_81D1ED4 arg2[4][5])
{
/*
u16 j;
u16 i;
s16 v1;
s16 v2;
for (j = 0; j < 5; j++)
{
v1 = arg1[0][j].unk0;
v2 = (arg2[0][j].unk0 - v1) / 10;
for (i = 0; i < 9; i++)
{
arg0->unk64[i][j].unk0 = v1 + ((v1 << 1) & 1);
}
for (i = 0; i < 9; i++)
{
}
}
*/
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x8\n\
mov r8, r0\n\
str r1, [sp]\n\
mov r9, r2\n\
movs r7, 0\n\
_081D1F98:\n\
lsls r4, r7, 2\n\
ldr r1, [sp]\n\
adds r0, r4, r1\n\
ldrh r1, [r0]\n\
lsls r5, r1, 8\n\
mov r2, r9\n\
adds r0, r4, r2\n\
ldrh r0, [r0]\n\
subs r0, r1\n\
lsls r0, 8\n\
movs r1, 0xA\n\
bl __divsi3\n\
adds r6, r0, 0\n\
movs r3, 0\n\
adds r7, 0x1\n\
mov r10, r7\n\
mov r12, r4\n\
_081D1FBC:\n\
lsls r0, r3, 2\n\
adds r0, r3\n\
lsls r0, 2\n\
add r0, r12\n\
add r0, r8\n\
asrs r2, r5, 8\n\
asrs r1, r5, 7\n\
movs r7, 0x1\n\
ands r1, r7\n\
adds r2, r1\n\
adds r0, 0x64\n\
strh r2, [r0]\n\
adds r5, r6\n\
adds r0, r3, 0x1\n\
lsls r0, 16\n\
lsrs r3, r0, 16\n\
cmp r3, 0x8\n\
bls _081D1FBC\n\
lsls r0, r3, 2\n\
adds r0, r3\n\
lsls r0, 2\n\
adds r0, r4, r0\n\
add r0, r8\n\
mov r1, r9\n\
adds r2, r4, r1\n\
ldrh r1, [r2]\n\
adds r0, 0x64\n\
strh r1, [r0]\n\
ldr r7, [sp]\n\
adds r0, r4, r7\n\
ldrh r1, [r0, 0x2]\n\
lsls r5, r1, 8\n\
ldrh r0, [r2, 0x2]\n\
subs r0, r1\n\
lsls r0, 8\n\
movs r1, 0xA\n\
bl __divsi3\n\
adds r6, r0, 0\n\
movs r3, 0\n\
str r4, [sp, 0x4]\n\
movs r0, 0x1\n\
mov r12, r0\n\
_081D2012:\n\
lsls r0, r3, 2\n\
adds r0, r3\n\
lsls r0, 2\n\
ldr r1, [sp, 0x4]\n\
adds r0, r1, r0\n\
add r0, r8\n\
asrs r2, r5, 8\n\
asrs r1, r5, 7\n\
mov r7, r12\n\
ands r1, r7\n\
adds r2, r1\n\
adds r0, 0x66\n\
strh r2, [r0]\n\
adds r5, r6\n\
adds r0, r3, 0x1\n\
lsls r0, 16\n\
lsrs r3, r0, 16\n\
cmp r3, 0x8\n\
bls _081D2012\n\
lsls r0, r3, 2\n\
adds r0, r3\n\
lsls r0, 2\n\
adds r0, r4, r0\n\
add r0, r8\n\
mov r2, r9\n\
adds r1, r4, r2\n\
ldrh r1, [r1, 0x2]\n\
adds r0, 0x66\n\
strh r1, [r0]\n\
mov r7, r10\n\
lsls r0, r7, 16\n\
lsrs r7, r0, 16\n\
cmp r7, 0x4\n\
bls _081D1F98\n\
ldr r1, =0x00000352\n\
add r1, r8\n\
movs r0, 0\n\
strh r0, [r1]\n\
add sp, 0x8\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0)
{
if (a0->unk352 < 10)
{
sub_81D2230(a0);
return ++a0->unk352 != 10;
}
else
{
return FALSE;
}
}
void sub_81D20AC(struct UnknownStruct_81D1ED4 *a0)
{
a0->unk355 = 0;
}
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0)
{
struct ScanlineEffectParams params;
switch (arg0->unk355)
{
case 0:
ScanlineEffect_Clear();
arg0->unk355++;
return TRUE;
case 1:
params = sUnknown_08625404;
ScanlineEffect_SetParams(params);
arg0->unk355++;
return FALSE;
default:
return FALSE;
}
}

View File

@ -237,11 +237,7 @@ gUnknown_0203CF40: @ 203CF40
gUnknown_0203CF44: @ 203CF44
.space 0x4
gUnknown_0203CF48: @ 203CF48
.space 0x4
gUnknown_0203CF4C: @ 203CF4C
.space 0x4
.include "src/menu_unknown.o"
gUnknown_0203CF50: @ 203CF50
.space 0x4