diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 9ae60d9a7..474eff46f 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -5,132 +5,6 @@ .text - thumb_func_start sub_80E7FF8 -sub_80E7FF8: @ 80E7FF8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x9 - bls _080E8012 - b _080E810A -_080E8012: - lsls r0, 2 - ldr r1, =_080E8024 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E8024: - .4byte _080E80F2 - .4byte _080E804C - .4byte _080E805A - .4byte _080E8064 - .4byte _080E807C - .4byte _080E8090 - .4byte _080E80A4 - .4byte _080E80C0 - .4byte _080E80EE - .4byte _080E80FA -_080E804C: - bl Link_AnyPartnersPlayingRubyOrSapphire - cmp r0, 0 - bne _080E80F2 - movs r0, 0x6 - strh r0, [r4, 0x8] - b _080E810A -_080E805A: - bl sub_8076D5C - bl sub_8153430 - b _080E80F2 -_080E8064: - bl sub_8153474 - lsls r0, 24 - cmp r0, 0 - beq _080E810A - bl sav2_gender2_inplace_and_xFE - movs r1, 0 - movs r0, 0x4 - strh r0, [r4, 0x8] - strh r1, [r4, 0xA] - b _080E810A -_080E807C: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - ble _080E810A - bl sub_800AC34 - b _080E80F2 -_080E8090: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080E810A - adds r0, r5, 0 - bl DestroyTask - b _080E810A - .pool -_080E80A4: - movs r0, 0 - bl sub_801048C - lsls r0, 24 - cmp r0, 0 - bne _080E810A - ldr r0, =sub_8153688 - movs r1, 0x5 - bl CreateTask - b _080E80F2 - .pool -_080E80C0: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _080E810A - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _080E80E8 - movs r0, 0x1 - bl sub_801048C - movs r0, 0x8 - strh r0, [r4, 0x8] - b _080E810A - .pool -_080E80E8: - movs r0, 0x4 - strh r0, [r4, 0x8] - b _080E810A -_080E80EE: - bl sub_800ADF8 -_080E80F2: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080E810A -_080E80FA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080E810A - adds r0, r5, 0 - bl DestroyTask -_080E810A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80E7FF8 - thumb_func_start sub_80E8110 sub_80E8110: @ 80E8110 push {r4-r7,lr} diff --git a/include/link.h b/include/link.h index 77e9a9d24..a33c7da89 100644 --- a/include/link.h +++ b/include/link.h @@ -201,5 +201,6 @@ u8 sub_800AA48(void); void sub_8009FAC(void); void sub_800A4D8(u8); u8 sub_800A9D8(void); +bool8 sub_801048C(u8); #endif // GUARD_LINK_H diff --git a/include/load_save.h b/include/load_save.h index 1f406bbad..ba85d4ad8 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -19,6 +19,7 @@ void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); void SetSaveBlocksPointers(u16); -void MoveSaveBlocks_ResetHeap(void); +void sub_8076D5C(void); +void sav2_gender2_inplace_and_xFE(void); #endif // GUARD_LOAD_SAVE_H diff --git a/include/save.h b/include/save.h index 6c1238cd2..a3473371e 100644 --- a/include/save.h +++ b/include/save.h @@ -92,5 +92,8 @@ u8 HandleSavingData(u8 saveType); //u8 unref_sub_8126080(u8 sector, u8 *data); u16 sub_815355C(void); u8 sub_81534D0(u8); +u8 sub_8153430(void); +bool8 sub_8153474(void); +void sub_8153688(u8 taskId); #endif // GUARD_SAVE_H diff --git a/src/record_mixing.c b/src/record_mixing.c index e8a61a223..afaa091eb 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -8,6 +8,8 @@ #include "item.h" #include "task.h" #include "species.h" +#include "save.h" +#include "load_save.h" #include "pokemon.h" #include "cable_club.h" #include "link.h" @@ -95,8 +97,8 @@ static void sub_80E7948(union BattleTowerRecord *, size_t, u8); static void sub_80E7A14(LilycoveLady *, size_t, u8); static void sub_80E7B2C(const u8 *); static void sub_80E7B60(struct UnkStruct_80E7B60 *, size_t, u8, TVShow *); -void sub_80E7F68(u16 *item, u8 which); -void sub_80E7FF8(u8 taskId); +static void sub_80E7F68(u16 *item, u8 which); +static void sub_80E7FF8(u8 taskId); void sub_80E8110(void *, void *); void sub_80E8468(void *, size_t, u8); void sub_80E89AC(void *, size_t, u8); @@ -1442,3 +1444,83 @@ static void sub_80E7F68(u16 *item, u8 which) } } } + +static void sub_80E7FF8(u8 taskId) +{ + struct Task *task; + + task = &gTasks[taskId]; + switch (task->data[0]) + { + case 0: + task->data[0] ++; + break; + case 1: + if (Link_AnyPartnersPlayingRubyOrSapphire()) + { + task->data[0] ++; + } + else + { + task->data[0] = 6; + } + break; + case 2: + sub_8076D5C(); + sub_8153430(); + task->data[0] ++; + break; + case 3: + if (sub_8153474()) + { + sav2_gender2_inplace_and_xFE(); + task->data[0] = 4; + task->data[1] = 0; + } + break; + case 4: + if (++ task->data[1] > 10) + { + sub_800AC34(); + task->data[0] ++; + } + break; + case 5: + if (gReceivedRemoteLinkPlayers == 0) + { + DestroyTask(taskId); + } + break; + case 6: + if (!sub_801048C(0)) + { + CreateTask(sub_8153688, 5); + task->data[0] ++; + } + break; + case 7: + if (!FuncIsActiveTask(sub_8153688)) + { + if (gLinkVSyncDisabled) + { + sub_801048C(1); + task->data[0] = 8; + } + else + { + task->data[0] = 4; + } + } + break; + case 8: + sub_800ADF8(); + task->data[0] ++; + break; + case 9: + if (sub_800A520()) + { + DestroyTask(taskId); + } + break; + } +}