From 75b52fe80aefd2a6e557fb326f0bce79e1e5a158 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 27 Oct 2017 08:43:10 -0400 Subject: [PATCH] through sub_80EAA18 --- asm/secret_base.s | 77 ----------------------------------------------- src/secret_base.c | 28 +++++++++++++++++ 2 files changed, 28 insertions(+), 77 deletions(-) diff --git a/asm/secret_base.s b/asm/secret_base.s index 5e919e76c..2c87724d5 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,83 +5,6 @@ .text - thumb_func_start sub_80EA9D8 -sub_80EA9D8: @ 80EA9D8 - push {r4,lr} - movs r2, 0x1 - ldr r0, =gSaveBlock1Ptr - ldr r3, [r0] - ldr r4, =0x00001a9c -_080EA9E2: - lsls r0, r2, 16 - asrs r1, r0, 16 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 5 - adds r0, r3, r0 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _080EAA04 - lsls r0, r2, 24 - lsrs r0, 24 - b _080EAA12 - .pool -_080EAA04: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080EA9E2 - movs r0, 0 -_080EAA12: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80EA9D8 - - thumb_func_start sub_80EAA18 -sub_80EAA18: @ 80EAA18 - push {r4,lr} - movs r3, 0x1 - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] -_080EAA20: - lsls r2, r3, 16 - asrs r1, r2, 16 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 5 - adds r0, r4, r0 - ldr r1, =0x00001a9d - adds r0, r1 - ldrb r1, [r0] - lsrs r0, r1, 6 - cmp r0, 0 - bne _080EAA4C - lsls r0, r1, 28 - cmp r0, 0 - bne _080EAA4C - lsls r0, r3, 24 - lsrs r0, 24 - b _080EAA5C - .pool -_080EAA4C: - movs r1, 0x80 - lsls r1, 9 - adds r0, r2, r1 - lsrs r3, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080EAA20 - movs r0, 0 -_080EAA5C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80EAA18 - thumb_func_start sub_80EAA64 sub_80EAA64: @ 80EAA64 push {r4-r7,lr} diff --git a/src/secret_base.c b/src/secret_base.c index b30c913b2..ddef4938b 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1507,3 +1507,31 @@ s16 sub_80EA990(u8 sbId) } return -1; } + +u8 sub_80EA9D8(void) +{ + s16 i; + + for (i = 1; i < 20; i ++) + { + if (gSaveBlock1Ptr->secretBases[i].secretBaseId == 0) + { + return i; + } + } + return 0; +} + +u8 sub_80EAA18(void) +{ + s16 i; + + for (i = 1; i < 20; i ++) + { + if (gSaveBlock1Ptr->secretBases[i].sbr_field_1_6 == 0 && gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 == 0) + { + return i; + } + } + return 0; +}