decompile sub_80FA8EC - sub_80FAB60

This commit is contained in:
camthesaxman 2017-07-14 17:24:36 -05:00
parent a0e590b739
commit 48407f4c37
5 changed files with 158 additions and 583 deletions

View File

@ -6,324 +6,6 @@
.text
thumb_func_start sub_80FA8EC
sub_80FA8EC: @ 80FA8EC
push {lr}
lsls r1, 24
lsrs r1, 24
bl sub_80FA904
_080FA8F6:
bl sub_80FA940
lsls r0, 24
cmp r0, 0
bne _080FA8F6
pop {r0}
bx r0
thumb_func_end sub_80FA8EC
thumb_func_start sub_80FA904
sub_80FA904: @ 80FA904
push {r4,lr}
lsls r1, 24
lsrs r1, 24
ldr r3, _080FA928 @ =gUnknown_020388CC
str r0, [r3]
movs r2, 0x79
adds r2, r0
mov r12, r2
movs r2, 0
mov r4, r12
strb r2, [r4]
adds r0, 0x78
strb r1, [r0]
ldr r3, [r3]
cmp r1, 0
bne _080FA930
ldr r0, _080FA92C @ =sub_80FAB78
b _080FA932
.align 2, 0
_080FA928: .4byte gUnknown_020388CC
_080FA92C: .4byte sub_80FAB78
_080FA930:
ldr r0, _080FA93C @ =sub_80FAD04
_080FA932:
str r0, [r3, 0x18]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080FA93C: .4byte sub_80FAD04
thumb_func_end sub_80FA904
thumb_func_start sub_80FA940
sub_80FA940: @ 80FA940
push {r4,r5,lr}
sub sp, 0xC
ldr r0, _080FA95C @ =gUnknown_020388CC
ldr r0, [r0]
adds r0, 0x79
ldrb r0, [r0]
cmp r0, 0x7
bls _080FA952
b _080FAAE2
_080FA952:
lsls r0, 2
ldr r1, _080FA960 @ =_080FA964
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_080FA95C: .4byte gUnknown_020388CC
_080FA960: .4byte _080FA964
.align 2, 0
_080FA964:
.4byte _080FA984
.4byte _080FA998
.4byte _080FA9AC
.4byte _080FA9BC
.4byte _080FA9D8
.4byte _080FA9F4
.4byte _080FAA38
.4byte _080FAAB4
_080FA984:
ldr r0, _080FA990 @ =gUnknown_083E5DA0
ldr r1, _080FA994 @ =0x06008000
bl LZ77UnCompVram
b _080FAAF4
.align 2, 0
_080FA990: .4byte gUnknown_083E5DA0
_080FA994: .4byte 0x06008000
_080FA998:
ldr r0, _080FA9A4 @ =gUnknown_083E6B04
ldr r1, _080FA9A8 @ =0x0600e000
bl LZ77UnCompVram
b _080FAAF4
.align 2, 0
_080FA9A4: .4byte gUnknown_083E6B04
_080FA9A8: .4byte 0x0600e000
_080FA9AC:
ldr r0, _080FA9B8 @ =gUnknown_083E5D60
movs r1, 0x70
movs r2, 0x60
bl LoadPalette
b _080FAAF4
.align 2, 0
_080FA9B8: .4byte gUnknown_083E5D60
_080FA9BC:
ldr r0, _080FA9D0 @ =gUnknown_083E5AF0
ldr r1, _080FA9D4 @ =gUnknown_020388CC
ldr r1, [r1]
movs r2, 0xC0
lsls r2, 1
adds r1, r2
bl LZ77UnCompWram
b _080FAAF4
.align 2, 0
_080FA9D0: .4byte gUnknown_083E5AF0
_080FA9D4: .4byte gUnknown_020388CC
_080FA9D8:
ldr r0, _080FA9EC @ =gUnknown_083E5B34
ldr r1, _080FA9F0 @ =gUnknown_020388CC
ldr r1, [r1]
movs r3, 0xA0
lsls r3, 2
adds r1, r3
bl LZ77UnCompWram
b _080FAAF4
.align 2, 0
_080FA9EC: .4byte gUnknown_083E5B34
_080FA9F0: .4byte gUnknown_020388CC
_080FA9F4:
bl sub_80FB32C
ldr r4, _080FAA34 @ =gUnknown_020388CC
ldr r2, [r4]
adds r0, r2, 0
adds r0, 0x54
ldrh r1, [r0]
adds r0, 0x20
strh r1, [r0]
subs r0, 0x1E
ldrh r0, [r0]
adds r1, r2, 0
adds r1, 0x76
strh r0, [r1]
ldrh r0, [r2, 0x14]
bl sub_80FB758
ldr r1, [r4]
strb r0, [r1, 0x16]
ldr r0, [r4]
ldrh r0, [r0, 0x14]
bl sub_80FB9C0
adds r1, r0, 0
ldr r0, [r4]
strh r1, [r0, 0x14]
ldrh r1, [r0, 0x14]
movs r2, 0x10
bl sub_80FBFB4
b _080FAAF4
.align 2, 0
_080FAA34: .4byte gUnknown_020388CC
_080FAA38:
ldr r0, _080FAA60 @ =gUnknown_020388CC
ldr r4, [r0]
adds r0, r4, 0
adds r0, 0x78
ldrb r1, [r0]
cmp r1, 0
bne _080FAA64
movs r0, 0x80
lsls r0, 1
str r0, [sp]
str r0, [sp, 0x4]
str r1, [sp, 0x8]
movs r0, 0
movs r1, 0
movs r2, 0
movs r3, 0
bl sub_80FB170
b _080FAAF4
.align 2, 0
_080FAA60: .4byte gUnknown_020388CC
_080FAA64:
adds r1, r4, 0
adds r1, 0x54
ldrh r0, [r1]
lsls r0, 3
subs r0, 0x34
adds r2, r4, 0
adds r2, 0x5C
movs r3, 0
strh r0, [r2]
movs r5, 0x56
adds r5, r4
mov r12, r5
ldrh r0, [r5]
lsls r0, 3
subs r0, 0x44
adds r5, r4, 0
adds r5, 0x5E
strh r0, [r5]
ldrh r1, [r1]
adds r0, r4, 0
adds r0, 0x64
strh r1, [r0]
mov r0, r12
ldrh r1, [r0]
adds r0, r4, 0
adds r0, 0x66
strh r1, [r0]
movs r1, 0
ldrsh r0, [r2, r1]
movs r2, 0
ldrsh r1, [r5, r2]
movs r2, 0x80
str r2, [sp]
str r2, [sp, 0x4]
str r3, [sp, 0x8]
movs r2, 0x38
movs r3, 0x48
bl sub_80FB170
b _080FAAF4
_080FAAB4:
bl sub_80FBA18
bl sub_80FB260
ldr r2, _080FAAE8 @ =gUnknown_020388CC
ldr r0, [r2]
movs r1, 0
str r1, [r0, 0x1C]
str r1, [r0, 0x20]
adds r0, 0x7A
strb r1, [r0]
ldr r0, [r2]
adds r0, 0x7E
strb r1, [r0]
ldr r1, _080FAAEC @ =REG_BG2CNT
ldr r3, _080FAAF0 @ =0x0000bc8a
adds r0, r3, 0
strh r0, [r1]
ldr r1, [r2]
adds r1, 0x79
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
_080FAAE2:
movs r0, 0
b _080FAB02
.align 2, 0
_080FAAE8: .4byte gUnknown_020388CC
_080FAAEC: .4byte REG_BG2CNT
_080FAAF0: .4byte 0x0000bc8a
_080FAAF4:
ldr r0, _080FAB0C @ =gUnknown_020388CC
ldr r1, [r0]
adds r1, 0x79
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
movs r0, 0x1
_080FAB02:
add sp, 0xC
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_080FAB0C: .4byte gUnknown_020388CC
thumb_func_end sub_80FA940
thumb_func_start sub_80FAB10
sub_80FAB10: @ 80FAB10
push {r4,lr}
ldr r4, _080FAB5C @ =gUnknown_020388CC
ldr r0, [r4]
ldr r0, [r0, 0x1C]
cmp r0, 0
beq _080FAB34
bl DestroySprite
ldr r0, [r4]
adds r0, 0x58
ldrh r0, [r0]
bl FreeSpriteTilesByTag
ldr r0, [r4]
adds r0, 0x5A
ldrh r0, [r0]
bl FreeSpritePaletteByTag
_080FAB34:
ldr r0, [r4]
ldr r0, [r0, 0x20]
cmp r0, 0
beq _080FAB54
bl DestroySprite
ldr r0, [r4]
adds r0, 0x70
ldrh r0, [r0]
bl FreeSpriteTilesByTag
ldr r0, [r4]
adds r0, 0x72
ldrh r0, [r0]
bl FreeSpritePaletteByTag
_080FAB54:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080FAB5C: .4byte gUnknown_020388CC
thumb_func_end sub_80FAB10
thumb_func_start sub_80FAB60
sub_80FAB60: @ 80FAB60
push {lr}
ldr r0, _080FAB74 @ =gUnknown_020388CC
ldr r0, [r0]
ldr r0, [r0, 0x18]
bl _call_via_r0
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.align 2, 0
_080FAB74: .4byte gUnknown_020388CC
thumb_func_end sub_80FAB60
thumb_func_start sub_80FAB78
sub_80FAB78: @ 80FAB78
push {r4,lr}

View File

@ -3,46 +3,6 @@
.section .rodata
.align 2
gPokenavCursor_Pal::
.incbin "graphics/pokenav/cursor.gbapal"
.align 2
gUnknown_083E5AF0:: @ 83E5AF0
.incbin "graphics/pokenav/cursor_small.4bpp.lz"
.align 2
gUnknown_083E5B34:: @ 83E5B34
.incbin "graphics/pokenav/cursor_large.4bpp.lz"
.align 2
gRegionMapBrendanIconPalette:: @ 83E5C20
.incbin "graphics/pokenav/brendan_icon.gbapal"
.align 2
gRegionMapBrendanIconTiles:: @ 83E5C40
.incbin "graphics/pokenav/brendan_icon.4bpp"
.align 2
gRegionMapMayIconPalette:: @ 83E5CC0
.incbin "graphics/pokenav/may_icon.gbapal"
.align 2
gRegionMapMayIconTiles:: @ 83E5CE0
.incbin "graphics/pokenav/may_icon.4bpp"
.align 2
gUnknown_083E5D60:: @ 83E5D60
.incbin "graphics/pokenav/region_map.gbapal", 0xE0, 0x40
.align 2
gUnknown_083E5DA0:: @ 83E5DA0
.incbin "graphics/pokenav/region_map.8bpp.lz"
.align 2
gUnknown_083E6B04:: @ 83E6B04
.incbin "graphics/pokenav/region_map_map.bin.lz"
@ 83E6E50
.include "data/region_map_sections.inc"

View File

@ -1,118 +1,6 @@
JASC-PAL
0100
256
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 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asm/region_map.o(.text);
asm/cute_sketch.o(.text);
src/decoration.o(.text);
@ -428,6 +429,7 @@ SECTIONS {
data/mail.o(.rodata);
data/menu_helpers.o(.rodata);
src/heal_location.o(.rodata);
src/region_map.o(.rodata);
data/region_map.o(.rodata);
data/cute_sketch.o(.rodata);
src/decoration.o(.rodata);

155
src/region_map.c Normal file
View File

@ -0,0 +1,155 @@
#include "global.h"
#include "palette.h"
#include "sprite.h"
struct UnknownStruct1
{
u8 filler0[0x14];
u16 unk14;
u8 unk16;
u8 filler17[1];
u8 (*unk18)(void);
struct Sprite *unk1C;
struct Sprite *unk20;
u8 filler24[0x30];
u16 unk54;
u16 unk56;
u16 unk58;
u16 unk5A;
s16 unk5C;
s16 unk5E;
u8 filler60[4];
u16 unk64;
u16 unk66;
u8 filler68[8];
u16 unk70;
u16 unk72;
u16 unk74;
u16 unk76;
u8 unk78;
u8 unk79;
u8 unk7A;
u8 filler7B[3];
u8 unk7E;
u8 filler7F[0x101];
u8 unk180[0x100];
u8 unk280[0x100];
};
extern struct UnknownStruct1 *gUnknown_020388CC;
const u16 gPokenavCursor_Pal[] = INCBIN_U16("graphics/pokenav/cursor.gbapal");
const u8 gUnknown_083E5AF0[] = INCBIN_U8("graphics/pokenav/cursor_small.4bpp.lz");
const u8 gUnknown_083E5B34[] = INCBIN_U8("graphics/pokenav/cursor_large.4bpp.lz");
const u16 gRegionMapBrendanIconPalette[] = INCBIN_U16("graphics/pokenav/brendan_icon.gbapal");
const u8 gRegionMapBrendanIconTiles[] = INCBIN_U8("graphics/pokenav/brendan_icon.4bpp");
const u16 gRegionMapMayIconPalette[] = INCBIN_U16("graphics/pokenav/may_icon.gbapal");
const u8 gRegionMapMayIconTiles[] = INCBIN_U8("graphics/pokenav/may_icon.4bpp");
const u16 gUnknown_083E5D60[] = INCBIN_U16("graphics/pokenav/region_map.gbapal");
const u8 gUnknown_083E5DA0[] = INCBIN_U8("graphics/pokenav/region_map.8bpp.lz");
const u8 gUnknown_083E6B04[] = INCBIN_U8("graphics/pokenav/region_map_map.bin.lz");
void sub_80FA904(struct UnknownStruct1 *, u8);
bool8 sub_80FA940(void);
u8 sub_80FAB78(void);
u8 sub_80FAD04(void);
void sub_80FB170();
void sub_80FB260(void);
void sub_80FB32C(void);
u16 sub_80FB758();
u16 sub_80FB9C0(u16);
void sub_80FBA18();
void sub_80FBFB4();
void sub_80FA8EC(struct UnknownStruct1 *a, u8 b)
{
sub_80FA904(a, b);
while (sub_80FA940())
;
}
void sub_80FA904(struct UnknownStruct1 *a, u8 b)
{
gUnknown_020388CC = a;
gUnknown_020388CC->unk79 = 0;
gUnknown_020388CC->unk78 = b;
gUnknown_020388CC->unk18 = (b == 0) ? sub_80FAB78 : sub_80FAD04;
}
bool8 sub_80FA940(void)
{
switch (gUnknown_020388CC->unk79)
{
case 0:
LZ77UnCompVram(gUnknown_083E5DA0, (void *)(VRAM + 0x8000));
break;
case 1:
LZ77UnCompVram(gUnknown_083E6B04, (void *)(VRAM + 0xE000));
break;
case 2:
LoadPalette(gUnknown_083E5D60, 0x70, 0x60); // Why isn't this the right size?
break;
case 3:
LZ77UnCompWram(gUnknown_083E5AF0, gUnknown_020388CC->unk180);
break;
case 4:
LZ77UnCompWram(gUnknown_083E5B34, gUnknown_020388CC->unk280);
break;
case 5:
sub_80FB32C();
gUnknown_020388CC->unk74 = gUnknown_020388CC->unk54;
gUnknown_020388CC->unk76 = gUnknown_020388CC->unk56;
gUnknown_020388CC->unk16 = sub_80FB758(gUnknown_020388CC->unk14);
gUnknown_020388CC->unk14 = sub_80FB9C0(gUnknown_020388CC->unk14);
sub_80FBFB4(gUnknown_020388CC, gUnknown_020388CC->unk14, 16);
break;
case 6:
if (gUnknown_020388CC->unk78 == 0)
{
sub_80FB170(0, 0, 0, 0, 0x100, 0x100, 0);
}
else
{
gUnknown_020388CC->unk5C = gUnknown_020388CC->unk54 * 8 - 0x34;
gUnknown_020388CC->unk5E = gUnknown_020388CC->unk56 * 8 - 0x44;
gUnknown_020388CC->unk64 = gUnknown_020388CC->unk54;
gUnknown_020388CC->unk66 = gUnknown_020388CC->unk56;
sub_80FB170(gUnknown_020388CC->unk5C, gUnknown_020388CC->unk5E, 0x38, 0x48, 0x80, 0x80, 0);
}
break;
case 7:
sub_80FBA18();
sub_80FB260();
gUnknown_020388CC->unk1C = NULL;
gUnknown_020388CC->unk20 = NULL;
gUnknown_020388CC->unk7A = 0;
gUnknown_020388CC->unk7E = 0;
REG_BG2CNT = 0xBC8A;
gUnknown_020388CC->unk79++;
default:
return FALSE;
}
gUnknown_020388CC->unk79++;
return TRUE;
}
void sub_80FAB10(void)
{
if (gUnknown_020388CC->unk1C != NULL)
{
DestroySprite(gUnknown_020388CC->unk1C);
FreeSpriteTilesByTag(gUnknown_020388CC->unk58);
FreeSpritePaletteByTag(gUnknown_020388CC->unk5A);
}
if (gUnknown_020388CC->unk20 != NULL)
{
DestroySprite(gUnknown_020388CC->unk20);
FreeSpriteTilesByTag(gUnknown_020388CC->unk70);
FreeSpritePaletteByTag(gUnknown_020388CC->unk72);
}
}
u8 sub_80FAB60(void)
{
return gUnknown_020388CC->unk18();
}