From 4df1937738c4dc39d23f5c4e4b0d6a3774ff1b17 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 31 Oct 2016 03:14:22 -0500 Subject: [PATCH] Ported task.c and others from pokeruby --- Makefile | 1 - asm/main_menu.s | 38 +- asm/rom_80093CC.s | 402 +++---- asm/rom_8032654.s | 388 +++---- asm/rom_80A18F4.s | 78 +- asm/rom_80A92F4.s | 1988 +++++++++++++++++----------------- asm/rom_81BAD84.s | 278 ++--- asm/task.s | 528 --------- asm/tileset_animation.s | 4 +- data/cry_id_table.s | 137 +++ data/data2.s | 4 +- data/graphics.s | 21 +- graphics/intro/copyright.bin | Bin 0 -> 2048 bytes graphics/intro/copyright.pal | 19 + graphics/intro/copyright.png | Bin 0 -> 538 bytes graphics_file_rules.mk | 4 + include/gba/defines.h | 61 ++ include/gba/flash_internal.h | 76 ++ include/gba/gba.h | 10 + include/gba/io_reg.h | 401 ++++++- include/gba/m4a_internal.h | 462 ++++++++ include/gba/macro.h | 80 +- include/gba/syscall.h | 24 +- include/gba/types.h | 108 ++ include/global.h | 30 +- include/task.h | 29 + iwram_syms.txt | 2 + ld_script.txt | 2 +- src/malloc.c | 2 +- src/task.c | 313 ++++++ 30 files changed, 3274 insertions(+), 2216 deletions(-) delete mode 100644 asm/task.s create mode 100644 data/cry_id_table.s create mode 100644 graphics/intro/copyright.bin create mode 100644 graphics/intro/copyright.pal create mode 100644 graphics/intro/copyright.png create mode 100644 include/gba/defines.h create mode 100644 include/gba/flash_internal.h create mode 100644 include/gba/gba.h create mode 100644 include/gba/m4a_internal.h create mode 100644 include/gba/types.h create mode 100644 include/task.h create mode 100644 src/task.c diff --git a/Makefile b/Makefile index 1e08b1cd1..ea76364ed 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ asm/main_menu.o \ asm/rom_8032654.o \ asm/tileset_animation.o \ asm/rom_80A18F4.o \ -asm/task.o \ asm/rom_80A92F4.o \ asm/multiboot.o \ asm/rom_81BAD84.o \ diff --git a/asm/main_menu.s b/asm/main_menu.s index ec3053a9d..c6dccfff8 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -8,7 +8,7 @@ @ void CB2_MainMenu() CB2_MainMenu: @ 802F6B0 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -127,7 +127,7 @@ InitMainMenu: @ 802F6F4 movs r2, 0x20 bl gpu_pal_apply bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator cmp r4, 0 @@ -216,7 +216,7 @@ _0802F7FE: bl HideBg ldr r0, =Task_MainMenuCheckSaveFile movs r1, 0 - bl AddTask + bl CreateTask movs r0, 0 add sp, 0xC pop {r4,r5} @@ -1502,7 +1502,7 @@ _08030488: _0803048A: bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask b _08030514 .pool _0803049C: @@ -1610,7 +1610,7 @@ _08030578: ldr r0, =c2_title_screen_1 bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0803058C: pop {r4,r5} pop {r0} @@ -2292,7 +2292,7 @@ _08030B7C: cmp r0, 0x5F ble _08030BBA adds r0, r4, 0 - bl remove_task + bl DestroyTask ldrb r1, [r7] lsls r0, r1, 2 adds r0, r1 @@ -2941,7 +2941,7 @@ task_new_game_prof_birch_speech_17: @ 8031090 lsrs r0, 24 bl set_default_player_name adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =0x03005d90 ldr r1, [r0] ldrb r2, [r1, 0x8] @@ -3591,7 +3591,7 @@ task_new_game_prof_birch_speech_part2_12: @ 8031630 ldr r0, =CB2_NewGame bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08031666: pop {r4} pop {r0} @@ -3692,10 +3692,10 @@ new_game_prof_birch_speech_part2_start: @ 8031678 movs r1, 0x1 movs r2, 0x10 bl gpu_pal_apply - bl clear_tasks + bl ResetTasks ldr r0, =task_new_game_prof_birch_speech_part2_1 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r1, =0x03005e00 @@ -4035,7 +4035,7 @@ sub_8031A5C: @ 8031A5C movs r0, 0x1 strh r0, [r1, 0x12] adds r0, r3, 0 - bl remove_task + bl DestroyTask b _08031AC4 .pool _08031A94: @@ -4100,7 +4100,7 @@ sub_8031ACC: @ 8031ACC strh r6, [r0, 0x12] ldr r0, =sub_8031A5C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -4145,7 +4145,7 @@ sub_8031B3C: @ 8031B3C movs r0, 0x1 strh r0, [r1, 0x12] adds r0, r3, 0 - bl remove_task + bl DestroyTask b _08031BA4 .pool _08031B74: @@ -4211,7 +4211,7 @@ sub_8031BAC: @ 8031BAC strh r6, [r0, 0x12] ldr r0, =sub_8031B3C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -4258,7 +4258,7 @@ _08031C40: cmp r0, 0x8 bne _08031C52 adds r0, r2, 0 - bl remove_task + bl DestroyTask b _08031C7C _08031C52: ldrh r2, [r1, 0x10] @@ -4300,7 +4300,7 @@ sub_8031C88: @ 8031C88 lsrs r5, 24 ldr r0, =sub_8031C1C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -4347,7 +4347,7 @@ _08031CEC: cmp r0, 0 bne _08031CFE adds r0, r2, 0 - bl remove_task + bl DestroyTask b _08031D28 _08031CFE: ldrh r2, [r1, 0x10] @@ -4389,7 +4389,7 @@ sub_8031D34: @ 8031D34 lsrs r5, 24 ldr r0, =sub_8031CC8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -5163,7 +5163,7 @@ sub_80323A0: @ 80323A0 strb r0, [r1] ldr r0, =sub_8030A70 movs r1, 0 - bl AddTask + bl CreateTask _080323C0: pop {r0} bx r0 diff --git a/asm/rom_80093CC.s b/asm/rom_80093CC.s index 287afef48..5f6c92dc1 100644 --- a/asm/rom_80093CC.s +++ b/asm/rom_80093CC.s @@ -34,7 +34,7 @@ sub_8009404: @ 8009404 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 thumb_func_end sub_8009404 @@ -202,7 +202,7 @@ sub_8009570: @ 8009570 sub sp, 0x4 bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks ldr r0, =sub_80096BC bl SetVBlankCallback bl sub_800A2E0 @@ -238,8 +238,8 @@ _080095A0: bl SetGpuReg ldr r0, =sub_8009404 movs r1, 0 - bl AddTask - bl RunActiveTasks + bl CreateTask + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -248,7 +248,7 @@ _080095A0: bl sub_8009638 ldr r0, =task00_link_test movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =c2_08009A8C bl SetMainCallback2 add sp, 0x4 @@ -377,7 +377,7 @@ task02_080097CC: @ 80096FC movs r0, 0x1 strb r0, [r1] adds r0, r2, 0 - bl remove_task + bl DestroyTask _08009726: pop {r0} bx r0 @@ -414,7 +414,7 @@ sub_8009734: @ 8009734 strh r4, [r0] ldr r0, =task02_080097CC movs r1, 0x2 - bl AddTask + bl CreateTask b _080097AC .pool _080097A8: @@ -663,7 +663,7 @@ c2_08009A8C: @ 80099BC movs r1, 0x1 movs r2, 0 bl sub_8009818 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -3359,7 +3359,7 @@ c2_800ACD4: @ 800AF30 movs r1, 0 movs r2, 0x2 bl rboxid_80040B8 - bl clear_tasks + bl ResetTasks bl remove_some_task ldr r1, =0x030030fc ldrb r0, [r1] @@ -3428,12 +3428,12 @@ _0800AF8C: strb r0, [r1] ldr r0, =sub_8009404 movs r1, 0 - bl AddTask + bl CreateTask bl sub_80A2F30 ldr r1, =0x030022c0 movs r0, 0 str r0, [r1] - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -10423,9 +10423,9 @@ _0800E828: strh r1, [r0, 0xA] ldr r0, =sub_801084C movs r1, 0x5 - bl AddTask + bl CreateTask adds r0, r5, 0 - bl remove_task + bl DestroyTask _0800E862: pop {r4,r5} pop {r0} @@ -10648,7 +10648,7 @@ _0800EA1C: movs r1, 0x2 strb r1, [r0] adds r0, r6, 0 - bl remove_task + bl DestroyTask b _0800EA9A .pool _0800EA3C: @@ -10681,7 +10681,7 @@ _0800EA3C: movs r1, 0x8 strh r1, [r0, 0xA] adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r4, =0x02022b44 ldrb r0, [r4, 0xF] cmp r0, 0 @@ -10693,7 +10693,7 @@ _0800EA3C: _0800EA92: ldr r0, =sub_801084C movs r1, 0x5 - bl AddTask + bl CreateTask _0800EA9A: pop {r4-r7} pop {r0} @@ -10871,7 +10871,7 @@ _0800EC38: bne _0800ECF4 strb r0, [r6, 0xC] adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =0x03005e00 lsls r1, r5, 2 adds r1, r5 @@ -10883,13 +10883,13 @@ _0800EC38: beq _0800EC88 ldr r0, =sub_8010D0C movs r1, 0x1 - bl AddTask + bl CreateTask b _0800ECF4 .pool _0800EC88: ldr r0, =sub_801084C movs r1, 0x5 - bl AddTask + bl CreateTask b _0800ECF4 .pool _0800EC98: @@ -10925,12 +10925,12 @@ _0800ECAC: strb r4, [r6, 0xC] ldr r0, =sub_801084C movs r1, 0x5 - bl AddTask + bl CreateTask ldr r1, =0x00000ce8 adds r0, r6, r1 strb r4, [r0] adds r0, r5, 0 - bl remove_task + bl DestroyTask _0800ECF4: pop {r4-r6} pop {r0} @@ -11045,7 +11045,7 @@ _0800EDF0: bne _0800EE18 ldr r0, =sub_800E94C _0800EDF6: - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -11053,7 +11053,7 @@ _0800EDF6: adds r0, r4, 0 adds r0, 0x67 ldrb r0, [r0] - bl remove_task + bl DestroyTask bl sub_800E604 b _0800EE38 .pool @@ -11061,7 +11061,7 @@ _0800EE18: cmp r0, 0x2 bne _0800EE38 ldr r0, =sub_800EB44 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -11069,7 +11069,7 @@ _0800EE18: adds r0, r4, 0 adds r0, 0x67 ldrb r0, [r0] - bl remove_task + bl DestroyTask bl sub_800E604 _0800EE38: movs r5, 0 @@ -11079,16 +11079,16 @@ _0800EE3C: adds r0, r6 ldr r4, [r0] adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _0800EE5E adds r0, r4, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0800EE5E: adds r0, r5, 0x1 lsls r0, 24 @@ -11106,7 +11106,7 @@ sub_800EE78: @ 800EE78 push {lr} ldr r0, =sub_800E748 movs r1, 0x1 - bl AddTask + bl CreateTask ldr r1, =0x03005000 adds r1, 0x67 strb r0, [r1] @@ -11175,7 +11175,7 @@ sub_800EF00: @ 800EF00 push {lr} ldr r0, =sub_800E94C movs r1, 0x1 - bl AddTask + bl CreateTask ldr r1, =0x03005000 adds r1, 0x67 strb r0, [r1] @@ -11802,7 +11802,7 @@ _0800F3D6: strb r0, [r1] ldr r0, =sub_8010AAC movs r1, 0 - bl AddTask + bl CreateTask b _0800F452 .pool _0800F444: @@ -13577,7 +13577,7 @@ sub_8010264: @ 8010264 ldr r0, =sub_801022C str r0, [r2] adds r0, r3, 0 - bl remove_task + bl DestroyTask _08010284: pop {r0} bx r0 @@ -13589,13 +13589,13 @@ task_add_05_task_del_08FA224_when_no_RfuFunc: @ 8010294 push {r4,lr} ldr r4, =sub_8010264 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080102AC adds r0, r4, 0 movs r1, 0x5 - bl AddTask + bl CreateTask _080102AC: pop {r4} pop {r0} @@ -14335,7 +14335,7 @@ sub_801084C: @ 801084C movs r0, 0 strb r0, [r1] adds r0, r6, 0 - bl remove_task + bl DestroyTask _08010872: ldr r2, =0x03005e00 lsls r1, r6, 2 @@ -14470,7 +14470,7 @@ _0801096E: .pool _08010984: adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r1, =0x03003124 movs r0, 0x1 strb r0, [r1] @@ -14646,7 +14646,7 @@ sub_8010AAC: @ 8010AAC movs r0, 0 strb r0, [r1] adds r0, r6, 0 - bl remove_task + bl DestroyTask _08010AE8: ldr r0, =0x03005e00 lsls r2, r6, 2 @@ -14871,7 +14871,7 @@ _08010CDA: ble _08010CDA _08010CEA: adds r0, r6, 0 - bl remove_task + bl DestroyTask _08010CF0: add sp, 0x4 pop {r4-r7} @@ -14895,7 +14895,7 @@ sub_8010D0C: @ 8010D0C cmp r0, 0x1 bhi _08010D2A adds r0, r5, 0 - bl remove_task + bl DestroyTask _08010D2A: ldr r1, =0x03005e00 lsls r0, r5, 2 @@ -14951,7 +14951,7 @@ _08010D82: ldr r0, =0x03003124 strb r4, [r0] adds r0, r5, 0 - bl remove_task + bl DestroyTask _08010DA6: pop {r4-r6} pop {r0} @@ -16315,7 +16315,7 @@ _08011884: strb r0, [r1] ldr r0, =sub_801209C movs r1, 0x2 - bl AddTask + bl CreateTask b _08011A42 .pool _080118B0: @@ -16442,7 +16442,7 @@ _080119B4: cmp r0, 0 bne _080119DA ldr r0, =sub_800EB44 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -16600,7 +16600,7 @@ sub_8011AFC: @ 8011AFC push {r4,lr} bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks bl sub_80A1A74 ldr r0, =sub_8011AE8 bl SetVBlankCallback @@ -16632,7 +16632,7 @@ _08011B38: lsls r1, 5 movs r0, 0 bl SetGpuReg - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -16650,7 +16650,7 @@ _08011B70: sub_8011B90: @ 8011B90 push {lr} ldr r0, =sub_800EB44 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -16663,13 +16663,13 @@ sub_8011BA4: @ 8011BA4 push {r4,lr} ldr r4, =nullsub_89 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _08011BC2 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x03005000 adds r1, 0x66 strb r0, [r1] @@ -16684,7 +16684,7 @@ _08011BC2: sub_8011BD0: @ 8011BD0 push {lr} ldr r0, =nullsub_89 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -16692,7 +16692,7 @@ sub_8011BD0: @ 8011BD0 ldr r0, =0x03005000 adds r0, 0x66 ldrb r0, [r0] - bl remove_task + bl DestroyTask _08011BEA: pop {r0} bx r0 @@ -16702,7 +16702,7 @@ _08011BEA: thumb_func_start sub_8011BF8 sub_8011BF8: @ 8011BF8 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -16780,7 +16780,7 @@ sub_8011C84: @ 8011C84 strh r0, [r2, 0x12] ldr r0, =sub_800EB44 movs r1, 0x1 - bl AddTask + bl CreateTask adds r4, 0x67 strb r0, [r4] pop {r4-r7} @@ -17001,7 +17001,7 @@ sub_8011E2C: @ 8011E2C ldrb r0, [r5, 0xD] strh r0, [r6, 0x6] adds r0, r4, 0 - bl remove_task + bl DestroyTask _08011E7A: pop {r4-r6} pop {r0} @@ -17016,14 +17016,14 @@ sub_8011E94: @ 8011E94 adds r6, r1, 0 ldr r5, =sub_8011E2C adds r0, r5, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF bne _08011ECC adds r0, r5, 0 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -17118,7 +17118,7 @@ _08011F5C: bl sub_8011A64 _08011F84: adds r0, r6, 0 - bl remove_task + bl DestroyTask b _08011FAA _08011F8C: ldrh r0, [r4, 0x1E] @@ -17144,7 +17144,7 @@ _08011FAA: movs r0, 0x2 bl sub_8011A64 adds r0, r6, 0 - bl remove_task + bl DestroyTask _08011FC2: pop {r4-r6} pop {r0} @@ -17163,7 +17163,7 @@ sub_8011FC8: @ 8011FC8 strb r1, [r0] ldr r0, =sub_8011EF4 movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -17271,7 +17271,7 @@ sub_801209C: @ 801209C cmp r0, 0x4 bne _080120BA adds r0, r5, 0 - bl remove_task + bl DestroyTask _080120BA: ldr r1, =0x03005e00 lsls r0, r5, 2 @@ -17291,7 +17291,7 @@ _080120BA: movs r0, 0x2 bl sub_8011A64 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080120E4: ldr r1, =0x00000ccd adds r0, r6, r1 @@ -17342,7 +17342,7 @@ _080120E4: movs r0, 0xA strh r0, [r6, 0x4] adds r0, r5, 0 - bl remove_task + bl DestroyTask b _0801217C .pool _0801216C: @@ -17351,7 +17351,7 @@ _0801216C: movs r0, 0x2 bl sub_8011A64 mov r0, r8 - bl remove_task + bl DestroyTask _0801217C: pop {r3} mov r8, r3 @@ -17388,7 +17388,7 @@ sub_8012188: @ 8012188 bl sub_800D658 ldr r0, =sub_801209C movs r1, 0x2 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r5, =0x03005e00 @@ -17398,7 +17398,7 @@ sub_8012188: @ 8012188 adds r1, r5 strh r4, [r1, 0xA] ldr r0, =sub_800EB44 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r1, r0, 24 adds r2, r1, 0 @@ -18029,7 +18029,7 @@ BerryBlenderLinkBecomeLeader: @ 801273C push {lr} ldr r0, =sub_8012780 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x02022c30 @@ -18890,7 +18890,7 @@ _08012ED0: _08012EE6: bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020375f0 movs r0, 0x5 strh r0, [r1] @@ -18899,7 +18899,7 @@ _08012EE6: _08012EFC: bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020375f0 movs r0, 0x8 strh r0, [r1] @@ -18930,7 +18930,7 @@ _08012F3A: adds r0, r6, 0 bl sub_8012F64 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08012F50: add sp, 0x8 pop {r3} @@ -18968,7 +18968,7 @@ sub_8012F64: @ 8012F64 ldrb r0, [r4, 0x10] bl RemoveWindow ldrb r0, [r4, 0x17] - bl remove_task + bl DestroyTask ldr r0, [r4, 0x8] bl Free ldr r0, [r4] @@ -19554,7 +19554,7 @@ BerryBlenderLinkJoinGroup: @ 80134A4 push {lr} ldr r0, =sub_80134E8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x02022c30 @@ -20170,7 +20170,7 @@ _08013A8C: ldrb r0, [r6, 0xC] bl RemoveWindow ldrb r0, [r6, 0x11] - bl remove_task + bl DestroyTask ldr r0, [r6] bl Free ldr r0, [r6, 0x4] @@ -20236,14 +20236,14 @@ _08013B58: .pool _08013B68: adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_80173D4 bl sub_800EDD4 b _08013B82 _08013B78: bl sub_80149C4 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08013B82: add sp, 0x8 pop {r4-r7} @@ -20342,7 +20342,7 @@ sub_8013C40: @ 8013C40 push {lr} ldr r0, =sub_8013C7C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r3, =0x02022c30 @@ -20452,7 +20452,7 @@ _08013D3A: .pool _08013D58: ldrb r0, [r4, 0x11] - bl remove_task + bl DestroyTask ldr r0, [r4] bl Free ldr r0, [r4, 0x4] @@ -20465,7 +20465,7 @@ _08013D58: _08013D76: bl sub_800EDD4 adds r0, r5, 0 - bl remove_task + bl DestroyTask _08013D80: pop {r4,r5} pop {r0} @@ -20739,7 +20739,7 @@ sub_8013F60: @ 8013F60 lsrs r4, 24 bl sub_80773AC adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -20750,7 +20750,7 @@ sub_8013F78: @ 8013F78 push {lr} ldr r0, =sub_8013F60 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -20884,7 +20884,7 @@ _08014070: mov r0, r8 bl sub_801807C adds r0, r6, 0 - bl remove_task + bl DestroyTask _080140BC: pop {r3} mov r8, r3 @@ -20978,7 +20978,7 @@ _08014190: _08014194: bl sub_800A5B4 adds r0, r6, 0 - bl remove_task + bl DestroyTask _0801419E: pop {r4-r6} pop {r0} @@ -21002,7 +21002,7 @@ sub_80141A4: @ 80141A4 _080141C0: ldr r0, =sub_80140E0 movs r1, 0x5 - bl AddTask + bl CreateTask ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -21010,7 +21010,7 @@ _080141C0: .pool _080141D4: ldr r0, =sub_80140E0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080141F2 @@ -21022,7 +21022,7 @@ _080141D4: ldr r1, =c2_exit_to_overworld_2_switch bl sub_80C4E74 _080141F2: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -21210,7 +21210,7 @@ sub_8014384: @ 8014384 _080143A0: ldr r0, =sub_80140E0 movs r1, 0x5 - bl AddTask + bl CreateTask ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -21218,14 +21218,14 @@ _080143A0: .pool _080143B4: ldr r0, =sub_80140E0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080143C6 ldr r0, =sub_8086074 bl SetMainCallback2 _080143C6: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -21483,7 +21483,7 @@ _080146C4: bl overworld_free_bg_tilemaps ldr r0, =sub_8013F90 movs r1, 0 - bl AddTask + bl CreateTask b _08014764 .pool _080146D8: @@ -21543,7 +21543,7 @@ _0801474C: bl sub_802493C _08014764: adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020375f0 movs r0, 0x1 strh r0, [r1] @@ -21671,7 +21671,7 @@ _08014854: _080148B8: bl sub_800E3A8 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080148C2: bl script_env_2_enable_and_set_ctx_running movs r0, 0x1 @@ -21700,7 +21700,7 @@ _080148E4: cmp r0, 0x1D bne _08014914 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80773AC bl SetMainCallback2 b _080149B2 @@ -21716,7 +21716,7 @@ _0801491E: cmp r0, 0 beq _080149B2 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_80149D8 b _080149B2 _08014934: @@ -21758,7 +21758,7 @@ _08014980: _08014986: bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080149B2 _08014992: bl sub_800AC34 @@ -21773,7 +21773,7 @@ _0801499C: bl sub_800E084 bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _080149B2: pop {r3,r4} mov r8, r3 @@ -21789,7 +21789,7 @@ sub_80149C4: @ 80149C4 push {lr} ldr r0, =sub_8014790 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -21800,7 +21800,7 @@ sub_80149D8: @ 80149D8 push {lr} ldr r0, =sub_801440C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -21821,7 +21821,7 @@ sub_8014A00: @ 8014A00 adds r4, r0, 0 ldr r0, =sub_8014A40 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x02022c30 @@ -22278,7 +22278,7 @@ _08014E16: ldrb r0, [r5, 0xF] bl RemoveWindow ldrb r0, [r5, 0x17] - bl remove_task + bl DestroyTask ldr r0, [r5, 0x8] bl Free ldr r0, [r5] @@ -22294,7 +22294,7 @@ _08014E4E: cmp r0, 0 beq _08014EF2 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020375f0 movs r0, 0x5 strh r0, [r1] @@ -22334,7 +22334,7 @@ _08014EA8: ldrb r0, [r5, 0xF] bl RemoveWindow ldrb r0, [r5, 0x17] - bl remove_task + bl DestroyTask ldr r0, [r5, 0x8] bl Free ldr r0, [r5] @@ -22353,7 +22353,7 @@ _08014EE2: cmp r0, 0 beq _08014EF2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08014EF2: add sp, 0x8 pop {r4-r6} @@ -22367,7 +22367,7 @@ sub_8014EFC: @ 8014EFC adds r4, r0, 0 ldr r0, =sub_8014F48 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x02022c30 @@ -22692,7 +22692,7 @@ _08015204: ldrb r0, [r7, 0xB] bl RemoveWindow ldrb r0, [r7, 0x11] - bl remove_task + bl DestroyTask ldr r0, [r7] bl Free ldr r0, [r7, 0x4] @@ -22723,7 +22723,7 @@ _08015260: bl sub_8018884 _0801526A: adds r0, r6, 0 - bl remove_task + bl DestroyTask bl sub_800EDD4 ldr r1, =0x020375f0 movs r0, 0x5 @@ -22742,7 +22742,7 @@ _08015290: cmp r0, 0 beq _080152A0 adds r0, r6, 0 - bl remove_task + bl DestroyTask _080152A0: add sp, 0x10 pop {r4-r7} @@ -22756,7 +22756,7 @@ sub_80152A8: @ 80152A8 adds r4, r0, 0 ldr r0, =task00_081182DC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x02022c30 @@ -23060,7 +23060,7 @@ _08015564: bl RemoveWindow _08015580: ldrb r0, [r5, 0x11] - bl remove_task + bl DestroyTask ldr r0, [r5] bl Free ldr r0, [r5, 0x4] @@ -23095,7 +23095,7 @@ _080155C2: beq _08015604 bl sub_800E084 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_800EDD4 ldr r1, =0x020375f0 movs r0, 0x5 @@ -23114,7 +23114,7 @@ _080155F4: cmp r0, 0 beq _08015604 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08015604: add sp, 0x8 pop {r4-r6} @@ -23128,7 +23128,7 @@ UnionRoomSpecial: @ 801560C bl sub_8010F60 ldr r0, =sub_80156E0 movs r1, 0xA - bl AddTask + bl CreateTask ldr r4, =0x02022c30 movs r0, 0x9B lsls r0, 2 @@ -23618,7 +23618,7 @@ _08015AD0: bl _08016878 _08015ADA: ldr r0, =sub_809FA34 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _08015AEA @@ -23725,13 +23725,13 @@ _08015BCA: bl sub_80143E4 ldr r0, =sub_80140E0 movs r1, 0x5 - bl AddTask + bl CreateTask movs r0, 0x26 bl _08016876 .pool _08015BF4: ldr r0, =sub_80140E0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _08015C04 @@ -24252,7 +24252,7 @@ _080160E4: bl sub_80143E4 ldr r0, =sub_80140E0 movs r1, 0x5 - bl AddTask + bl CreateTask movs r0, 0x27 b _08016876 .pool @@ -24260,7 +24260,7 @@ _08016104: adds r0, r6, 0 bl sub_801689C ldr r0, =sub_80140E0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _08016118 @@ -24520,7 +24520,7 @@ _08016360: adds r0, r6, 0 adds r0, 0x20 ldrb r0, [r0] - bl remove_task + bl DestroyTask adds r0, r6, 0 adds r0, 0x21 bl sub_8019F04 @@ -24545,7 +24545,7 @@ _080163A2: _080163AE: bl sub_8019E3C adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =0x02022c30 ldr r0, [r0] bl Free @@ -25165,7 +25165,7 @@ sub_8016934: @ 8016934 strb r0, [r5] ldr r0, =task00_081199FC movs r1, 0 - bl AddTask + bl CreateTask ldr r4, =0x02022c30 movs r0, 0x9B lsls r0, 2 @@ -25320,13 +25320,13 @@ _08016A94: adds r0, r5, 0 adds r0, 0x20 ldrb r0, [r0] - bl remove_task + bl DestroyTask ldr r0, =0x02022c30 ldr r0, [r0] bl Free bl sub_800EDD4 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08016AC8: add sp, 0x20 pop {r4-r6} @@ -25750,7 +25750,7 @@ sub_8016DF0: @ 8016DF0 adds r6, r2, 0 ldr r0, =sub_8016CA0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -25988,7 +25988,7 @@ sub_8016FC0: @ 8016FC0 adds r5, r1, 0 ldr r0, =sub_8016E24 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r2, r0, 2 @@ -26012,7 +26012,7 @@ sub_8016FF0: @ 8016FF0 adds r5, r1, 0 ldr r0, =sub_8016F44 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r2, r0, 2 @@ -28592,7 +28592,7 @@ sub_8018424: @ 8018424 thumb_func_start sub_8018438 sub_8018438: @ 8018438 push {lr} - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -28636,7 +28636,7 @@ _08018482: bl sub_80A1A74 bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks bl remove_some_task movs r0, 0 bl ResetBgsAndClearDma3BusyFlags @@ -28823,7 +28823,7 @@ c2_mystery_gift: @ 8018650 strb r0, [r1] bl task_add_00_mystery_gift _0801866C: - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 .pool @@ -30219,7 +30219,7 @@ task_add_00_mystery_gift: @ 80191AC push {r4,lr} ldr r0, =task00_mystery_gift movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -31102,7 +31102,7 @@ _0801990C: ldr r0, [r5, 0x10] bl Free adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80186A4 bl SetMainCallback2 _08019922: @@ -31758,14 +31758,14 @@ sub_8019DF4: @ 8019DF4 push {r4,lr} ldr r4, =sub_8019DD0 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _08019E18 adds r0, r4, 0 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 b _08019E1A @@ -31782,12 +31782,12 @@ _08019E1A: sub_8019E20: @ 8019E20 push {lr} ldr r0, =sub_8019DD0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xF bhi _08019E34 - bl remove_task + bl DestroyTask _08019E34: pop {r0} bx r0 @@ -32541,7 +32541,7 @@ sub_801A3F4: @ 801A3F4 lsls r0, 24 cmp r0, 0 bne _0801A414 - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -32619,14 +32619,14 @@ sub_801A43C: @ 801A43C bl DeactivateAllTextPrinters bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl remove_some_task bl SoundVSyncOn_rev01 ldr r0, =sub_801A418 bl SetVBlankCallback ldr r0, =sub_801A6C0 movs r1, 0 - bl AddTask + bl CreateTask ldr r1, [r5] adds r1, 0x60 strb r0, [r1] @@ -32674,7 +32674,7 @@ sub_801A43C: @ 801A43C bl CopyBgTilemapBufferToVram ldr r0, =sub_801A3F4 bl SetMainCallback2 - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -33052,7 +33052,7 @@ _0801A884: ldr r0, =sub_801A584 bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0801A89C: add sp, 0x8 pop {r3} @@ -33630,7 +33630,7 @@ _0801AD4C: str r0, [r4] bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_082F0DD0 @@ -33866,7 +33866,7 @@ _0801AF98: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 _0801AFAE: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -39733,10 +39733,10 @@ sub_801DE30: @ 801DE30 ldr r4, =0x02022c84 ldr r0, [r4] ldrb r0, [r0, 0xE] - bl remove_task + bl DestroyTask ldr r0, [r4] ldrb r0, [r0, 0xF] - bl remove_task + bl DestroyTask ldr r0, [r4] bl Free pop {r4} @@ -39767,7 +39767,7 @@ _0801DE74: beq _0801DEC8 b _0801DF04 _0801DE7A: - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator bl sub_801F4D0 @@ -39810,13 +39810,13 @@ _0801DEC8: bl SetMainCallback2 ldr r0, =sub_801DF54 movs r1, 0x8 - bl AddTask + bl CreateTask ldr r4, =0x02022c84 ldr r1, [r4] strb r0, [r1, 0xE] ldr r0, =sub_801F2B4 movs r1, 0x7 - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1, 0xF] bl sub_800E0E8 @@ -39845,7 +39845,7 @@ sub_801DF20: @ 801DF20 thumb_func_start sub_801DF38 sub_801DF38: @ 801DF38 push {lr} - bl RunActiveTasks + bl RunTasks bl sub_801F5B8 bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -40500,7 +40500,7 @@ _0801E484: .4byte _0801E5A8 _0801E4A4: ldr r0, =sub_801F2B4 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _0801E4B2 @@ -40649,7 +40649,7 @@ _0801E5E0: b _0801E662 _0801E5EA: ldr r0, =sub_801F2B4 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0801E662 @@ -40735,7 +40735,7 @@ _0801E688: .4byte _0801E748 _0801E69C: ldr r0, =sub_801F2B4 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0801E75C @@ -42480,7 +42480,7 @@ _0801F49A: strb r0, [r1, 0x17] _0801F49C: adds r0, r5, 0 - bl remove_task + bl DestroyTask b _0801F4C4 .pool _0801F4A8: @@ -45448,7 +45448,7 @@ _08020C20: ldr r4, [r0] _08020C26: ldrb r0, [r0, 0xA] - bl remove_task + bl DestroyTask ldr r0, [r5] bl Free movs r0, 0 @@ -45582,7 +45582,7 @@ _08020D10: bl SetMainCallback2 ldr r0, =sub_8020FA0 movs r1, 0x8 - bl AddTask + bl CreateTask ldr r1, [r6] strb r0, [r1, 0xA] ldr r2, =0x03003014 @@ -45654,7 +45654,7 @@ _08020DB0: bl sub_8022BEC ldr r0, =sub_8020FA0 movs r1, 0x8 - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1, 0xA] ldr r0, =sub_8020F88 @@ -45672,7 +45672,7 @@ sub_8020E1C: @ 8020E1C ldr r0, =0x02022c90 ldr r0, [r0] ldrb r0, [r0, 0xA] - bl remove_task + bl DestroyTask ldr r0, =sub_8020D8C bl sub_81AABF0 pop {r0} @@ -45852,7 +45852,7 @@ sub_8020F74: @ 8020F74 thumb_func_start sub_8020F88 sub_8020F88: @ 8020F88 push {lr} - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -48338,7 +48338,7 @@ _08022494: ldrb r0, [r6, 0x2] bl RemoveWindow adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running bl script_env_2_disable mov r0, r9 @@ -48365,7 +48365,7 @@ sub_80224D0: @ 80224D0 bl script_env_2_enable ldr r0, =sub_8022250 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -52040,12 +52040,12 @@ _080241A6: bl CopyWindowToVram ldr r0, =sub_8153688 movs r1, 0 - bl AddTask + bl CreateTask b _08024218 .pool _080241F0: ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _08024218 @@ -53071,7 +53071,7 @@ sub_802493C: @ 802493C bl sub_80261F8 ldr r0, =sub_8024BC8 movs r1, 0x1 - bl AddTask + bl CreateTask ldr r0, =sub_80261CC bl SetMainCallback2 bl sub_80273F0 @@ -53100,7 +53100,7 @@ _08024A16: thumb_func_start sub_8024A1C sub_8024A1C: @ 8024A1C push {lr} - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator pop {r0} @@ -53356,7 +53356,7 @@ _08024C10: .pool _08024C24: ldr r0, =sub_8025910 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _08024C32 @@ -53474,7 +53474,7 @@ _08024D24: .pool _08024D34: adds r0, r1, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_802589C bl sub_802621C _08024D40: @@ -54698,7 +54698,7 @@ _08025728: bl SetMainCallback2 ldr r0, [r4] ldrb r0, [r0, 0x4] - bl remove_task + bl DestroyTask ldr r0, [r4] bl Free bl FreeAllWindowBuffers @@ -54823,7 +54823,7 @@ _08025848: .pool _0802585C: ldrb r0, [r1, 0x4] - bl remove_task + bl DestroyTask ldr r0, =sub_802589C bl sub_802621C bl sub_802903C @@ -54902,7 +54902,7 @@ _080258F8: bl sub_802621C _080258FE: adds r0, r5, 0 - bl remove_task + bl DestroyTask _08025904: pop {r4,r5} pop {r0} @@ -55010,7 +55010,7 @@ _080259C4: cmp r0, r1 bcc _080259E8 adds r0, r6, 0 - bl remove_task + bl DestroyTask movs r0, 0x6 bl sub_80292E0 ldr r1, [r4] @@ -55979,7 +55979,7 @@ _080261C0: thumb_func_start sub_80261CC sub_80261CC: @ 80261CC push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -56014,7 +56014,7 @@ sub_802620C: @ 802620C push {lr} lsls r1, 24 lsrs r1, 24 - bl AddTask + bl CreateTask pop {r0} bx r0 thumb_func_end sub_802620C @@ -56023,7 +56023,7 @@ sub_802620C: @ 802620C sub_802621C: @ 802621C push {lr} movs r1, 0x1 - bl AddTask + bl CreateTask ldr r1, =0x02022c98 ldr r3, [r1] movs r2, 0 @@ -59231,7 +59231,7 @@ sub_8027AAC: @ 8027AAC ldr r4, =sub_8027ACC adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -59367,7 +59367,7 @@ _08027BC8: ldrb r0, [r7, 0x2] bl RemoveWindow adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _08027BE2: add sp, 0x8 @@ -62280,7 +62280,7 @@ sub_8029274: @ 8029274 strb r2, [r0] ldr r0, =sub_8029314 movs r1, 0x3 - bl AddTask + bl CreateTask ldr r1, [r4] ldr r2, =0x00003004 adds r1, r2 @@ -64142,12 +64142,12 @@ _0802A3EC: bne _0802A448 ldr r0, =sub_8153688 movs r1, 0 - bl AddTask + bl CreateTask b _0802A410 .pool _0802A404: ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0802A448 @@ -64498,7 +64498,7 @@ unused_0: @ 802A6FC ldr r1, =0x00003004 adds r0, r1 ldrb r0, [r0] - bl remove_task + bl DestroyTask ldr r0, [r4] movs r1, 0xC0 lsls r1, 6 @@ -64828,10 +64828,10 @@ sub_802A9A8: @ 802A9A8 str r0, [r5] cmp r0, 0 beq _0802AA3C - bl clear_tasks + bl ResetTasks ldr r0, =sub_802ACA0 movs r1, 0x1 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -64861,7 +64861,7 @@ sub_802A9A8: @ 802A9A8 ldr r2, [r5] adds r0, r4, 0 movs r1, 0x2 - bl set_word_task_arg + bl SetWordTaskArg ldr r0, =sub_802AC6C bl SetMainCallback2 b _0802AA42 @@ -65147,7 +65147,7 @@ sub_802AC58: @ 802AC58 thumb_func_start sub_802AC6C sub_802AC6C: @ 802AC6C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -65159,7 +65159,7 @@ sub_802AC6C: @ 802AC6C sub_802AC84: @ 802AC84 push {lr} movs r1, 0x1 - bl AddTask + bl CreateTask ldr r2, =0x02022cfc ldr r1, [r2] movs r3, 0 @@ -65215,7 +65215,7 @@ _0802ACE0: .pool _0802AD0C: ldr r0, =sub_802BD84 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0802AE08 @@ -65314,7 +65314,7 @@ _0802ADF8: _0802ADFE: bl sub_802BE80 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0802AE08: add sp, 0x4 pop {r4} @@ -66558,12 +66558,12 @@ _0802B780: beq _0802B7D8 ldr r0, =sub_8153688 movs r1, 0x6 - bl AddTask + bl CreateTask b _0802B7A8 .pool _0802B798: ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0802B7D8 @@ -67312,7 +67312,7 @@ sub_802BD84: @ 802BD84 adds r6, r0, r1 mov r0, r10 movs r1, 0xE - bl get_word_task_arg + bl GetWordTaskArg mov r8, r0 movs r1, 0 ldrsh r0, [r6, r1] @@ -67325,7 +67325,7 @@ sub_802BD84: @ 802BD84 _0802BDBC: bl sub_802AB20 mov r0, r10 - bl remove_task + bl DestroyTask b _0802BE48 _0802BDC8: movs r1, 0 @@ -67410,13 +67410,13 @@ sub_802BE60: @ 802BE60 push {lr} lsls r1, 24 lsrs r1, 24 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x02022cfc ldr r2, [r1] movs r1, 0xE - bl set_word_task_arg + bl SetWordTaskArg pop {r0} bx r0 .pool @@ -69793,13 +69793,13 @@ sub_802D074: @ 802D074 bl sub_802D0BC ldr r0, =sub_802D12C movs r1, 0x3 - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1, 0x6] ldr r2, [r4] ldrb r0, [r2, 0x6] movs r1, 0x2 - bl set_word_task_arg + bl SetWordTaskArg ldr r0, =sub_802D150 bl sub_802D108 pop {r4} @@ -69872,7 +69872,7 @@ sub_802D108: @ 802D108 ldr r0, [r4] ldrb r0, [r0, 0x6] movs r1, 0 - bl set_word_task_arg + bl SetWordTaskArg ldr r1, [r4] movs r0, 0 strh r0, [r1, 0x4] @@ -69895,7 +69895,7 @@ sub_802D12C: @ 802D12C bne _0802D148 adds r0, r1, 0 movs r1, 0 - bl get_word_task_arg + bl GetWordTaskArg bl _call_via_r0 _0802D148: pop {r0} @@ -71739,7 +71739,7 @@ sub_802E00C: @ 802E00C bl ShowBg ldr r0, =sub_802E090 movs r1, 0x4 - bl AddTask + bl CreateTask pop {r4} pop {r0} bx r0 @@ -71787,7 +71787,7 @@ sub_802E090: @ 802E090 cmp r0, 0 bne _0802E0A4 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0802E0A4: pop {r4} pop {r0} @@ -72229,7 +72229,7 @@ sub_802E3C4: @ 802E3C4 ldr r4, =sub_802E3E4 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -72364,7 +72364,7 @@ _0802E4DC: ldrb r0, [r7, 0x2] bl RemoveWindow adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _0802E4F6: add sp, 0x8 @@ -72531,7 +72531,7 @@ sub_802E63C: @ 802E63C lsls r1, 24 lsrs r1, 24 ldr r0, =sub_802E6D0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -72560,7 +72560,7 @@ sub_802E63C: @ 802E63C sub_802E688: @ 802E688 push {lr} ldr r0, =sub_802E6D0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -72586,7 +72586,7 @@ _0802E6B6: sub_802E6BC: @ 802E6BC push {lr} ldr r0, =sub_802E6D0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -72655,7 +72655,7 @@ _0802E738: adds r0, r5, 0 bl _call_via_r1 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0802E752: pop {r4,r5} pop {r0} @@ -73148,7 +73148,7 @@ sub_802EB24: @ 802EB24 ldr r0, =sub_802EB98 movs r1, 0x50 str r3, [sp] - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -73176,7 +73176,7 @@ sub_802EB24: @ 802EB24 sub_802EB84: @ 802EB84 push {lr} ldr r0, =sub_802EB98 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -73295,7 +73295,7 @@ _0802EC4C: ldrh r0, [r5, 0x6] bl FreeObjectPaletteByTag adds r0, r6, 0 - bl remove_task + bl DestroyTask _0802EC8A: add sp, 0xC pop {r4-r6} diff --git a/asm/rom_8032654.s b/asm/rom_8032654.s index 7edc62297..59cc3bf7d 100644 --- a/asm/rom_8032654.s +++ b/asm/rom_8032654.s @@ -28,7 +28,7 @@ _0803266E: _0803267A: ldr r0, =task00_08081A90 movs r1, 0 - bl AddTask + bl CreateTask bl sub_8033244 _08032686: pop {r0} @@ -1362,7 +1362,7 @@ sub_8033244: @ 8033244 push {r4-r6,lr} ldr r0, =task00_wireless_something movs r1, 0 - bl AddTask + bl CreateTask ldr r2, =0x02022d08 strb r0, [r2] ldr r5, =0x03005e00 @@ -1400,7 +1400,7 @@ sub_8033244: @ 8033244 strh r4, [r0, 0x26] ldr r0, =sub_803375C movs r1, 0 - bl AddTask + bl CreateTask ldr r2, =0x02022d09 strb r0, [r2] ldrb r1, [r2] @@ -7136,7 +7136,7 @@ _0803607C: movs r0, 0x78 bl audio_play adds r0, r7, 0 - bl remove_task + bl DestroyTask ldr r4, =0x02020630 ldr r5, =0x0202449c ldr r0, [r5] @@ -8019,7 +8019,7 @@ _080368FE: bl c2_berry_program_update_menu bl sub_8035AA4 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl sub_8036154 bl ResetObjectPaletteAllocator ldr r1, =0x0300301c @@ -8806,7 +8806,7 @@ _08036FA0: thumb_func_start sub_8036FAC sub_8036FAC: @ 8036FAC push {r4-r6,lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl link_get_multiplayer_id @@ -8974,7 +8974,7 @@ _08037152: bl berry_801017C ldr r0, =task00_0800F6FC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -9276,7 +9276,7 @@ _0803744C: sub_8037458: @ 8037458 push {r4-r7,lr} sub sp, 0x4 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl link_get_multiplayer_id @@ -9464,7 +9464,7 @@ _0803762A: bl berry_801017C ldr r0, =task00_0800F6FC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -9990,7 +9990,7 @@ _08037B02: str r1, [sp] adds r0, 0xAC mov r10, r0 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad ldr r5, =0x02024332 @@ -10220,7 +10220,7 @@ intro_end: @ 8037D2C mov r8, r1 adds r7, r0, 0 adds r7, 0xAC - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad ldr r5, =0x02024332 @@ -10298,7 +10298,7 @@ sub_8037DF4: @ 8037DF4 ldr r0, =0x02024474 adds r0, 0x25 strb r7, [r0] - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad ldr r0, =0x02024332 @@ -10439,7 +10439,7 @@ _08037F5E: bl sub_8068AA4 ldr r0, =task00_0800F6FC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -10998,7 +10998,7 @@ sub_8038420: @ 8038420 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks ldr r0, =0x030022c0 ldrh r1, [r0, 0x2C] movs r0, 0x2 @@ -12224,7 +12224,7 @@ _08038E1A: bl decompress_palette bl sub_803570C bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl sub_8036154 movs r0, 0x4A movs r1, 0x37 @@ -12237,7 +12237,7 @@ _08038E1A: bl SetVBlankCallback ldr r0, =task00_0800F6FC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -12273,7 +12273,7 @@ sub_8038F14: @ 8038F14 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_8038F14 @@ -12428,7 +12428,7 @@ _08039090: bne _08039172 ldr r0, =sub_80B3AF8 movs r1, 0x5 - bl AddTask + bl CreateTask b _08039172 .pool _080390AC: @@ -12481,7 +12481,7 @@ _0803910C: .pool _08039118: ldr r0, =sub_80B3AF8 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080391C6 @@ -12702,7 +12702,7 @@ _080392FE: cmp r4, 0x1 ble _080392FE bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator ldr r1, =0x0300301c movs r0, 0x4 @@ -12736,7 +12736,7 @@ sub_803937C: @ 803937C bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_803937C @@ -12800,7 +12800,7 @@ _08039414: bne _08039434 ldr r0, =sub_80B3AF8 movs r1, 0x5 - bl AddTask + bl CreateTask _08039434: ldr r1, =0x02024332 ldrb r0, [r1] @@ -12809,7 +12809,7 @@ _08039434: .pool _08039450: ldr r0, =sub_80B3AF8 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _0803945E @@ -70432,7 +70432,7 @@ c3_0802FDF4: @ 8059100 lsls r2, 1 bl MPlayVolumeControl adds r0, r4, 0 - bl remove_task + bl DestroyTask _08059122: pop {r4} pop {r0} @@ -70651,7 +70651,7 @@ _080592EC: ldr r1, =sub_80591A0 str r1, [r0] mov r0, r9 - bl remove_task + bl DestroyTask b _0805931A .pool _08059314: @@ -70894,7 +70894,7 @@ _08059510: ldr r1, =sub_80591A0 str r1, [r0] mov r0, r8 - bl remove_task + bl DestroyTask _0805952C: add sp, 0x8 pop {r3-r5} @@ -71057,7 +71057,7 @@ sub_805965C: @ 805965C ldr r1, =sub_80591A0 str r1, [r0] adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4,r5} pop {r0} bx r0 @@ -71216,7 +71216,7 @@ sub_80597CC: @ 80597CC lsls r1, 3 adds r1, r3 ldrb r4, [r1, 0x8] - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers adds r0, r4, 0 bl sub_81B89AC @@ -76021,9 +76021,9 @@ _0805C2C8: b _0805C3BC .pool _0805C330: - ldr r0, =nullsub_4 + ldr r0, =TaskDummy movs r1, 0xFF - bl AddTask + bl CreateTask ldr r3, =0x03005d7c ldr r4, =0x02024064 ldrb r1, [r4] @@ -76273,7 +76273,7 @@ _0805C560: orrs r4, r0 ldr r0, =sub_80591B8 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -76974,7 +76974,7 @@ dp01t_2F_1_pokemon_enter: @ 805CA80 strb r0, [r1, 0x5] ldr r0, =task05_08033660 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -77173,7 +77173,7 @@ _0805CD38: mov r3, r9 strb r3, [r2] mov r0, r8 - bl remove_task + bl DestroyTask _0805CD50: pop {r3,r4} mov r8, r3 @@ -78674,7 +78674,7 @@ _0805D9CC: bl move_something ldr r0, =task0A_0803415C movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -78740,7 +78740,7 @@ task0A_0803415C: @ 805DA48 ands r0, r2 strb r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _0805DA8A: pop {r4} pop {r0} @@ -78791,7 +78791,7 @@ move_anim_start_t4: @ 805DAC4 bl move_something ldr r0, =task0A_08034248 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -78851,7 +78851,7 @@ task0A_08034248: @ 805DB34 ands r0, r2 strb r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _0805DB76: pop {r4} pop {r0} @@ -87565,7 +87565,7 @@ sub_80626FC: @ 80626FC bl oamt_set_x3A_32 ldr r0, =sub_8062828 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -87724,7 +87724,7 @@ _080628E0: mov r0, r9 strb r0, [r2] mov r0, r8 - bl remove_task + bl DestroyTask pop {r3,r4} mov r8, r3 mov r9, r4 @@ -96620,7 +96620,7 @@ sub_8067508: @ 8067508 bl oamt_set_x3A_32 ldr r0, =c3_08038DC4 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -96759,7 +96759,7 @@ _080676C4: mov r0, r9 strb r0, [r2] mov r0, r8 - bl remove_task + bl DestroyTask pop {r3,r4} mov r8, r3 mov r9, r4 @@ -108444,7 +108444,7 @@ speciesid_conv: @ 806D510 ldr r0, =0x00000113 cmp r1, r0 bls _0806D53C - ldr r0, =gUnknown_0831F61C + ldr r0, =gSpeciesIdToCryId ldr r2, =0xfffffeec adds r1, r2 lsls r1, 1 @@ -110688,7 +110688,7 @@ sub_806E694: @ 806E694 bl m4aMPlayAllStop ldr r0, =sub_806E6CC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -110728,7 +110728,7 @@ _0806E6F0: bl current_map_music_set _0806E6FC: adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -111431,7 +111431,7 @@ sub_806EC70: @ 806EC70 ldrb r1, [r2, 0xC] bl sub_817F544 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0806ECA0: pop {r4} pop {r0} @@ -111464,7 +111464,7 @@ sub_806ECAC: @ 806ECAC movs r0, 0xFF bl sub_81C488C adds r0, r4, 0 - bl remove_task + bl DestroyTask _0806ECE2: pop {r4} pop {r0} @@ -111573,7 +111573,7 @@ _0806EDA6: beq _0806EDEC ldr r0, =sub_806EC70 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -111634,7 +111634,7 @@ _0806EE2E: beq _0806EE80 ldr r0, =sub_806ECAC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -111673,12 +111673,12 @@ _0806EE8C: sub_806EE98: @ 806EE98 push {lr} ldr r0, =sub_806ECAC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _0806EEAC - bl remove_task + bl DestroyTask _0806EEAC: pop {r0} bx r0 @@ -116348,7 +116348,7 @@ _0807124E: ldrb r0, [r4, 0xA] bl RemoveWindow adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running b _080712B4 .pool @@ -116370,7 +116370,7 @@ _08071284: ldrb r0, [r4, 0xA] bl RemoveWindow adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080712B4: pop {r4,r5} @@ -116410,7 +116410,7 @@ sub_80712C0: @ 80712C0 bl CopyWindowToVram ldr r0, =c3_080469FC movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -116905,7 +116905,7 @@ sub_8071740: @ 8071740 bl script_env_2_enable ldr r0, =sub_8071760 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 movs r1, 0 bl fade_screen @@ -116932,7 +116932,7 @@ sub_8071760: @ 8071760 ldr r0, =sub_80AF168 str r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _08071788: pop {r4} pop {r0} @@ -117034,7 +117034,7 @@ _080717EC: bl sub_80A1A74 bl ResetObjectPaletteAllocator bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl remove_some_task bl SoundVSyncOn_rev01 b _080719A6 @@ -117147,7 +117147,7 @@ _080719C8: movs r0, 0 strb r0, [r1, 0x2] _080719D6: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -117214,7 +117214,7 @@ _08071A6C: ldr r0, =0x00000179 bl song_play_for_text adds r0, r5, 0 - bl remove_task + bl DestroyTask _08071A80: ldrh r0, [r4, 0x8] adds r0, 0x1 @@ -117287,7 +117287,7 @@ _08071AF4: strb r0, [r1, 0x2] ldr r0, =c3_080472E4 movs r1, 0x5 - bl AddTask + bl CreateTask b _08071E06 .pool _08071B40: @@ -117598,7 +117598,7 @@ _08071DD4: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 _08071E06: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -121174,9 +121174,9 @@ _08073B92: cmp r7, 0x5 ble _08073ABC _08073B9A: - ldr r0, =nullsub_4 + ldr r0, =TaskDummy movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r2, =0x03005e00 @@ -121652,7 +121652,7 @@ _08073F54: movs r1, 0 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask _08073F8A: add sp, 0x8 pop {r4-r7} @@ -121762,7 +121762,7 @@ _08074034: movs r1, 0 bl SetGpuReg adds r0, r4, 0 - bl remove_task + bl DestroyTask _0807406A: add sp, 0x8 pop {r4-r7} @@ -124191,7 +124191,7 @@ sub_80753E8: @ 80753E8 strb r1, [r0] ldr r0, =sub_8075450 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -124362,7 +124362,7 @@ _08075592: cmp r2, 0 bne _080755B8 mov r0, r10 - bl remove_task + bl DestroyTask b _08075602 .pool _080755B8: @@ -124395,7 +124395,7 @@ _080755B8: adds r0, r1 ldrb r1, [r5] strh r1, [r0, 0x10] - ldr r1, =nullsub_4 + ldr r1, =TaskDummy str r1, [r0] movs r0, 0x3D bl audio_play @@ -124483,7 +124483,7 @@ objc_0804ABD4: @ 8075620 mov r0, r8 strh r0, [r7, 0x3C] adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80756D4 str r0, [r7, 0x1C] _080756C0: @@ -125165,7 +125165,7 @@ _08075C2E: ands r0, r2 strb r0, [r1, 0x1] adds r0, r4, 0 - bl remove_task + bl DestroyTask b _08075D04 .pool _08075C54: @@ -125255,7 +125255,7 @@ _08075CE4: ands r0, r2 strb r0, [r1, 0x1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _08075D04: pop {r3} mov r8, r3 @@ -125450,7 +125450,7 @@ _08075EA2: strb r0, [r1, 0x1] ldr r0, =c3_0804B070 movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -127938,7 +127938,7 @@ sub_80772A4: @ 80772A4 sub sp, 0xC bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks bl sub_80A1A74 ldr r2, =0x02037fd4 ldrb r0, [r2, 0x8] @@ -128190,7 +128190,7 @@ _08077528: strb r1, [r0] ldr r0, =task00_08081A90 movs r1, 0x1 - bl AddTask + bl CreateTask b _08077B46 .pool _0807754C: @@ -128851,7 +128851,7 @@ _08077B30: bl SetMainCallback2 _08077B46: bl RunTextPrinters - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -129465,7 +129465,7 @@ _080780E4: ldr r0, =sub_807825C bl SetMainCallback2 _080780F6: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -129642,7 +129642,7 @@ sub_807825C: @ 807825C movs r0, 0x1C bl SetGpuReg bl sub_8197224 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -135032,7 +135032,7 @@ _0807AEC0: bl AllocZeroed str r0, [r4] bl init_uns_table_pokemon_copy - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator ldr r0, =sub_807AC24 @@ -135280,7 +135280,7 @@ _0807B110: ldr r0, =sub_807EA2C bl SetMainCallback2 _0807B116: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -135491,7 +135491,7 @@ _0807B2D0: bl AllocZeroed str r0, [r4] bl init_uns_table_pokemon_copy - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator ldr r0, =sub_807AC24 @@ -135599,7 +135599,7 @@ _0807B438: ldr r0, =sub_807B60C bl SetMainCallback2 _0807B43E: - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -135813,7 +135813,7 @@ _0807B600: sub_807B60C: @ 807B60C push {lr} bl sub_807BBC8 - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -139088,13 +139088,13 @@ _0807D748: bl SetGpuReg ldr r0, =c3_08054588 movs r1, 0x5 - bl AddTask + bl CreateTask ldr r1, [r7] bl _0807E398 .pool _0807D77C: ldr r0, =c3_08054588 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _0807D78C @@ -139649,7 +139649,7 @@ _0807DC04: ldr r0, =sub_807F39C _0807DC5A: movs r1, 0x5 - bl AddTask + bl CreateTask b _0807E400 .pool _0807DC6C: @@ -139878,7 +139878,7 @@ _0807DE1C: bne _0807DE60 ldr r0, =c3_08054588 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -139933,7 +139933,7 @@ _0807DE84: .pool _0807DEC0: ldr r0, =c3_08054588 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r3, r0, 24 cmp r3, 0 @@ -140621,7 +140621,7 @@ _0807E4B4: lsls r0, 24 cmp r0, 0 bne _0807E4C2 - bl RunActiveTasks + bl RunTasks _0807E4C2: bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -141315,7 +141315,7 @@ _0807EA90: _0807EA96: bl sub_807B5B8 bl sub_807E4DC - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -141370,7 +141370,7 @@ _0807EAEC: adds r0, 0x73 strb r1, [r0] _0807EB2C: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -141864,7 +141864,7 @@ _0807F03A: lsls r0, 24 cmp r0, 0 bne _0807F048 - bl RunActiveTasks + bl RunTasks _0807F048: bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -141912,7 +141912,7 @@ _0807F0B6: ldr r0, [r0, 0x8] bl SetMainCallback2 _0807F0BE: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -141929,7 +141929,7 @@ sub_807F0E4: @ 807F0E4 bl script_env_2_enable ldr r0, =sub_807F110 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -141960,7 +141960,7 @@ sub_807F110: @ 807F110 ldr r0, =sub_80AF168 str r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _0807F134: pop {r4} pop {r0} @@ -142157,7 +142157,7 @@ _0807F298: cmp r0, 0xFF bne _0807F2DE adds r0, r5, 0 - bl remove_task + bl DestroyTask b _0807F2DE .pool _0807F2D8: @@ -142251,7 +142251,7 @@ _0807F336: cmp r0, 0x4F bhi _0807F38E adds r0, r6, 0 - bl remove_task + bl DestroyTask _0807F38E: pop {r4-r6} pop {r0} @@ -142346,7 +142346,7 @@ _0807F44C: movs r0, 0 bl ClearGpuRegBits adds r0, r6, 0 - bl remove_task + bl DestroyTask _0807F45C: pop {r4-r6} pop {r0} @@ -142648,7 +142648,7 @@ _0807F70C: lsls r0, 24 cmp r0, 0 bne _0807F71A - bl RunActiveTasks + bl RunTasks _0807F71A: bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -144233,7 +144233,7 @@ _08080546: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -144253,7 +144253,7 @@ sub_8080588: @ 8080588 bl SetGpuReg bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks ldr r0, =sub_807F764 bl SetVBlankCallback movs r0, 0 @@ -145128,7 +145128,7 @@ _08080CC4: bne _08080D30 ldr r0, =sub_8081224 movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, [r5] movs r3, 0x90 lsls r3, 1 @@ -145139,7 +145139,7 @@ _08080D30: ldr r0, =gUnknown_083399EC ldr r0, [r0] movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, [r5] movs r5, 0x90 lsls r5, 1 @@ -145161,7 +145161,7 @@ _08080D44: _08080D5A: ldm r6!, {r0} lsrs r1, r5, 24 - bl AddTask + bl CreateTask ldr r1, =0x020322a4 ldr r1, [r1] movs r2, 0x90 @@ -145211,7 +145211,7 @@ _08080DAE: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -145272,7 +145272,7 @@ sub_8080E20: @ 8080E20 ldr r0, =0x00002345 strh r0, [r1] adds r0, r3, 0 - bl remove_task + bl DestroyTask _08080E58: pop {r4} pop {r0} @@ -145291,7 +145291,7 @@ sub_8080E6C: @ 8080E6C lsrs r4, 24 ldr r0, =sub_8080E20 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -146507,7 +146507,7 @@ _0808191A: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -147438,7 +147438,7 @@ _0808204C: adds r0, r1 adds r0, r4 ldrb r0, [r0] - bl remove_task + bl DestroyTask adds r0, r4, 0x1 lsls r0, 24 lsrs r4, r0, 24 @@ -147957,7 +147957,7 @@ _0808249E: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -148427,7 +148427,7 @@ _080828DC: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -148607,7 +148607,7 @@ _08082A92: movs r2, 0 ldrsh r1, [r1, r2] bl nullsub_31 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -150272,7 +150272,7 @@ _080837EA: bl sub_8083F94 ldr r0, =sub_8083F3C movs r1, 0x6 - bl AddTask + bl CreateTask bl sub_80EECEC ldr r0, =0x0203ce7c ldrh r0, [r0] @@ -151132,7 +151132,7 @@ _08083F62: ldrh r0, [r0] bl song_play_for_text adds r0, r5, 0 - bl remove_task + bl DestroyTask _08083F82: pop {r4,r5} pop {r0} @@ -154984,7 +154984,7 @@ _08085E18: c2_overworld_basic: @ 8085E24 push {lr} bl script_env_2_run_current_script - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl CameraUpdate bl UpdateCameraPanning @@ -156215,7 +156215,7 @@ map_loading_lcd_reset: @ 8086878 sub_8086988: @ 8086988 push {r4,lr} adds r4, r0, 0 - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl dp12_8087EA4 @@ -165088,7 +165088,7 @@ task50_overworld_door: @ 808A654 cmp r0, 0 bne _0808A682 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0808A682: pop {r4} pop {r0} @@ -165148,14 +165148,14 @@ task_overworld_door_add_if_inactive: @ 808A6C4 mov r8, r3 ldr r4, =task50_overworld_door adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _0808A718 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -165454,7 +165454,7 @@ _0808A914: sub_808A91C: @ 808A91C push {lr} ldr r0, =task50_overworld_door - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -168901,7 +168901,7 @@ task_add_bump_boulder: @ 808C310 ldr r6, =taskFF_bump_boulder adds r0, r6, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -169087,10 +169087,10 @@ sub_808C484: @ 808C484 strb r0, [r1, 0x6] bl script_env_2_disable ldr r0, =taskFF_bump_boulder - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0808C4C6: movs r0, 0 pop {r4,r5} @@ -169105,7 +169105,7 @@ sub_808C4D8: @ 808C4D8 ldr r4, =sub_808C4F8 adds r0, r4, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -169188,10 +169188,10 @@ sub_808C544: @ 808C544 orrs r0, r1 strb r0, [r5, 0x1] ldr r0, =sub_808C4F8 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0808C5A0: movs r0, 0 pop {r4-r6} @@ -169206,7 +169206,7 @@ sub_808C5B0: @ 808C5B0 ldr r4, =sub_808C5D0 adds r0, r4, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -169388,10 +169388,10 @@ sub_808C6FC: @ 808C6FC movs r0, 0 strb r0, [r1, 0x6] ldr r0, =sub_808C5D0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0808C740: movs r0, 0 pop {r4,r5} @@ -169421,7 +169421,7 @@ sub_808C750: @ 808C750 ldr r5, =taskFF_0805D1D4 adds r0, r5, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -169528,7 +169528,7 @@ sub_808C814: @ 808C814 adds r0, r1 bl RemoveObjectAndFreeTiles adds r0, r5, 0 - bl remove_task + bl DestroyTask _0808C87A: pop {r4-r6} pop {r0} @@ -169545,7 +169545,7 @@ StartFishing: @ 808C88C ldr r5, =Task_Fish adds r0, r5, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -170155,10 +170155,10 @@ _0808CD58: movs r0, 0x1 bl sub_80ED950 ldr r0, =Task_Fish - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0808CD80: movs r0, 0 pop {r3} @@ -170376,10 +170376,10 @@ fishF: @ 808CF2C movs r0, 0 bl sub_80ED950 ldr r0, =Task_Fish - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0808CF68: movs r0, 0 pop {r1} @@ -170649,7 +170649,7 @@ _0808D14A: .pool _0808D184: adds r0, r2, 0 - bl remove_task + bl DestroyTask _0808D18A: pop {r3} mov r8, r3 @@ -170664,7 +170664,7 @@ sub_808D194: @ 808D194 ldr r4, =sub_808D1FC adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -170678,7 +170678,7 @@ sub_808D194: @ 808D194 sub_808D1B4: @ 808D1B4 push {lr} ldr r0, =sub_808D1FC - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -170692,7 +170692,7 @@ sub_808D1C8: @ 808D1C8 ldr r4, =sub_808D094 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -170706,7 +170706,7 @@ sub_808D1C8: @ 808D1C8 sub_808D1E8: @ 808D1E8 push {lr} ldr r0, =sub_808D094 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -170897,7 +170897,7 @@ _0808D33A: strb r1, [r0] bl CameraObjectReset1 mov r0, r8 - bl remove_task + bl DestroyTask _0808D37E: pop {r3,r4} mov r8, r3 @@ -194791,7 +194791,7 @@ sub_8097FA4: @ 8097FA4 adds r6, r0, 0 ldr r0, =sub_8097FE4 movs r1, 0xFF - bl AddTask + bl CreateTask adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 @@ -194879,7 +194879,7 @@ sub_8098044: @ 8098044 mov r1, sp bl sub_806F684 adds r0, r4, 0 - bl remove_task + bl DestroyTask add sp, 0x4 pop {r4} pop {r0} @@ -195064,7 +195064,7 @@ _08098198: movs r0, 0 strb r0, [r1] adds r0, r5, 0 - bl remove_task + bl DestroyTask _080981B0: pop {r4,r5} pop {r0} @@ -195077,7 +195077,7 @@ task_add_textbox: @ 80981BC push {lr} ldr r0, =sub_8098154 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -195087,12 +195087,12 @@ task_add_textbox: @ 80981BC task_del_textbox: @ 80981D0 push {lr} ldr r0, =sub_8098154 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _080981E4 - bl remove_task + bl DestroyTask _080981E4: pop {r0} bx r0 @@ -195135,7 +195135,7 @@ sub_8098214: @ 8098214 ldr r0, =0x020375bc strb r1, [r0] adds r0, r4, 0 - bl remove_task + bl DestroyTask _0809822E: pop {r4} pop {r0} @@ -195156,7 +195156,7 @@ sub_8098238: @ 8098238 bl ExpandStringRefs ldr r0, =sub_8098214 movs r1, 0 - bl AddTask + bl CreateTask adds r0, r4, 0 bl sub_8196080 movs r0, 0x2 @@ -195353,7 +195353,7 @@ sub_80983A4: @ 80983A4 beq _080983BE bl sub_808B864 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080983BE: pop {r4} pop {r0} @@ -195364,7 +195364,7 @@ _080983BE: sub_80983C4: @ 80983C4 push {lr} ldr r0, =sub_80983A4 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080983E0 @@ -195385,7 +195385,7 @@ sub_80983E8: @ 80983E8 bl player_bitmagic ldr r0, =sub_80983A4 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -195442,7 +195442,7 @@ _08098452: cmp r0, 0 beq _08098468 adds r0, r6, 0 - bl remove_task + bl DestroyTask _08098468: pop {r4-r6} pop {r0} @@ -195454,7 +195454,7 @@ _08098468: sub_809847C: @ 809847C push {lr} ldr r0, =sub_8098400 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _08098498 @@ -195477,7 +195477,7 @@ sub_80984A0: @ 80984A0 bl sub_80974D0 ldr r0, =sub_8098400 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r2, =0x02037350 @@ -195650,7 +195650,7 @@ _0809860C: cmp r0, 0 beq _08098622 adds r0, r6, 0 - bl remove_task + bl DestroyTask _08098622: pop {r4-r7} pop {r0} @@ -195683,7 +195683,7 @@ sub_8098630: @ 8098630 ldr r7, =sub_80985BC adds r0, r7, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r0, =0x03005e00 @@ -195711,7 +195711,7 @@ sub_8098630: @ 8098630 _0809869A: adds r0, r7, 0 movs r1, 0x51 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 lsls r0, r2, 2 @@ -195740,7 +195740,7 @@ _080986E0: bl sub_80974D0 ldr r0, =sub_80985BC movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -195776,7 +195776,7 @@ _0809871A: sub_8098734: @ 8098734 push {lr} ldr r0, =sub_80985BC - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _08098750 @@ -206381,14 +206381,14 @@ overworld_ensure_per_step_coros_running: @ 809D93C push {r4,r5,lr} ldr r5, =task_per_step_callback_manager adds r0, r5, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r4, r0, 24 cmp r4, 0 bne _0809D966 adds r0, r5, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -206400,23 +206400,23 @@ overworld_ensure_per_step_coros_running: @ 809D93C _0809D966: ldr r4, =sub_809E638 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0809D97C adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask _0809D97C: ldr r4, =sub_809D908 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _0809D992 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask _0809D992: pop {r4,r5} pop {r0} @@ -206430,7 +206430,7 @@ activate_per_step_callback: @ 809D9A8 lsls r0, 24 lsrs r4, r0, 24 ldr r0, =task_per_step_callback_manager - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r1, r0, 24 cmp r1, 0xFF @@ -206466,11 +206466,11 @@ _0809D9EA: wild_encounter_reset_coro_args: @ 809D9F0 push {lr} ldr r0, =task_per_step_callback_manager - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r1, r0, 24 ldr r0, =sub_809D908 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r1, r0, 24 cmp r1, 0xFF @@ -209250,7 +209250,7 @@ _0809EFCA: bl remove_some_task bl dp12_8087EA4 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl sub_80A1A74 bl sub_809F048 ldr r0, =sub_809F0AC @@ -209259,7 +209259,7 @@ _0809EFCA: bl SetMainCallback2 ldr r0, =sub_809F200 movs r1, 0x50 - bl AddTask + bl CreateTask add sp, 0x4 pop {r4-r7} pop {r0} @@ -209297,7 +209297,7 @@ sub_809F048: @ 809F048 thumb_func_start sub_809F090 sub_809F090: @ 809F090 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -209440,7 +209440,7 @@ _0809F1B2: cmp r0, 0 beq _0809F1E4 adds r0, r7, 0 - bl remove_task + bl DestroyTask bl Reset b _0809F1F8 .pool @@ -209452,7 +209452,7 @@ _0809F1E4: movs r0, 0x5 bl audio_play adds r0, r7, 0 - bl remove_task + bl DestroyTask _0809F1F8: add sp, 0xC pop {r4-r7} @@ -209531,7 +209531,7 @@ _0809F29C: bl GameFreakRTC_CalcLocalDateTime ldr r0, =sub_809F0F8 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x2] @@ -209565,7 +209565,7 @@ _0809F2CA: str r1, [r2, 0x4] ldr r0, =sub_809EF00 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x2] @@ -209590,7 +209590,7 @@ _0809F310: cmp r0, 0 bne _0809F340 ldrb r0, [r5, 0x2] - bl remove_task + bl DestroyTask _0809F334: movs r0, 0x2 strh r0, [r5] @@ -209598,7 +209598,7 @@ _0809F334: .pool _0809F340: ldrb r0, [r5, 0x2] - bl remove_task + bl DestroyTask bl GameFreakRTC_Reset ldr r4, =0x03005cf8 movs r1, 0 @@ -209673,7 +209673,7 @@ _0809F3EA: cmp r0, 0 bne _0809F404 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers bl Reset _0809F404: @@ -210316,7 +210316,7 @@ task50_startmenu: @ 809F9B4 cmp r0, 0x1 bne _0809F9C8 adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _0809F9C8: pop {r4} pop {r0} @@ -210334,12 +210334,12 @@ sub_809F9D0: @ 809F9D0 ldr r4, =task50_startmenu adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 adds r2, r5, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4,r5} pop {r0} bx r0 @@ -210416,7 +210416,7 @@ _0809FA7C: cmp r0, 0x1 bne _0809FA92 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0809FA92: pop {r4,r5} pop {r0} @@ -211000,7 +211000,7 @@ sub_809FF80: @ 809FF80 bl sub_809FF28 ldr r0, =task50_save_game movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -211058,7 +211058,7 @@ _0809FFFC: strh r1, [r0] _080A0000: adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080A000A: pop {r4} @@ -211633,7 +211633,7 @@ _080A045A: .pool _080A0490: bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl sub_80A1A74 bl dp12_8087EA4 b _080A04FC @@ -211695,7 +211695,7 @@ sub_80A0514: @ 80A0514 beq _080A052E ldr r0, =sub_80A0550 movs r1, 0x50 - bl AddTask + bl CreateTask ldr r0, =sub_80A0540 bl SetMainCallback2 _080A052E: @@ -211707,7 +211707,7 @@ _080A052E: thumb_func_start sub_80A0540 sub_80A0540: @ 80A0540 push {lr} - bl RunActiveTasks + bl RunTasks bl fade_and_return_progress_probably pop {r0} bx r0 @@ -211843,19 +211843,19 @@ _080A0670: ldr r0, [r0, 0x8] bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080A06A8 .pool _080A0688: ldr r0, =sub_8153688 movs r1, 0x5 - bl AddTask + bl CreateTask movs r0, 0x6 b _080A06A6 .pool _080A0698: ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080A06A8 @@ -212090,12 +212090,12 @@ sub_80A08A4: @ 80A08A4 lsls r0, 24 lsrs r4, r0, 24 ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080A08C0 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080A08C0: pop {r4} @@ -212109,7 +212109,7 @@ sub_80A08CC: @ 80A08CC push {r4,r5,lr} ldr r0, =sub_8153688 movs r1, 0x5 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -212122,7 +212122,7 @@ sub_80A08CC: @ 80A08CC strh r1, [r0, 0xC] ldr r0, =sub_80A08A4 movs r1, 0x6 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 diff --git a/asm/rom_80A18F4.s b/asm/rom_80A18F4.s index 90fbff785..9f1d966fd 100644 --- a/asm/rom_80A18F4.s +++ b/asm/rom_80A18F4.s @@ -2560,7 +2560,7 @@ sub_80A2C44: @ 80A2C44 lsrs r5, 24 mov r8, r5 ldr r0, =sub_80A2D54 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r1, =0x03005e00 @@ -2600,7 +2600,7 @@ _080A2CC4: adds r0, r5, 0 movs r1, 0x5 mov r2, r10 - bl set_word_task_arg + bl SetWordTaskArg ldr r0, =0x03005e00 adds r1, r4, r5 lsls r1, 3 @@ -2661,10 +2661,10 @@ sub_80A2D34: @ 80A2D34 push {lr} b _080A2D3C _080A2D38: - bl remove_task + bl DestroyTask _080A2D3C: ldr r0, =sub_80A2D54 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -2686,7 +2686,7 @@ sub_80A2D54: @ 80A2D54 adds r4, r0, r1 adds r0, r5, 0 movs r1, 0x5 - bl get_word_task_arg + bl GetWordTaskArg adds r3, r0, 0 ldrh r0, [r4, 0x8] adds r0, 0x1 @@ -2712,7 +2712,7 @@ sub_80A2D54: @ 80A2D54 cmp r0, r2 bne _080A2DAC adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080A2DCC .pool _080A2DAC: @@ -3128,7 +3128,7 @@ _080A311A: task_is_not_running_overworld_fanfare: @ 80A3120 push {lr} ldr r0, =task50_overworld_fanfare - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -3160,7 +3160,7 @@ _080A3158: ldr r0, =0x03007420 bl m4aMPlayContinue adds r0, r4, 0 - bl remove_task + bl DestroyTask _080A3164: pop {r4} pop {r0} @@ -3174,14 +3174,14 @@ task_add_50_overworld_fanfare_if_not_running: @ 80A3170 push {r4,lr} ldr r4, =task50_overworld_fanfare adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _080A318A adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask _080A318A: pop {r4} pop {r0} @@ -3786,7 +3786,7 @@ _080A365E: sub_80A3678: @ 80A3678 push {lr} ldr r0, =sub_80A370C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -3887,7 +3887,7 @@ _080A3724: lsls r2, 1 bl MPlayVolumeControl adds r0, r4, 0 - bl remove_task + bl DestroyTask _080A3742: pop {r4} pop {r0} @@ -3900,14 +3900,14 @@ sub_80A3754: @ 80A3754 push {r4,lr} ldr r4, =sub_80A370C adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _080A376E adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask _080A376E: pop {r4} pop {r0} @@ -4432,7 +4432,7 @@ move_anim_task_del: @ 80A3C1C push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldr r1, =0x020383fe ldrb r0, [r1] subs r0, 0x1 @@ -4447,7 +4447,7 @@ move_anim_related_task_del: @ 80A3C38 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldr r1, =0x020383ff ldrb r0, [r1] subs r0, 0x1 @@ -4804,7 +4804,7 @@ _080A3F04: _080A3F1C: adds r0, r6, 0 adds r1, r7, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r6 @@ -5053,7 +5053,7 @@ sub_80A40F4: @ 80A40F4 _080A4148: ldr r0, =task_pA_ma0A_obj_to_bg_pal movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 mov r1, r8 @@ -5164,7 +5164,7 @@ _080A4232: bl sub_80A438C ldr r0, =sub_80A40F4 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x020383fe @@ -5216,7 +5216,7 @@ _080A42A6: bl sub_80A438C ldr r0, =sub_80A40F4 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x020383fe @@ -5971,7 +5971,7 @@ _080A4948: _080A494A: ldr r0, =sub_80A4980 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -6035,7 +6035,7 @@ _080A49C6: adds r0, r4, 0 bl sub_80A477C ldrb r0, [r6] - bl remove_task + bl DestroyTask movs r0, 0xFF strb r0, [r6] _080A49DE: @@ -6053,12 +6053,12 @@ _080A49DE: adds r0, r4, 0 bl sub_80A477C ldrb r0, [r6, 0x1] - bl remove_task + bl DestroyTask movs r0, 0xFF strb r0, [r6, 0x1] _080A4A04: adds r0, r5, 0 - bl remove_task + bl DestroyTask _080A4A0A: pop {r4-r6} pop {r0} @@ -6250,7 +6250,7 @@ _080A4B78: _080A4B7A: ldr r0, =sub_80A4BB0 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -6338,7 +6338,7 @@ _080A4C0C: bl sub_80A477C _080A4C38: adds r0, r6, 0 - bl remove_task + bl DestroyTask _080A4C3E: pop {r4-r6} pop {r0} @@ -6600,7 +6600,7 @@ ma14_load_background: @ 80A4E18 str r0, [r1] ldr r0, =task_p5_load_battle_screen_elements movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -6635,7 +6635,7 @@ sub_80A4E5C: @ 80A4E5C str r1, [r2] ldr r0, =task_p5_load_battle_screen_elements movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 adds r5, r4, 0 @@ -6780,7 +6780,7 @@ _080A4F94: cmp r0, 0x3 bne _080A4FBC adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =0x02038433 strb r4, [r0] _080A4FBC: @@ -6895,7 +6895,7 @@ ma15_load_battle_screen_elements: @ 80A50AC str r0, [r1] ldr r0, =task_p5_load_battle_screen_elements movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7324,7 +7324,7 @@ ma1B_8073C2C: @ 80A53B8 lsrs r4, 24 ldr r0, =c3_08073CEC movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7421,7 +7421,7 @@ _080A54E0: _080A54E4: lsrs r4, r2, 16 adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020383ff ldrb r0, [r1] subs r0, 0x1 @@ -7464,7 +7464,7 @@ sub_80A5508: @ 80A5508 mov r10, r1 ldr r0, =c3_08073CEC movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7553,7 +7553,7 @@ sub_80A559C: @ 80A559C lsrs r4, 24 ldr r0, =c3_08073CEC movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7619,7 +7619,7 @@ ma1C_8073ED0: @ 80A565C lsrs r4, 24 ldr r0, =sub_80A56E4 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7689,7 +7689,7 @@ sub_80A56E4: @ 80A56E4 cmp r4, 0 bne _080A5732 adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020383ff ldrb r0, [r1] subs r0, 0x1 @@ -7724,7 +7724,7 @@ ma1D_08073FB4: @ 80A5740 lsrs r4, 24 ldr r0, =sub_80A57B4 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -7774,7 +7774,7 @@ sub_80A57B4: @ 80A57B4 ldrsb r1, [r2, r1] bl audio_play_and_stuff adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020383ff ldrb r0, [r1] subs r0, 0x1 @@ -7829,7 +7829,7 @@ _080A582A: _080A5842: adds r0, r6, 0 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r6 diff --git a/asm/rom_80A92F4.s b/asm/rom_80A92F4.s index 8dabce13d..07a72e235 100644 --- a/asm/rom_80A92F4.s +++ b/asm/rom_80A92F4.s @@ -1053,7 +1053,7 @@ sub_80A9C70: @ 80A9C70 ldrb r6, [r0] ldr r0, =sub_80A9DB4 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -1251,7 +1251,7 @@ _080A9E10: cmp r0, 0x2 bne _080A9E3E adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080A9E3E _080A9E3A: adds r0, r1, 0x1 @@ -1903,7 +1903,7 @@ move_anim_start_t2: @ 80AA364 bl move_something ldr r0, =task0A_80788BC movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -1950,7 +1950,7 @@ task0A_80788BC: @ 80AA3B4 ands r0, r2 strb r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _080AA3F6: pop {r4} pop {r0} @@ -2568,7 +2568,7 @@ _080AA8C4: ldr r1, =0x0600d800 bl LZ77UnCompVram bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator ldr r1, =0x0300301c @@ -2598,7 +2598,7 @@ _080AA8C4: _080AA998: ldr r0, =task_title_screen_1 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -2747,7 +2747,7 @@ _080AAB1E: @ void c2_title_screen_2() c2_title_screen_2: @ 80AAB2C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -3276,7 +3276,7 @@ _080AAF9C: sub_80AAFA4: @ 80AAFA4 push {r4-r6,lr} ldr r0, =sub_80AB1B0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0 @@ -3357,7 +3357,7 @@ sub_80AAFA4: @ 80AAFA4 strb r0, [r1] ldr r0, =sub_80AB160 movs r1, 0x50 - bl AddTask + bl CreateTask ldr r1, =0x000006c9 adds r4, r1 strb r0, [r4] @@ -6280,7 +6280,7 @@ sub_80AC81C: @ 80AC81C push {lr} ldr r0, =task50_0807B6D4 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -6395,7 +6395,7 @@ _080AC910: _080AC918: bl script_env_2_enable_and_set_ctx_running adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AC922: pop {r4,r5} pop {r0} @@ -10730,7 +10730,7 @@ bag_add_task0_by_acit: @ 80AED28 push {lr} ldr r0, =sub_80AECA8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -10860,7 +10860,7 @@ sub_80AEE20: @ 80AEE20 cmp r4, 0xF bne _080AEE4C ldr r0, =sub_80AECA8 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080AEE3E @@ -10873,15 +10873,15 @@ _080AEE3E: _080AEE4C: ldr r5, =sub_80AECA8 adds r0, r5, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _080AEE68 adds r0, r5, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080AEE68: ldr r1, =0x02038bc4 movs r0, 0xD @@ -10904,7 +10904,7 @@ sub_80AEE84: @ 80AEE84 cmp r4, 0xF bne _080AEEB0 ldr r0, =sub_80AECA8 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080AEEA2 @@ -10917,15 +10917,15 @@ _080AEEA2: _080AEEB0: ldr r5, =sub_80AECA8 adds r0, r5, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _080AEECC adds r0, r5, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080AEECC: ldr r1, =0x02038bc4 movs r0, 0xD @@ -11230,7 +11230,7 @@ task0A_nop_for_a_while: @ 80AF10C cmp r0, 0x1 bne _080AF120 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080AF120: pop {r4} pop {r0} @@ -11245,7 +11245,7 @@ sub_80AF128: @ 80AF128 bl pal_fill_black ldr r0, =task0A_nop_for_a_while movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11260,7 +11260,7 @@ task0A_asap_script_env_2_enable_and_set_ctx_running: @ 80AF148 cmp r0, 0x1 bne _080AF160 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080AF160: pop {r4} @@ -11276,7 +11276,7 @@ sub_80AF168: @ 80AF168 bl pal_fill_black ldr r0, =task0A_asap_script_env_2_enable_and_set_ctx_running movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11289,7 +11289,7 @@ sub_80AF188: @ 80AF188 bl pal_fill_black ldr r0, =task0A_asap_script_env_2_enable_and_set_ctx_running movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11347,7 +11347,7 @@ _080AF1FC: bne _080AF20E bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF20E: pop {r4,r5} pop {r0} @@ -11362,7 +11362,7 @@ sub_80AF214: @ 80AF214 bl palette_bg_faded_fill_black ldr r0, =task_mpl_807DD60 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11426,7 +11426,7 @@ _080AF298: bl sub_8009F18 bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF2AE: pop {r4,r5} pop {r0} @@ -11475,7 +11475,7 @@ _080AF2FA: bl sub_8086C2C bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF30C: pop {r4,r5} pop {r0} @@ -11490,7 +11490,7 @@ sub_80AF314: @ 80AF314 bl palette_bg_faded_fill_black ldr r0, =sub_80AF234 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11534,7 +11534,7 @@ _080AF36C: _080AF37E: adds r0, r1, 0 movs r1, 0xA - bl AddTask + bl CreateTask add sp, 0x4 pop {r4} pop {r0} @@ -11588,7 +11588,7 @@ sub_80AF3E8: @ 80AF3E8 bl audio_play ldr r0, =task0A_mpl_807E31C movs r1, 0xA - bl AddTask + bl CreateTask bl script_env_2_enable pop {r0} bx r0 @@ -11604,7 +11604,7 @@ sub_80AF40C: @ 80AF40C bl audio_play ldr r0, =task_map_chg_seq_0807E2CC movs r1, 0xA - bl AddTask + bl CreateTask bl script_env_2_enable movs r0, 0xE bl sub_8085540 @@ -11734,7 +11734,7 @@ _080AF536: _080AF540: bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask _080AF54A: pop {r4-r7} pop {r0} @@ -11823,7 +11823,7 @@ _080AF5EC: _080AF600: bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask _080AF60A: pop {r4-r7} pop {r0} @@ -11862,7 +11862,7 @@ _080AF644: bl sub_809757C bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF65A: pop {r4,r5} pop {r0} @@ -11878,10 +11878,10 @@ sub_80AF660: @ 80AF660 cmp r0, 0x1 bne _080AF67C adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_809FA34 movs r1, 0x50 - bl AddTask + bl CreateTask _080AF67C: pop {r4} pop {r0} @@ -11895,7 +11895,7 @@ sub_80AF688: @ 80AF688 bl pal_fill_black ldr r0, =sub_80AF660 movs r1, 0x50 - bl AddTask + bl CreateTask bl script_env_2_enable pop {r0} bx r0 @@ -11921,7 +11921,7 @@ task_mpl_807E3C8: @ 80AF6B0 bne _080AF6CC bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_80984F4 _080AF6CC: pop {r4} @@ -11936,7 +11936,7 @@ sub_80AF6D4: @ 80AF6D4 bl pal_fill_black ldr r0, =task_mpl_807E3C8 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11950,7 +11950,7 @@ sub_80AF6F0: @ 80AF6F0 bl pal_fill_black ldr r0, =task_mpl_807E3C8 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -11996,7 +11996,7 @@ sub_80AF734: @ 80AF734 str r1, [r0] ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12014,7 +12014,7 @@ sp13E_warp_to_last_warp: @ 80AF76C str r1, [r0] ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12034,7 +12034,7 @@ sub_80AF79C: @ 80AF79C str r1, [r0] ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12049,7 +12049,7 @@ sub_80AF7D0: @ 80AF7D0 str r1, [r0] ldr r0, =sub_80AFA88 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12112,7 +12112,7 @@ sub_80AF848: @ 80AF848 bl audio_play ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, =0x03005dac ldr r0, =sub_80AF3E8 str r0, [r1] @@ -12134,7 +12134,7 @@ sub_80AF87C: @ 80AF87C bl audio_play ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, =0x03005dac ldr r0, =sub_80AF40C str r0, [r1] @@ -12150,7 +12150,7 @@ sub_80AF8B8: @ 80AF8B8 bl sub_80AF0B4 ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, =0x03005dac ldr r0, =sub_80FB768 str r0, [r1] @@ -12204,7 +12204,7 @@ _080AF92E: ldr r0, =sub_8086074 bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF93E: pop {r4,r5} pop {r0} @@ -12222,7 +12222,7 @@ sub_80AF948: @ 80AF948 bl audio_play ldr r0, =sub_80AF8E0 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12284,7 +12284,7 @@ _080AF9D0: ldr r0, =c2_load_new_map bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AF9E8: pop {r4,r5} pop {r0} @@ -12297,7 +12297,7 @@ sub_80AF9F8: @ 80AF9F8 push {lr} ldr r0, =sub_80AF96C movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12356,7 +12356,7 @@ _080AFA6C: ldr r0, =c2_load_new_map bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask _080AFA7C: pop {r4-r6} pop {r0} @@ -12577,7 +12577,7 @@ _080AFC46: ldr r0, =sub_8086024 bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AFC56: pop {r4,r5} pop {r0} @@ -12599,7 +12599,7 @@ sub_80AFC60: @ 80AFC60 str r1, [r0] ldr r0, =task0A_fade_n_map_maybe movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -12894,12 +12894,12 @@ _080AFE64: .pool _080AFEB4: adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080AFEC6 _080AFEBC: bl dp12_8087EA4 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AFEC6: pop {r4-r6} pop {r0} @@ -12987,12 +12987,12 @@ _080AFF28: .pool _080AFF78: adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080AFF8A _080AFF80: bl dp12_8087EA4 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080AFF8A: pop {r4-r6} pop {r0} @@ -13005,13 +13005,13 @@ sub_80AFF90: @ 80AFF90 lsls r0, 24 lsrs r4, r0, 24 ldr r0, =sub_80AFE08 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080AFFAC bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _080AFFAC: pop {r4} pop {r0} @@ -13024,13 +13024,13 @@ sub_80AFFB8: @ 80AFFB8 push {r4,lr} ldr r4, =sub_80AFF90 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080AFFD0 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask _080AFFD0: pop {r4} pop {r0} @@ -13054,7 +13054,7 @@ sub_80AFFDC: @ 80AFFDC lsrs r7, r0, 24 ldr r0, =sub_80AFE08 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 lsls r0, r2, 2 @@ -13103,7 +13103,7 @@ sub_80B003C: @ 80B003C lsrs r7, r0, 24 ldr r0, =sub_80AFECC movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 lsls r0, r2, 2 @@ -13265,7 +13265,7 @@ _080B0198: bl sub_809757C bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B01B6: pop {r4,r5} pop {r0} @@ -13329,7 +13329,7 @@ _080B022A: ldr r0, =c2_load_new_map bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B023A: pop {r4,r5} pop {r0} @@ -13343,7 +13343,7 @@ sub_80B0244: @ 80B0244 bl script_env_2_enable ldr r0, =sub_80AFA0C movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, =0x03005dac ldr r0, =sub_80AF3E8 str r0, [r1] @@ -13361,7 +13361,7 @@ sub_80B0268: @ 80B0268 str r1, [r0] ldr r0, =sub_80B01BC movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -13573,7 +13573,7 @@ _080B0424: b _080B052C _080B0450: ldr r0, =sub_80AFECC - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080B052C @@ -13669,7 +13669,7 @@ _080B04F2: bl SetGpuReg bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B052C: add sp, 0x8 pop {r4,r5} @@ -13682,7 +13682,7 @@ sub_80B0534: @ 80B0534 push {lr} ldr r0, =sub_80B0318 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -13726,7 +13726,7 @@ _080B0580: sub_80B058C: @ 80B058C push {lr} ldr r0, =sub_80B0318 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -13747,7 +13747,7 @@ sub_80B05B4: @ 80B05B4 bl sub_80859B0 ldr r0, =task50_0807F0C8 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -13764,7 +13764,7 @@ task50_0807F0C8: @ 80B05CC cmp r0, 0x1 bne _080B05E8 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080B05E8: pop {r4} @@ -13813,7 +13813,7 @@ _080B062E: bl prev_quest_postbuffer_cursor_backup_reset bl overworld_poison_timer_set adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B0652: pop {r4,r5} pop {r0} @@ -13832,7 +13832,7 @@ task_add_01_battle_start: @ 80B065C lsrs r5, 16 ldr r0, =task01_battle_start movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -15125,7 +15125,7 @@ sub_80B1158: @ 80B1158 movs r2, 0 movs r3, 0 bl sub_80F9244 - bl clear_tasks + bl ResetTasks bl sub_806E64C ldr r0, =sub_80B11A8 bl SetMainCallback2 @@ -15141,7 +15141,7 @@ sub_80B1158: @ 80B1158 sub_80B11A8: @ 80B11A8 push {lr} bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks bl sub_8145F20 lsls r0, 24 lsrs r0, 24 @@ -17323,14 +17323,14 @@ sub_80B236C: @ 80B236C lsrs r5, r1, 24 ldr r4, =sub_80B2634 adds r0, r4, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF bne _080B23A0 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -17661,7 +17661,7 @@ sub_80B2600: @ 80B2600 movs r0, 0x2 bl sub_800A4D8 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B262A: pop {r4} pop {r0} @@ -18311,7 +18311,7 @@ _080B2BEC: bl script_env_2_enable_and_set_ctx_running lsls r0, r4, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _080B2C22 .pool _080B2C10: @@ -18406,7 +18406,7 @@ sub_80B2CB0: @ 80B2CB0 ldrb r0, [r4, 0x12] bl RemoveWindow adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B2CDE: pop {r4,r5} pop {r0} @@ -18435,7 +18435,7 @@ sub_80B2CEC: @ 80B2CEC bl RemoveWindow bl script_env_2_enable_and_set_ctx_running adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4,r5} pop {r0} bx r0 @@ -18463,7 +18463,7 @@ sub_80B2D2C: @ 80B2D2C bl textbox_close bl script_env_2_enable_and_set_ctx_running adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4,r5} pop {r0} bx r0 @@ -18616,14 +18616,14 @@ sub_80B2EA8: @ 80B2EA8 push {r4,lr} ldr r4, =sub_80B2EE4 adds r0, r4, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF bne _080B2ED4 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -18740,7 +18740,7 @@ _080B2F82: _080B2FA8: bl script_env_2_enable_and_set_ctx_running adds r0, r6, 0 - bl remove_task + bl DestroyTask b _080B2FC6 _080B2FB4: ldr r0, =0x03003124 @@ -18749,7 +18749,7 @@ _080B2FB4: bne _080B2FC6 bl script_env_2_enable_and_set_ctx_running adds r0, r6, 0 - bl remove_task + bl DestroyTask _080B2FC6: pop {r3,r4} mov r8, r3 @@ -18818,7 +18818,7 @@ sub_80B3028: @ 80B3028 sub_80B3050: @ 80B3050 push {lr} ldr r0, =sub_80B3144 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _080B3068 @@ -18896,7 +18896,7 @@ _080B3124: _080B3128: ldr r0, =sub_80B3144 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 _080B3134: @@ -18923,7 +18923,7 @@ sub_80B3144: @ 80B3144 bl sub_800A2BC ldr r0, =task00_08081A90 movs r1, 0x50 - bl AddTask + bl CreateTask b _080B3184 .pool _080B3178: @@ -19027,7 +19027,7 @@ sub_80B3220: @ 80B3220 bl sub_800AB18 bl sub_8009F18 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B3248: pop {r4} pop {r0} @@ -19187,7 +19187,7 @@ _080B3378: ldr r0, =sub_80B360C str r0, [r1, 0x8] adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B33A0: pop {r4,r5} pop {r0} @@ -19360,7 +19360,7 @@ _080B3504: ldr r0, =sub_80B360C str r0, [r1, 0x8] adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B3532: pop {r4-r7} pop {r0} @@ -19449,7 +19449,7 @@ _080B35F8: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 _080B35FE: - bl RunActiveTasks + bl RunTasks pop {r4} pop {r0} bx r0 @@ -19639,7 +19639,7 @@ _080B379E: strh r0, [r5, 0x8] bl sub_80872C4 adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080B37CC _080B37B2: movs r0, 0x3 @@ -19650,7 +19650,7 @@ _080B37B8: movs r0, 0x1 bl sub_8197AE8 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080B37CC: pop {r4,r5} @@ -19665,12 +19665,12 @@ sub_80B37D4: @ 80B37D4 ldr r4, =sub_80B3728 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 adds r2, r5, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc bl script_env_2_set_ctx_paused pop {r4,r5} pop {r0} @@ -19741,7 +19741,7 @@ _080B3870: ldr r0, =sub_80773AC bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B3884: pop {r4,r5} pop {r0} @@ -19811,7 +19811,7 @@ _080B3908: beq _080B391C bl sub_8013F78 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B391C: pop {r4,r5} pop {r0} @@ -19843,7 +19843,7 @@ sub_80B3950: @ 80B3950 push {lr} ldr r0, =sub_80B37FC movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -19883,7 +19883,7 @@ sub_80B39A4: @ 80B39A4 push {lr} ldr r0, =sub_80B3728 movs r1, 0x50 - bl AddTask + bl CreateTask bl script_env_2_set_ctx_paused pop {r0} bx r0 @@ -19964,7 +19964,7 @@ task00_08081A90: @ 80B3A30 ldr r0, =c2_800ACD4 bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B3A62: ldr r0, =0x03003124 ldrb r0, [r0] @@ -19983,12 +19983,12 @@ _080B3A62: bl SetMainCallback2 _080B3A86: adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080B3AA6 .pool _080B3AA0: adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B3AA6: pop {r4,r5} pop {r0} @@ -20006,7 +20006,7 @@ sub_80B3AAC: @ 80B3AAC bne _080B3AC4 bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B3AC4: pop {r4} pop {r0} @@ -20066,14 +20066,14 @@ _080B3B2A: cmp r0, 0 beq _080B3B40 adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080B3BB8 .pool _080B3B40: bl sub_8009734 ldr r0, =task00_08081A90 movs r1, 0x1 - bl AddTask + bl CreateTask b _080B3B96 .pool _080B3B54: @@ -20123,7 +20123,7 @@ _080B3B9E: cmp r0, 0x1 bne _080B3BB8 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080B3BB8: pop {r4,r5} pop {r0} @@ -20750,7 +20750,7 @@ TrainerApproachPlayer: @ 80B406C lsrs r5, 24 ldr r0, =c3_8081EDC movs r1, 0x50 - bl AddTask + bl CreateTask ldr r4, =0x03006090 ldr r3, =0x030060a8 ldrb r2, [r3] @@ -20803,7 +20803,7 @@ _080B40E8: ldr r4, =c3_8081EDC adds r0, r5, 0 adds r1, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc ldr r1, =0x03005e00 lsls r0, r5, 2 adds r0, r5 @@ -20841,7 +20841,7 @@ c3_8081EDC: @ 80B4118 cmp r0, 0 bne _080B4150 adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080B416C .pool _080B4150: @@ -21098,7 +21098,7 @@ sub_80B4318: @ 80B4318 beq _080B434A _080B4344: adds r0, r5, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080B434A: movs r0, 0 pop {r4,r5} @@ -21369,7 +21369,7 @@ _080B44FA: adds r0, r4, 0 bl sub_808F23C adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080B456E .pool _080B4564: @@ -21391,7 +21391,7 @@ sub_80B4578: @ 80B4578 adds r4, r0, 0 ldr r0, =sub_80B44C8 movs r1, 0 - bl AddTask + bl CreateTask adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -21424,7 +21424,7 @@ sub_80B45BC: @ 80B45BC push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r0} bx r0 @@ -25028,7 +25028,7 @@ sub_80B61A0: @ 80B61A0 lsrs r4, 24 ldr r0, =sub_80B61E4 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -25183,10 +25183,10 @@ sub_80B62B4: @ 80B62B4 movs r0, 0x19 bl FieldEffectActiveListRemove ldr r0, =sub_80B61E4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B62E6: pop {r0} bx r0 @@ -25202,7 +25202,7 @@ sub_80B62F4: @ 80B62F4 lsrs r4, 24 ldr r0, =sub_80B6330 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -25264,7 +25264,7 @@ sub_80B6360: @ 80B6360 lsrs r0, 24 strh r0, [r4, 0x14] ldr r0, =sub_80B6330 - bl get_task_id_by_function + bl FindTaskIdByFunc adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -25369,10 +25369,10 @@ sub_80B642C: @ 80B642C movs r0, 0x3E bl FieldEffectActiveListRemove ldr r0, =sub_80B6330 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B645E: pop {r0} bx r0 @@ -26084,7 +26084,7 @@ mapldr_080842E8: @ 80B69FC bl pal_fill_black ldr r0, =task00_8084310 movs r1, 0 - bl AddTask + bl CreateTask bl script_env_2_enable bl player_bitmagic ldr r1, =0x03005dac @@ -26141,7 +26141,7 @@ _080B6A64: ldr r0, =mapldr_08084390 str r0, [r1] adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B6A8A: pop {r4-r6} pop {r0} @@ -26156,7 +26156,7 @@ mapldr_08084390: @ 80B6AA4 bl pal_fill_black ldr r0, =c3_080843F8 movs r1, 0 - bl AddTask + bl CreateTask ldr r4, =0x02037350 ldr r3, =0x02037590 ldrb r1, [r3, 0x5] @@ -26227,7 +26227,7 @@ _080B6B3E: bl script_env_2_disable bl sub_809757C adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B6B58: pop {r4,r5} pop {r0} @@ -26244,7 +26244,7 @@ sub_80B6B68: @ 80B6B68 bl player_bitmagic ldr r0, =sub_80B6B94 movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x03005dac movs r0, 0 str r0, [r1] @@ -26587,10 +26587,10 @@ sub_80B6E18: @ 80B6E18 bl sub_809757C bl InstallCameraPanAheadCallback ldr r0, =sub_80B6B94 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -26606,7 +26606,7 @@ sub_80B6E4C: @ 80B6E4C lsls r1, 24 lsrs r1, 24 ldr r0, =sub_80B6E88 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -26892,10 +26892,10 @@ sub_80B7060: @ 80B7060 ldr r0, =c2_load_new_map bl SetMainCallback2 ldr r0, =sub_80B6E88 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B709C: pop {r0} bx r0 @@ -26910,7 +26910,7 @@ sub_80B70B4: @ 80B70B4 bl script_env_2_enable ldr r0, =sub_80B70DC movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x03005dac movs r0, 0 str r0, [r1] @@ -27210,10 +27210,10 @@ sub_80B72F4: @ 80B72F4 adds r0, r4, 0 bl FieldObjectSetSpecialAnim ldr r0, =sub_80B70DC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B7338: movs r0, 0 pop {r4} @@ -27228,7 +27228,7 @@ oei_waterfall: @ 80B734C ldr r4, =sub_80B7384 adds r0, r4, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -27396,10 +27396,10 @@ _080B748E: ldr r0, =0x02037590 strb r4, [r0, 0x6] ldr r0, =sub_80B7384 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0x2B bl FieldEffectActiveListRemove movs r0, 0 @@ -27421,7 +27421,7 @@ sub_80B74D0: @ 80B74D0 ldr r4, =sub_80B750C adds r0, r4, 0 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -27528,10 +27528,10 @@ dive_3_unknown: @ 80B7580 mov r0, sp bl dive_warp ldr r0, =sub_80B750C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0x2C bl FieldEffectActiveListRemove _080B75C4: @@ -27549,7 +27549,7 @@ sub_80B75D8: @ 80B75D8 lsls r1, 24 lsrs r1, 24 ldr r0, =sub_80B75F0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -27858,10 +27858,10 @@ sub_80B7814: @ 80B7814 ldr r0, =c2_load_new_map bl SetMainCallback2 ldr r0, =sub_80B75F0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B784C: movs r0, 0 pop {r1} @@ -27879,7 +27879,7 @@ mapldr_080851BC: @ 80B7868 movs r1, 0 str r1, [r0] ldr r0, =sub_80B7890 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -28046,10 +28046,10 @@ sub_80B79BC: @ 80B79BC bl script_env_2_disable bl sub_809757C ldr r0, =sub_80B7890 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B79E6: movs r0, 0 pop {r1} @@ -28128,7 +28128,7 @@ sub_80B7A74: @ 80B7A74 lsls r1, 24 lsrs r1, 24 ldr r0, =sub_80B7A8C - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -28333,10 +28333,10 @@ sub_80B7BF4: @ 80B7BF4 ldr r0, =c2_load_new_map bl SetMainCallback2 ldr r0, =sub_80B7A8C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B7C2C: movs r0, 0 pop {r1} @@ -28415,7 +28415,7 @@ sub_80B7CC8: @ 80B7CC8 bl player_bitmagic ldr r0, =sub_80B7CE4 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -28530,10 +28530,10 @@ _080B7D86: ldr r0, =c2_load_new_map bl SetMainCallback2 ldr r0, =sub_80B7CE4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _080B7E40 .pool _080B7DF8: @@ -28603,7 +28603,7 @@ mapldr_080859D4: @ 80B7E48 strb r1, [r0, 0x1] ldr r0, =sub_80B7E94 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -28710,10 +28710,10 @@ _080B7F32: bl script_env_2_disable bl sub_809757C ldr r0, =sub_80B7E94 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _080B7FC0 .pool _080B7F7C: @@ -28763,7 +28763,7 @@ sub_80B7FC8: @ 80B7FC8 push {lr} ldr r0, =sub_80B7FDC movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -29014,10 +29014,10 @@ _080B81B8: ldr r0, =mapldr_08085D88 str r0, [r1] ldr r0, =sub_80B7FDC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B81E6: pop {r4} pop {r0} @@ -29049,7 +29049,7 @@ mapldr_08085D88: @ 80B8200 bl CameraObjectReset2 ldr r0, =sub_80B8250 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -29321,10 +29321,10 @@ sub_80B8410: @ 80B8410 bl CameraObjectReset1 bl sub_809757C ldr r0, =sub_80B8250 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B8484: add sp, 0x8 pop {r4,r5} @@ -29351,7 +29351,7 @@ _080B84BC: ldr r0, =sub_80B88B4 _080B84BE: movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r2, =0x02038c08 @@ -29738,10 +29738,10 @@ overworld_bg_setup_2: @ 80B87B8 movs r0, 0x6 bl FieldEffectActiveListRemove ldr r0, =sub_80B8554 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask add sp, 0x4 pop {r4} pop {r0} @@ -29754,7 +29754,7 @@ sub_80B880C: @ 80B880C push {r4,lr} sub sp, 0x4 ldr r0, =sub_80B8554 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -30068,10 +30068,10 @@ sub_80B8A64: @ 80B8A64 movs r0, 0x6 bl FieldEffectActiveListRemove ldr r0, =sub_80B88B4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask add sp, 0x8 pop {r4} pop {r0} @@ -30084,7 +30084,7 @@ sub_80B8AE0: @ 80B8AE0 push {r4,lr} sub sp, 0x4 ldr r0, =sub_80B88B4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -30409,7 +30409,7 @@ sub_80B8D44: @ 80B8D44 push {lr} ldr r0, =sub_80B8D84 movs r1, 0xFF - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -30657,10 +30657,10 @@ sub_80B8F24: @ 80B8F24 movs r0, 0x9 bl FieldEffectActiveListRemove ldr r0, =sub_80B8D84 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B8F84: pop {r4,r5} pop {r0} @@ -30910,7 +30910,7 @@ sub_80B91A4: @ 80B91A4 push {lr} ldr r0, =sub_80B91D4 movs r1, 0xFE - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -31276,10 +31276,10 @@ sub_80B9494: @ 80B9494 movs r0, 0x1F bl FieldEffectActiveListRemove ldr r0, =sub_80B91D4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B94B6: pop {r0} bx r0 @@ -31673,7 +31673,7 @@ sub_80B97C0: @ 80B97C0 push {lr} ldr r0, =sub_80B97D4 movs r1, 0xFE - bl AddTask + bl CreateTask movs r0, 0 pop {r1} bx r1 @@ -32032,10 +32032,10 @@ _080B9A94: movs r0, 0x20 bl FieldEffectActiveListRemove ldr r0, =sub_80B97D4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _080B9ACA: pop {r4-r7} pop {r0} @@ -32058,7 +32058,7 @@ sub_80B9ADC: @ 80B9ADC bne _080B9B2C ldr r0, =sub_80B9BE8 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -32159,7 +32159,7 @@ _080B9BB6: cmp r0, 0 bne _080B9BC8 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B9BC8: pop {r4,r5} pop {r0} @@ -32216,7 +32216,7 @@ sub_80B9C28: @ 80B9C28 adds r5, r0, 0 ldr r0, =sub_80B9B3C movs r1, 0x5A - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -32305,7 +32305,7 @@ sub_80B9CDC: @ 80B9CDC cmp r0, 0 bne _080B9D16 ldr r0, =sub_80B9B3C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080B9D16 @@ -32317,7 +32317,7 @@ sub_80B9CDC: @ 80B9CDC movs r0, 0x41 bl FieldEffectActiveListRemove adds r0, r5, 0 - bl remove_task + bl DestroyTask _080B9D16: pop {r4,r5} pop {r0} @@ -32506,7 +32506,7 @@ sub_80B9E28: @ 80B9E28 bl npc_coords_shift ldr r0, =sub_80B9EDC movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -32647,7 +32647,7 @@ _080B9F7C: movs r0, 0x42 bl FieldEffectActiveListRemove adds r0, r7, 0 - bl remove_task + bl DestroyTask _080B9FAC: pop {r4-r7} pop {r0} @@ -32674,7 +32674,7 @@ remove_some_task: @ 80B9FB8 ldrb r0, [r4, 0x18] cmp r0, 0xFF beq _080B9FE2 - bl remove_task + bl DestroyTask movs r0, 0xFF strb r0, [r4, 0x18] _080B9FE2: @@ -32870,7 +32870,7 @@ task00_for_dp12: @ 80BA174 cmp r0, 0 beq _080BA1A4 mov r0, r12 - bl remove_task + bl DestroyTask ldr r1, =0x02039b28 movs r0, 0xFF strb r0, [r1, 0x18] @@ -33163,7 +33163,7 @@ sub_80BA384: @ 80BA384 bl sub_80BA038 ldr r0, =task00_for_dp12 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r7, r0, 24 ldr r0, =0x03005e00 @@ -33243,7 +33243,7 @@ _080BA47E: thumb_func_start sub_80BA4B0 sub_80BA4B0: @ 80BA4B0 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -33446,7 +33446,7 @@ _080BA56A: _080BA69C: bl sub_80A1A74 bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData ldr r1, =0x030022c0 movs r0, 0x87 @@ -33533,7 +33533,7 @@ _080BA760: _080BA774: ldr r0, =sub_80BA83C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -33975,7 +33975,7 @@ sub_80BAB08: @ 80BAB08 cmp r0, 0 bne _080BAB2C adds r0, r2, 0 - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers ldr r0, =0x030022c0 ldr r0, [r0, 0x8] @@ -35301,7 +35301,7 @@ _080BB582: .pool _080BB5FC: bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl ResetObjectPaletteAllocator @@ -35322,7 +35322,7 @@ _080BB628: bl sub_80BB384 ldr r0, =sub_80BB78C movs r1, 0 - bl AddTask + bl CreateTask ldr r1, [r4] ldr r5, =0x03005d90 ldr r0, [r5] @@ -35435,7 +35435,7 @@ _080BB74C: thumb_func_start sub_80BB774 sub_80BB774: @ 80BB774 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -36164,7 +36164,7 @@ _080BBE18: bl sub_80BDA40 bl sub_80BC890 adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_8086194 bl SetMainCallback2 ldr r0, =0x03007420 @@ -41100,7 +41100,7 @@ sub_80BE91C: @ 80BE91C str r0, [r1] ldr r0, =sub_80BEA24 movs r1, 0 - bl AddTask + bl CreateTask adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 @@ -41926,7 +41926,7 @@ sub_80BF070: @ 80BF070 bl sub_818D820 bl sub_80BEDB0 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080BF09C: pop {r4} pop {r0} @@ -43360,7 +43360,7 @@ sub_80BFDF4: @ 80BFDF4 lsrs r4, 16 ldr r0, =sub_80BFE38 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -43755,7 +43755,7 @@ _080C0168: movs r2, 0x20 bl decompress_palette adds r0, r6, 0 - bl remove_task + bl DestroyTask _080C01BA: pop {r4-r6} pop {r0} @@ -45908,7 +45908,7 @@ sub_80C1258: @ 80C1258 push {lr} ldr r0, =sub_80C12E0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -47153,7 +47153,7 @@ sub_80C1D70: @ 80C1D70 bne _080C1D8C bl sub_80C152C adds r0, r4, 0 - bl remove_task + bl DestroyTask _080C1D8C: pop {r4} pop {r0} @@ -48348,7 +48348,7 @@ sub_80C26D4: @ 80C26D4 thumb_func_start sub_80C2710 sub_80C2710: @ 80C2710 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -48375,7 +48375,7 @@ sub_80C2728: @ 80C2728 movs r0, 0 str r0, [r5] adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4,r5} pop {r0} bx r0 @@ -49840,11 +49840,11 @@ sub_80C3404: @ 80C3404 thumb_func_start sub_80C3414 sub_80C3414: @ 80C3414 push {lr} - bl clear_tasks + bl ResetTasks bl remove_some_task ldr r0, =sub_80C2760 movs r1, 0 - bl AddTask + bl CreateTask bl sub_80C4EE4 bl sub_80C3190 pop {r0} @@ -52194,7 +52194,7 @@ sub_80C4918: @ 80C4918 ldr r4, =sub_80C4960 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -52210,7 +52210,7 @@ sub_80C4918: @ 80C4918 sub_80C4940: @ 80C4940 push {lr} ldr r0, =sub_80C4960 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -52773,10 +52773,10 @@ sub_80C4DB0: @ 80C4DB0 movs r0, 0 bl SetHBlankCallback ldr r0, =sub_80C4960 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -53524,7 +53524,7 @@ _080C5416: thumb_func_start sub_80C5438 sub_80C5438: @ 80C5438 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad pop {r0} @@ -53539,7 +53539,7 @@ sub_80C544C: @ 80C544C beq _080C5464 ldr r0, =sub_80C5A48 movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_80C5438 bl SetMainCallback2 _080C5464: @@ -53604,7 +53604,7 @@ _080C54EE: bl sub_80C50D0 b _080C56F4 _080C54F4: - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator bl sub_80A1A74 @@ -53887,7 +53887,7 @@ _080C57A6: b _080C57E4 _080C57AC: bl sub_80C50D0 - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator b _080C57E4 @@ -53997,7 +53997,7 @@ sub_80C5868: @ 80C5868 bgt _080C58AC ldr r0, =sub_80C5BD8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -54018,7 +54018,7 @@ _080C58AC: strb r0, [r2, 0xE] ldr r0, =sub_80C5A48 movs r1, 0 - bl AddTask + bl CreateTask _080C58C0: ldr r0, =sub_80C5438 bl SetMainCallback2 @@ -54156,7 +54156,7 @@ _080C59D4: orrs r0, r1 strb r0, [r2, 0xE] adds r0, r3, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80C5934 bl SetMainCallback2 b _080C5A1A @@ -54339,7 +54339,7 @@ _080C5B48: ldr r0, =sub_80C5470 bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask _080C5B5E: ldr r0, =0x030022c0 ldrh r1, [r0, 0x2E] @@ -54352,7 +54352,7 @@ _080C5B5E: ldr r0, =sub_80C5470 bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask b _080C5BCA .pool _080C5B88: @@ -54566,7 +54566,7 @@ _080C5D3C: cmp r0, 0 bne _080C5D64 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80C5934 bl SetMainCallback2 b _080C5D82 @@ -55410,10 +55410,10 @@ _080C6466: bl AllocZeroed str r0, [r5] str r4, [r0] - bl clear_tasks + bl ResetTasks ldr r0, =sub_80C67BC movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_80C5438 bl SetMainCallback2 pop {r4,r5} @@ -55425,7 +55425,7 @@ _080C6466: thumb_func_start sub_80C6498 sub_80C6498: @ 80C6498 push {r4,lr} - bl clear_tasks + bl ResetTasks ldr r4, =0x02039cf4 ldr r0, [r4] ldr r0, [r0] @@ -55883,7 +55883,7 @@ _080C68C8: b _080C68E0 _080C68CE: adds r0, r2, 0 - bl remove_task + bl DestroyTask bl sub_80C6498 b _080C68E0 _080C68DA: @@ -57286,7 +57286,7 @@ _080C73D0: lsrs r0, 24 bl RemoveWindow adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080C756A _080C73F6: movs r3, 0xC @@ -57459,7 +57459,7 @@ _080C7544: lsrs r0, 24 bl RemoveWindow adds r0, r4, 0 - bl remove_task + bl DestroyTask _080C756A: add sp, 0x10 pop {r4-r7} @@ -57473,7 +57473,7 @@ sub_80C7578: @ 80C7578 push {lr} ldr r0, =c3_0808C39C movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -57500,7 +57500,7 @@ mapldr_0808C6D8: @ 80C75A8 ldr r4, =c3_0808C39C adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -58435,7 +58435,7 @@ sub_80C7D28: @ 80C7D28 thumb_func_start c2_Box c2_Box: @ 80C7D54 push {lr} - bl RunActiveTasks + bl RunTasks bl do_scheduled_bg_tilemap_copies_to_vram bl sub_80CA028 bl sub_80CAA14 @@ -58450,7 +58450,7 @@ sub_80C7D74: @ 80C7D74 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - bl clear_tasks + bl ResetTasks ldr r0, =0x02039d0d strb r5, [r0] ldr r4, =0x02039d08 @@ -58475,7 +58475,7 @@ _080C7DA8: strb r1, [r0] ldr r0, =task_box_related_3 movs r1, 0x3 - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1, 0x4] bl get_preferred_box @@ -58493,7 +58493,7 @@ _080C7DD4: thumb_func_start c2_808CE60 c2_808CE60: @ 80C7DEC push {r4,lr} - bl clear_tasks + bl ResetTasks ldr r4, =0x02039d08 ldr r0, =0x000062c4 bl Alloc @@ -58517,7 +58517,7 @@ _080C7E18: strb r2, [r0] ldr r0, =task_box_related_3 movs r1, 0x3 - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1, 0x4] ldr r0, =c2_Box @@ -62159,7 +62159,7 @@ _080C9F48: bl GoToBagMenu _080C9F56: mov r0, r8 - bl remove_task + bl DestroyTask add sp, 0x8 pop {r3} mov r8, r3 @@ -66499,7 +66499,7 @@ sub_80CC32C: @ 80CC32C lsrs r4, 24 ldr r0, =sub_80CC370 movs r1, 0x2 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -66518,7 +66518,7 @@ sub_80CC32C: @ 80CC32C sub_80CC35C: @ 80CC35C push {lr} ldr r0, =sub_80CC370 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -66616,7 +66616,7 @@ _080CC426: .pool _080CC44C: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _080CC458 _080CC454: movs r0, 0 @@ -77264,10 +77264,10 @@ _080D1CFC: .pool thumb_func_end sub_80D1CCC - thumb_func_start nullsub_40 -nullsub_40: @ 80D1D04 + thumb_func_start TaskDummy0 +TaskDummy0: @ 80D1D04 bx lr - thumb_func_end nullsub_40 + thumb_func_end TaskDummy0 thumb_func_start nullsub_98 nullsub_98: @ 80D1D08 @@ -80230,7 +80230,7 @@ exec_movement: @ 80D32E8 b _080D3332 _080D330A: ldr r0, =sub_80D3660 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080D331C @@ -80305,7 +80305,7 @@ sub_80D338C: @ 80D338C adds r0, r4, 0 bl sub_80D361C adds r0, r4, 0 - bl remove_task + bl DestroyTask _080D33A6: pop {r4} pop {r0} @@ -80319,7 +80319,7 @@ sub_80D33AC: @ 80D33AC lsls r1, 24 lsrs r1, 24 ldr r0, =sub_80D3660 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 movs r2, 0x1 @@ -80351,7 +80351,7 @@ _080D33CC: sub_80D33F4: @ 80D33F4 push {lr} ldr r0, =sub_80D3660 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 pop {r1} @@ -82860,13 +82860,13 @@ AddMapNamePopUpWindowTask: @ 80D47E4 beq _080D486C ldr r4, =Task_MapNamePopUpWindow adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080D4844 adds r0, r4, 0 movs r1, 0x5A - bl AddTask + bl CreateTask ldr r4, =0x02039dd4 strb r0, [r4] movs r0, 0x12 @@ -83044,7 +83044,7 @@ _080D496E: HideMapNamePopUpWindow: @ 80D4974 push {lr} ldr r0, =Task_MapNamePopUpWindow - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _080D49A4 @@ -83059,7 +83059,7 @@ HideMapNamePopUpWindow: @ 80D4974 bl SetGpuReg_ForcedBlank ldr r0, =0x02039dd4 ldrb r0, [r0] - bl remove_task + bl DestroyTask _080D49A4: pop {r0} bx r0 @@ -88758,10 +88758,10 @@ itemid_get_x28: @ 80D7644 .pool thumb_func_end itemid_get_x28 - thumb_func_start nullsub_41 -nullsub_41: @ 80D7668 + thumb_func_start TaskDummy1 +TaskDummy1: @ 80D7668 bx lr - thumb_func_end nullsub_41 + thumb_func_end TaskDummy1 thumb_func_start sub_80D766C sub_80D766C: @ 80D766C @@ -89324,7 +89324,7 @@ _080D7B4E: orrs r0, r1 strb r0, [r2, 0x8] bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator ldr r1, =0x0300301c movs r0, 0x4 @@ -89380,7 +89380,7 @@ _080D7C04: bl SetVBlankCallback ldr r0, =sub_80D7C7C movs r1, 0xA - bl AddTask + bl CreateTask ldr r1, =0x02039f34 ldr r1, [r1] ldr r1, [r1] @@ -89518,14 +89518,14 @@ _080D7D3A: _080D7D62: ldr r0, =sub_80D7DAC movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x03005e00 lsls r0, r5, 2 adds r0, r5 lsls r0, 3 adds r0, r1 strh r4, [r0, 0x8] - ldr r1, =nullsub_41 + ldr r1, =TaskDummy1 str r1, [r0] b _080D7D9E .pool @@ -89551,7 +89551,7 @@ sub_80D7DAC: @ 80D7DAC lsrs r0, 24 ldr r1, =sub_80FC998 ldr r2, =sub_80D7DC8 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -89592,7 +89592,7 @@ sub_80D7DE8: @ 80D7DE8 bgt _080D7E2A bl link_get_multiplayer_id adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =0x02039f34 ldr r0, [r0] ldr r0, [r0] @@ -90039,7 +90039,7 @@ _080D822C: sub_80D823C: @ 80D823C push {r4,r5,lr} bl CallObjectCallbacks - bl RunActiveTasks + bl RunTasks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably movs r4, 0 @@ -90732,18 +90732,18 @@ sub_80D8894: @ 80D8894 ldr r4, =sub_80FC9F8 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =sub_80D892C adds r1, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc ldr r1, =0x03005e00 lsls r0, r5, 2 adds r0, r5 lsls r0, 3 adds r0, r1 - ldr r1, =nullsub_41 + ldr r1, =TaskDummy1 str r1, [r0] bl sub_80DBF68 movs r0, 0 @@ -90771,7 +90771,7 @@ sub_80D892C: @ 80D892C push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldr r2, =0x03005e00 ldr r0, =0x02039f34 ldr r0, [r0] @@ -91150,12 +91150,12 @@ _080D8CD4: ldr r4, =sub_80FCC88 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =sub_80DA110 adds r1, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc bl sub_80DBF68 ldr r1, =0x03005e00 mov r0, r10 @@ -93486,7 +93486,7 @@ sub_80DA110: @ 80DA110 negs r1, r1 ands r1, r2 strb r1, [r3, 0x7] - bl remove_task + bl DestroyTask pop {r0} bx r0 .pool @@ -93599,12 +93599,12 @@ _080DA1F4: ldr r4, =sub_80FCC88 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =sub_80DA110 adds r1, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc bl sub_80DBF68 strh r6, [r5, 0x8] b _080DA250 @@ -94269,18 +94269,18 @@ sub_80DA7A0: @ 80DA7A0 ldr r5, =sub_80FCACC adds r0, r5, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =sub_80DA7EC adds r1, r5, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc ldr r1, =0x03005e00 lsls r0, r4, 2 adds r0, r4 lsls r0, 3 adds r0, r1 - ldr r1, =nullsub_41 + ldr r1, =TaskDummy1 str r1, [r0] bl sub_80DBF68 movs r0, 0 @@ -94297,7 +94297,7 @@ sub_80DA7EC: @ 80DA7EC sub sp, 0x4 lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -94334,7 +94334,7 @@ sub_80DA830: @ 80DA830 cmp r0, 0 bne _080DA860 adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r0, =0x03005dac ldr r1, =sub_80DA874 str r1, [r0] @@ -97390,7 +97390,7 @@ sub_80DC028: @ 80DC028 strb r0, [r1, 0x2] ldr r0, =sub_80DC0F4 movs r1, 0x14 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r7, r0, 24 lsls r5, 16 @@ -97498,7 +97498,7 @@ _080DC126: cmp r0, 0 bne _080DC15C adds r0, r7, 0 - bl remove_task + bl DestroyTask ldr r0, =0x02039f34 ldr r0, [r0] ldr r0, [r0, 0x14] @@ -98083,7 +98083,7 @@ sub_80DC5E8: @ 80DC5E8 push {r4,lr} ldr r0, =sub_80DC728 movs r1, 0x1E - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x02039f34 @@ -98155,7 +98155,7 @@ sub_80DC674: @ 80DC674 lsrs r4, 24 ldr r0, =sub_80DC6A4 movs r1, 0x1F - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -98227,7 +98227,7 @@ _080DC6DC: movs r2, 0 bl pal_fade_1 adds r0, r6, 0 - bl remove_task + bl DestroyTask _080DC716: pop {r4-r7} pop {r0} @@ -98342,7 +98342,7 @@ sub_80DC7EC: @ 80DC7EC push {r4,lr} ldr r0, =sub_80DC8D0 movs r1, 0x1E - bl AddTask + bl CreateTask ldr r1, =0x02039f34 ldr r1, [r1] ldr r1, [r1] @@ -100575,7 +100575,7 @@ sub_80DDA20: @ 80DDA20 push {r4,r5,lr} ldr r0, =c3_08130B10 movs r1, 0xA - bl AddTask + bl CreateTask adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 @@ -100677,7 +100677,7 @@ _080DDACA: movs r3, 0x1F bl pal_fade_1 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080DDAFE: pop {r4-r6} pop {r0} @@ -100690,7 +100690,7 @@ sub_80DDB0C: @ 80DDB0C push {r4,lr} ldr r0, =sub_80DDB6C movs r1, 0xA - bl AddTask + bl CreateTask ldr r3, =0x02020630 ldr r4, =0x02039f34 ldr r2, [r4] @@ -100781,7 +100781,7 @@ _080DDBB8: ands r0, r1 strb r0, [r2, 0x6] adds r0, r3, 0 - bl remove_task + bl DestroyTask _080DDBD4: pop {r4,r5} pop {r0} @@ -100817,7 +100817,7 @@ sub_80DDBE8: @ 80DDBE8 _080DDC1C: ldr r0, =task08_080CD1CC movs r1, 0xA - bl AddTask + bl CreateTask ldr r2, [r4] ldr r0, [r2] adds r0, 0x58 @@ -100901,7 +100901,7 @@ _080DDC9C: ands r0, r1 strb r0, [r2, 0x6] adds r0, r4, 0 - bl remove_task + bl DestroyTask _080DDCC4: pop {r4,r5} pop {r0} @@ -100917,7 +100917,7 @@ sub_80DDCDC: @ 80DDCDC lsrs r4, 24 ldr r0, =sub_80DDD20 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -101003,7 +101003,7 @@ _080DDD70: ands r0, r1 strb r0, [r2, 0x6] adds r0, r5, 0 - bl remove_task + bl DestroyTask _080DDD9C: pop {r4,r5} pop {r0} @@ -101068,7 +101068,7 @@ sub_80DDE0C: @ 80DDE0C push {lr} ldr r0, =sub_80DDE30 movs r1, 0xF - bl AddTask + bl CreateTask ldr r0, =0x02039f34 ldr r0, [r0] ldr r2, [r0] @@ -101144,7 +101144,7 @@ _080DDE8C: ands r0, r1 strb r0, [r2, 0x6] adds r0, r5, 0 - bl remove_task + bl DestroyTask _080DDEBA: pop {r4,r5} pop {r0} @@ -101162,7 +101162,7 @@ sub_80DDED0: @ 80DDED0 lsrs r5, r1, 24 ldr r0, =sub_80DDF80 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r6, r0, 24 lsls r4, 24 @@ -101288,7 +101288,7 @@ _080DDFB8: cmp r1, r0 bne _080DDFFC adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =0x02039f34 ldr r0, [r0] ldr r2, [r0] @@ -101939,12 +101939,12 @@ _080DE552: ldr r4, =sub_80FCC88 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =sub_80DA110 adds r1, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc bl sub_80DBF68 movs r0, 0x2 strh r0, [r5, 0x8] @@ -102193,7 +102193,7 @@ _080DE74C: ble _080DE6AE ldr r0, =sub_80DE794 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -102291,7 +102291,7 @@ _080DE7EE: ands r0, r1 strb r0, [r2, 0x7] adds r0, r6, 0 - bl remove_task + bl DestroyTask _080DE822: pop {r4-r6} pop {r0} @@ -104698,7 +104698,7 @@ _080DFAF8: bl CopyWindowToVram ldr r0, =Task_ShopMenu movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 add sp, 0x10 @@ -104870,7 +104870,7 @@ HandleShopMenuQuit: @ 80DFC68 bl SaveRecordedItemPurchasesForTVShow bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r5, [r5] cmp r5, 0 beq _080DFC98 @@ -104900,7 +104900,7 @@ Task_GoToBuyOrSellMenu: @ 80DFCA4 cmp r0, 0 bne _080DFCD2 adds r0, r2, 0 - bl remove_task + bl DestroyTask ldrh r0, [r4, 0x10] lsls r0, 16 ldrh r1, [r4, 0x12] @@ -104920,7 +104920,7 @@ MapPostLoadHook_ExitBuyOrSellMenu: @ 80DFCE0 bl pal_fill_black ldr r0, =Task_ExitSellMenu movs r1, 0x8 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -104971,7 +104971,7 @@ ReturnToShopMenuAfterExitingSellMenu: @ 80DFD44 ldrb r0, [r0, 0xF] bl CreateShopMenu adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -104982,7 +104982,7 @@ ReturnToShopMenuAfterExitingSellMenu: @ 80DFD44 @ void CB2_BuyMenu() CB2_BuyMenu: @ 80DFD64 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -105022,7 +105022,7 @@ _080DFDAC: bl BuyMenuAddScrollIndicatorArrows ldr r0, =Task_BuyMenu movs r1, 0x8 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -105070,7 +105070,7 @@ _080DFE20: bl ResetObjectPaletteAllocator bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl clear_scheduled_bg_copies_to_vram ldr r4, =0x02039f70 ldr r0, =0x000020b0 @@ -107326,7 +107326,7 @@ Task_ExitBuyMenu: @ 80E11B0 ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080E11D6: pop {r4} pop {r0} @@ -107754,7 +107754,7 @@ sub_80E150C: @ 80E150C ldr r6, =sub_80E1444 adds r0, r6, 0 movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -107799,7 +107799,7 @@ sub_80E1570: @ 80E1570 push {lr} ldr r0, =0x02039f8c ldrb r0, [r0] - bl remove_task + bl DestroyTask pop {r0} bx r0 .pool @@ -108959,7 +108959,7 @@ Multichoice: @ 80E1E08 lsls r3, 24 lsrs r4, r3, 24 ldr r0, =sub_80E2058 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -109005,7 +109005,7 @@ sub_80E1E58: @ 80E1E58 lsls r4, 24 lsrs r4, 24 ldr r0, =sub_80E2058 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -109200,7 +109200,7 @@ _080E1FF0: bls _080E1FE6 adds r0, r6, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -109310,7 +109310,7 @@ _080E20EC: ldrb r0, [r5, 0xC] bl sub_80E2A78 adds r0, r6, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080E20FC: pop {r4-r6} @@ -109324,7 +109324,7 @@ yes_no_box: @ 80E2108 push {r4,lr} ldr r4, =task_yes_no_maybe adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -109335,7 +109335,7 @@ yes_no_box: @ 80E2108 bl sub_8197930 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask movs r0, 0x1 b _080E213A .pool @@ -109416,7 +109416,7 @@ _080E21B8: strh r0, [r1] _080E21BA: adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080E21C4: pop {r4} @@ -109448,7 +109448,7 @@ sub_80E21D0: @ 80E21D0 lsrs r4, 24 mov r10, r4 ldr r0, =sub_80E2308 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -109510,7 +109510,7 @@ _080E2246: lsrs r6, 24 ldr r0, =sub_80E2308 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -109607,7 +109607,7 @@ _080E2350: ldrb r0, [r5, 0xC] bl sub_80E2A78 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080E2360: pop {r4,r5} @@ -109621,7 +109621,7 @@ _080E2360: sp109_CreatePCMenu: @ 80E236C push {lr} ldr r0, =sub_80E2058 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -109828,7 +109828,7 @@ sub_80E2514: @ 80E2514 sub_80E2548: @ 80E2548 push {lr} ldr r0, =sub_80E2058 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -110267,7 +110267,7 @@ _080E28EC: ldrb r0, [r4, 0x12] bl sub_80E2A78 adds r0, r5, 0 - bl remove_task + bl DestroyTask _080E28F8: pop {r4,r5} pop {r0} @@ -110288,7 +110288,7 @@ sub_80E2900: @ 80E2900 lsrs r6, r2, 24 ldr r4, =task_picbox adds r0, r4, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -110309,7 +110309,7 @@ sub_80E2900: @ 80E2900 lsrs r5, 24 adds r0, r4, 0 movs r1, 0x50 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -110368,7 +110368,7 @@ _080E29BA: picbox_close: @ 80E29C4 push {lr} ldr r0, =task_picbox - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -110395,7 +110395,7 @@ _080E29F6: sub_80E29FC: @ 80E29FC push {lr} ldr r0, =task_picbox - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -110583,7 +110583,7 @@ _080E2B70: sp106_CreateStartMenu: @ 80E2B7C push {lr} ldr r0, =sub_80E2058 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -110734,7 +110734,7 @@ sub_80E2CC4: @ 80E2CC4 strb r0, [r1] ldr r0, =sub_80E2058 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -110923,7 +110923,7 @@ _080E2E5E: bl ResetObjectPaletteAllocator b _080E2E86 _080E2E68: - bl clear_tasks + bl ResetTasks b _080E2E86 _080E2E6E: bl choose_name_or_words_screen_apply_bg_pals @@ -111283,7 +111283,7 @@ sub_80E3194: @ 80E3194 push {lr} ldr r0, =sub_80E31B0 movs r1, 0x2 - bl AddTask + bl CreateTask ldr r0, =sub_80E4F58 bl SetMainCallback2 pop {r0} @@ -111625,10 +111625,10 @@ _080E34A0: ldr r0, [r0] bl SetMainCallback2 ldr r0, =sub_80E31B0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers ldr r0, [r4] bl Free @@ -111893,7 +111893,7 @@ sub_80E373C: @ 80E373C ldr r4, =sub_80E375C adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -111935,7 +111935,7 @@ _080E376E: sub_80E3794: @ 80E3794 push {lr} ldr r0, =sub_80E375C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -112111,10 +112111,10 @@ _080E38EA: sub_80E3904: @ 80E3904 push {lr} ldr r0, =sub_80E375C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -112126,7 +112126,7 @@ sub_80E3920: @ 80E3920 push {lr} ldr r0, =c3_0809E58C movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -112151,7 +112151,7 @@ sub_80E3948: @ 80E3948 lsls r2, 24 lsrs r6, r2, 24 ldr r0, =c3_0809E58C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -113412,10 +113412,10 @@ sub_80E4354: @ 80E4354 .pool thumb_func_end sub_80E4354 - thumb_func_start nullsub_42 -nullsub_42: @ 80E4380 + thumb_func_start TaskDummy2 +TaskDummy2: @ 80E4380 bx lr - thumb_func_end nullsub_42 + thumb_func_end TaskDummy2 thumb_func_start sub_80E4384 sub_80E4384: @ 80E4384 @@ -113725,7 +113725,7 @@ sub_80E45F8: @ 80E45F8 push {lr} ldr r0, =sub_80E465C movs r1, 0x1 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -113735,7 +113735,7 @@ sub_80E45F8: @ 80E45F8 sub_80E460C: @ 80E460C push {lr} ldr r0, =sub_80E465C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -113756,7 +113756,7 @@ sub_80E4630: @ 80E4630 lsls r4, 24 lsrs r4, 24 ldr r0, =sub_80E465C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -114192,10 +114192,10 @@ sub_80E498C: @ 80E498C .pool thumb_func_end sub_80E498C - thumb_func_start nullsub_43 -nullsub_43: @ 80E49B8 + thumb_func_start TaskDummy3 +TaskDummy3: @ 80E49B8 bx lr - thumb_func_end nullsub_43 + thumb_func_end TaskDummy3 thumb_func_start sub_80E49BC sub_80E49BC: @ 80E49BC @@ -114873,7 +114873,7 @@ sub_80E4EF0: @ 80E4EF0 thumb_func_start sub_80E4F58 sub_80E4F58: @ 80E4F58 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -118816,7 +118816,7 @@ sub_80E6D54: @ 80E6D54 adds r1, r4, 0 bl sub_81659DC adds r0, r4, 0 - bl nullsub_44 + bl TaskDummy4 bl link_get_multiplayer_id lsls r0, 24 cmp r0, 0 @@ -119198,13 +119198,13 @@ _080E71A0: strh r0, [r5] ldr r0, =sub_80E7324 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x14] ldr r0, =sub_80E7128 movs r1, 0x51 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1E] @@ -119227,13 +119227,13 @@ _080E7218: bl FlagSet bl sub_80FB074 ldrb r0, [r5, 0x1E] - bl remove_task + bl DestroyTask b _080E730A .pool _080E724C: ldr r0, =sub_80E7FF8 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x14] @@ -119305,13 +119305,13 @@ _080E72C0: beq _080E72F8 ldr r0, =sub_80AF2B4 movs r1, 0xA - bl AddTask + bl CreateTask _080E72F8: movs r0, 0 movs r1, 0x1 bl sub_8197434 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _080E730A: pop {r4,r5} @@ -119525,7 +119525,7 @@ _080E7490: bl sub_80E7808 ldr r0, =sub_80E7630 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1C] @@ -119552,7 +119552,7 @@ _080E7504: bl sub_80E7808 ldr r0, =sub_80E7630 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1C] @@ -119821,7 +119821,7 @@ _080E773E: cmp r4, r0 bne _080E7752 ldr r0, [sp] - bl remove_task + bl DestroyTask _080E7752: add sp, 0xC pop {r3-r5} @@ -119854,7 +119854,7 @@ sub_80E776C: @ 80E776C cmp r0, 0 bne _080E7794 adds r0, r3, 0 - bl remove_task + bl DestroyTask _080E7794: pop {r4} pop {r0} @@ -121008,7 +121008,7 @@ _080E8090: cmp r0, 0 bne _080E810A adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080E810A .pool _080E80A4: @@ -121019,12 +121019,12 @@ _080E80A4: bne _080E810A ldr r0, =sub_8153688 movs r1, 0x5 - bl AddTask + bl CreateTask b _080E80F2 .pool _080E80C0: ldr r0, =sub_8153688 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _080E810A @@ -121055,7 +121055,7 @@ _080E80FA: cmp r0, 0 beq _080E810A adds r0, r5, 0 - bl remove_task + bl DestroyTask _080E810A: pop {r4,r5} pop {r0} @@ -122311,10 +122311,10 @@ _080E8AAE: bx r0 thumb_func_end sub_80E8A54 - thumb_func_start nullsub_44 -nullsub_44: @ 80E8ABC + thumb_func_start TaskDummy4 +TaskDummy4: @ 80E8ABC bx lr - thumb_func_end nullsub_44 + thumb_func_end TaskDummy4 thumb_func_start sub_80E8AC0 sub_80E8AC0: @ 80E8AC0 @@ -123030,7 +123030,7 @@ _080E9030: ldr r0, =c2_load_new_map bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080E904A: pop {r4} pop {r0} @@ -123043,7 +123043,7 @@ sub_80E9068: @ 80E9068 push {lr} ldr r0, =sub_80E8FD0 movs r1, 0 - bl AddTask + bl CreateTask movs r0, 0x1 movs r1, 0 bl fade_screen @@ -123105,7 +123105,7 @@ sub_80E90C8: @ 80E90C8 bne _080E90F8 bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _080E90F8: pop {r4} pop {r0} @@ -123151,7 +123151,7 @@ sub_80E9108: @ 80E9108 bl pal_fill_black ldr r0, =sub_80E90C8 movs r1, 0 - bl AddTask + bl CreateTask add sp, 0x4 pop {r4} pop {r0} @@ -123207,7 +123207,7 @@ sub_80E916C: @ 80E916C ldr r0, =c2_load_new_map bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask _080E91D4: add sp, 0x4 pop {r4-r6} @@ -123221,7 +123221,7 @@ sub_80E91F8: @ 80E91F8 push {lr} ldr r0, =sub_80E916C movs r1, 0 - bl AddTask + bl CreateTask movs r0, 0x1 movs r1, 0 bl fade_screen @@ -123831,7 +123831,7 @@ _080E96F4: bl SetMainCallback2 bl script_env_2_disable adds r0, r5, 0 - bl remove_task + bl DestroyTask _080E9714: pop {r4,r5} pop {r0} @@ -123844,7 +123844,7 @@ sub_80E9728: @ 80E9728 push {lr} ldr r0, =sub_80E96A4 movs r1, 0 - bl AddTask + bl CreateTask movs r0, 0x1 movs r1, 0 bl fade_screen @@ -124479,7 +124479,7 @@ sub_80E9C74: @ 80E9C74 push {lr} ldr r0, =sub_8126AD8 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -124490,7 +124490,7 @@ sub_80E9C88: @ 80E9C88 push {lr} ldr r0, =sub_80E9C9C movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -125116,7 +125116,7 @@ _080EA1F4: bl script_env_1_execute_new_script _080EA1FA: adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -129211,7 +129211,7 @@ _080EC708: bl sub_80ED610 b _080EC724 _080EC70E: - bl nullsub_45 + bl TaskDummy5 b _080EC724 _080EC714: bl sub_80ECF5C @@ -130979,10 +130979,10 @@ _080ED706: bx r0 thumb_func_end sub_80ED610 - thumb_func_start nullsub_45 -nullsub_45: @ 80ED714 + thumb_func_start TaskDummy5 +TaskDummy5: @ 80ED714 bx lr - thumb_func_end nullsub_45 + thumb_func_end TaskDummy5 thumb_func_start sub_80ED718 sub_80ED718: @ 80ED718 @@ -145479,7 +145479,7 @@ sub_80F5B00: @ 80F5B00 bl dp12_8087EA4 bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator bl sub_80F591C bl sub_80F6A9C @@ -145513,7 +145513,7 @@ sub_80F5B00: @ 80F5B00 strb r0, [r5, 0x8] ldr r0, =sub_80F5CE4 movs r1, 0x5 - bl AddTask + bl CreateTask ldr r1, [r4] ldr r1, [r1] strb r0, [r1, 0x2] @@ -145528,7 +145528,7 @@ sub_80F5B00: @ 80F5B00 strh r0, [r1] ldr r0, =sub_80F68B4 movs r1, 0x14 - bl AddTask + bl CreateTask bl sub_80F7880 ldr r0, =0x02039f2a ldrb r1, [r0] @@ -145560,7 +145560,7 @@ sub_80F5C00: @ 80F5C00 push {lr} bl CallObjectCallbacks bl PrepareSpritesForOamLoad - bl RunActiveTasks + bl RunTasks bl fade_and_return_progress_probably movs r0, 0x1 bl CopyBgTilemapBufferToVram @@ -145840,13 +145840,13 @@ sub_80F5ED8: @ 80F5ED8 beq _080F5EFC ldr r0, =sub_80F5F14 movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x03005e00 lsls r0, r4, 2 adds r0, r4 lsls r0, 3 adds r0, r1 - ldr r1, =nullsub_4 + ldr r1, =TaskDummy str r1, [r0] _080F5EFC: pop {r4} @@ -145862,7 +145862,7 @@ sub_80F5F14: @ 80F5F14 lsrs r0, 24 ldr r1, =sub_80FC998 ldr r2, =sub_80F5F30 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -145878,7 +145878,7 @@ sub_80F5F30: @ 80F5F30 cmp r0, 0 beq _080F5F60 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r2, =0x03005e00 ldr r0, =0x0203a034 ldr r0, [r0] @@ -145915,7 +145915,7 @@ sub_80F5F74: @ 80F5F74 bne _080F5FC4 ldr r0, =sub_80F68F0 movs r1, 0x14 - bl AddTask + bl CreateTask ldr r0, =gUnknown_085ED1B8 ldr r1, =0x0203a034 ldr r1, [r1] @@ -146285,7 +146285,7 @@ _080F6292: _080F6298: ldr r0, =sub_80F73DC movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -146328,7 +146328,7 @@ _080F62F2: strh r0, [r4, 0xA] ldr r0, =sub_80F74BC movs r1, 0xA - bl AddTask + bl CreateTask ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -146588,7 +146588,7 @@ _080F64F2: bl LoadCompressedObjectPalette ldr r0, =sub_80F7670 movs r1, 0xA - bl AddTask + bl CreateTask ldr r0, =0x03005e00 mov r4, r10 adds r1, r4, r7 @@ -146930,7 +146930,7 @@ sub_80F6820: @ 80F6820 ldr r0, [r0] ldr r0, [r0] ldrb r0, [r0, 0x3] - bl remove_task + bl DestroyTask ldr r0, =0x0000ffff b _080F686E .pool @@ -146955,7 +146955,7 @@ _080F6884: movs r1, 0 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music bl SetMainCallback2 @@ -148433,7 +148433,7 @@ _080F741C: adds r0, 0x1 strb r0, [r1, 0x5] mov r0, r8 - bl remove_task + bl DestroyTask movs r0, 0x18 bl audio_play _080F74A4: @@ -148766,7 +148766,7 @@ _080F7732: cmp r0, 0 beq _080F7744 adds r0, r7, 0 - bl remove_task + bl DestroyTask _080F7744: pop {r3} mov r8, r3 @@ -148851,7 +148851,7 @@ sub_80F77E0: @ 80F77E0 lsrs r5, 24 ldr r0, =sub_80F7824 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -149224,7 +149224,7 @@ _080F7AAC: bl FillBgTilemapBufferRect_Palette0 ldr r0, =sub_80F7CA8 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 mov r0, r10 @@ -149318,7 +149318,7 @@ _080F7B7C: bl FillBgTilemapBufferRect_Palette0 ldr r0, =sub_80F7CA8 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r0, =0x0203a034 @@ -149600,7 +149600,7 @@ _080F7DCA: subs r0, 0x1 strb r0, [r1, 0x14] mov r0, r8 - bl remove_task + bl DestroyTask _080F7DDC: add sp, 0x8 pop {r3,r4} @@ -150315,7 +150315,7 @@ sub_80F83E0: @ 80F83E0 cmp r0, 0 bne _080F83FE adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80F83D0 bl SetMainCallback2 _080F83FE: @@ -150331,7 +150331,7 @@ sub_80F840C: @ 80F840C bl script_env_2_enable ldr r0, =sub_80F83E0 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -150371,7 +150371,7 @@ sub_80F8458: @ 80F8458 cmp r0, 0 bne _080F8476 adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80F5B00 bl SetMainCallback2 _080F8476: @@ -150387,7 +150387,7 @@ sub_80F8484: @ 80F8484 bl script_env_2_enable ldr r0, =sub_80F8458 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -150421,14 +150421,14 @@ sub_80F84C4: @ 80F84C4 ldr r6, =sub_80FC580 adds r0, r6, 0 movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 ldr r2, =sub_80F8508 adds r0, r4, 0 adds r1, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc ldr r1, =0x03005e00 lsls r0, r4, 2 adds r0, r4 @@ -150458,7 +150458,7 @@ sub_80F8508: @ 80F8508 ldr r1, =sub_80FC6BC ldr r2, =sub_80F8568 adds r0, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc b _080F8556 .pool _080F8540: @@ -150486,7 +150486,7 @@ sub_80F8568: @ 80F8568 lsrs r0, 24 ldr r1, =sub_80FC804 ldr r2, =sub_80F8584 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -150499,7 +150499,7 @@ sub_80F8584: @ 80F8584 lsrs r0, 24 ldr r1, =sub_80FCE48 ldr r2, =sub_80F85A0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -150512,7 +150512,7 @@ sub_80F85A0: @ 80F85A0 lsrs r0, 24 ldr r1, =sub_80FC894 ldr r2, =sub_80F85BC - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -150626,7 +150626,7 @@ _080F8678: ldr r1, =sub_80FCF40 ldr r2, =sub_80F86B8 adds r0, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc add sp, 0x8 pop {r3,r4} mov r8, r3 @@ -150648,7 +150648,7 @@ sub_80F86B8: @ 80F86B8 ldr r1, =sub_80FCFD0 ldr r2, =sub_80F8714 adds r0, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4} pop {r0} bx r0 @@ -150720,7 +150720,7 @@ _080F874C: cmp r4, 0 bge _080F874C adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r0, =0x03005d8c ldr r0, [r0] movs r1, 0x4 @@ -150770,7 +150770,7 @@ sub_80F87B4: @ 80F87B4 cmp r0, 0 bne _080F87D0 adds r0, r1, 0 - bl remove_task + bl DestroyTask bl script_env_2_disable bl script_env_2_enable_and_set_ctx_running _080F87D0: @@ -151437,7 +151437,7 @@ sub_80F8D28: @ 80F8D28 push {r5-r7} ldr r7, =sub_80F8EE8 adds r0, r7, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -151465,7 +151465,7 @@ _080F8D44: mov r8, r1 adds r0, r7, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r7, r0, 24 ldr r1, =0x03005e00 @@ -151603,7 +151603,7 @@ _080F8E9C: sub_80F8EB8: @ 80F8EB8 push {lr} ldr r0, =sub_80F8EE8 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -151702,7 +151702,7 @@ _080F8F84: ldrb r0, [r0, 0x12] bl sub_80E2A78 adds r0, r4, 0 - bl remove_task + bl DestroyTask _080F8F98: pop {r4,r5} pop {r0} @@ -151808,7 +151808,7 @@ sub_80F905C: @ 80F905C _080F9074: ldr r0, =sub_80F9088 movs r1, 0x5 - bl AddTask + bl CreateTask movs r0, 0x1 _080F907E: pop {r1} @@ -151839,7 +151839,7 @@ sub_80F9088: @ 80F9088 bne _080F90D4 bl script_env_2_enable_and_set_ctx_running adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080F90D4 .pool _080F90C0: @@ -152662,7 +152662,7 @@ _080F9714: _080F9718: bl script_env_2_enable_and_set_ctx_running adds r0, r6, 0 - bl remove_task + bl DestroyTask _080F9722: pop {r4-r6} pop {r0} @@ -152675,7 +152675,7 @@ sub_80F972C: @ 80F972C push {lr} ldr r0, =sub_80F9654 movs r1, 0x50 - bl AddTask + bl CreateTask bl script_env_2_set_ctx_paused pop {r0} bx r0 @@ -153282,7 +153282,7 @@ sub_80F9BF4: @ 80F9BF4 sub_80F9C1C: @ 80F9C1C push {lr} ldr r0, =sub_80F9C90 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -153294,7 +153294,7 @@ sub_80F9C1C: @ 80F9C1C sub_80F9C30: @ 80F9C30 push {lr} ldr r0, =sub_80F9DFC - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -153311,7 +153311,7 @@ sub_80F9C44: @ 80F9C44 lsls r3, 24 lsrs r3, 24 adds r1, r3, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r2, r0, 0 @@ -153508,7 +153508,7 @@ _080F9DDE: movs r0, 0x50 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080F9DF4 _080F9DEE: ldrh r0, [r4, 0x8] @@ -153681,7 +153681,7 @@ _080F9F2C: movs r1, 0 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080F9F54 _080F9F4E: ldrh r0, [r4, 0x8] @@ -154322,7 +154322,7 @@ sub_80FA458: @ 80FA458 bl GetXYCoordsOneStepInFrontOfPlayer ldr r0, =sub_80FA4A0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -154426,7 +154426,7 @@ _080FA540: bl FieldEffectActiveListRemove bl script_env_2_enable_and_set_ctx_running adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080FA574 _080FA56E: ldrh r0, [r4, 0x4] @@ -154500,7 +154500,7 @@ sub_80FA5E4: @ 80FA5E4 lsrs r6, 16 ldr r0, =sub_80FA62C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -154576,7 +154576,7 @@ _080FA66C: cmp r0, 0x3 bne _080FA6A0 adds r0, r5, 0 - bl remove_task + bl DestroyTask b _080FA6A4 _080FA6A0: adds r0, r1, 0x1 @@ -154701,7 +154701,7 @@ sub_80FA754: @ 80FA754 ldrsh r1, [r1, r3] bl sub_80FA704 adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080FA78C .pool _080FA788: @@ -154738,7 +154738,7 @@ _080FA7BC: bne _080FA7DE ldr r0, =sub_80FA754 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -154885,7 +154885,7 @@ _080FA958: bl audio_play _080FA95E: adds r0, r4, 0 - bl remove_task + bl DestroyTask b _080FA96A _080FA966: adds r0, r2, 0x1 @@ -154904,7 +154904,7 @@ sub_80FA970: @ 80FA970 lsrs r4, 16 ldr r0, =sub_80FA7EC movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -155476,7 +155476,7 @@ _080FAE82: b _080FAE92 _080FAE8A: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _080FAEA2 _080FAE92: ldrh r0, [r1, 0x2] @@ -155498,7 +155498,7 @@ overworld_posion_effect: @ 80FAEA8 bl audio_play ldr r0, =task50_overworld_posion_effect movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -155508,7 +155508,7 @@ overworld_posion_effect: @ 80FAEA8 c3_80A0DD8_is_running: @ 80FAEC0 push {lr} ldr r0, =task50_overworld_posion_effect - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -155642,7 +155642,7 @@ sub_80FAFD4: @ 80FAFD4 lsrs r0, 24 bl SetPlayerAvatarTransitionFlags adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r4} pop {r0} @@ -155654,7 +155654,7 @@ sub_80FAFF8: @ 80FAFF8 push {lr} ldr r0, =sub_80FAED4 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -155896,7 +155896,7 @@ _080FB1DC: cmp r0, 0x13 bne _080FB1F0 adds r0, r2, 0 - bl remove_task + bl DestroyTask b _080FB2A8 .pool _080FB1F0: @@ -156024,7 +156024,7 @@ _080FB2F0: cmp r0, 0x13 bne _080FB304 adds r0, r3, 0 - bl remove_task + bl DestroyTask b _080FB358 .pool _080FB304: @@ -156122,7 +156122,7 @@ _080FB3C0: strh r0, [r4, 0x2] ldr r0, =sub_80FB0F8 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x4] @@ -156165,10 +156165,10 @@ _080FB404: ble _080FB4D8 strh r2, [r4, 0x2] ldrb r0, [r4, 0x4] - bl remove_task + bl DestroyTask ldr r0, =sub_80FB1AC movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x6] @@ -156237,7 +156237,7 @@ _080FB492: movs r0, 0x34 bl audio_play adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_disable _080FB4D8: pop {r4,r5} @@ -156271,7 +156271,7 @@ sub_80FB4E0: @ 80FB4E0 bl CpuFastSet ldr r0, =sub_80FB36C movs r1, 0xA - bl AddTask + bl CreateTask add sp, 0x4 pop {r0} bx r0 @@ -156283,7 +156283,7 @@ sub_80FB540: @ 80FB540 push {r4-r6,lr} sub sp, 0x4 ldr r0, =sub_80FB36C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0 @@ -156480,7 +156480,7 @@ _080FB6C4: bl copy_saved_warp2_bank_and_enter_x_to_warp1 bl sp13E_warp_to_last_warp adds r0, r5, 0 - bl remove_task + bl DestroyTask _080FB6E2: pop {r4-r7} pop {r0} @@ -156561,7 +156561,7 @@ sub_80FB768: @ 80FB768 bl pal_fill_black ldr r0, =sub_80FB5E8 movs r1, 0x50 - bl AddTask + bl CreateTask bl script_env_2_enable pop {r0} bx r0 @@ -158439,7 +158439,7 @@ _080FC63A: strb r1, [r0] _080FC64A: adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FC650: pop {r4-r7} pop {r0} @@ -158625,7 +158625,7 @@ _080FC7DC: strh r0, [r1, 0x1E] strh r0, [r1, 0x20] adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FC7F4: pop {r3} mov r8, r3 @@ -158654,7 +158654,7 @@ sub_80FC804: @ 80FC804 movs r0, 0 strh r0, [r5, 0x8] adds r0, r2, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080FC880 .pool _080FC830: @@ -158815,7 +158815,7 @@ _080FC96E: strh r0, [r1, 0x1E] strh r0, [r1, 0x20] adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FC986: pop {r3,r4} mov r8, r3 @@ -158845,7 +158845,7 @@ sub_80FC998: @ 80FC998 movs r0, 0 strh r0, [r4, 0x8] adds r0, r2, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080FC9F0 .pool _080FC9C4: @@ -158899,7 +158899,7 @@ sub_80FC9F8: @ 80FC9F8 movs r0, 0 strh r0, [r4, 0x8] adds r0, r5, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080FCAB2 .pool _080FCA30: @@ -159154,7 +159154,7 @@ _080FCC78: movs r0, 0 strh r0, [r2, 0x8] adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FCC82: pop {r4} pop {r0} @@ -159347,7 +159347,7 @@ _080FCE38: movs r0, 0 strh r0, [r2, 0x8] adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FCE42: pop {r4} pop {r0} @@ -159466,7 +159466,7 @@ _080FCF16: strh r0, [r1, 0x1E] strh r0, [r1, 0x20] adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _080FCF2E: pop {r3,r4} mov r8, r3 @@ -159504,7 +159504,7 @@ sub_80FCF40: @ 80FCF40 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r5, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080FCFBE .pool _080FCF80: @@ -159570,7 +159570,7 @@ sub_80FCFD0: @ 80FCFD0 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r5, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _080FD04E .pool _080FD010: @@ -159706,7 +159706,7 @@ MapPostLoadHook_UseItem: @ 80FD124 bl pal_fill_black ldr r0, =Task_CallItemUseOnFieldCallback movs r1, 0x8 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -159820,7 +159820,7 @@ CleanUpAfterFailingToUseRegisteredKeyItemOnField: @ 80FD1F8 movs r1, 0x1 bl sub_8197434 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_80984F4 bl script_env_2_disable pop {r4} @@ -160002,7 +160002,7 @@ _080FD37E: bl sub_80984F4 bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -160126,7 +160126,7 @@ ItemUseOnFieldCB_Rod: @ 80FD468 lsrs r0, 24 bl StartFishing adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -160293,7 +160293,7 @@ sub_80FD5CC: @ 80FD5CC bl sub_80984F4 bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -161123,7 +161123,7 @@ sub_80FDC00: @ 80FDC00 movs r0, 0 bl sub_81357FC adds r0, r4, 0 - bl remove_task + bl DestroyTask _080FDC24: pop {r4} pop {r0} @@ -161273,7 +161273,7 @@ sub_80FDD74: @ 80FDD74 ldr r0, =gUnknown_08274482 bl script_env_1_execute_new_script adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -161335,7 +161335,7 @@ sub_80FDE08: @ 80FDE08 ldr r0, =gUnknown_082744C0 bl script_env_1_execute_new_script adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -161394,7 +161394,7 @@ sub_80FDE7C: @ 80FDE7C ldr r0, =gUnknown_08242CFC bl script_env_1_execute_new_script adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -161858,7 +161858,7 @@ task08_080A1C44: @ 80FE2BC bl player_avatar_init_params_reset bl sub_80B7CC8 adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -180592,7 +180592,7 @@ _08107A32: adds r1, 0x1 lsls r1, 24 lsrs r1, 24 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -181313,7 +181313,7 @@ _0810800C: bne _08108022 bl remove_some_task adds r0, r7, 0 - bl remove_task + bl DestroyTask _08108022: add sp, 0xC pop {r4-r7} @@ -182122,7 +182122,7 @@ _0810866A: ldr r6, =sub_81152DC adds r0, r6, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -182143,7 +182143,7 @@ _081086B4: strh r0, [r5] adds r0, r6, 0 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -199523,7 +199523,7 @@ sub_811131C: @ 811131C cmp r0, 0 beq _0811134E ldr r0, =sub_81110A4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -207681,7 +207681,7 @@ _0811564A: _0811565A: ldr r0, =sub_81156D0 ldrb r1, [r6, 0x2] - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -207748,7 +207748,7 @@ sub_81156D0: @ 81156D0 ldr r0, =0x02022e22 strh r1, [r0] adds r0, r3, 0 - bl remove_task + bl DestroyTask b _0811571C .pool _08115710: @@ -211535,7 +211535,7 @@ sub_8117660: @ 8117660 bl sub_80A6DAC ldr r0, =sub_81176D8 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r4, =0x0203841e @@ -211629,7 +211629,7 @@ sub_81176D8: @ 81176D8 movs r0, 0x1 bl sub_80A6DAC adds r0, r5, 0 - bl remove_task + bl DestroyTask _0811773E: pop {r4-r7} pop {r0} @@ -212676,7 +212676,7 @@ sub_8117FD0: @ 8117FD0 orrs r0, r1 strb r0, [r3] adds r0, r4, 0 - bl remove_task + bl DestroyTask _08118014: pop {r4} pop {r0} @@ -212948,7 +212948,7 @@ _08118250: ldr r0, [r0] _08118258: movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r0, =0x03005e00 @@ -212975,7 +212975,7 @@ sub_811828C: @ 811828C push {r4,lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldr r0, =0x02022e18 movs r1, 0 strh r1, [r0] @@ -216916,10 +216916,10 @@ sub_811A20C: @ 811A20C lsrs r6, 24 lsls r5, 24 lsrs r5, 24 - bl clear_tasks + bl ResetTasks ldr r0, =sub_811A2C0 movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -216933,11 +216933,11 @@ sub_811A20C: @ 811A20C adds r0, r4, 0 movs r1, 0x2 mov r2, r8 - bl set_word_task_arg + bl SetWordTaskArg adds r0, r4, 0 movs r1, 0x4 mov r2, r9 - bl set_word_task_arg + bl SetWordTaskArg ldr r0, =sub_811A278 bl SetMainCallback2 pop {r3,r4} @@ -216952,7 +216952,7 @@ sub_811A20C: @ 811A20C thumb_func_start sub_811A278 sub_811A278: @ 811A278 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -217136,7 +217136,7 @@ _0811A3EC: bne _0811A41C adds r0, r2, 0 movs r1, 0x4 - bl get_word_task_arg + bl GetWordTaskArg bl sub_811A4D0 b _0811A41C .pool @@ -217200,7 +217200,7 @@ _0811A482: ldrb r4, [r6, 0x2] adds r0, r5, 0 movs r1, 0x2 - bl get_word_task_arg + bl GetWordTaskArg adds r1, r0, 0 ldrb r2, [r6, 0xE] adds r0, r4, 0 @@ -217214,7 +217214,7 @@ _0811A49C: bne _0811A4C0 adds r0, r5, 0 movs r1, 0x4 - bl get_word_task_arg + bl GetWordTaskArg bl sub_811A4D0 b _0811A4C0 _0811A4B0: @@ -217637,7 +217637,7 @@ sub_811A8A4: @ 811A8A4 lsrs r0, 16 bl sub_811A868 adds r4, r0, 0 - bl clear_tasks + bl ResetTasks ldr r0, =gUnknown_08597530 lsls r4, 3 adds r0, 0x4 @@ -228597,7 +228597,7 @@ sub_811FC80: @ 811FC80 str r7, [r4, 0xC] ldr r0, =gDummyObjectRotScalAnimTable str r0, [r4, 0x10] - ldr r0, =nullsub_47 + ldr r0, =TaskDummy7 str r0, [r4, 0x14] mov r0, sp bl LoadObjectPics @@ -228836,10 +228836,10 @@ _0811FF28: .pool thumb_func_end sub_811FC80 - thumb_func_start nullsub_47 -nullsub_47: @ 811FF3C + thumb_func_start TaskDummy7 +TaskDummy7: @ 811FF3C bx lr - thumb_func_end nullsub_47 + thumb_func_end TaskDummy7 thumb_func_start sub_811FF40 sub_811FF40: @ 811FF40 @@ -228959,7 +228959,7 @@ sub_811FFD4: @ 811FFD4 str r2, [sp, 0xC] ldr r0, =gDummyObjectRotScalAnimTable str r0, [sp, 0x10] - ldr r0, =nullsub_47 + ldr r0, =TaskDummy7 str r0, [sp, 0x14] lsls r3, 23 lsrs r3, 16 @@ -229770,7 +229770,7 @@ sub_81206C0: @ 81206C0 lsrs r4, 24 ldr r0, =sub_8120944 movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -230243,7 +230243,7 @@ _08120A7E: bl sub_82E0308 bl script_env_2_enable_and_set_ctx_running adds r0, r6, 0 - bl remove_task + bl DestroyTask b _08120B50 .pool _08120AB0: @@ -231407,7 +231407,7 @@ _08121364: ldrb r0, [r0] bl sub_80E2A78 adds r0, r6, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _08121376: pop {r4-r6} @@ -231421,7 +231421,7 @@ sub_8121388: @ 8121388 push {lr} ldr r0, =sub_81212FC movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -231745,7 +231745,7 @@ _08121688: bl sub_80A1A74 b _081219D4 _0812168E: - bl clear_tasks + bl ResetTasks b _081219D4 _08121694: bl ResetAllObjectData @@ -237128,10 +237128,10 @@ _081240C6: .pool thumb_func_end sub_8124088 - thumb_func_start nullsub_48 -nullsub_48: @ 81240D0 + thumb_func_start TaskDummy8 +TaskDummy8: @ 81240D0 bx lr - thumb_func_end nullsub_48 + thumb_func_end TaskDummy8 thumb_func_start sub_81240D4 sub_81240D4: @ 81240D4 @@ -237203,7 +237203,7 @@ _08124158: lsls r1, 3 orrs r0, r1 str r0, [r2, 0x4] - ldr r0, =nullsub_48 + ldr r0, =TaskDummy8 _0812416E: str r0, [sp, 0x14] adds r0, r2, 0 @@ -242634,7 +242634,7 @@ sub_8126D6C: @ 8126D6C ldr r0, =gUnknown_0823B4E8 bl script_env_1_execute_new_script adds r0, r4, 0 - bl remove_task + bl DestroyTask b _08126D9E .pool _08126D98: @@ -246326,7 +246326,7 @@ _08128C30: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08128C4C: pop {r4,r5} pop {r0} @@ -246400,7 +246400,7 @@ sub_8128CD4: @ 8128CD4 bl pal_fill_black ldr r0, =sub_8128C64 movs r1, 0x8 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -249084,7 +249084,7 @@ _0812A29C: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0812A2B2: pop {r4,r5} pop {r0} @@ -249161,7 +249161,7 @@ sub_812A334: @ 812A334 bl sub_8126ABC ldr r0, =sub_812A2C4 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -249376,7 +249376,7 @@ _0812A518: ldr r0, =sub_812A588 bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0812A530: add sp, 0x4 pop {r4,r5} @@ -249401,7 +249401,7 @@ sub_812A540: @ 812A540 bl sub_812A6D4 ldr r0, =sub_812A4DC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -249520,7 +249520,7 @@ _0812A666: thumb_func_start sub_812A670 sub_812A670: @ 812A670 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -249568,9 +249568,9 @@ sub_812A6D4: @ 812A6D4 adds r5, r1, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =nullsub_49 + ldr r0, =TaskDummy9 movs r1, 0xFF - bl AddTask + bl CreateTask adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -249592,8 +249592,8 @@ sub_812A6D4: @ 812A6D4 thumb_func_start sub_812A710 sub_812A710: @ 812A710 push {lr} - ldr r0, =nullsub_49 - bl get_task_id_by_function + ldr r0, =TaskDummy9 + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 lsls r2, r0, 2 @@ -249615,10 +249615,10 @@ sub_812A710: @ 812A710 .pool thumb_func_end sub_812A710 - thumb_func_start nullsub_49 -nullsub_49: @ 812A74C + thumb_func_start TaskDummy9 +TaskDummy9: @ 812A74C bx lr - thumb_func_end nullsub_49 + thumb_func_end TaskDummy9 thumb_func_start sub_812A750 sub_812A750: @ 812A750 @@ -249904,7 +249904,7 @@ sub_812A9AC: @ 812A9AC movs r0, 0x80 strb r0, [r1] bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks pop {r0} bx r0 .pool @@ -250004,7 +250004,7 @@ sub_812AAA8: @ 812AAA8 ldr r4, =sub_812AAC8 adds r0, r4, 0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -251994,7 +251994,7 @@ sub_812BABC: @ 812BABC ldr r4, =sub_812BAFC adds r0, r4, 0 movs r1, 0x4 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -252008,7 +252008,7 @@ sub_812BABC: @ 812BABC sub_812BADC: @ 812BADC push {lr} ldr r0, =sub_812BAFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -252180,10 +252180,10 @@ sub_812BC20: @ 812BC20 cmp r0, 0 beq _0812BC3A ldr r0, =sub_812BAFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0812BC3A: movs r0, 0 pop {r1} @@ -252473,7 +252473,7 @@ sub_812BE5C: @ 812BE5C _0812BE64: adds r0, r5, 0 movs r1, 0x2 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -254465,7 +254465,7 @@ sub_812CD40: @ 812CD40 ldr r5, =sub_812CD74 adds r0, r5, 0 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -254572,7 +254572,7 @@ sub_812CDF4: @ 812CDF4 movs r3, 0x52 bl sub_812FA78 adds r0, r4, 0 - bl remove_task + bl DestroyTask add sp, 0x4 pop {r4} pop {r0} @@ -254927,7 +254927,7 @@ sub_812D0B0: @ 812D0B0 ldr r4, =sub_812D128 adds r0, r4, 0 movs r1, 0x6 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -254948,7 +254948,7 @@ sub_812D0B0: @ 812D0B0 sub_812D0E0: @ 812D0E0 push {lr} ldr r0, =sub_812D128 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -254965,7 +254965,7 @@ sub_812D0E0: @ 812D0E0 .pool _0812D10C: adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r0, =gUnknown_085A84AC ldr r0, [r0] movs r1, 0x10 @@ -255032,7 +255032,7 @@ sub_812D188: @ 812D188 push {lr} ldr r0, =sub_812D230 movs r1, 0x8 - bl AddTask + bl CreateTask ldr r1, =0x0203ab34 ldr r1, [r1] adds r1, 0x3E @@ -255446,7 +255446,7 @@ sub_812D4AC: @ 812D4AC ldr r4, =sub_812D4EC adds r0, r4, 0 movs r1, 0x7 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl _call_via_r4 @@ -255460,7 +255460,7 @@ sub_812D4AC: @ 812D4AC sub_812D4CC: @ 812D4CC push {lr} ldr r0, =sub_812D4EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -256088,10 +256088,10 @@ sub_812D9A4: @ 812D9A4 cmp r0, 0 bne _0812DA04 ldr r0, =sub_812D4EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _0812DA1A .pool _0812DA04: @@ -256160,10 +256160,10 @@ sub_812DA6C: @ 812DA6C cmp r0, 0 beq _0812DA86 ldr r0, =sub_812D4EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0812DA86: pop {r0} bx r0 @@ -256328,10 +256328,10 @@ sub_812DBBC: @ 812DBBC bl sub_812E8C4 bl sub_812ED8C ldr r0, =sub_812D4EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 .pool @@ -256410,7 +256410,7 @@ sub_812DC80: @ 812DC80 ldr r5, =sub_812DCD4 adds r0, r5, 0 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -256430,7 +256430,7 @@ sub_812DC80: @ 812DC80 sub_812DCB4: @ 812DCB4 push {lr} ldr r0, =sub_812DCD4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -256664,10 +256664,10 @@ sub_812DE48: @ 812DE48 sub_812DE7C: @ 812DE7C push {lr} ldr r0, =sub_812DCD4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 .pool @@ -256678,7 +256678,7 @@ sub_812DE94: @ 812DE94 push {lr} ldr r0, =sub_812E0B0 movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r1, r0, 24 ldr r0, =0x0203ab34 @@ -268186,7 +268186,7 @@ _08133C18: movs r0, 0 bl schedule_bg_copy_tilemap_to_vram adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r4,r5} pop {r0} @@ -268352,7 +268352,7 @@ sub_8133D8C: @ 8133D8C push {lr} ldr r0, =sub_8127208 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -268397,7 +268397,7 @@ _08133DFC: strh r0, [r1] _08133E04: adds r0, r6, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r4-r6} pop {r0} @@ -268413,7 +268413,7 @@ sub_8133E1C: @ 8133E1C ldr r2, =0x020375e4 movs r1, 0 strh r1, [r2] - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r0} bx r0 @@ -268476,7 +268476,7 @@ sub_8133EC0: @ 8133EC0 push {lr} ldr r0, =sub_8133C48 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 bl sub_8133A78 @@ -268626,7 +268626,7 @@ set_256color_bg_bg0: @ 8133F0C bl sub_809882C bl clear_scheduled_bg_copies_to_vram bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl ResetObjectPaletteAllocator @@ -268692,7 +268692,7 @@ set_256color_bg_bg0: @ 8133F0C bl ShowBg ldr r0, =sub_81341FC movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -268780,7 +268780,7 @@ set_256color_bg_bg0: @ 8133F0C thumb_func_start sub_81341E0 sub_81341E0: @ 81341E0 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -269634,7 +269634,7 @@ _08134906: bl sub_809882C bl clear_scheduled_bg_copies_to_vram bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl ResetObjectPaletteAllocator @@ -269707,7 +269707,7 @@ Cb2_StartWallClock: @ 81349F4 bl LZ77UnCompVram ldr r0, =sub_8134CB8 movs r1, 0 - bl AddTask + bl CreateTask adds r6, r0, 0 lsls r6, 24 lsrs r6, 24 @@ -269848,7 +269848,7 @@ Cb2_ViewWallClock: @ 8134B44 bl LZ77UnCompVram ldr r0, =sub_8134F10 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r7, r0, 24 adds r0, r7, 0 @@ -269984,7 +269984,7 @@ _08134BA4: thumb_func_start sub_8134C9C sub_8134C9C: @ 8134C9C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -271017,7 +271017,7 @@ oei_task_add: @ 8135478 bl GetXYCoordsOneStepInFrontOfPlayer ldr r0, =task08_080C9820 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -271212,7 +271212,7 @@ sub_813561C: @ 813561C movs r0, 0 strb r0, [r1, 0x6] adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -271396,7 +271396,7 @@ sub_81357BC: @ 81357BC _081357D6: ldr r0, =task08_080A1C44 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -271533,7 +271533,7 @@ sub_8135908: @ 8135908 thumb_func_start sub_813591C sub_813591C: @ 813591C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -271657,7 +271657,7 @@ _08135A36: bne _08135A46 b _08135B9E _08135A46: - bl clear_tasks + bl ResetTasks b _08135B9E .pool _08135A54: @@ -271741,7 +271741,7 @@ _08135B14: _08135B1A: ldr r0, =sub_81365C8 movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -272980,7 +272980,7 @@ _081365AC: ldr r0, [r0] bl Free adds r0, r5, 0 - bl remove_task + bl DestroyTask _081365BE: pop {r4-r6} pop {r0} @@ -274381,7 +274381,7 @@ sub_81371B4: @ 81371B4 thumb_func_start sub_81371D4 sub_81371D4: @ 81371D4 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -274466,7 +274466,7 @@ c2_change_map: @ 8137200 str r0, [r1, 0x8] ldr r0, [r1, 0x8] bl sub_80A1A74 - bl clear_tasks + bl ResetTasks bl ResetAllObjectData ldr r3, =0x04000208 ldrh r2, [r3] @@ -274635,7 +274635,7 @@ sub_81373F0: @ 81373F0 push {lr} ldr r0, =sub_8137404 movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -274829,7 +274829,7 @@ sub_81375A8: @ 81375A8 push {lr} ldr r0, =sub_81375BC movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -275319,7 +275319,7 @@ sub_81379D8: @ 81379D8 beq _081379F2 bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _081379F2: pop {r4} pop {r0} @@ -275331,7 +275331,7 @@ sub_81379F8: @ 81379F8 push {lr} ldr r0, =sub_81379D8 movs r1, 0x50 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -275640,7 +275640,7 @@ mapldr_080CA5C0: @ 8137C5C bl pal_fade_maybe ldr r0, =sub_8137C94 movs r1, 0xA - bl AddTask + bl CreateTask add sp, 0x4 pop {r0} bx r0 @@ -275659,7 +275659,7 @@ sub_8137C94: @ 8137C94 cmp r0, 0 bne _08137CAC adds r0, r2, 0 - bl remove_task + bl DestroyTask _08137CAC: pop {r0} bx r0 @@ -277118,7 +277118,7 @@ sub_81388E4: @ 81388E4 bl audio_play ldr r0, =sub_8138910 movs r1, 0x8 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -277155,7 +277155,7 @@ sub_8138910: @ 8138910 cmp r0, 0x5 bne _08138970 adds r0, r6, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running b _08138970 .pool @@ -277589,14 +277589,14 @@ sp0D9_ComputerRelated: @ 8138CA4 push {r4,lr} ldr r4, =sub_8138CE8 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _08138CD8 adds r0, r4, 0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -277696,7 +277696,7 @@ _08138D4C: cmp r0, 0x5 bne _08138D7C ldrb r0, [r4, 0xA] - bl remove_task + bl DestroyTask _08138D7C: ldrh r0, [r4, 0xE] adds r0, 0x1 @@ -277871,14 +277871,14 @@ sub_8138EC0: @ 8138EC0 push {r4,lr} ldr r4, =sub_8138F04 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _08138EF4 adds r0, r4, 0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -277969,7 +277969,7 @@ _08138F7A: cmp r0, 0x5 bne _08138F9A ldrb r0, [r4, 0xA] - bl remove_task + bl DestroyTask _08138F9A: ldrh r0, [r4, 0xE] adds r0, 0x1 @@ -278707,7 +278707,7 @@ sub_8139560: @ 8139560 push {lr} ldr r0, =sub_81395BC movs r1, 0x9 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -278792,7 +278792,7 @@ sub_8139620: @ 8139620 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r0} bx r0 @@ -279358,7 +279358,7 @@ sub_8139A78: @ 8139A78 push {r4-r6,lr} ldr r0, =sub_8139AF4 movs r1, 0x9 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -279451,7 +279451,7 @@ sub_8139AF4: @ 8139AF4 movs r0, 0x49 bl audio_play adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running bl InstallCameraPanAheadCallback _08139B54: @@ -279559,14 +279559,14 @@ sub_8139C2C: @ 8139C2C lsrs r5, r1, 24 ldr r4, =sub_8139C80 adds r0, r4, 0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 beq _08139C6C adds r0, r4, 0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -279713,7 +279713,7 @@ _08139D62: cmp r1, r0 bne _08139D7C ldr r0, [sp] - bl remove_task + bl DestroyTask _08139D7C: ldrh r0, [r6, 0x2] adds r0, 0x1 @@ -280143,7 +280143,7 @@ sub_813A128: @ 813A128 push {r4,lr} ldr r0, =sub_813A2DC movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 lsls r0, r4, 2 @@ -280349,7 +280349,7 @@ _0813A2C6: movs r0, 0x7F strh r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _0813A2D2: pop {r4} pop {r0} @@ -280540,7 +280540,7 @@ sub_813A46C: @ 813A46C movs r0, 0x5 bl audio_play ldr r0, =sub_813A4EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -280704,7 +280704,7 @@ sub_813A570: @ 813A570 lsrs r0, 24 bl RemoveWindow adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running add sp, 0x4 pop {r4,r5} @@ -280743,7 +280743,7 @@ _0813A624: sub_813A630: @ 813A630 push {lr} ldr r0, =sub_813A600 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -281656,7 +281656,7 @@ sub_813ADD4: @ 813ADD4 push {r6,r7} sub sp, 0x18 ldr r0, =sub_813A600 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r1, r0, 24 cmp r1, 0xFF @@ -281819,7 +281819,7 @@ _0813AF38: sub_813AF48: @ 813AF48 push {r4,r5,lr} ldr r0, =sub_813A600 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0xFF @@ -281862,7 +281862,7 @@ sub_813AF48: @ 813AF48 lsrs r0, 24 bl RemoveWindow adds r0, r5, 0 - bl remove_task + bl DestroyTask _0813AFB6: pop {r4,r5} pop {r0} @@ -281875,7 +281875,7 @@ sub_813AFC8: @ 813AFC8 push {lr} ldr r0, =task_deoxys_sound movs r1, 0x8 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -281942,7 +281942,7 @@ _0813B06A: bl script_env_2_enable_and_set_ctx_running _0813B070: adds r0, r7, 0 - bl remove_task + bl DestroyTask b _0813B0A2 .pool _0813B080: @@ -281959,7 +281959,7 @@ _0813B080: movs r0, 0x1 strh r0, [r1] adds r0, r7, 0 - bl remove_task + bl DestroyTask _0813B0A2: pop {r3} mov r8, r3 @@ -282002,7 +282002,7 @@ _0813B0F0: _0813B0F8: ldr r0, =sub_813B160 movs r1, 0x8 - bl AddTask + bl CreateTask ldr r3, =0x02038c08 movs r0, 0x1 str r0, [r3] @@ -282058,7 +282058,7 @@ sub_813B160: @ 813B160 bne _0813B17C bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _0813B17C: pop {r4} pop {r0} @@ -282534,7 +282534,7 @@ sub_813B534: @ 813B534 bne _0813B552 ldr r0, =sub_80B3AF8 movs r1, 0x5 - bl AddTask + bl CreateTask _0813B552: pop {r0} bx r0 @@ -282546,7 +282546,7 @@ sub_813B568: @ 813B568 push {lr} ldr r0, =sub_813B57C movs r1, 0x5 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -282588,7 +282588,7 @@ _0813B5A8: .4byte _0813B7A8 _0813B5D0: ldr r0, =sub_80B3AF8 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _0813B5DE @@ -282799,7 +282799,7 @@ _0813B7B4: str r1, [r0] bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _0813B7C6: pop {r4,r5} pop {r0} @@ -282836,7 +282836,7 @@ sub_813B80C: @ 813B80C push {lr} ldr r0, =sub_813B824 movs r1, 0x8 - bl AddTask + bl CreateTask movs r0, 0x9D bl audio_play pop {r0} @@ -282880,7 +282880,7 @@ _0813B858: cmp r1, r0 bne _0813B86C adds r0, r5, 0 - bl remove_task + bl DestroyTask _0813B86C: pop {r4,r5} pop {r0} @@ -282893,7 +282893,7 @@ sub_813B880: @ 813B880 push {lr} ldr r0, =_fwalk movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -282989,7 +282989,7 @@ _0813B8F4: cmp r0, 0x3 bne _0813B94E mov r0, r9 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _0813B94E: pop {r3-r5} @@ -284592,7 +284592,7 @@ sub_813C664: @ 813C664 bl sub_813C6A8 bl FreeAllWindowBuffers adds r0, r4, 0 - bl remove_task + bl DestroyTask _0813C694: pop {r4} pop {r0} @@ -284763,7 +284763,7 @@ _0813C6FA: sub_813C80C: @ 813C80C push {lr} bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl ResetObjectPaletteAllocator @@ -284865,7 +284865,7 @@ sub_813C8D8: @ 813C8D8 thumb_func_start sub_813C8EC sub_813C8EC: @ 813C8EC push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -284993,7 +284993,7 @@ _0813CA14: bl sub_81D5C8C ldr r0, =sub_813C5BC movs r1, 0x8 - bl AddTask + bl CreateTask ldr r0, =sub_813C8EC bl SetMainCallback2 ldr r0, =0x030022c0 @@ -286238,7 +286238,7 @@ sub_813D3D8: @ 813D3D8 strb r1, [r6] ldr r0, =sub_813D42C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -286518,7 +286518,7 @@ _0813D652: strb r0, [r1] bl sub_813D6B4 adds r0, r5, 0 - bl remove_task + bl DestroyTask bl sub_81C4EB4 ldr r0, [r4] bl Free @@ -286898,7 +286898,7 @@ _0813D9A4: sub_813D9B0: @ 813D9B0 push {lr} bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_813D9B0 @@ -286952,7 +286952,7 @@ _0813DA00: ldrb r5, [r6, 0xE] ldrb r6, [r6, 0x1C] adds r0, r2, 0 - bl remove_task + bl DestroyTask adds r0, r7, 0 adds r1, r4, 0 adds r2, r5, 0 @@ -286980,7 +286980,7 @@ sub_813DA40: @ 813DA40 lsrs r6, 24 ldr r0, =sub_813D9C0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -287082,7 +287082,7 @@ evolution_cutscene: @ 813DA8C bl sub_8035AA4 bl ResetAllObjectData bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator ldr r0, =0x0300301c movs r2, 0x4 @@ -287230,7 +287230,7 @@ evolution_cutscene: @ 813DA8C bl sub_817BE78 ldr r0, =evovle_mon_maybe movs r1, 0 - bl AddTask + bl CreateTask ldr r1, =0x0203ab80 ldr r2, [r1] lsls r1, r0, 24 @@ -287809,7 +287809,7 @@ sub_813E1D4: @ 813E1D4 bl sub_817BE78 ldr r0, =sub_813F1B8 movs r1, 0 - bl AddTask + bl CreateTask mov r1, r9 ldr r2, [r1] lsls r1, r0, 24 @@ -287876,7 +287876,7 @@ sub_813E3A4: @ 813E3A4 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_813E3A4 @@ -287888,7 +287888,7 @@ sub_813E3C0: @ 813E3C0 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_813E3C0 @@ -288663,7 +288663,7 @@ _0813EAF6: bl evovle_mon_internal_maybe _0813EB06: adds r0, r7, 0 - bl remove_task + bl DestroyTask bl sub_805F094 ldr r4, =0x0203ab80 ldr r0, [r4] @@ -289823,7 +289823,7 @@ _0813F624: b _0813FCC4 _0813F634: adds r0, r7, 0 - bl remove_task + bl DestroyTask ldr r4, =0x0203ab80 ldr r0, [r4] bl Free @@ -290690,7 +290690,7 @@ _0813FE8C: cmp r0, 0x4 bne _0813FE9A adds r0, r6, 0 - bl remove_task + bl DestroyTask _0813FE9A: pop {r4-r6} pop {r0} @@ -290705,7 +290705,7 @@ sub_813FEA4: @ 813FEA4 lsrs r4, r0, 24 ldr r0, =sub_813FEE8 movs r1, 0x7 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 cmp r4, 0 @@ -290801,13 +290801,13 @@ _0813FF2C: adds r0, 0x10 strh r0, [r6] ldr r0, =sub_813FDEC - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r4, r0, 24 cmp r4, 0 bne _0813FFA6 adds r0, r5, 0 - bl remove_task + bl DestroyTask mov r0, r8 strh r4, [r0] mov r1, r9 @@ -290948,7 +290948,7 @@ _081400C4: _081400DE: ldr r0, =sub_813FDEC movs r1, 0x5 - bl AddTask + bl CreateTask adds r0, r5, 0 bl sub_813FEA4 add sp, 0x4 @@ -290962,7 +290962,7 @@ _081400DE: sub_8140100: @ 8140100 push {lr} ldr r0, =sub_813FDEC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -290988,20 +290988,20 @@ _0814011E: sub_8140134: @ 8140134 push {lr} ldr r0, =sub_813FDEC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _08140148 - bl remove_task + bl DestroyTask _08140148: ldr r0, =sub_813FEE8 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _0814015A - bl remove_task + bl DestroyTask _0814015A: movs r0, 0 movs r1, 0xA0 @@ -291105,7 +291105,7 @@ _08140232: thumb_func_start sub_8140238 sub_8140238: @ 8140238 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad ldr r0, =0x0203ab88 @@ -291540,7 +291540,7 @@ _08140630: _08140650: bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl reset_temp_tile_data_buffers b _081407F8 _08140662: @@ -291659,7 +291659,7 @@ _0814077A: bl sub_80A27B0 ldr r0, =sub_81408A8 movs r1, 0 - bl AddTask + bl CreateTask ldr r5, =0x0203ab88 ldr r1, [r5] adds r1, 0xA4 @@ -291681,7 +291681,7 @@ _0814077A: bl sub_80EDE84 ldr r0, =sub_8140814 movs r1, 0x1 - bl AddTask + bl CreateTask ldr r1, [r5] adds r1, 0xA5 strb r0, [r1] @@ -291894,7 +291894,7 @@ sub_8140994: @ 8140994 ldr r0, [r0] adds r0, 0xA5 ldrb r0, [r0] - bl remove_task + bl DestroyTask adds r0, r4, 0 bl sub_8141DE4 pop {r4} @@ -294354,7 +294354,7 @@ sub_8141E7C: @ 8141E7C ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 adds r0, r5, 0 - bl remove_task + bl DestroyTask _08141EDE: pop {r4,r5} pop {r0} @@ -295603,7 +295603,7 @@ sub_81428E4: @ 81428E4 ldr r0, =sub_81405CC bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08142908: pop {r4} pop {r0} @@ -295667,7 +295667,7 @@ sub_814297C: @ 814297C bl HideCoinsWindow bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -295701,7 +295701,7 @@ sub_81429A0: @ 81429A0 bl sub_819746C bl script_env_2_disable adds r0, r4, 0 - bl remove_task + bl DestroyTask _081429DE: pop {r4} pop {r0} @@ -295913,7 +295913,7 @@ sub_8142BC8: @ 8142BC8 bl ShowCoinsWindow ldr r0, =sub_8142A88 movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -302080,7 +302080,7 @@ _08145EAC: ldr r0, =c2_exit_to_overworld_2_switch bl SetMainCallback2 _08145EC0: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -302130,7 +302130,7 @@ sub_8145F10: @ 8145F10 sub_8145F20: @ 8145F20 push {r4,lr} ldr r0, =sub_8145FA8 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -302147,7 +302147,7 @@ sub_8145F20: @ 8145F20 .pool _08145F4C: adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r4, =0x0203aba0 ldr r0, [r4] bl Free @@ -302169,7 +302169,7 @@ sub_8145F6C: @ 8145F6C lsrs r4, 24 ldr r0, =sub_8145FA8 movs r1, 0x2 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -302240,7 +302240,7 @@ sub_8145FE0: @ 8145FE0 .pool _0814601C: movs r1, 0x4 - bl AddTask + bl CreateTask ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -302261,7 +302261,7 @@ sub_8146030: @ 8146030 lsls r0, 2 adds r0, r1 ldr r0, [r0] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -302291,7 +302291,7 @@ sub_8146064: @ 8146064 adds r0, r1 ldr r0, [r0] movs r1, 0 - bl AddTask + bl CreateTask ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -302314,7 +302314,7 @@ sub_814608C: @ 814608C lsls r0, 2 adds r0, r1 ldr r0, [r0] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -302363,7 +302363,7 @@ _081460F4: cmp r0, 0 beq _08146104 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08146104: add sp, 0x4 pop {r4} @@ -302487,10 +302487,10 @@ sub_81461D8: @ 81461D8 cmp r0, 0 bne _081461F4 ldr r0, =sub_814610C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081461F4: movs r0, 0 pop {r1} @@ -302605,10 +302605,10 @@ sub_81462A8: @ 81462A8 cmp r0, 0 bne _081462FA ldr r0, =sub_8146204 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081462FA: ldr r0, [r4] ldrb r1, [r0] @@ -302788,10 +302788,10 @@ _08146448: cmp r0, 0 bne _0814648E ldr r0, =sub_8146384 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0814648E: ldr r0, [r6] ldrb r1, [r0] @@ -303663,10 +303663,10 @@ sub_8146BA8: @ 8146BA8 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _08146BDE: movs r0, 0 pop {r4} @@ -303998,10 +303998,10 @@ _08146E34: ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _08146EB0 .pool _08146E90: @@ -304251,10 +304251,10 @@ sub_81470A4: @ 81470A4 bne _081470C4 bl sub_8149F84 ldr r0, =sub_8146F94 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081470C4: movs r0, 0 pop {r1} @@ -304969,10 +304969,10 @@ sub_8147648: @ 8147648 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, =sub_8147204 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -305187,10 +305187,10 @@ _08147838: cmp r0, 0 bne _0814785A ldr r0, =sub_8147718 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0814785A: ldr r0, =0x0203aba0 ldr r1, [r0] @@ -305419,10 +305419,10 @@ sub_8147A18: @ 8147A18 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, =sub_81478EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -306216,10 +306216,10 @@ sub_814808C: @ 814808C ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r4} pop {r1} @@ -306919,10 +306919,10 @@ sub_814865C: @ 814865C ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, =sub_81484D0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -307488,10 +307488,10 @@ sub_8148B14: @ 8148B14 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, =sub_8148760 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r1} bx r1 @@ -307620,10 +307620,10 @@ sub_8148C28: @ 8148C28 movs r0, 0 bl SetVBlankCallback ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _08148CDE .pool _08148C6C: @@ -307802,10 +307802,10 @@ _08148D9A: ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _08148DD6: ldrh r2, [r4, 0x12] ldrb r0, [r4, 0x12] @@ -308084,10 +308084,10 @@ sub_8149008: @ 8149008 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 pop {r4} pop {r1} @@ -308962,10 +308962,10 @@ sub_8149740: @ 8149740 bls _08149766 bl sub_8149F84 ldr r0, =sub_8149578 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _08149766: movs r0, 0 pop {r1} @@ -309323,10 +309323,10 @@ sub_8149A40: @ 8149A40 bne _08149A60 bl sub_8149F84 ldr r0, =sub_814995C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _08149A60: movs r0, 0 pop {r1} @@ -309605,10 +309605,10 @@ sub_8149C60: @ 8149C60 ldrh r0, [r1, 0xA] bl sub_8149F84 ldr r0, =sub_8149A6C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 b _08149CC4 .pool @@ -309734,7 +309734,7 @@ sub_8149D78: @ 8149D78 ldr r0, =sub_8149DFC movs r1, 0x3 str r3, [sp] - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -309763,7 +309763,7 @@ sub_8149D78: @ 8149D78 sub_8149DDC: @ 8149DDC push {lr} ldr r0, =sub_8149DFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -309901,10 +309901,10 @@ _08149ECA: cmp r0, 0 bne _08149EF8 ldr r0, =sub_8149DFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _08149EFE .pool _08149EF8: @@ -310861,10 +310861,10 @@ _0814A632: cmp r0, 0 bne _0814A654 ldr r0, =sub_814A3F4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _0814A654: ldrh r0, [r4, 0x16] subs r0, 0x11 @@ -311531,10 +311531,10 @@ sub_814ABA0: @ 814ABA0 movs r2, 0 bl sub_80A2A20 ldr r0, [r4] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 add sp, 0x8 pop {r4} @@ -311620,7 +311620,7 @@ sub_814AC38: @ 814AC38 strh r5, [r6, 0xC] ldr r0, =sub_814ABE4 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 bl GenerateRandomNumber @@ -311805,10 +311805,10 @@ sub_814ADD8: @ 814ADD8 cmp r0, 0x3F ble _0814AE2E ldr r0, =sub_814ABE4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -311853,10 +311853,10 @@ sub_814AE40: @ 814AE40 movs r2, 0 bl sub_80A2A20 ldr r0, [r5] - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldrh r0, [r5, 0x8] adds r0, 0x1 strh r0, [r5, 0x8] @@ -312708,7 +312708,7 @@ sub_814B5A8: @ 814B5A8 bl FreeObjectPaletteByTag ldr r0, =c3_0802FDF4 movs r1, 0xA - bl AddTask + bl CreateTask ldr r0, =0x0202406e mov r8, r0 ldrb r1, [r7] @@ -317000,7 +317000,7 @@ _0814DC06: strb r0, [r1, 0x5] ldr r0, =sub_814DCCC movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -317157,7 +317157,7 @@ _0814DD9C: mov r3, r9 strb r3, [r2] mov r0, r8 - bl remove_task + bl DestroyTask _0814DDB4: pop {r3,r4} mov r8, r3 @@ -320602,7 +320602,7 @@ sub_814FC70: @ 814FC70 ldr r0, =sub_814FCC8 bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0814FC8E: pop {r4} pop {r0} @@ -320617,7 +320617,7 @@ sub_814FC9C: @ 814FC9C bl script_env_2_enable ldr r0, =sub_814FC70 movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -320749,7 +320749,7 @@ _0814FD4E: .pool _0814FDD8: bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator bl sub_80A1A74 bl reset_temp_tile_data_buffers @@ -320894,7 +320894,7 @@ _0814FF5C: .pool _0814FF7C: bl sub_8150D28 - bl RunActiveTasks + bl RunTasks ldr r1, =0x030022c0 movs r0, 0x87 lsls r0, 3 @@ -321169,7 +321169,7 @@ _081501C8: bl SetMainCallback2 ldr r0, =sub_81503E4 movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =0x020375e0 ldrh r0, [r0] cmp r0, 0 @@ -321181,7 +321181,7 @@ _08150218: ldr r0, =sub_8150664 _0815021A: movs r1, 0x1 - bl AddTask + bl CreateTask ldr r1, =0x0203abac ldr r1, [r1] _08150224: @@ -321200,7 +321200,7 @@ _08150226: thumb_func_start mainloop mainloop: @ 815023C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -321246,7 +321246,7 @@ _08150298: lsrs r4, r0, 24 cmp r4, 0x13 bls _08150298 - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 movs r0, 0 @@ -321543,10 +321543,10 @@ _08150528: movs r0, 0 bl SetVBlankCallback adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r0, [r5] ldrb r0, [r0] - bl remove_task + bl DestroyTask ldr r0, =c2_8011A1C bl SetMainCallback2 _08150542: @@ -327865,7 +327865,7 @@ _081537A8: movs r0, 0 strb r0, [r1] adds r0, r2, 0 - bl remove_task + bl DestroyTask _081537C2: pop {r4} pop {r0} @@ -341089,7 +341089,7 @@ sub_8159F5C: @ 8159F5C bl pal_fade_maybe ldr r0, =sub_8159FEC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -341144,7 +341144,7 @@ sub_8159FEC: @ 8159FEC cmp r0, 0x1 bne _0815A044 adds r0, r5, 0 - bl remove_task + bl DestroyTask b _0815A088 .pool _0815A044: @@ -341203,7 +341203,7 @@ sub_815A090: @ 815A090 ldr r0, =gUnknown_08290CAE bl script_env_1_execute_new_script adds r0, r4, 0 - bl remove_task + bl DestroyTask _0815A0BE: pop {r4} pop {r0} @@ -341834,7 +341834,7 @@ _0815A59C: cmp r1, r0 bne _0815A5AC adds r0, r4, 0 - bl remove_task + bl DestroyTask _0815A5AC: pop {r3,r4} mov r8, r3 @@ -341955,7 +341955,7 @@ _0815A692: cmp r1, r0 bne _0815A6A2 mov r0, r8 - bl remove_task + bl DestroyTask _0815A6A2: pop {r3-r5} mov r8, r3 @@ -348225,7 +348225,7 @@ _0815D9F2: cmp r0, 0 bgt _0815DA12 adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r1, =0x020383fe ldrb r0, [r1] subs r0, 0x1 @@ -353708,7 +353708,7 @@ sub_8160638: @ 8160638 bl script_env_2_enable ldr r0, =sub_8160664 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -353739,7 +353739,7 @@ sub_8160664: @ 8160664 ldr r0, =sub_80AF168 str r0, [r1] adds r0, r4, 0 - bl remove_task + bl DestroyTask _08160688: pop {r4} pop {r0} @@ -353752,7 +353752,7 @@ sub_81606A0: @ 81606A0 push {r4-r6,lr} bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks bl clear_scheduled_bg_copies_to_vram ldr r6, =0x0203bc34 movs r0, 0x8C @@ -353806,7 +353806,7 @@ sub_8160740: @ 8160740 push {r4,r5,lr} bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks bl clear_scheduled_bg_copies_to_vram ldr r5, =0x0203bc34 movs r0, 0x8C @@ -353889,7 +353889,7 @@ sub_81607EC: @ 81607EC sub_816082C: @ 816082C push {lr} bl sub_8160868 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -359793,7 +359793,7 @@ sub_8163A8C: @ 8163A8C ldr r0, =sub_8036760 bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08163AB0: pop {r4} pop {r0} @@ -359896,7 +359896,7 @@ _08163B98: _08163BA6: ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0 @@ -359928,7 +359928,7 @@ _08163BC4: ble _08163BC4 ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0xC @@ -359963,7 +359963,7 @@ _08163C18: strh r0, [r1] ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0xD @@ -359993,7 +359993,7 @@ _08163C8A: _08163C9A: ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl sub_806E694 movs r0, 0x3 @@ -360032,7 +360032,7 @@ _08163D0C: _08163D12: ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0x4 @@ -360061,7 +360061,7 @@ _08163D58: _08163D5E: ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0x5 @@ -360084,7 +360084,7 @@ _08163D8E: bl sub_8163590 ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0x6 @@ -360107,7 +360107,7 @@ _08163DC8: bl sub_8163048 ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0xA @@ -360122,7 +360122,7 @@ _08163DF4: _08163E00: ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0x7 @@ -360153,7 +360153,7 @@ _08163E2C: strh r5, [r0] ldr r0, =sub_8163A8C movs r1, 0x1 - bl AddTask + bl CreateTask movs r0, 0 bl current_map_music_set__default_for_battle movs r0, 0x12 @@ -368781,7 +368781,7 @@ _08168842: bl FreeObjectPaletteByTag ldr r0, =c3_0802FDF4 movs r1, 0xA - bl AddTask + bl CreateTask ldr r2, =0x0202406e mov r0, r8 ldrb r1, [r0] @@ -372487,7 +372487,7 @@ sub_816A90C: @ 816A90C strb r0, [r1, 0x5] ldr r0, =sub_816AC04 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -372748,7 +372748,7 @@ _0816AC28: str r1, [r0] strb r5, [r4] adds r0, r6, 0 - bl remove_task + bl DestroyTask _0816AC5E: pop {r4-r6} pop {r0} @@ -372997,9 +372997,9 @@ sub_816AE58: @ 816AE58 ldr r1, =0x0203bcb4 movs r0, 0x4 strb r0, [r1] - ldr r0, =nullsub_4 + ldr r0, =TaskDummy movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =gUnknown_085E8D80 @@ -373019,9 +373019,9 @@ sub_816AE98: @ 816AE98 ldr r1, =0x0203bcb4 movs r0, 0x3 strb r0, [r1] - ldr r0, =nullsub_4 + ldr r0, =TaskDummy movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =gUnknown_085E8D80 @@ -373325,7 +373325,7 @@ _0816B180: bl script_env_2_enable_and_set_ctx_running _0816B184: adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -373505,7 +373505,7 @@ sub_816B2F0: @ 816B2F0 bl overworld_free_bg_tilemaps bl sub_81AAC14 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0816B310: pop {r4} pop {r0} @@ -373535,7 +373535,7 @@ mapldr_080EBC0C: @ 816B33C bl sub_81973C4 ldr r0, =sub_816B368 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 movs r1, 0x1 @@ -374198,7 +374198,7 @@ sub_816B8A4: @ 816B8A4 movs r2, 0x1 bl sub_8121478 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0816B8E6: pop {r4} pop {r0} @@ -374225,7 +374225,7 @@ pal_fill_for_maplights_or_black: @ 816B920 bl sub_81973A4 ldr r0, =task00_080EBBDC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r0, =0x0203bcb8 @@ -374241,7 +374241,7 @@ pal_fill_for_maplights_or_black: @ 816B920 .pool _0816B954: adds r0, r4, 0 - bl remove_task + bl DestroyTask _0816B95A: bl pal_fill_black pop {r4} @@ -374457,7 +374457,7 @@ sub_816BAF8: @ 816BAF8 bl overworld_free_bg_tilemaps bl sub_81B8448 adds r0, r4, 0 - bl remove_task + bl DestroyTask _0816BB1C: pop {r4} pop {r0} @@ -374483,7 +374483,7 @@ sub_816BB48: @ 816BB48 push {r4-r6,lr} ldr r0, =task00_080EBBDC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r6, r0, 24 ldr r5, =0x0203bcb8 @@ -374521,7 +374521,7 @@ _0816BB7E: .pool _0816BBA8: adds r0, r6, 0 - bl remove_task + bl DestroyTask _0816BBAE: bl pal_fill_black pop {r4-r6} @@ -376380,7 +376380,7 @@ sub_816CBE8: @ 816CBE8 thumb_func_start sub_816CC00 sub_816CC00: @ 816CC00 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -376441,17 +376441,17 @@ load_copyright_graphics: @ 816CC70 lsrs r4, 16 lsls r5, 16 lsrs r5, 16 - ldr r0, =gUnknown_08DC3D74 + ldr r0, =gIntroCopyright_Gfx movs r6, 0xC0 lsls r6, 19 adds r3, r6 adds r1, r3, 0 bl LZ77UnCompVram - ldr r0, =gUnknown_08DC3FD4 + ldr r0, =gIntroCopyright_Tilemap adds r4, r6 adds r1, r4, 0 bl LZ77UnCompVram - ldr r0, =gUnknown_08DC3D54 + ldr r0, =gIntroCopyright_Pal adds r1, r5, 0 movs r2, 0x20 bl gpu_pal_apply @@ -376546,7 +376546,7 @@ _0816CCF4: movs r2, 0 bl load_copyright_graphics bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator movs r0, 0x1 @@ -376614,7 +376614,7 @@ _0816CE2C: bne _0816CEA0 ldr r0, =task_intro_1 movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_816CC00 bl SetMainCallback2 ldr r5, =0x030062b0 @@ -376962,7 +376962,7 @@ _0816D1BE: bne _0816D1CC ldr r0, =task_intro_3_1 movs r1, 0 - bl AddTask + bl CreateTask _0816D1CC: ldr r0, [r5] cmp r0, 0xFB @@ -376989,7 +376989,7 @@ _0816D1EE: bne _0816D200 ldr r0, =task_intro_3_2 movs r1, 0 - bl AddTask + bl CreateTask _0816D200: ldr r1, [r5] movs r0, 0xB8 @@ -377030,7 +377030,7 @@ _0816D240: bne _0816D252 ldr r0, =task_intro_3_3 movs r1, 0 - bl AddTask + bl CreateTask _0816D252: ldr r0, [r5] cmp r0, r4 @@ -377131,7 +377131,7 @@ _0816D324: cmp r0, 0x3C ble _0816D332 adds r0, r5, 0 - bl remove_task + bl DestroyTask _0816D332: pop {r4,r5} pop {r0} @@ -377477,7 +377477,7 @@ task_intro_8: @ 816D650 lsls r0, 3 adds r0, r1 ldrb r0, [r0, 0x8] - bl remove_task + bl DestroyTask _0816D67C: ldr r1, [r5] ldr r0, =0x0000079a @@ -380180,7 +380180,7 @@ task_intro_27: @ 816ED20 strh r1, [r4, 0x10] ldr r0, =sub_816EEA8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -380317,7 +380317,7 @@ task_intro_29: @ 816EE90 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask ldr r0, =sub_816CC54 bl SetMainCallback2 pop {r0} @@ -380563,7 +380563,7 @@ _0816F0A0: cmp r0, 0 bne _0816F0B2 adds r0, r2, 0 - bl remove_task + bl DestroyTask _0816F0B2: add sp, 0x4 pop {r4,r5} @@ -380695,7 +380695,7 @@ _0816F1BC: movs r1, 0 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask _0816F1DA: pop {r4,r5} pop {r0} @@ -380790,7 +380790,7 @@ _0816F284: movs r1, 0 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask _0816F2A2: pop {r4,r5} pop {r0} @@ -384401,7 +384401,7 @@ sub_8171030: @ 8171030 str r1, [r0] ldr r0, =sub_81710A8 movs r1, 0xA - bl AddTask + bl CreateTask ldr r0, =sub_8170EF0 str r0, [r4] _0817108A: @@ -384446,7 +384446,7 @@ sub_81710A8: @ 81710A8 movs r1, 0 bl StartObjectImageAnim adds r0, r5, 0 - bl remove_task + bl DestroyTask _081710F4: pop {r4-r6} pop {r0} @@ -384571,9 +384571,9 @@ sub_81711E8: @ 81711E8 asrs r0, 16 cmp r0, 0xA bne _08171224 - ldr r0, =nullsub_4 + ldr r0, =TaskDummy movs r1, 0x32 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0x38] @@ -384733,7 +384733,7 @@ _08171354: cmp r0, 0xA ble _0817137C adds r0, r6, 0 - bl remove_task + bl DestroyTask adds r0, r7, 0 movs r1, 0x2 bl StartObjectImageAnim @@ -386038,7 +386038,7 @@ sub_8171D98: @ 8171D98 adds r0, r1 ldr r0, [r0] movs r1, 0x5 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -386199,7 +386199,7 @@ _08171EEC: strh r0, [r1, 0x3C] _08171F22: mov r0, r8 - bl remove_task + bl DestroyTask b _08171F58 .pool _08171F48: @@ -386380,7 +386380,7 @@ _0817206A: strh r0, [r1, 0x3C] _08172092: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -386498,7 +386498,7 @@ _0817216E: strh r0, [r1, 0x3C] _08172196: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -386614,7 +386614,7 @@ _0817226E: strh r0, [r1, 0x3C] _08172296: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -386734,7 +386734,7 @@ _08172376: strh r0, [r1, 0x3C] _0817239E: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -386875,7 +386875,7 @@ _0817248C: strh r0, [r1, 0x3C] _081724D0: mov r0, r8 - bl remove_task + bl DestroyTask _081724D6: add sp, 0x18 pop {r3-r5} @@ -387035,7 +387035,7 @@ _081725FE: strh r0, [r1, 0x3C] _08172626: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -387221,7 +387221,7 @@ _08172790: strh r0, [r1, 0x3C] _081727C4: ldr r0, [sp] - bl remove_task + bl DestroyTask add sp, 0x18 pop {r3-r5} mov r8, r3 @@ -387332,7 +387332,7 @@ _08172880: strh r0, [r1, 0x3C] _081728A8: mov r0, r9 - bl remove_task + bl DestroyTask add sp, 0x14 pop {r3-r5} mov r8, r3 @@ -387437,7 +387437,7 @@ _08172998: cmp r4, 0xB bgt _081729AA ldr r0, [r5] - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -387489,7 +387489,7 @@ sub_81729E8: @ 81729E8 lsrs r7, r3, 24 ldr r0, =sub_8172AB0 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -387621,7 +387621,7 @@ _08172B08: movs r3, 0 bl pal_fade_maybe adds r0, r5, 0 - bl remove_task + bl DestroyTask _08172B30: add sp, 0x4 pop {r4,r5} @@ -387709,7 +387709,7 @@ sub_8172B90: @ 8172B90 .pool _08172BE4: adds r0, r2, 0 - bl remove_task + bl DestroyTask _08172BEA: pop {r4} pop {r0} @@ -388138,13 +388138,13 @@ _08172F6E: ldr r5, =sub_8172FEC adds r0, r5, 0 movs r1, 0xA - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 adds r0, r5, 0 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r3, =0x03005e00 @@ -388423,7 +388423,7 @@ sub_81731B0: @ 81731B0 strb r1, [r0, 0x1] _081731EA: adds r0, r3, 0 - bl remove_task + bl DestroyTask _081731F0: pop {r0} bx r0 @@ -388838,7 +388838,7 @@ sub_817354C: @ 817354C thumb_func_start sub_8173560 sub_8173560: @ 8173560 push {lr} - bl RunActiveTasks + bl RunTasks bl RunTextPrinters bl CallObjectCallbacks bl PrepareSpritesForOamLoad @@ -388970,7 +388970,7 @@ sub_8173694: @ 8173694 bne _081736C4 ldr r0, =sub_817371C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -388999,7 +388999,7 @@ sub_81736D8: @ 81736D8 bne _08173708 ldr r0, =sub_817371C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -389374,7 +389374,7 @@ _08173A06: str r0, [r5] _08173A16: adds r0, r4, 0 - bl remove_task + bl DestroyTask b _08173A4C .pool _08173A34: @@ -390205,7 +390205,7 @@ _081740FA: movs r0, 0 bl ResetBgsAndClearDma3BusyFlags adds r0, r7, 0 - bl remove_task + bl DestroyTask ldr r4, =0x0203bcdc ldr r0, [r4] cmp r0, 0 @@ -390332,7 +390332,7 @@ _08174240: b _081742A2 .pool _08174280: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -390363,7 +390363,7 @@ _081742B0: bl SetGpuReg ldr r0, =sub_8174324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 movs r2, 0 @@ -391107,7 +391107,7 @@ _08174928: movs r0, 0 bl ResetBgsAndClearDma3BusyFlags adds r0, r6, 0 - bl remove_task + bl DestroyTask ldr r4, =0x0203bcdc ldr r0, [r4] cmp r0, 0 @@ -391796,7 +391796,7 @@ _08174EEA: sub_8174F70: @ 8174F70 push {lr} bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl reset_temp_tile_data_buffers bl dp13_810BB8C @@ -392165,7 +392165,7 @@ sub_8175280: @ 8175280 strh r0, [r4] ldr r0, =sub_8175364 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -392190,12 +392190,12 @@ _081752AA: sub_81752C0: @ 81752C0 push {r4,lr} ldr r0, =sub_8175364 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _081752D4 - bl remove_task + bl DestroyTask _081752D4: bl sub_8152254 ldr r4, =0x000003e9 @@ -392302,7 +392302,7 @@ _0817539C: cmp r0, 0 bne _081753B8 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =0x020375e0 strh r7, [r0] ldr r1, =0x020375e2 @@ -392433,7 +392433,7 @@ sub_81754C8: @ 81754C8 thumb_func_start sub_81754DC sub_81754DC: @ 81754DC push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks ldr r0, =0x030022c0 ldrh r1, [r0, 0x2C] @@ -392457,7 +392457,7 @@ sub_81754DC: @ 81754DC cmp r1, r0 bne _08175522 bl sub_81754C8 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks ldr r1, =0x0203bce5 movs r0, 0x1 @@ -392585,11 +392585,11 @@ sub_8175620: @ 8175620 lsls r1, 9 bl InitHeap bl sub_80A1A74 - bl clear_tasks + bl ResetTasks bl sub_8175548 ldr r0, =sub_8175744 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r7, r0, 24 ldr r1, =0x03005e00 @@ -392631,7 +392631,7 @@ _0817566A: bl SetGpuReg ldr r0, =sub_8175DA0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r1, r0, 2 @@ -392983,7 +392983,7 @@ _0817596E: _081759F0: ldr r0, =sub_81760FC movs r1, 0 - bl AddTask + bl CreateTask ldr r2, =0x03005e00 lsls r4, r6, 2 adds r4, r6 @@ -393709,7 +393709,7 @@ _08175FFC: movs r1, 0x1 strh r1, [r0, 0x10] adds r0, r4, 0 - bl remove_task + bl DestroyTask bl sub_81755A4 ldr r4, =0x0203bce8 ldr r0, [r4] @@ -394913,7 +394913,7 @@ _081769D4: _081769E0: ldr r0, =sub_817651C movs r1, 0 - bl AddTask + bl CreateTask ldr r6, =0x03005e00 lsls r1, r7, 2 adds r1, r7 @@ -394947,7 +394947,7 @@ _081769E0: strh r7, [r0, 0xC] ldr r0, =sub_817624C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0xA] @@ -395215,7 +395215,7 @@ sub_8176CA0: @ 8176CA0 beq _08176CC6 lsls r0, r1, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 strh r0, [r4, 0x8] _08176CC6: @@ -395226,7 +395226,7 @@ _08176CC6: beq _08176CDC lsls r0, r1, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 strh r0, [r4, 0xA] _08176CDC: @@ -395237,7 +395237,7 @@ _08176CDC: beq _08176CF2 lsls r0, r1, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 strh r0, [r4, 0xC] _08176CF2: @@ -395248,7 +395248,7 @@ _08176CF2: beq _08176D08 lsls r0, r1, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask movs r0, 0 strh r0, [r4, 0xE] _08176D08: @@ -395278,7 +395278,7 @@ sub_8176D1C: @ 8176D1C adds r3, r6 adds r1, r3, 0 bl LZ77UnCompVram - ldr r0, =gUnknown_08DC3D54 + ldr r0, =gIntroCopyright_Pal adds r1, r5, 0 movs r2, 0x20 bl gpu_pal_apply @@ -396775,7 +396775,7 @@ sub_8177888: @ 8177888 str r0, [r1, 0x8] ldr r0, [r1, 0x8] bl remove_some_task - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl sub_80A1A74 bl ResetObjectPaletteAllocator @@ -396830,7 +396830,7 @@ _0817797C: bl SetMainCallback2 ldr r0, =sub_8177A20 movs r1, 0 - bl AddTask + bl CreateTask add sp, 0xC pop {r4,r5} pop {r0} @@ -396841,7 +396841,7 @@ _0817797C: thumb_func_start sub_8177A08 sub_8177A08: @ 8177A08 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -396923,7 +396923,7 @@ sub_8177A98: @ 8177A98 bl Free bl FreeAllWindowBuffers adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80861E8 bl SetMainCallback2 _08177AC2: @@ -397095,7 +397095,7 @@ sub_8177C14: @ 8177C14 thumb_func_start sub_8177C54 sub_8177C54: @ 8177C54 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -397202,7 +397202,7 @@ _08177D4C: lsls r0, 24 cmp r0, 0 bne _08177DDC - bl clear_tasks + bl ResetTasks b _08177DDC _08177D5C: bl sub_8177E14 @@ -397239,7 +397239,7 @@ _08177D9C: _08177DA6: ldr r0, =sub_8178654 movs r1, 0 - bl AddTask + bl CreateTask b _08177DDC .pool _08177DB4: @@ -398206,7 +398206,7 @@ sub_8178610: @ 8178610 ldr r0, =bag_menu_mail_related bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08178642: pop {r4} pop {r0} @@ -398630,7 +398630,7 @@ sub_8178974: @ 8178974 sub sp, 0x8 bl ResetAllObjectData bl ResetObjectPaletteAllocator - bl clear_tasks + bl ResetTasks ldr r0, =sub_8178944 bl SetVBlankCallback movs r0, 0 @@ -398678,9 +398678,9 @@ _081789AC: bl SetGpuReg ldr r0, =sub_8009404 movs r1, 0 - bl AddTask + bl CreateTask bl sub_80A2F30 - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -399181,7 +399181,7 @@ _08178E58: movs r1, 0xD strb r1, [r0] _08178E98: - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl RunTextPrinters @@ -399480,7 +399480,7 @@ _08178FF8: bl SetWindowAttribute bl DeactivateAllTextPrinters bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl sub_80A1A74 ldr r0, =gUnknown_085B0A00 movs r1, 0 @@ -400078,7 +400078,7 @@ sub_8179700: @ 8179700 push {lr} ldr r0, =sub_8179778 movs r1, 0x9 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -400107,7 +400107,7 @@ sub_817973C: @ 817973C push {lr} ldr r0, =sub_8179778 movs r1, 0x9 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -400169,7 +400169,7 @@ sub_8179778: @ 8179778 cmp r1, r0 bne _081797D0 adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running bl InstallCameraPanAheadCallback _081797D0: @@ -400579,7 +400579,7 @@ _08179B5C: thumb_func_start sub_8179B68 sub_8179B68: @ 8179B68 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -401207,7 +401207,7 @@ sub_817A168: @ 817A168 push {lr} ldr r0, =sub_817A030 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -401363,7 +401363,7 @@ sub_817A2C0: @ 817A2C0 ldr r0, [r0, 0x8] bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask bl FreeAllWindowBuffers ldr r0, =0x0203bd18 ldr r0, [r0] @@ -402450,7 +402450,7 @@ c2_clear_save_data_screen_2: @ 817ACC8 beq _0817ACDC ldr r0, =sub_817ACE4 movs r1, 0 - bl AddTask + bl CreateTask _0817ACDC: pop {r0} bx r0 @@ -402545,7 +402545,7 @@ _0817ADA0: movs r0, 0x5 bl audio_play adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_817AFD4 bl SetMainCallback2 _0817ADB2: @@ -402564,7 +402564,7 @@ sub_817ADC0: @ 817ADC0 lsrs r4, 24 bl calls_flash_erase_block adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_817AFD4 bl SetMainCallback2 pop {r4} @@ -402576,7 +402576,7 @@ sub_817ADC0: @ 817ADC0 thumb_func_start sub_817ADE4 sub_817ADE4: @ 817ADE4 push {lr} - bl RunActiveTasks + bl RunTasks bl fade_and_return_progress_probably pop {r0} bx r0 @@ -402707,7 +402707,7 @@ _0817AEEC: lsrs r1, r0, 16 cmp r1, r2 bls _0817AEEC - bl clear_tasks + bl ResetTasks bl ResetAllObjectData movs r0, 0 bl ResetBgsAndClearDma3BusyFlags @@ -403143,7 +403143,7 @@ sub_817B3DC: @ 817B3DC mov r0, r9 movs r1, 0 str r3, [sp] - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -404477,7 +404477,7 @@ sub_817BE94: @ 817BE94 lsrs r4, 16 ldr r0, =sub_817BEC4 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -404608,7 +404608,7 @@ sub_817BF84: @ 817BF84 .pool _0817BFA8: adds r0, r2, 0 - bl remove_task + bl DestroyTask _0817BFAE: pop {r4} pop {r0} @@ -404620,7 +404620,7 @@ sub_817BFB4: @ 817BFB4 push {lr} ldr r0, =sub_817BFCC movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -404704,7 +404704,7 @@ sub_817C058: @ 817C058 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 thumb_func_end sub_817C058 @@ -404714,7 +404714,7 @@ sub_817C068: @ 817C068 push {lr} ldr r0, =sub_817C080 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -404819,7 +404819,7 @@ sub_817C134: @ 817C134 push {lr} lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 thumb_func_end sub_817C134 @@ -404832,7 +404832,7 @@ sub_817C144: @ 817C144 lsrs r4, 16 ldr r0, =sub_817C174 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -404964,7 +404964,7 @@ sub_817C260: @ 817C260 cmp r0, 0 bne _0817C278 adds r0, r2, 0 - bl remove_task + bl DestroyTask _0817C278: pop {r0} bx r0 @@ -404979,7 +404979,7 @@ sub_817C280: @ 817C280 lsrs r4, 16 ldr r0, =sub_817C2B0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -405131,7 +405131,7 @@ _0817C3BA: bls _0817C3BA adds r0, r3, 0 movs r1, 0 - bl AddTask + bl CreateTask mov r8, r0 mov r0, r8 lsls r0, 24 @@ -405547,7 +405547,7 @@ sub_817C67C: @ 817C67C negs r2, r2 ands r2, r3 strb r2, [r1] - bl remove_task + bl DestroyTask pop {r3} mov r8, r3 pop {r4-r6} @@ -405635,7 +405635,7 @@ sub_817C72C: @ 817C72C movs r3, 0x4 orrs r2, r3 strb r2, [r1] - bl remove_task + bl DestroyTask pop {r3} mov r8, r3 pop {r4-r6} @@ -410892,7 +410892,7 @@ _0817F508: strh r0, [r3, 0x32] strh r2, [r3, 0x30] adds r0, r5, 0 - bl remove_task + bl DestroyTask _0817F528: pop {r3} mov r8, r3 @@ -410910,7 +410910,7 @@ sub_817F544: @ 817F544 lsrs r4, 24 ldr r0, =sub_817F498 movs r1, 0x80 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -410951,7 +410951,7 @@ sub_817F594: @ 817F594 lsrs r6, 24 ldr r0, =sub_817F498 movs r1, 0x80 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -424072,7 +424072,7 @@ sub_8185B1C: @ 8185B1C ldr r0, =sub_8036760 bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08185B4A: pop {r4} pop {r0} @@ -424385,7 +424385,7 @@ sub_8185E24: @ 8185E24 bl sub_8185B60 ldr r0, =sub_8185B1C movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -424415,7 +424415,7 @@ sub_8185E8C: @ 8185E8C push {lr} bl CallObjectCallbacks bl PrepareSpritesForOamLoad - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_8185E8C @@ -430681,7 +430681,7 @@ sub_8189438: @ 8189438 bl oamt_set_x3A_32 ldr r0, =c3_0803D564 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -430820,7 +430820,7 @@ _081895F4: mov r0, r9 strb r0, [r2] mov r0, r8 - bl remove_task + bl DestroyTask pop {r3,r4} mov r8, r3 mov r9, r4 @@ -432415,7 +432415,7 @@ sub_818A37C: @ 818A37C bl FreeObjectPaletteByTag ldr r0, =c3_0802FDF4 movs r1, 0xA - bl AddTask + bl CreateTask ldr r0, =0x0202406e mov r8, r0 ldrb r1, [r7] @@ -436860,7 +436860,7 @@ _0818CB5A: strb r0, [r1, 0x5] ldr r0, =sub_818CC24 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -437017,7 +437017,7 @@ _0818CCF4: mov r3, r9 strb r3, [r2] mov r0, r8 - bl remove_task + bl DestroyTask _0818CD0C: pop {r3,r4} mov r8, r3 @@ -443593,7 +443593,7 @@ sub_81903B8: @ 81903B8 push {r4,r5,lr} ldr r0, =sub_8190400 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r1, =0x03005e00 @@ -443851,7 +443851,7 @@ _0819064A: bl sub_80D2F04 ldr r0, =sub_8190CD4 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r6, r0, 24 ldr r1, =0x03005e00 @@ -443970,7 +443970,7 @@ _08190746: strh r0, [r4, 0x30] _0819076C: mov r0, r10 - bl remove_task + bl DestroyTask _08190772: add sp, 0xC pop {r3-r5} @@ -447010,7 +447010,7 @@ _0819218E: _081921C4: ldr r0, =sub_8194220 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r6, r0, 24 ldr r2, =0x03005e00 @@ -447037,7 +447037,7 @@ _081921C4: strh r0, [r1, 0x10] _081921FC: mov r0, r8 - bl remove_task + bl DestroyTask _08192202: add sp, 0x4 pop {r3-r5} @@ -449735,7 +449735,7 @@ sub_81938A4: @ 81938A4 push {lr} ldr r0, =sub_8194220 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -449784,7 +449784,7 @@ sub_81938E0: @ 81938E0 strh r1, [r0] ldr r0, =sub_8194220 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -449978,7 +449978,7 @@ _08193ABA: str r6, [r4] ldr r0, =sub_8190400 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r3, r0, 24 ldr r2, =0x03005e00 @@ -450023,7 +450023,7 @@ _08193B20: str r6, [r4] ldr r0, =sub_8190400 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r3, r0, 24 ldr r2, =0x03005e00 @@ -450069,9 +450069,9 @@ _08193B84: lsls r0, 3 adds r0, r1 ldrb r0, [r0, 0x16] - bl remove_task + bl DestroyTask adds r0, r5, 0 - bl remove_task + bl DestroyTask _08193BC2: add sp, 0x4 pop {r4-r7} @@ -450255,7 +450255,7 @@ sub_8193D40: @ 8193D40 push {lr} ldr r0, =sub_8194220 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -451476,7 +451476,7 @@ _081947C8: bne _08194844 ldr r0, =sub_819395C movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r2, =0x03005e00 @@ -451499,7 +451499,7 @@ _081947C8: _08194844: ldr r0, =sub_8194950 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r5, r0, 24 ldr r1, =0x03005e00 @@ -451557,7 +451557,7 @@ _081948A4: ldr r2, [r3, 0x8] bl sub_80BA038 mov r0, r8 - bl remove_task + bl DestroyTask _081948C2: add sp, 0x28 pop {r3-r5} @@ -451845,7 +451845,7 @@ _08194B24: ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music bl SetMainCallback2 adds r0, r4, 0 - bl remove_task + bl DestroyTask _08194B3C: add sp, 0x14 pop {r3,r4} @@ -451864,7 +451864,7 @@ sub_8194B54: @ 8194B54 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_8194B54 @@ -454393,7 +454393,7 @@ sub_8196080: @ 8196080 sub_8196094: @ 8196094 push {lr} ldr r0, =sub_81960E0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -454417,7 +454417,7 @@ _081960C2: bl audio_play ldr r0, =sub_81960E0 movs r1, 0x1 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -454453,7 +454453,7 @@ sub_81960E0: @ 81960E0 cmp r0, 0x7 bls _0819611E adds r0, r5, 0 - bl remove_task + bl DestroyTask _0819611E: pop {r4,r5} pop {r0} @@ -454532,7 +454532,7 @@ _081961D8: bl RemoveWindow adds r0, r6, 0 _081961E0: - bl remove_task + bl DestroyTask movs r0, 0 _081961E6: add sp, 0x4 @@ -454578,7 +454578,7 @@ sub_81961F0: @ 81961F0 bl WriteSequenceToBgTilemapBuffer ldr r0, =sub_8196694 movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r4, 0xA] @@ -454771,7 +454771,7 @@ _081963C0: movs r3, 0xE bl FillBgTilemapBufferRect_Palette0 ldrb r0, [r4, 0xA] - bl remove_task + bl DestroyTask ldrb r0, [r4, 0x4] bl RemoveWindow movs r0, 0 @@ -461942,7 +461942,7 @@ _08199B36: beq _08199B6E ldr r0, =task_free_buf_after_copying_tile_data_to_vram movs r1, 0 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -461962,7 +461962,7 @@ _08199B36: adds r0, r4, 0 movs r1, 0x1 adds r2, r6, 0 - bl set_word_task_arg + bl SetWordTaskArg _08199B6E: add sp, 0x8 pop {r3,r4} @@ -461993,10 +461993,10 @@ task_free_buf_after_copying_tile_data_to_vram: @ 8199B84 bne _08199BB4 adds r0, r4, 0 movs r1, 0x1 - bl get_word_task_arg + bl GetWordTaskArg bl Free adds r0, r4, 0 - bl remove_task + bl DestroyTask _08199BB4: pop {r4} pop {r0} @@ -463207,7 +463207,7 @@ sub_819A4C8: @ 819A4C8 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_819A4C8 @@ -463382,7 +463382,7 @@ _0819A5C0: _0819A69C: bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator ldr r0, =gUnknown_08DC0754 ldr r5, =0x0203ce2c @@ -463609,7 +463609,7 @@ _0819A8EE: _0819A8FC: ldr r0, =sub_819C69C movs r1, 0 - bl AddTask + bl CreateTask ldr r2, =0x0300127c ldr r1, [r2] ldr r3, =0x000002a1 @@ -463630,7 +463630,7 @@ _0819A8FC: strh r5, [r0, 0x8] ldr r0, =sub_819B378 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r1, r0, 24 lsls r0, r1, 2 @@ -463657,7 +463657,7 @@ _0819A954: strb r2, [r0] ldr r0, =sub_819B124 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r1, r0, 24 lsls r0, r1, 2 @@ -464294,7 +464294,7 @@ _0819AE64: ldr r2, =0x000002a1 adds r0, r2 ldrb r0, [r0] - bl remove_task + bl DestroyTask ldr r1, [r4] movs r3, 0xA6 lsls r3, 2 @@ -464338,7 +464338,7 @@ _0819AEE8: adds r1, r3 strh r0, [r1] adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r1, [r4] movs r0, 0x1 strb r0, [r1, 0x6] @@ -464434,7 +464434,7 @@ _0819AFB8: ldr r1, =0x000002a1 adds r0, r1 ldrb r0, [r0] - bl remove_task + bl DestroyTask bl sub_819AB40 ldr r4, =0x0203ce2c ldr r0, [r4] @@ -464455,7 +464455,7 @@ _0819AFB8: ldr r0, =sub_80861B0 bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask _0819B00E: add sp, 0x4 pop {r4-r7} @@ -466431,7 +466431,7 @@ sub_819C040: @ 819C040 strb r1, [r0] ldr r0, =sub_819C1D0 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -466657,7 +466657,7 @@ _0819C29E: b _0819C2C6 _0819C2BA: adds r0, r2, 0 - bl remove_task + bl DestroyTask bl sub_819BF2C b _0819C2CC _0819C2C6: @@ -466807,7 +466807,7 @@ _0819C2FC: movs r0, 0 bl ClearGpuRegBits adds r0, r7, 0 - bl remove_task + bl DestroyTask b _0819C4A4 .pool _0819C410: @@ -466992,7 +466992,7 @@ sub_819C568: @ 819C568 bl sub_818D820 ldr r0, =sub_819C2D4 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -467280,7 +467280,7 @@ sub_819C7E0: @ 819C7E0 bl PrepareSpritesForOamLoad bl RunTextPrinters bl fade_and_return_progress_probably - bl RunActiveTasks + bl RunTasks pop {r0} bx r0 thumb_func_end sub_819C7E0 @@ -467457,7 +467457,7 @@ _0819C950: ldr r0, [r4] adds r0, 0x21 ldrb r0, [r0] - bl remove_task + bl DestroyTask ldr r1, [r4] ldr r0, [r1, 0x2C] adds r1, 0x30 @@ -467486,7 +467486,7 @@ _0819C950: .pool _0819C9C4: adds r0, r2, 0 - bl remove_task + bl DestroyTask ldr r2, =0x03001284 ldr r1, [r2] movs r0, 0x1 @@ -467600,7 +467600,7 @@ _0819CAA4: ldr r0, [r7] adds r0, 0x21 ldrb r0, [r0] - bl remove_task + bl DestroyTask bl sub_819E538 ldr r4, =0x0203ce40 ldr r0, [r4] @@ -467625,7 +467625,7 @@ _0819CAA4: ldr r0, =sub_80861B0 bl SetMainCallback2 adds r0, r6, 0 - bl remove_task + bl DestroyTask _0819CAFE: add sp, 0x4 pop {r4-r7} @@ -468613,7 +468613,7 @@ _0819D306: cmp r7, 0x1 bne _0819D310 ldr r0, [sp] - bl remove_task + bl DestroyTask _0819D310: add sp, 0x10 pop {r3-r5} @@ -468795,7 +468795,7 @@ _0819D40E: movs r1, 0x1 strh r1, [r0, 0xE] adds r0, r7, 0 - bl remove_task + bl DestroyTask b _0819D570 .pool _0819D480: @@ -468918,7 +468918,7 @@ _0819D520: movs r1, 0x1 strh r1, [r0, 0x10] adds r0, r7, 0 - bl remove_task + bl DestroyTask _0819D570: pop {r3-r5} mov r8, r3 @@ -469033,7 +469033,7 @@ _0819D64E: bne _0819D6B0 ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r1, =0x03005e00 @@ -469061,7 +469061,7 @@ _0819D64E: _0819D6B0: ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r3, =0x03005e00 @@ -469099,7 +469099,7 @@ _0819D6F0: bne _0819D734 ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 strh r7, [r6, 0x10] @@ -469206,7 +469206,7 @@ _0819D7E0: bne _0819D828 ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r3, =0x03005e00 @@ -469234,7 +469234,7 @@ _0819D7E0: _0819D828: ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 ldr r3, =0x03005e00 @@ -469271,7 +469271,7 @@ _0819D868: bne _0819D8A8 ldr r0, =sub_819D324 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 strh r7, [r5, 0x10] @@ -469508,7 +469508,7 @@ _0819DA58: _0819DA8C: ldr r0, =sub_819D12C movs r1, 0 - bl AddTask + bl CreateTask ldr r2, =0x03005e00 ldr r0, =0x03001284 ldr r0, [r0] @@ -469524,7 +469524,7 @@ _0819DA8C: .pool _0819DABC: ldr r0, =sub_819D12C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _0819DACA @@ -469838,7 +469838,7 @@ _0819DCD4: _0819DDA8: bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl ResetObjectPaletteAllocator bl dp13_810BB8C ldr r0, =gUnknown_08DC0754 @@ -470070,7 +470070,7 @@ _0819E00E: _0819E01C: ldr r0, =sub_819CF54 movs r1, 0 - bl AddTask + bl CreateTask ldr r6, =0x03001284 ldr r1, [r6] adds r1, 0x21 @@ -470089,7 +470089,7 @@ _0819E01C: strh r5, [r0, 0x8] ldr r0, =sub_819CE40 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r1, r0, 24 lsls r0, r1, 2 @@ -470117,7 +470117,7 @@ _0819E06C: strb r3, [r2] ldr r0, =sub_819CD34 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r1, r0, 24 lsls r0, r1, 2 @@ -472504,7 +472504,7 @@ sub_819F3F8: @ 819F3F8 bl sub_818D820 ldr r0, =sub_819F7B4 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -472742,7 +472742,7 @@ sub_819F600: @ 819F600 strb r0, [r2] ldr r0, =sub_819F69C movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -472907,7 +472907,7 @@ _0819F760: b _0819F7A6 _0819F77C: adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =0x03005e00 lsls r1, r5, 2 adds r1, r5 @@ -472995,7 +472995,7 @@ sub_819F7B4: @ 819F7B4 movs r0, 0 bl ClearGpuRegBits adds r0, r5, 0 - bl remove_task + bl DestroyTask b _0819F8D8 .pool _0819F844: @@ -474937,7 +474937,7 @@ _081A0768: ldrb r0, [r4, 0xC] bl sub_81A07E8 adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _081A0778: pop {r4,r5} @@ -475025,7 +475025,7 @@ sub_81A0804: @ 81A0804 lsrs r6, r2, 24 ldr r0, =sub_81A070C movs r1, 0x50 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 ldr r1, =0x03005e00 @@ -475318,7 +475318,7 @@ sub_81A0A34: @ 81A0A34 cmp r0, 0 bne _081A0A68 adds r0, r4, 0 - bl remove_task + bl DestroyTask ldr r0, =0x020375e2 ldrh r0, [r0] cmp r0, 0 @@ -475564,7 +475564,7 @@ _081A0C7A: bl AddTextPrinterForMessage ldr r0, =sub_81A0A34 movs r1, 0x1 - bl AddTask + bl CreateTask _081A0C8E: pop {r0} bx r0 @@ -476848,7 +476848,7 @@ sub_81A16B4: @ 81A16B4 beq _081A16D4 _081A16CE: adds r0, r2, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _081A16D4: pop {r0} bx r0 @@ -476885,7 +476885,7 @@ _081A16F6: str r1, [r2] bl _call_via_r1 adds r0, r4, 0 - bl remove_task + bl DestroyTask _081A1718: pop {r4} pop {r0} @@ -476899,7 +476899,7 @@ sub_81A172C: @ 81A172C adds r4, r0, 0 ldr r0, =sub_81A16DC movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -476923,12 +476923,12 @@ sub_81A175C: @ 81A175C ldr r4, =sub_81A16B4 adds r0, r4, 0 movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 adds r2, r5, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4,r5} pop {r0} bx r0 @@ -487836,7 +487836,7 @@ sub_81A7580: @ 81A7580 push {lr} ldr r0, =sub_81A7EE4 movs r1, 0x2 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -488958,10 +488958,10 @@ _081A7E22: cmp r0, 0 bne _081A7E50 ldr r0, =sub_81A7D54 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask b _081A7E56 .pool _081A7E50: @@ -489000,7 +489000,7 @@ sub_81A7E60: @ 81A7E60 ldr r0, =sub_81A7D54 movs r1, 0x3 str r3, [sp] - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -489029,7 +489029,7 @@ sub_81A7E60: @ 81A7E60 sub_81A7EC4: @ 81A7EC4 push {lr} ldr r0, =sub_81A7D54 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -489079,7 +489079,7 @@ _081A7F1C: beq _081A7F30 bl script_env_2_enable_and_set_ctx_running adds r0, r4, 0 - bl remove_task + bl DestroyTask _081A7F30: add sp, 0x4 pop {r4} @@ -492073,7 +492073,7 @@ sub_81A97C8: @ 81A97C8 push {lr} ldr r0, =sub_81A97DC movs r1, 0 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -492102,7 +492102,7 @@ sub_81A97DC: @ 81A97DC movs r2, 0x10 bl CpuSet adds r0, r4, 0 - bl remove_task + bl DestroyTask _081A980C: pop {r4} pop {r0} @@ -494775,7 +494775,7 @@ _081AAD3A: thumb_func_start c2_bag_3 c2_bag_3: @ 81AAD5C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -494902,7 +494902,7 @@ _081AAE86: lsls r0, 24 cmp r0, 0 bne _081AAE94 - bl clear_tasks + bl ResetTasks _081AAE94: ldr r1, =0x030022c0 movs r2, 0x87 @@ -495274,7 +495274,7 @@ _081AB204: ldr r0, =Task_BagMenu _081AB206: movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -496136,7 +496136,7 @@ _081AB98A: bl ResetObjectPaletteAllocator bl free_bag_item_list_buffers adds r0, r5, 0 - bl remove_task + bl DestroyTask _081AB9A0: pop {r4,r5} pop {r0} @@ -497011,7 +497011,7 @@ _081AC09A: adds r0, r2 ldr r2, [r0] adds r0, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc add sp, 0xC pop {r4-r6} pop {r0} @@ -497052,7 +497052,7 @@ _081AC148: ldrsb r1, [r6, r1] bl ChangeBagPocketId adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc movs r1, 0x1 negs r1, r1 adds r0, r7, 0 @@ -497064,7 +497064,7 @@ _081AC164: ldrsb r1, [r6, r1] bl ChangeBagPocketId adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc adds r0, r7, 0 movs r1, 0x1 _081AC178: @@ -497149,7 +497149,7 @@ _081AC1DC: bl bag_menu_add_pocket_scroll_arrow_indicators_maybe bl bag_menu_add_list_scroll_arrow_indicators_maybe adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _081AC22E: pop {r4-r7} pop {r0} @@ -499282,7 +499282,7 @@ _081AD550: ldrh r0, [r0] bl itemid_get_overworld_function movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -501337,7 +501337,7 @@ _081AE6EC: bl ListMenuRemoveCursorObject _081AE6FC: adds r0, r4, 0 - bl remove_task + bl DestroyTask pop {r4} pop {r0} bx r0 @@ -501603,7 +501603,7 @@ ListMenuInitInternal: @ 81AE8D4 lsrs r6, 16 ldr r0, =ListMenuDummyTask movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -503049,7 +503049,7 @@ _081AF3DC: _081AF3EE: ldr r0, =Task_ScrollIndicatorArrowPair movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 mov r8, r0 @@ -503357,7 +503357,7 @@ _081AF648: adds r0, r4 bl RemoveObjectAndFreeTiles adds r0, r6, 0 - bl remove_task + bl DestroyTask pop {r4-r6} pop {r0} bx r0 @@ -503643,7 +503643,7 @@ _081AF884: _081AF896: ldr r0, =Task_RedOutlineCursor movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r4, r0, 0 @@ -503822,7 +503822,7 @@ _081AFA06: adds r0, r1 bl RemoveObjectAndFreeTiles adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4-r6} pop {r0} bx r0 @@ -503905,7 +503905,7 @@ _081AFAB4: _081AFAC6: ldr r0, =Task_RedArrowCursor movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 adds r6, r0, 0 @@ -504034,7 +504034,7 @@ _081AFBC8: adds r0, r1 bl RemoveObjectAndFreeTiles adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4-r6} pop {r0} bx r0 @@ -504792,7 +504792,7 @@ _081B0194: thumb_func_start sub_81B01B0 sub_81B01B0: @ 81B01B0 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -504924,7 +504924,7 @@ _081B02EC: beq _081B02F8 b _081B0484 _081B02F8: - bl clear_tasks + bl ResetTasks b _081B0484 _081B02FE: bl sub_81B209C @@ -505067,7 +505067,7 @@ _081B0430: ldr r0, [r4] ldr r0, [r0] movs r1, 0 - bl AddTask + bl CreateTask ldr r0, [r4] ldrh r0, [r0, 0xA] lsrs r0, 2 @@ -505140,7 +505140,7 @@ sub_81B04BC: @ 81B04BC bl pal_fade_maybe ldr r0, =sub_81B04F8 movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_81B01CC bl SetVBlankCallback ldr r0, =sub_81B01B0 @@ -505167,7 +505167,7 @@ sub_81B04F8: @ 81B04F8 bl SetMainCallback2 bl sub_81B06F4 adds r0, r4, 0 - bl remove_task + bl DestroyTask _081B051C: pop {r4} pop {r0} @@ -506888,7 +506888,7 @@ _081B133E: bl ResetAllObjectData bl sub_81B06F4 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B134C: pop {r4,r5} pop {r0} @@ -507923,7 +507923,7 @@ sub_81B1B5C: @ 81B1B5C bl sub_81B3300 ldr r0, =sub_81B1B8C movs r1, 0x1 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -507966,7 +507966,7 @@ sub_81B1B8C: @ 81B1B8C bl ClearWindowTilemap _081B1BC2: adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B1BC8: pop {r4,r5} pop {r0} @@ -507978,7 +507978,7 @@ _081B1BC8: sub_81B1BD4: @ 81B1BD4 push {lr} ldr r0, =sub_81B1B8C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -508342,7 +508342,7 @@ _081B1EDC: bl ConvertIntToDecimalString _081B1EF8: mov r0, r8 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc _081B1EFE: pop {r3} mov r8, r3 @@ -508408,7 +508408,7 @@ sub_81B1F18: @ 81B1F18 ldr r1, =sub_81B1E60 mov r0, r8 adds r2, r7, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r3-r5} mov r8, r3 mov r9, r4 @@ -508466,7 +508466,7 @@ _081B1FFE: _081B2002: ldr r1, =sub_81B1E60 adds r0, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc _081B200A: pop {r4,r5} pop {r0} @@ -514817,7 +514817,7 @@ hm_add_c3_launch_phase_2: @ 81B5738 bl pal_fill_black ldr r0, =task_launch_hm_phase_2 movs r1, 0x8 - bl AddTask + bl CreateTask movs r0, 0x1 pop {r1} bx r1 @@ -514843,7 +514843,7 @@ task_launch_hm_phase_2: @ 81B5750 ldr r0, [r0] bl _call_via_r0 adds r0, r4, 0 - bl remove_task + bl DestroyTask _081B577C: pop {r4} pop {r0} @@ -518654,7 +518654,7 @@ sub_81B7810: @ 81B7810 movs r2, 0x1 bl sub_813DA40 adds r0, r5, 0 - bl remove_task + bl DestroyTask b _081B786E .pool _081B7860: @@ -521923,7 +521923,7 @@ hm_add_c3_without_phase_2: @ 81B93C8 bl pal_fill_black ldr r0, =task_hm_without_phase_2 movs r1, 0xA - bl AddTask + bl CreateTask movs r0, 0x1 pop {r1} bx r1 @@ -521940,7 +521940,7 @@ task_hm_without_phase_2: @ 81B93E0 cmp r0, 0 beq _081B93FE adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_disable bl script_env_2_enable_and_set_ctx_running _081B93FE: @@ -521958,7 +521958,7 @@ sub_81B9404: @ 81B9404 bl fade_screen ldr r0, =sub_81B9424 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -521990,7 +521990,7 @@ sub_81B9424: @ 81B9424 movs r3, 0 bl sub_81B0038 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B945C: add sp, 0xC pop {r4,r5} @@ -522034,7 +522034,7 @@ sub_81B94B0: @ 81B94B0 bl fade_screen ldr r0, =sub_81B94D0 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -522066,7 +522066,7 @@ sub_81B94D0: @ 81B94D0 movs r3, 0 bl sub_81B0038 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B9508: add sp, 0xC pop {r4,r5} @@ -522084,7 +522084,7 @@ sub_81B951C: @ 81B951C bl fade_screen ldr r0, =sub_81B953C movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -522116,7 +522116,7 @@ sub_81B953C: @ 81B953C movs r3, 0 bl sub_81B0038 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B9574: add sp, 0xC pop {r4,r5} @@ -522205,7 +522205,7 @@ sub_81B9620: @ 81B9620 bl fade_screen ldr r0, =sub_81B9640 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -522237,7 +522237,7 @@ sub_81B9640: @ 81B9640 movs r3, 0 bl sub_81B0038 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081B9678: add sp, 0xC pop {r4,r5} diff --git a/asm/rom_81BAD84.s b/asm/rom_81BAD84.s index ae0a7cbe4..d32d573d0 100644 --- a/asm/rom_81BAD84.s +++ b/asm/rom_81BAD84.s @@ -740,7 +740,7 @@ _081BB3D0: ldr r1, =sub_81BB284 str r1, [r0] mov r0, r9 - bl remove_task + bl DestroyTask b _081BB3FE .pool _081BB3F8: @@ -983,7 +983,7 @@ _081BB5F4: ldr r1, =sub_81BB284 str r1, [r0] mov r0, r8 - bl remove_task + bl DestroyTask _081BB610: add sp, 0x8 pop {r3-r5} @@ -1146,7 +1146,7 @@ sub_81BB740: @ 81BB740 ldr r1, =sub_81BB284 str r1, [r0] adds r0, r5, 0 - bl remove_task + bl DestroyTask pop {r4,r5} pop {r0} bx r0 @@ -1467,7 +1467,7 @@ sub_81BB9F4: @ 81BB9F4 bl FreeObjectPaletteByTag ldr r0, =c3_0802FDF4 movs r1, 0xA - bl AddTask + bl CreateTask ldr r0, =0x0202406e mov r8, r0 ldrb r1, [r7] @@ -5338,7 +5338,7 @@ _081BDD38: orrs r4, r0 ldr r0, =sub_81BB29C movs r1, 0xA - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -5917,7 +5917,7 @@ _081BE21A: strb r0, [r1, 0x5] ldr r0, =sub_81BE2C8 movs r1, 0x5 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r4, =0x03005e00 @@ -6074,7 +6074,7 @@ _081BE398: mov r3, r9 strb r3, [r2] mov r0, r8 - bl remove_task + bl DestroyTask _081BE3B0: pop {r3,r4} mov r8, r3 @@ -6477,7 +6477,7 @@ _081BE6CC: bl sub_8151CA8 ldr r0, =sub_81BE698 movs r1, 0xFF - bl AddTask + bl CreateTask ldr r1, [r4] strb r0, [r1] _081BE718: @@ -6508,13 +6508,13 @@ sub_81BE72C: @ 81BE72C cmp r0, 0 beq _081BE788 ldr r0, =sub_81BE698 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 beq _081BE766 ldr r0, [r4] ldrb r0, [r0] - bl remove_task + bl DestroyTask _081BE766: ldr r0, [r4] adds r0, 0x4 @@ -6586,7 +6586,7 @@ sub_81BE7F4: @ 81BE7F4 push {lr} ldr r0, =sub_81BE808 movs r1, 0x8 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -6650,7 +6650,7 @@ sub_81BE808: @ 81BE808 cmp r2, r1 blt _081BE882 adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _081BE882: add sp, 0x4 @@ -6680,7 +6680,7 @@ sp136_strengh_sound: @ 81BE89C lsrs r6, 24 ldr r0, =sub_81BE900 movs r1, 0x9 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -6748,7 +6748,7 @@ sub_81BE900: @ 81BE900 bne _081BE95C bl sub_81BE968 adds r0, r5, 0 - bl remove_task + bl DestroyTask bl InstallCameraPanAheadCallback _081BE95C: pop {r4,r5} @@ -6761,7 +6761,7 @@ _081BE95C: sub_81BE968: @ 81BE968 push {lr} ldr r0, =sub_81BE9C0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -6788,7 +6788,7 @@ sub_81BE994: @ 81BE994 bl sub_81BEA20 ldr r0, =sub_81BE9C0 movs r1, 0x8 - bl AddTask + bl CreateTask movs r0, 0x2 movs r1, 0x1 movs r2, 0x10 @@ -6843,7 +6843,7 @@ sub_81BEA00: @ 81BEA00 lsls r0, 4 bl FreeObjectTilesByTag adds r0, r4, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running pop {r4} pop {r0} @@ -7010,7 +7010,7 @@ sub_81BEB54: @ 81BEB54 push {lr} ldr r0, =sub_81BED50 movs r1, 0x9 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -7021,7 +7021,7 @@ sub_81BEB68: @ 81BEB68 push {lr} ldr r0, =sub_81BEBF4 movs r1, 0x9 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -7032,7 +7032,7 @@ sub_81BEB7C: @ 81BEB7C push {lr} ldr r0, =sub_81BF028 movs r1, 0x9 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -7221,9 +7221,9 @@ _081BED1C: strh r2, [r0, 0x2] ldr r0, =sub_81BEBB4 movs r1, 0xA - bl AddTask + bl CreateTask adds r0, r5, 0 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _081BED40: add sp, 0xC @@ -7489,12 +7489,12 @@ _081BEF64: movs r0, 0 bl UnsetBgTilemapBuffer ldr r0, =sub_81BEBB4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF beq _081BEF7C - bl remove_task + bl DestroyTask _081BEF7C: ldr r0, =0x0203cf14 ldr r1, [r0] @@ -7543,7 +7543,7 @@ _081BEFF0: b _081BF002 _081BEFF8: mov r0, r10 - bl remove_task + bl DestroyTask bl script_env_2_enable_and_set_ctx_running _081BF002: ldr r0, =0x03005e00 @@ -7980,7 +7980,7 @@ sub_81BF384: @ 81BF384 movs r0, 0 bl SetVBlankCallback bl ResetAllObjectData - bl clear_tasks + bl ResetTasks bl remove_some_task movs r0, 0 movs r1, 0 @@ -8758,7 +8758,7 @@ sub_81BFA80: @ 81BFA80 thumb_func_start sub_81BFAB4 sub_81BFAB4: @ 81BFAB4 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -9053,13 +9053,13 @@ _081BFD7A: beq _081BFDA0 ldr r0, =sub_81C0510 movs r1, 0 - bl AddTask + bl CreateTask b _081BFDE6 .pool _081BFDA0: ldr r0, =sub_81C171C movs r1, 0 - bl AddTask + bl CreateTask b _081BFDE6 .pool _081BFDB0: @@ -9841,7 +9841,7 @@ sub_81C0484: @ 81C0484 _081C04E2: bl sub_81C0434 adds r0, r5, 0 - bl remove_task + bl DestroyTask _081C04EC: pop {r4,r5} pop {r0} @@ -10263,7 +10263,7 @@ _081C08BC: cmp r0, 0 bne _081C08F2 ldr r0, =sub_81C20F0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0 @@ -10571,7 +10571,7 @@ _081C0AF4: adds r0, r7, r0 ldr r2, [r0] adds r0, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc b _081C0B5C .pool _081C0B4C: @@ -10581,7 +10581,7 @@ _081C0B4C: adds r0, r7, r0 ldr r2, [r0] ldr r0, [sp] - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc _081C0B5C: ldr r0, =0x0203cf1c ldr r0, [r0] @@ -10727,7 +10727,7 @@ sub_81C0C68: @ 81C0C68 bl sub_81C4280 bl sub_81C0E24 adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc pop {r4,r5} pop {r0} bx r0 @@ -10877,7 +10877,7 @@ _081C0DD0: bl sub_81C4280 bl sub_81C0E24 adds r0, r5, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc pop {r4-r7} pop {r0} bx r0 @@ -12168,7 +12168,7 @@ sub_81C1940: @ 81C1940 mov r4, r8 add r4, r9 ldr r0, =sub_81C1E20 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -12708,14 +12708,14 @@ _081C1DC6: _081C1DE8: ldr r5, =sub_81C1E20 adds r0, r5, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF bne _081C1E04 adds r0, r5, 0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 _081C1E04: @@ -12819,7 +12819,7 @@ _081C1ED4: movs r0, 0 bl schedule_bg_copy_tilemap_to_vram adds r0, r6, 0 - bl remove_task + bl DestroyTask _081C1EE0: movs r0, 0x1 bl schedule_bg_copy_tilemap_to_vram @@ -12868,14 +12868,14 @@ _081C1F22: _081C1F44: ldr r5, =sub_81C1F80 adds r0, r5, 0 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF bne _081C1F60 adds r0, r5, 0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r2, r0, 24 _081C1F60: @@ -12953,7 +12953,7 @@ _081C1FE0: cmp r0, 0x3 bne _081C2006 ldr r0, =sub_81C0B8C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 cmp r0, 0 bne _081C2006 @@ -12988,7 +12988,7 @@ _081C204C: movs r0, 0 bl schedule_bg_copy_tilemap_to_vram adds r0, r6, 0 - bl remove_task + bl DestroyTask _081C2058: movs r0, 0x1 bl schedule_bg_copy_tilemap_to_vram @@ -13041,7 +13041,7 @@ _081C2096: _081C20C8: ldr r0, =sub_81C20F0 movs r1, 0x8 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -13124,7 +13124,7 @@ _081C2162: bl schedule_bg_copy_tilemap_to_vram _081C217A: adds r0, r6, 0 - bl remove_task + bl DestroyTask _081C2180: pop {r4-r7} pop {r0} @@ -14559,7 +14559,7 @@ sub_81C2DE4: @ 81C2DE4 adds r0, r1 ldr r0, [r0] movs r1, 0x10 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -14643,7 +14643,7 @@ _081C2EAA: b _081C2EB8 _081C2EB0: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _081C2EBE _081C2EB8: ldrh r0, [r4] @@ -15460,7 +15460,7 @@ _081C35C8: b _081C35D6 _081C35CE: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _081C35DC _081C35D6: ldrh r0, [r4] @@ -16018,7 +16018,7 @@ _081C3ABE: .pool _081C3AF4: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _081C3B02 _081C3AFC: ldrh r0, [r4] @@ -16367,7 +16367,7 @@ _081C3DDC: .pool _081C3E18: adds r0, r2, 0 - bl remove_task + bl DestroyTask b _081C3E26 _081C3E20: ldrh r0, [r4] @@ -17626,7 +17626,7 @@ sub_81C4898: @ 81C4898 ldrb r0, [r4] cmp r0, 0xFF beq _081C48AA - bl remove_task + bl DestroyTask movs r0, 0xFF strb r0, [r4] _081C48AA: @@ -18426,7 +18426,7 @@ sub_81C4F24: @ 81C4F24 bl fade_screen ldr r0, =sub_81C4F44 movs r1, 0xA - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -18451,7 +18451,7 @@ sub_81C4F44: @ 81C4F44 movs r0, 0x3 bl sub_81C4F98 adds r0, r4, 0 - bl remove_task + bl DestroyTask _081C4F6E: pop {r4} pop {r0} @@ -18527,7 +18527,7 @@ _081C4FBA: thumb_func_start sub_81C501C sub_81C501C: @ 81C501C push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -18634,7 +18634,7 @@ _081C5112: lsls r0, 24 cmp r0, 0 bne _081C51A2 - bl clear_tasks + bl ResetTasks b _081C51A2 _081C5122: bl sub_81C51DC @@ -19284,7 +19284,7 @@ sub_81C56F8: @ 81C56F8 push {r4,lr} ldr r0, =sub_81C5BC8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -19866,7 +19866,7 @@ _081C5B9E: ldr r0, [r0] bl Free adds r0, r5, 0 - bl remove_task + bl DestroyTask _081C5BBC: pop {r4,r5} pop {r0} @@ -22234,13 +22234,13 @@ _081C7090: _081C7092: lsls r1, r4, 24 lsrs r1, 24 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r4, r0, 24 adds r0, r4, 0 movs r1, 0x1 adds r2, r5, 0 - bl set_word_task_arg + bl SetWordTaskArg ldr r1, =0x03005e00 lsls r0, r4, 2 adds r0, r4 @@ -22318,7 +22318,7 @@ _081C7140: lsls r0, r5, 24 lsrs r0, 24 movs r1, 0x1 - bl get_word_task_arg + bl GetWordTaskArg cmp r0, r6 bne _081C7160 movs r0, 0x1 @@ -22343,7 +22343,7 @@ sub_81C7170: @ 81C7170 lsrs r5, r0, 24 adds r0, r5, 0 movs r1, 0x1 - bl get_word_task_arg + bl GetWordTaskArg adds r6, r0, 0 lsls r0, r5, 2 adds r0, r5 @@ -22381,7 +22381,7 @@ _081C71C6: b _081C71DE _081C71CE: adds r0, r5, 0 - bl remove_task + bl DestroyTask b _081C71DE _081C71D6: subs r0, 0x5 @@ -22406,7 +22406,7 @@ sub_81C71E4: @ 81C71E4 bne _081C724A adds r0, r5, 0 movs r1, 0x1 - bl get_word_task_arg + bl GetWordTaskArg adds r2, r0, 0 lsls r0, r5, 2 adds r0, r5 @@ -22437,7 +22437,7 @@ _081C7238: b _081C7248 _081C723E: adds r0, r5, 0 - bl remove_task + bl DestroyTask b _081C724A _081C7246: subs r0, 0x5 @@ -22464,12 +22464,12 @@ CB2_PokeNav: @ 81C7250 .pool _081C7270: bl sub_81C7360 - bl clear_tasks + bl ResetTasks movs r0, 0 bl SetVBlankCallback ldr r0, =sub_81C742C movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_81C7400 bl SetMainCallback2 ldr r0, =sub_81C7418 @@ -22519,14 +22519,14 @@ _081C72F0: ldr r1, [r4] movs r0, 0x1 strh r0, [r1, 0x8] - bl clear_tasks + bl ResetTasks bl ResetAllObjectData bl ResetObjectPaletteAllocator movs r0, 0 bl SetVBlankCallback ldr r0, =sub_81C742C movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_81C7400 bl SetMainCallback2 ldr r0, =sub_81C7418 @@ -22651,7 +22651,7 @@ _081C73FA: thumb_func_start sub_81C7400 sub_81C7400: @ 81C7400 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl fade_and_return_progress_probably @@ -28859,7 +28859,7 @@ _081CA3C8: bl SetGpuReg ldr r0, =sub_81CA580 movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -29139,7 +29139,7 @@ _081CA5F6: movs r0, 0x52 bl SetGpuReg adds r0, r5, 0 - bl remove_task + bl DestroyTask b _081CA638 _081CA634: subs r0, 0x1 @@ -29353,7 +29353,7 @@ sub_81CA7D4: @ 81CA7D4 adds r4, r0, 0 ldr r0, =sub_81CA808 movs r1, 0x2 - bl AddTask + bl CreateTask strb r0, [r4, 0xA] pop {r4} pop {r0} @@ -29367,7 +29367,7 @@ sub_81CA7F4: @ 81CA7F4 movs r0, 0x2 bl sub_81C763C ldrb r0, [r0, 0xA] - bl remove_task + bl DestroyTask pop {r0} bx r0 thumb_func_end sub_81CA7F4 @@ -29388,7 +29388,7 @@ sub_81CA818: @ 81CA818 push {r4,r5,lr} ldr r0, =sub_81CA8B0 movs r1, 0x3 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -29396,12 +29396,12 @@ sub_81CA818: @ 81CA818 adds r0, r4, 0 movs r1, 0x1 adds r2, r5, 0 - bl set_word_task_arg + bl SetWordTaskArg adds r5, 0xC adds r0, r4, 0 movs r1, 0x3 adds r2, r5, 0 - bl set_word_task_arg + bl SetWordTaskArg pop {r4,r5} pop {r0} bx r0 @@ -29425,7 +29425,7 @@ sub_81CA864: @ 81CA864 push {r4,r5,lr} ldr r0, =sub_81CA8B0 movs r1, 0x3 - bl AddTask + bl CreateTask adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 @@ -29433,12 +29433,12 @@ sub_81CA864: @ 81CA864 adds r0, r4, 0 movs r1, 0x1 adds r2, r5, 0 - bl set_word_task_arg + bl SetWordTaskArg subs r5, 0xC adds r0, r4, 0 movs r1, 0x3 adds r2, r5, 0 - bl set_word_task_arg + bl SetWordTaskArg pop {r4,r5} pop {r0} bx r0 @@ -29449,7 +29449,7 @@ sub_81CA864: @ 81CA864 sub_81CA89C: @ 81CA89C push {lr} ldr r0, =sub_81CA8B0 - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -29470,11 +29470,11 @@ sub_81CA8B0: @ 81CA8B0 adds r4, r0 adds r0, r6, 0 movs r1, 0x1 - bl get_word_task_arg + bl GetWordTaskArg adds r5, r0, 0 adds r0, r6, 0 movs r1, 0x3 - bl get_word_task_arg + bl GetWordTaskArg adds r1, r0, 0 ldrh r0, [r4] adds r0, 0x1 @@ -29497,7 +29497,7 @@ sub_81CA8B0: @ 81CA8B0 cmp r0, 0xC bne _081CA908 adds r0, r6, 0 - bl remove_task + bl DestroyTask _081CA908: add sp, 0xC pop {r4-r6} @@ -29550,7 +29550,7 @@ titlescreen_0: @ 81CA92C bl c3args_set_0toR1_1to0 ldr r0, =sub_81CA9EC movs r1, 0x3 - bl AddTask + bl CreateTask pop {r0} bx r0 .pool @@ -29568,10 +29568,10 @@ sub_81CA994: @ 81CA994 bl ClearGpuRegBits bl remove_some_task ldr r0, =sub_81CA9EC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask bl sub_81C760C pop {r0} bx r0 @@ -31963,7 +31963,7 @@ sub_81CBBB8: @ 81CBBB8 bl sub_81C81D4 ldr r0, =sub_81CBC64 movs r1, 0x7 - bl AddTask + bl CreateTask add sp, 0x18 pop {r0} bx r0 @@ -31975,10 +31975,10 @@ sub_81CBC1C: @ 81CBC1C push {lr} bl sub_81C8234 ldr r0, =sub_81CBC64 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask pop {r0} bx r0 .pool @@ -31989,7 +31989,7 @@ sub_81CBC38: @ 81CBC38 push {r4,lr} adds r4, r0, 0 ldr r0, =sub_81CBC64 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r2, r0, 24 cmp r2, 0xFF @@ -34019,7 +34019,7 @@ sub_81CCC5C: @ 81CCC5C adds r4, r0, 0 ldr r0, =sub_81CCC9C movs r1, 0x3 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 ldr r2, =0x03005e00 @@ -34038,7 +34038,7 @@ sub_81CCC5C: @ 81CCC5C sub_81CCC88: @ 81CCC88 push {lr} ldr r0, =sub_81CCC9C - bl is_function_an_active_task + bl FuncIsActiveTask lsls r0, 24 lsrs r0, 24 pop {r1} @@ -34073,7 +34073,7 @@ sub_81CCC9C: @ 81CCC9C movs r2, 0 bl ChangeBgY adds r0, r4, 0 - bl remove_task + bl DestroyTask _081CCCD6: bl sub_81CCF78 b _081CCD04 @@ -34091,7 +34091,7 @@ _081CCCE0: movs r2, 0 bl ChangeBgY adds r0, r5, 0 - bl remove_task + bl DestroyTask _081CCD00: bl sub_81CCF78 _081CCD04: @@ -50745,7 +50745,7 @@ sub_81D5014: @ 81D5014 push {r4,lr} ldr r0, =sub_81D5084 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 lsls r4, r0, 2 @@ -51237,7 +51237,7 @@ _081D5478: ldr r0, [r4, 0x10] bl Free adds r0, r5, 0 - bl remove_task + bl DestroyTask ldr r0, =sub_80186A4 bl SetMainCallback2 _081D548A: @@ -53539,7 +53539,7 @@ sub_81D6774: @ 81D6774 bl ResetObjectPaletteAllocator bl sub_80A1A74 bl ResetAllObjectData - bl clear_tasks + bl ResetTasks movs r0, 0 movs r1, 0xF0 movs r2, 0x20 @@ -53554,7 +53554,7 @@ sub_81D6774: @ 81D6774 adds r0, r1 ldr r0, [r0] movs r1, 0 - bl AddTask + bl CreateTask ldr r0, =sub_81D67D0 bl SetMainCallback2 pop {r0} @@ -53565,7 +53565,7 @@ sub_81D6774: @ 81D6774 thumb_func_start sub_81D67D0 sub_81D67D0: @ 81D67D0 push {lr} - bl RunActiveTasks + bl RunTasks bl CallObjectCallbacks bl PrepareSpritesForOamLoad bl do_scheduled_bg_tilemap_copies_to_vram @@ -53604,7 +53604,7 @@ sub_81D6800: @ 81D6800 ldr r0, [r4] bl Free adds r0, r5, 0 - bl remove_task + bl DestroyTask _081D6830: pop {r4,r5} pop {r0} @@ -54690,7 +54690,7 @@ task_add_00_WIN0V_open_close_above_and_more: @ 81D7134 strh r4, [r5] ldr r0, =sub_81D7228 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x2] @@ -55257,7 +55257,7 @@ sub_81D7600: @ 81D7600 cmp r4, 0 bne _081D7652 ldrb r0, [r5, 0x2] - bl remove_task + bl DestroyTask movs r0, 0x1 movs r1, 0 movs r2, 0 @@ -56386,7 +56386,7 @@ sub_81D7F4C: @ 81D7F4C bl SetVBlankCallback ldr r0, =sub_81D81A4 movs r1, 0 - bl AddTask + bl CreateTask movs r0, 0 strh r0, [r6] strh r0, [r6, 0x2] @@ -56719,7 +56719,7 @@ sub_81D81A4: @ 81D81A4 cmp r0, 0x9 bne _081D8250 adds r0, r5, 0 - bl remove_task + bl DestroyTask b _081D825A .pool _081D8250: @@ -57531,7 +57531,7 @@ sub_81D8980: @ 81D8980 strh r0, [r6, 0x2] ldr r0, =sub_81D8AD8 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x4] @@ -57828,7 +57828,7 @@ sub_81D8BEC: @ 81D8BEC bl SetVBlankCallback bl sub_81D6904 ldrb r0, [r4, 0x4] - bl remove_task + bl DestroyTask adds r0, r6, 0 subs r0, 0x8 adds r0, r5, r0 @@ -58000,7 +58000,7 @@ sub_81D8DB4: @ 81D8DB4 str r0, [r4] ldr r0, =sub_81D8FB0 movs r1, 0 - bl AddTask + bl CreateTask lsls r0, 24 lsrs r0, 24 strh r0, [r6, 0x4] @@ -58294,7 +58294,7 @@ sub_81D9034: @ 81D9034 bl ResetAllObjectData bl ResetObjectPaletteAllocator ldrb r0, [r4, 0x4] - bl remove_task + bl DestroyTask _081D9078: ldrh r1, [r4, 0x2] movs r2, 0x2 @@ -59136,7 +59136,7 @@ _081D9700: bl cry_related ldr r0, =sub_81D98B4 movs r1, 0 - bl AddTask + bl CreateTask b _081D979E .pool _081D974C: @@ -59170,7 +59170,7 @@ _081D974C: .pool _081D9790: ldr r0, =sub_81D8E80 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 bl sub_81D9274 @@ -59450,7 +59450,7 @@ _081D99A4: movs r0, 0 bl ClearGpuRegBits adds r0, r5, 0 - bl remove_task + bl DestroyTask _081D99B4: add sp, 0x10 pop {r4,r5} @@ -60121,7 +60121,7 @@ _081D9EB4: ldr r1, =sub_81DA160 ldr r2, =sub_81D9F14 adds r0, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4-r6} pop {r0} bx r0 @@ -60135,7 +60135,7 @@ sub_81D9F14: @ 81D9F14 lsrs r0, 24 ldr r1, =sub_81DA244 ldr r2, =sub_81D9F30 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -60148,7 +60148,7 @@ sub_81D9F30: @ 81D9F30 lsrs r0, 24 ldr r1, =sub_81DA2E8 ldr r2, =sub_81D9F4C - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -60161,7 +60161,7 @@ sub_81D9F4C: @ 81D9F4C lsrs r0, 24 ldr r1, =sub_81DA3B8 ldr r2, =sub_81D9F68 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r0} bx r0 .pool @@ -60352,7 +60352,7 @@ _081DA0B8: ldr r1, =sub_81DA488 ldr r2, =sub_81DA10C adds r0, r6, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc b _081DA0F6 .pool _081DA0E8: @@ -60386,7 +60386,7 @@ sub_81DA10C: @ 81DA10C ldr r1, =sub_80FCF40 ldr r2, =sub_81DA138 adds r0, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4} pop {r0} bx r0 @@ -60404,7 +60404,7 @@ sub_81DA138: @ 81DA138 ldr r1, =sub_80FCFD0 ldr r2, =sub_80F8714 adds r0, r4, 0 - bl set_task_function_and_args_14_15 + bl SetTaskFuncWithFollowupFunc pop {r4} pop {r0} bx r0 @@ -60440,7 +60440,7 @@ sub_81DA160: @ 81DA160 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r7, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _081DA224 .pool _081DA1A4: @@ -60538,7 +60538,7 @@ sub_81DA244: @ 81DA244 strh r0, [r5, 0x8] strh r0, [r5, 0x20] adds r0, r4, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _081DA2D4 .pool _081DA284: @@ -60619,7 +60619,7 @@ sub_81DA2E8: @ 81DA2E8 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _081DA39E .pool _081DA338: @@ -60722,7 +60722,7 @@ sub_81DA3B8: @ 81DA3B8 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _081DA46E .pool _081DA408: @@ -60818,7 +60818,7 @@ sub_81DA488: @ 81DA488 strh r0, [r4, 0x8] strh r0, [r4, 0x20] adds r0, r6, 0 - bl set_task_function_to_args_14_15 + bl SwitchTaskToFollowupFunc b _081DA55C .pool _081DA4CC: @@ -61809,10 +61809,10 @@ sub_81DAC80: @ 81DAC80 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DABDC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DACA4: movs r0, 0 pop {r1} @@ -61916,10 +61916,10 @@ sub_81DAD58: @ 81DAD58 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DACB4 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DAD7C: movs r0, 0 pop {r1} @@ -62032,10 +62032,10 @@ sub_81DAE44: @ 81DAE44 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DAD8C - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DAE68: movs r0, 0 pop {r1} @@ -62150,10 +62150,10 @@ sub_81DAF34: @ 81DAF34 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DAE78 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DAF58: movs r0, 0 pop {r1} @@ -62275,10 +62275,10 @@ sub_81DB02C: @ 81DB02C adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DAF68 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DB050: movs r0, 0 pop {r1} @@ -62400,10 +62400,10 @@ sub_81DB124: @ 81DB124 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DB060 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DB148: movs r0, 0 pop {r1} @@ -62529,10 +62529,10 @@ sub_81DB224: @ 81DB224 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DB158 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DB248: movs r0, 0 pop {r1} @@ -62660,10 +62660,10 @@ sub_81DB328: @ 81DB328 adds r0, r2, 0 bl sub_81DAA20 ldr r0, =sub_81DB258 - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 - bl remove_task + bl DestroyTask _081DB34C: movs r0, 0 pop {r1} diff --git a/asm/task.s b/asm/task.s deleted file mode 100644 index 1d5d4d1db..000000000 --- a/asm/task.s +++ /dev/null @@ -1,528 +0,0 @@ - .include "asm/macros.s" - - .syntax unified - - .text - - thumb_func_start clear_tasks -@ void clear_tasks() -clear_tasks: @ 80A8F50 - push {r4-r7,lr} - movs r4, 0 - ldr r6, =0x03005e00 - adds r7, r6, 0 - adds r7, 0x8 -_080A8F5A: - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r6 - movs r1, 0 - strb r1, [r2, 0x4] - ldr r1, =nullsub_4 - str r1, [r2] - strb r4, [r2, 0x5] - adds r4, 0x1 - strb r4, [r2, 0x6] - movs r1, 0x1 - negs r1, r1 - adds r5, r1, 0 - movs r1, 0xFF - strb r1, [r2, 0x7] - adds r0, r7 - movs r1, 0 - movs r2, 0x20 - bl memset - lsls r4, 24 - lsrs r4, 24 - cmp r4, 0xF - bls _080A8F5A - ldr r0, =0x03005e00 - movs r1, 0xFE - strb r1, [r0, 0x5] - ldr r1, =0x0000025e - adds r0, r1 - ldrb r1, [r0] - orrs r1, r5 - strb r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end clear_tasks - - thumb_func_start AddTask -@ int AddTask(void ( *func)(int task_id), u8 priority) -AddTask: @ 80A8FB0 - push {r4-r7,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r6, 0 - ldr r7, =0x03005e00 -_080A8FBC: - lsls r0, r6, 2 - adds r0, r6 - lsls r5, r0, 3 - adds r4, r5, r7 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _080A8FF0 - str r2, [r4] - strb r1, [r4, 0x7] - adds r0, r6, 0 - bl insert_task_in_order_by_priority - adds r0, r7, 0 - adds r0, 0x8 - adds r0, r5, r0 - movs r1, 0 - movs r2, 0x20 - bl memset - movs r0, 0x1 - strb r0, [r4, 0x4] - adds r0, r6, 0 - b _080A8FFC - .pool -_080A8FF0: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0xF - bls _080A8FBC - movs r0, 0 -_080A8FFC: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end AddTask - - thumb_func_start insert_task_in_order_by_priority -@ void insert_task_in_order_by_priority(int task_id) -insert_task_in_order_by_priority: @ 80A9004 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - bl get_first_active_task - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x10 - bne _080A9034 - ldr r1, =0x03005e00 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0xFE - strb r1, [r0, 0x5] - movs r1, 0xFF - strb r1, [r0, 0x6] - b _080A9090 - .pool -_080A9034: - ldr r6, =0x03005e00 - lsls r0, r4, 2 - mov r12, r0 - mov r8, r6 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r6 -_080A9042: - lsls r0, r1, 2 - adds r0, r1 - lsls r5, r0, 3 - mov r7, r8 - adds r3, r5, r7 - ldrb r0, [r2, 0x7] - ldrb r7, [r3, 0x7] - cmp r0, r7 - bcs _080A9074 - ldrb r0, [r3, 0x5] - strb r0, [r2, 0x5] - strb r1, [r2, 0x6] - ldrb r0, [r3, 0x5] - cmp r0, 0xFE - beq _080A906C - adds r1, r0, 0 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - add r0, r8 - strb r4, [r0, 0x6] -_080A906C: - strb r4, [r3, 0x5] - b _080A9090 - .pool -_080A9074: - ldrb r0, [r3, 0x6] - cmp r0, 0xFF - beq _080A907E - adds r1, r0, 0 - b _080A9042 -_080A907E: - mov r2, r12 - adds r0, r2, r4 - lsls r0, 3 - adds r0, r6 - strb r1, [r0, 0x5] - adds r2, r5, r6 - ldrb r1, [r2, 0x6] - strb r1, [r0, 0x6] - strb r4, [r2, 0x6] -_080A9090: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end insert_task_in_order_by_priority - - thumb_func_start remove_task -@ void remove_task(int task_id) -remove_task: @ 80A909C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =0x03005e00 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r2, r1, r4 - ldrb r0, [r2, 0x4] - cmp r0, 0 - beq _080A9106 - movs r0, 0 - strb r0, [r2, 0x4] - ldrb r3, [r2, 0x5] - cmp r3, 0xFE - bne _080A90D4 - ldrb r0, [r2, 0x6] - cmp r0, 0xFF - beq _080A9106 - adds r1, r0, 0 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - strb r3, [r0, 0x5] - b _080A9106 - .pool -_080A90D4: - ldrb r3, [r2, 0x6] - adds r0, r3, 0 - cmp r0, 0xFF - bne _080A90EC - ldrb r0, [r2, 0x5] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r4 - movs r0, 0xFF - strb r0, [r1, 0x6] - b _080A9106 -_080A90EC: - ldrb r1, [r2, 0x5] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - strb r3, [r0, 0x6] - ldrb r1, [r2, 0x6] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r4 - ldrb r1, [r2, 0x5] - strb r1, [r0, 0x5] -_080A9106: - pop {r4} - pop {r0} - bx r0 - thumb_func_end remove_task - - thumb_func_start RunActiveTasks -@ void RunActiveTasks() -RunActiveTasks: @ 80A910C - push {r4,r5,lr} - bl get_first_active_task - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x10 - beq _080A9130 - ldr r5, =0x03005e00 -_080A911C: - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r5 - ldr r1, [r4] - bl _call_via_r1 - ldrb r0, [r4, 0x6] - cmp r0, 0xFF - bne _080A911C -_080A9130: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end RunActiveTasks - - thumb_func_start get_first_active_task -@ int get_first_active_task() -get_first_active_task: @ 80A913C - push {lr} - movs r2, 0 - ldr r0, =0x03005e00 - ldrb r1, [r0, 0x4] - adds r3, r0, 0 - cmp r1, 0x1 - bne _080A9150 - ldrb r0, [r3, 0x5] - cmp r0, 0xFE - beq _080A916E -_080A9150: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bhi _080A916E - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r3 - ldrb r0, [r1, 0x4] - cmp r0, 0x1 - bne _080A9150 - ldrb r0, [r1, 0x5] - cmp r0, 0xFE - bne _080A9150 -_080A916E: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end get_first_active_task - - thumb_func_start nullsub_4 -nullsub_4: @ 80A9178 - bx lr - thumb_func_end nullsub_4 - - thumb_func_start set_task_function_and_args_14_15 -set_task_function_and_args_14_15: @ 80A917C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =0x03005e00 - lsls r3, r0, 2 - adds r3, r0 - lsls r3, 3 - adds r0, r3, 0 - adds r0, 0x1C - adds r4, r5, 0 - adds r4, 0x8 - adds r0, r4 - strh r2, [r0] - adds r0, r3, 0 - adds r0, 0x1E - adds r0, r4 - lsrs r2, 16 - strh r2, [r0] - adds r3, r5 - str r1, [r3] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end set_task_function_and_args_14_15 - - thumb_func_start set_task_function_to_args_14_15 -set_task_function_to_args_14_15: @ 80A91B0 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0x03005e00 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r3 - adds r0, r1, 0 - adds r0, 0x1C - adds r3, 0x8 - adds r0, r3 - ldrh r2, [r0] - adds r1, 0x1E - adds r1, r3 - movs r3, 0 - ldrsh r0, [r1, r3] - lsls r0, 16 - orrs r2, r0 - str r2, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end set_task_function_to_args_14_15 - - thumb_func_start is_function_an_active_task -@ int is_function_an_active_task(void ( *func)(int task_id)) -is_function_an_active_task: @ 80A91E4 - push {r4,lr} - adds r3, r0, 0 - movs r2, 0 - ldr r4, =0x03005e00 -_080A91EC: - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0, r4 - ldrb r0, [r1, 0x4] - cmp r0, 0x1 - bne _080A9208 - ldr r0, [r1] - cmp r0, r3 - bne _080A9208 - movs r0, 0x1 - b _080A9214 - .pool -_080A9208: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bls _080A91EC - movs r0, 0 -_080A9214: - pop {r4} - pop {r1} - bx r1 - thumb_func_end is_function_an_active_task - - thumb_func_start get_task_id_by_function -@ int get_task_id_by_function(void ( *func)(int task_id)) -get_task_id_by_function: @ 80A921C - push {lr} - adds r3, r0, 0 - movs r2, 0 - ldr r1, =0x03005e00 -_080A9224: - ldrb r0, [r1, 0x4] - cmp r0, 0x1 - bne _080A923C - ldr r0, [r1] - cmp r0, r3 - bne _080A923C - lsls r0, r2, 24 - lsrs r0, 24 - b _080A9246 - .pool -_080A923C: - adds r1, 0x28 - adds r2, 0x1 - cmp r2, 0xF - ble _080A9224 - movs r0, 0xFF -_080A9246: - pop {r1} - bx r1 - thumb_func_end get_task_id_by_function - - thumb_func_start sub_80A924C -sub_80A924C: @ 80A924C - push {lr} - movs r2, 0 - movs r1, 0 - ldr r3, =0x03005e00 -_080A9254: - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r3 - ldrb r0, [r0, 0x4] - cmp r0, 0x1 - bne _080A9268 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080A9268: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bls _080A9254 - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80A924C - - thumb_func_start set_word_task_arg -set_word_task_arg: @ 80A927C - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - cmp r3, 0xE - bhi _080A92AA - ldr r2, =0x03005e00 - lsls r0, r3, 1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r0, r1 - adds r2, 0x8 - adds r0, r2 - strh r5, [r0] - adds r0, r3, 0x1 - lsls r0, 1 - adds r0, r1 - adds r0, r2 - lsrs r1, r5, 16 - strh r1, [r0] -_080A92AA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end set_word_task_arg - - thumb_func_start get_word_task_arg -get_word_task_arg: @ 80A92B4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0xE - bls _080A92C6 - movs r0, 0 - b _080A92E8 -_080A92C6: - ldr r3, =0x03005e00 - lsls r0, r1, 1 - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - adds r0, r2 - adds r3, 0x8 - adds r0, r3 - ldrh r0, [r0] - adds r1, 0x1 - lsls r1, 1 - adds r1, r2 - adds r1, r3 - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r1, 16 - orrs r0, r1 -_080A92E8: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end get_word_task_arg - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/tileset_animation.s b/asm/tileset_animation.s index 3e6dbfc9a..404685366 100644 --- a/asm/tileset_animation.s +++ b/asm/tileset_animation.s @@ -1814,7 +1814,7 @@ sub_80A1818: @ 80A1818 movs r1, 0x10 bl pal_fade_1 ldr r0, =sub_8149DFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF @@ -1846,7 +1846,7 @@ sub_80A1884: @ 80A1884 movs r2, 0x10 bl CpuSet ldr r0, =sub_8149DFC - bl get_task_id_by_function + bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 cmp r0, 0xFF diff --git a/data/cry_id_table.s b/data/cry_id_table.s new file mode 100644 index 000000000..ece08de06 --- /dev/null +++ b/data/cry_id_table.s @@ -0,0 +1,137 @@ + .align 1 +gSpeciesIdToCryId:: @ 831F61C + .2byte 273 @ TREECKO + .2byte 274 @ GROVYLE + .2byte 275 @ SCEPTILE + .2byte 270 @ TORCHIC + .2byte 271 @ COMBUSKEN + .2byte 272 @ BLAZIKEN + .2byte 276 @ MUDKIP + .2byte 277 @ MARSHTOMP + .2byte 278 @ SWAMPERT + .2byte 359 @ POOCHYENA + .2byte 360 @ MIGHTYENA + .2byte 378 @ ZIGZAGOON + .2byte 375 @ LINOONE + .2byte 290 @ WURMPLE + .2byte 291 @ SILCOON + .2byte 292 @ BEAUTIFLY + .2byte 293 @ CASCOON + .2byte 294 @ DUSTOX + .2byte 283 @ LOTAD + .2byte 284 @ LOMBRE + .2byte 285 @ LUDICOLO + .2byte 286 @ SEEDOT + .2byte 287 @ NUZLEAF + .2byte 288 @ SHIFTRY + .2byte 301 @ NINCADA + .2byte 302 @ NINJASK + .2byte 303 @ SHEDINJA + .2byte 266 @ TAILLOW + .2byte 267 @ SWELLOW + .2byte 374 @ SHROOMISH + .2byte 373 @ BRELOOM + .2byte 269 @ SPINDA + .2byte 280 @ WINGULL + .2byte 279 @ PELIPPER + .2byte 310 @ SURSKIT + .2byte 311 @ MASQUERAIN + .2byte 377 @ WAILMER + .2byte 381 @ WAILORD + .2byte 312 @ SKITTY + .2byte 313 @ DELCATTY + .2byte 251 @ KECLEON + .2byte 329 @ BALTOY + .2byte 330 @ CLAYDOL + .2byte 306 @ NOSEPASS + .2byte 253 @ TORKOAL + .2byte 362 @ SABLEYE + .2byte 318 @ BARBOACH + .2byte 319 @ WHISCASH + .2byte 368 @ LUVDISC + .2byte 320 @ CORPHISH + .2byte 321 @ CRAWDAUNT + .2byte 333 @ FEEBAS + .2byte 334 @ MILOTIC + .2byte 289 @ CARVANHA + .2byte 260 @ SHARPEDO + .2byte 324 @ TRAPINCH + .2byte 325 @ VIBRAVA + .2byte 326 @ FLYGON + .2byte 304 @ MAKUHITA + .2byte 305 @ HARIYAMA + .2byte 254 @ ELECTRIKE + .2byte 255 @ MANECTRIC + .2byte 316 @ NUMEL + .2byte 317 @ CAMERUPT + .2byte 338 @ SPHEAL + .2byte 339 @ SEALEO + .2byte 340 @ WALREIN + .2byte 327 @ CACNEA + .2byte 328 @ CACTURNE + .2byte 383 @ SNORUNT + .2byte 307 @ GLALIE + .2byte 331 @ LUNATONE + .2byte 332 @ SOLROCK + .2byte 262 @ AZURILL + .2byte 322 @ SPOINK + .2byte 323 @ GRUMPIG + .2byte 308 @ PLUSLE + .2byte 309 @ MINUN + .2byte 363 @ MAWILE + .2byte 336 @ MEDITITE + .2byte 337 @ MEDICHAM + .2byte 263 @ SWABLU + .2byte 264 @ ALTARIA + .2byte 258 @ WYNAUT + .2byte 256 @ DUSKULL + .2byte 361 @ DUSCLOPS + .2byte 252 @ ROSELIA + .2byte 298 @ SLAKOTH + .2byte 299 @ VIGOROTH + .2byte 300 @ SLAKING + .2byte 314 @ GULPIN + .2byte 315 @ SWALOT + .2byte 376 @ TROPIUS + .2byte 382 @ WHISMUR + .2byte 380 @ LOUDRED + .2byte 379 @ EXPLOUD + .2byte 341 @ CLAMPERL + .2byte 342 @ HUNTAIL + .2byte 343 @ GOREBYSS + .2byte 335 @ ABSOL + .2byte 282 @ SHUPPET + .2byte 281 @ BANETTE + .2byte 259 @ SEVIPER + .2byte 261 @ ZANGOOSE + .2byte 367 @ RELICANTH + .2byte 364 @ ARON + .2byte 365 @ LAIRON + .2byte 366 @ AGGRON + .2byte 356 @ CASTFORM + .2byte 357 @ VOLBEAT + .2byte 358 @ ILLUMISE + .2byte 344 @ LILEEP + .2byte 345 @ CRADILY + .2byte 346 @ ANORITH + .2byte 347 @ ARMALDO + .2byte 295 @ RALTS + .2byte 296 @ KIRLIA + .2byte 297 @ GARDEVOIR + .2byte 351 @ BAGON + .2byte 352 @ SHELGON + .2byte 372 @ SALAMENCE + .2byte 348 @ BELDUM + .2byte 349 @ METANG + .2byte 350 @ METAGROSS + .2byte 353 @ REGIROCK + .2byte 354 @ REGICE + .2byte 355 @ REGISTEEL + .2byte 370 @ KYOGRE + .2byte 369 @ GROUDON + .2byte 371 @ RAYQUAZA + .2byte 257 @ LATIAS + .2byte 384 @ LATIOS + .2byte 385 @ JIRACHI + .2byte 386 @ DEOXYS + .2byte 387 @ CHIMECHO diff --git a/data/data2.s b/data/data2.s index 3541b35de..8f9853f62 100644 --- a/data/data2.s +++ b/data/data2.s @@ -1645,8 +1645,8 @@ gUnknown_0831C7B4:: @ 831C7B4 @ 831F5CA .include "data/trainer_class_name_indices.s" -gUnknown_0831F61C:: @ 831F61C - .incbin "baserom.gba", 0x31f61c, 0x110 +@ 831F61C + .include "data/cry_id_table.s" @ 831F72C .include "data/experience_tables.s" diff --git a/data/graphics.s b/data/graphics.s index 9f7af036e..e71f55906 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -716,14 +716,23 @@ gUnknown_08DC3A0C:: @ 8DC3A0C gUnknown_08DC3CD4:: @ 8DC3CD4 .incbin "baserom.gba", 0xdc3cd4, 0x80 -gUnknown_08DC3D54:: @ 8DC3D54 - .incbin "baserom.gba", 0xdc3d54, 0x20 +gIntroCopyright_Pal:: @ 8DC3D54 + .incbin "graphics/intro/copyright.gbapal" -gUnknown_08DC3D74:: @ 8DC3D74 - .incbin "baserom.gba", 0xdc3d74, 0x260 + .align 2 -gUnknown_08DC3FD4:: @ 8DC3FD4 - .incbin "baserom.gba", 0xdc3fd4, 0x16c +gIntroCopyright_Gfx:: @ 8DC3D74 + .incbin "graphics/intro/copyright.4bpp.lz" + + .align 2 + +gIntroCopyright_Tilemap:: @ 8DC3FD4 + .incbin "graphics/intro/copyright.bin.lz" + + .align 2 + +gUnknown_08DC4120:: @ 8DC4120 + .incbin "baserom.gba", 0xdc4120, 0x20 gUnknown_08DC4140:: @ 8DC4140 .incbin "baserom.gba", 0xdc4140, 0x1d8 diff --git a/graphics/intro/copyright.bin b/graphics/intro/copyright.bin new file mode 100644 index 0000000000000000000000000000000000000000..2e48c59b40b87ff480dc9612ead5b8527322c042 GIT binary patch literal 2048 zcmeH{#}0!q5JaB|B%y^QK>h0F-H{xyg3Tm6t)Q}Fh$)XT+gu!OTxiTKKKM6exh2~ zf+Hw{=?c#rDN6yTsC%$Q76~|OpywerL2TE3Qz~NcB(8ajAE4(n!l~Bt9o$52nadOW zBF7Ft?eM+e5zbchG_wtsgx`CP?GY%gc1JX2)ZO5lVE6o&X82be-bJ1|3okLgpW#}>I@BKES~SY`!o_8i|Kb8Z&40?AAajojv+{@OUFv(isaqamU$WvF zD+##hG%Funiax?ovPFz + +#define TRUE 1 +#define FALSE 0 + +#define IWRAM_DATA __attribute__((section("iwram_data"))) +#define EWRAM_DATA __attribute__((section("ewram_data"))) + +#define ALIGNED(n) __attribute__((aligned(n))) + +#define SOUND_INFO_PTR (*(struct SoundInfo **)0x3007FF0) +#define INTR_CHECK (*(u16 *)0x3007FF8) +#define INTR_VECTOR (*(void **)0x3007FFC) + +#define PLTT 0x5000000 +#define PLTT_SIZE 0x400 + +#define BG_PLTT PLTT +#define BG_PLTT_SIZE 0x200 + +#define OBJ_PLTT (PLTT + 0x200) +#define OBJ_PLTT_SIZE 0x200 + +#define VRAM 0x6000000 +#define VRAM_SIZE 0x18000 + +#define BG_VRAM VRAM +#define BG_VRAM_SIZE 0x10000 +#define BG_CHAR_ADDR(n) (BG_VRAM + (0x4000 * (n))) +#define BG_SCREEN_ADDR(n) (BG_VRAM + (0x800 * (n))) + +// text-mode BG +#define OBJ_VRAM0 (VRAM + 0x10000) +#define OBJ_VRAM0_SIZE 0x8000 + +// bitmap-mode BG +#define OBJ_VRAM1 (VRAM + 0x14000) +#define OBJ_VRAM1_SIZE 0x4000 + +#define OAM 0x7000000 +#define OAM_SIZE 0x400 + +#define DISPLAY_WIDTH 240 +#define DISPLAY_HEIGHT 160 + +#define TILE_SIZE_4BPP 32 +#define TILE_SIZE_8BPP 64 + +#define TOTAL_OBJ_TILE_COUNT 1024 + +#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) + +#define RGB_BLACK RGB(0, 0, 0) +#define RGB_WHITE RGB(31, 31, 31) + +#define WIN_RANGE(a, b) (((a) << 8) | (b)) + +#endif // GUARD_GBA_DEFINES diff --git a/include/gba/flash_internal.h b/include/gba/flash_internal.h new file mode 100644 index 000000000..6156b6c14 --- /dev/null +++ b/include/gba/flash_internal.h @@ -0,0 +1,76 @@ +#ifndef GUARD_GBA_FLASH_INTERNAL_H +#define GUARD_GBA_FLASH_INTERNAL_H + +#define FLASH_BASE ((u8 *)0xE000000) + +#define FLASH_WRITE(addr, data) ((*(vu8 *)(FLASH_BASE + (addr))) = (data)) + +#define FLASH_ROM_SIZE_1M 131072 // 1 megabit ROM + +#define SECTORS_PER_BANK 16 + +struct FlashSector +{ + u32 size; + u8 shift; + u16 count; + u16 top; +}; + +struct FlashType { + u32 romSize; + struct FlashSector sector; + u16 wait[2]; // game pak bus read/write wait + + // TODO: add support for anonymous unions/structs if possible + union { + struct { + u8 makerId; + u8 deviceId; + } separate; + u16 joined; + } ids; +}; + +struct FlashSetupInfo +{ + u16 (*programFlashByte)(u16, u32, u8); + u16 (*programFlashSector)(u16, u8 *); + u16 (*eraseFlashChip)(void); + u16 (*eraseFlashSector)(u16); + u16 (*WaitForFlashWrite)(u8, u8 *, u8); + const u16 *maxTime; + struct FlashType type; +}; + +extern u16 gFlashNumRemainingBytes; + +extern u16 (*ProgramFlashByte)(u16, u32, u8); +extern u16 (*ProgramFlashSector)(u16, u8 *); +extern u16 (*EraseFlashChip)(void); +extern u16 (*EraseFlashSector)(u16); +extern u16 (*WaitForFlashWrite)(u8, u8 *, u8); +extern const u16 *gFlashMaxTime; +extern const struct FlashType *gFlash; + +extern u8 (*PollFlashStatus)(u8 *); +extern u8 gFlashTimeoutFlag; + +extern const struct FlashSetupInfo MX29L010; +extern const struct FlashSetupInfo LE26FV10N1TS; +extern const struct FlashSetupInfo DefaultFlash; + +void SwitchFlashBank(u8 bankNum); +u16 ReadFlashId(void); +void StartFlashTimer(u8 phase); +void SetReadFlash1(u16 *dest); +void StopFlashTimer(void); + +u16 WaitForFlashWrite_Common(u8 phase, u8 *addr, u8 lastData); + +u16 EraseFlashChip_MX(void); +u16 EraseFlashSector_MX(u16 sectorNum); +u16 ProgramFlashByte_MX(u16 sectorNum, u32 offset, u8 data); +u16 ProgramFlashSector_MX(u16 sectorNum, u8 *src); + +#endif // GUARD_GBA_FLASH_INTERNAL_H diff --git a/include/gba/gba.h b/include/gba/gba.h new file mode 100644 index 000000000..26342cf88 --- /dev/null +++ b/include/gba/gba.h @@ -0,0 +1,10 @@ +#ifndef GUARD_GBA_GBA_H +#define GUARD_GBA_GBA_H + +#include "gba/defines.h" +#include "gba/io_reg.h" +#include "gba/types.h" +#include "gba/syscall.h" +#include "gba/macro.h" + +#endif // GUARD_GBA_GBA_H diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 1ef639793..0be92fa60 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -24,16 +24,20 @@ #define REG_OFFSET_BG2PB 0x22 #define REG_OFFSET_BG2PC 0x24 #define REG_OFFSET_BG2PD 0x26 +#define REG_OFFSET_BG2X 0x28 #define REG_OFFSET_BG2X_L 0x28 #define REG_OFFSET_BG2X_H 0x2a +#define REG_OFFSET_BG2Y 0x2c #define REG_OFFSET_BG2Y_L 0x2c #define REG_OFFSET_BG2Y_H 0x2e #define REG_OFFSET_BG3PA 0x30 #define REG_OFFSET_BG3PB 0x32 #define REG_OFFSET_BG3PC 0x34 #define REG_OFFSET_BG3PD 0x36 +#define REG_OFFSET_BG3X 0x38 #define REG_OFFSET_BG3X_L 0x38 #define REG_OFFSET_BG3X_H 0x3a +#define REG_OFFSET_BG3Y 0x3c #define REG_OFFSET_BG3Y_L 0x3c #define REG_OFFSET_BG3Y_H 0x3e #define REG_OFFSET_WIN0H 0x40 @@ -47,45 +51,49 @@ #define REG_OFFSET_BLDALPHA 0x52 #define REG_OFFSET_BLDY 0x54 -#define REG_OFFSET_SOUND1CNT 0x60 #define REG_OFFSET_SOUND1CNT_L 0x60 +#define REG_OFFSET_NR10 0x60 #define REG_OFFSET_SOUND1CNT_H 0x62 +#define REG_OFFSET_NR11 0x62 +#define REG_OFFSET_NR12 0x63 #define REG_OFFSET_SOUND1CNT_X 0x64 -#define REG_OFFSET_SOUND2CNT 0x68 +#define REG_OFFSET_NR13 0x64 +#define REG_OFFSET_NR14 0x65 #define REG_OFFSET_SOUND2CNT_L 0x68 +#define REG_OFFSET_NR21 0x68 +#define REG_OFFSET_NR22 0x69 #define REG_OFFSET_SOUND2CNT_H 0x6c -#define REG_OFFSET_SOUND3CNT 0x70 +#define REG_OFFSET_NR23 0x6c +#define REG_OFFSET_NR24 0x6d #define REG_OFFSET_SOUND3CNT_L 0x70 +#define REG_OFFSET_NR30 0x70 #define REG_OFFSET_SOUND3CNT_H 0x72 +#define REG_OFFSET_NR31 0x72 +#define REG_OFFSET_NR32 0x73 #define REG_OFFSET_SOUND3CNT_X 0x74 -#define REG_OFFSET_SOUND4CNT 0x78 +#define REG_OFFSET_NR33 0x74 +#define REG_OFFSET_NR34 0x75 #define REG_OFFSET_SOUND4CNT_L 0x78 +#define REG_OFFSET_NR41 0x78 +#define REG_OFFSET_NR42 0x79 #define REG_OFFSET_SOUND4CNT_H 0x7c -#define REG_OFFSET_SOUNDCNT 0x80 +#define REG_OFFSET_NR43 0x7c +#define REG_OFFSET_NR44 0x7d #define REG_OFFSET_SOUNDCNT_L 0x80 +#define REG_OFFSET_NR50 0x80 +#define REG_OFFSET_NR51 0x81 #define REG_OFFSET_SOUNDCNT_H 0x82 #define REG_OFFSET_SOUNDCNT_X 0x84 +#define REG_OFFSET_NR52 0x84 #define REG_OFFSET_SOUNDBIAS 0x88 -#define REG_OFFSET_WAVE_RAM 0x90 +#define REG_OFFSET_SOUNDBIAS_L 0x88 +#define REG_OFFSET_SOUNDBIAS_H 0x89 #define REG_OFFSET_WAVE_RAM0 0x90 -#define REG_OFFSET_WAVE_RAM0_L 0x90 -#define REG_OFFSET_WAVE_RAM0_H 0x92 #define REG_OFFSET_WAVE_RAM1 0x94 -#define REG_OFFSET_WAVE_RAM1_L 0x94 -#define REG_OFFSET_WAVE_RAM1_H 0x96 #define REG_OFFSET_WAVE_RAM2 0x98 -#define REG_OFFSET_WAVE_RAM2_L 0x98 -#define REG_OFFSET_WAVE_RAM2_H 0x9a #define REG_OFFSET_WAVE_RAM3 0x9c -#define REG_OFFSET_WAVE_RAM3_L 0x9c -#define REG_OFFSET_WAVE_RAM3_H 0x9e -#define REG_OFFSET_FIFO 0xa0 #define REG_OFFSET_FIFO_A 0xa0 -#define REG_OFFSET_FIFO_A_L 0xa0 -#define REG_OFFSET_FIFO_A_H 0xa2 #define REG_OFFSET_FIFO_B 0xa4 -#define REG_OFFSET_FIFO_B_L 0xa4 -#define REG_OFFSET_FIFO_B_H 0xa6 #define REG_OFFSET_DMA0 0xb0 #define REG_OFFSET_DMA0SAD 0xb0 @@ -128,6 +136,7 @@ #define REG_OFFSET_DMA3CNT_L 0xdc #define REG_OFFSET_DMA3CNT_H 0xde +#define REG_OFFSET_TMCNT 0x100 #define REG_OFFSET_TM0CNT 0x100 #define REG_OFFSET_TM0CNT_L 0x100 #define REG_OFFSET_TM0CNT_H 0x102 @@ -192,16 +201,20 @@ #define REG_ADDR_BG2PB (REG_BASE + REG_OFFSET_BG2PB) #define REG_ADDR_BG2PC (REG_BASE + REG_OFFSET_BG2PC) #define REG_ADDR_BG2PD (REG_BASE + REG_OFFSET_BG2PD) +#define REG_ADDR_BG2X (REG_BASE + REG_OFFSET_BG2X) #define REG_ADDR_BG2X_L (REG_BASE + REG_OFFSET_BG2X_L) #define REG_ADDR_BG2X_H (REG_BASE + REG_OFFSET_BG2X_H) +#define REG_ADDR_BG2Y (REG_BASE + REG_OFFSET_BG2Y) #define REG_ADDR_BG2Y_L (REG_BASE + REG_OFFSET_BG2Y_L) #define REG_ADDR_BG2Y_H (REG_BASE + REG_OFFSET_BG2Y_H) #define REG_ADDR_BG3PA (REG_BASE + REG_OFFSET_BG3PA) #define REG_ADDR_BG3PB (REG_BASE + REG_OFFSET_BG3PB) #define REG_ADDR_BG3PC (REG_BASE + REG_OFFSET_BG3PC) #define REG_ADDR_BG3PD (REG_BASE + REG_OFFSET_BG3PD) +#define REG_ADDR_BG3X (REG_BASE + REG_OFFSET_BG3X) #define REG_ADDR_BG3X_L (REG_BASE + REG_OFFSET_BG3X_L) #define REG_ADDR_BG3X_H (REG_BASE + REG_OFFSET_BG3X_H) +#define REG_ADDR_BG3Y (REG_BASE + REG_OFFSET_BG3Y) #define REG_ADDR_BG3Y_L (REG_BASE + REG_OFFSET_BG3Y_L) #define REG_ADDR_BG3Y_H (REG_BASE + REG_OFFSET_BG3Y_H) #define REG_ADDR_WIN0H (REG_BASE + REG_OFFSET_WIN0H) @@ -215,87 +228,76 @@ #define REG_ADDR_BLDALPHA (REG_BASE + REG_OFFSET_BLDALPHA) #define REG_ADDR_BLDY (REG_BASE + REG_OFFSET_BLDY) -#define REG_ADDR_SOUND1CNT (REG_BASE + REG_OFFSET_SOUND1CNT) #define REG_ADDR_SOUND1CNT_L (REG_BASE + REG_OFFSET_SOUND1CNT_L) +#define REG_ADDR_NR10 (REG_BASE + REG_OFFSET_NR10) #define REG_ADDR_SOUND1CNT_H (REG_BASE + REG_OFFSET_SOUND1CNT_H) +#define REG_ADDR_NR11 (REG_BASE + REG_OFFSET_NR11) +#define REG_ADDR_NR12 (REG_BASE + REG_OFFSET_NR12) #define REG_ADDR_SOUND1CNT_X (REG_BASE + REG_OFFSET_SOUND1CNT_X) -#define REG_ADDR_SOUND2CNT (REG_BASE + REG_OFFSET_SOUND2CNT) +#define REG_ADDR_NR13 (REG_BASE + REG_OFFSET_NR13) +#define REG_ADDR_NR14 (REG_BASE + REG_OFFSET_NR14) #define REG_ADDR_SOUND2CNT_L (REG_BASE + REG_OFFSET_SOUND2CNT_L) +#define REG_ADDR_NR21 (REG_BASE + REG_OFFSET_NR21) +#define REG_ADDR_NR22 (REG_BASE + REG_OFFSET_NR22) #define REG_ADDR_SOUND2CNT_H (REG_BASE + REG_OFFSET_SOUND2CNT_H) -#define REG_ADDR_SOUND3CNT (REG_BASE + REG_OFFSET_SOUND3CNT) +#define REG_ADDR_NR23 (REG_BASE + REG_OFFSET_NR23) +#define REG_ADDR_NR24 (REG_BASE + REG_OFFSET_NR24) #define REG_ADDR_SOUND3CNT_L (REG_BASE + REG_OFFSET_SOUND3CNT_L) +#define REG_ADDR_NR30 (REG_BASE + REG_OFFSET_NR30) #define REG_ADDR_SOUND3CNT_H (REG_BASE + REG_OFFSET_SOUND3CNT_H) +#define REG_ADDR_NR31 (REG_BASE + REG_OFFSET_NR31) +#define REG_ADDR_NR32 (REG_BASE + REG_OFFSET_NR32) #define REG_ADDR_SOUND3CNT_X (REG_BASE + REG_OFFSET_SOUND3CNT_X) -#define REG_ADDR_SOUND4CNT (REG_BASE + REG_OFFSET_SOUND4CNT) +#define REG_ADDR_NR33 (REG_BASE + REG_OFFSET_NR33) +#define REG_ADDR_NR34 (REG_BASE + REG_OFFSET_NR34) #define REG_ADDR_SOUND4CNT_L (REG_BASE + REG_OFFSET_SOUND4CNT_L) +#define REG_ADDR_NR41 (REG_BASE + REG_OFFSET_NR41) +#define REG_ADDR_NR42 (REG_BASE + REG_OFFSET_NR42) #define REG_ADDR_SOUND4CNT_H (REG_BASE + REG_OFFSET_SOUND4CNT_H) -#define REG_ADDR_SOUNDCNT (REG_BASE + REG_OFFSET_SOUNDCNT) +#define REG_ADDR_NR43 (REG_BASE + REG_OFFSET_NR43) +#define REG_ADDR_NR44 (REG_BASE + REG_OFFSET_NR44) #define REG_ADDR_SOUNDCNT_L (REG_BASE + REG_OFFSET_SOUNDCNT_L) +#define REG_ADDR_NR50 (REG_BASE + REG_OFFSET_NR50) +#define REG_ADDR_NR51 (REG_BASE + REG_OFFSET_NR51) #define REG_ADDR_SOUNDCNT_H (REG_BASE + REG_OFFSET_SOUNDCNT_H) #define REG_ADDR_SOUNDCNT_X (REG_BASE + REG_OFFSET_SOUNDCNT_X) +#define REG_ADDR_NR52 (REG_BASE + REG_OFFSET_NR52) #define REG_ADDR_SOUNDBIAS (REG_BASE + REG_OFFSET_SOUNDBIAS) -#define REG_ADDR_WAVE_RAM (REG_BASE + REG_OFFSET_WAVE_RAM) +#define REG_ADDR_SOUNDBIAS_L (REG_BASE + REG_OFFSET_SOUNDBIAS_L) +#define REG_ADDR_SOUNDBIAS_H (REG_BASE + REG_OFFSET_SOUNDBIAS_H) #define REG_ADDR_WAVE_RAM0 (REG_BASE + REG_OFFSET_WAVE_RAM0) -#define REG_ADDR_WAVE_RAM0_L (REG_BASE + REG_OFFSET_WAVE_RAM0_L) -#define REG_ADDR_WAVE_RAM0_H (REG_BASE + REG_OFFSET_WAVE_RAM0_H) #define REG_ADDR_WAVE_RAM1 (REG_BASE + REG_OFFSET_WAVE_RAM1) -#define REG_ADDR_WAVE_RAM1_L (REG_BASE + REG_OFFSET_WAVE_RAM1_L) -#define REG_ADDR_WAVE_RAM1_H (REG_BASE + REG_OFFSET_WAVE_RAM1_H) #define REG_ADDR_WAVE_RAM2 (REG_BASE + REG_OFFSET_WAVE_RAM2) -#define REG_ADDR_WAVE_RAM2_L (REG_BASE + REG_OFFSET_WAVE_RAM2_L) -#define REG_ADDR_WAVE_RAM2_H (REG_BASE + REG_OFFSET_WAVE_RAM2_H) #define REG_ADDR_WAVE_RAM3 (REG_BASE + REG_OFFSET_WAVE_RAM3) -#define REG_ADDR_WAVE_RAM3_L (REG_BASE + REG_OFFSET_WAVE_RAM3_L) -#define REG_ADDR_WAVE_RAM3_H (REG_BASE + REG_OFFSET_WAVE_RAM3_H) -#define REG_ADDR_FIFO (REG_BASE + REG_OFFSET_FIFO) #define REG_ADDR_FIFO_A (REG_BASE + REG_OFFSET_FIFO_A) -#define REG_ADDR_FIFO_A_L (REG_BASE + REG_OFFSET_FIFO_A_L) -#define REG_ADDR_FIFO_A_H (REG_BASE + REG_OFFSET_FIFO_A_H) #define REG_ADDR_FIFO_B (REG_BASE + REG_OFFSET_FIFO_B) -#define REG_ADDR_FIFO_B_L (REG_BASE + REG_OFFSET_FIFO_B_L) -#define REG_ADDR_FIFO_B_H (REG_BASE + REG_OFFSET_FIFO_B_H) #define REG_ADDR_DMA0 (REG_BASE + REG_OFFSET_DMA0) #define REG_ADDR_DMA0SAD (REG_BASE + REG_OFFSET_DMA0SAD) -#define REG_ADDR_DMA0SAD_L (REG_BASE + REG_OFFSET_DMA0SAD_L) -#define REG_ADDR_DMA0SAD_H (REG_BASE + REG_OFFSET_DMA0SAD_H) #define REG_ADDR_DMA0DAD (REG_BASE + REG_OFFSET_DMA0DAD) -#define REG_ADDR_DMA0DAD_L (REG_BASE + REG_OFFSET_DMA0DAD_L) -#define REG_ADDR_DMA0DAD_H (REG_BASE + REG_OFFSET_DMA0DAD_H) #define REG_ADDR_DMA0CNT (REG_BASE + REG_OFFSET_DMA0CNT) #define REG_ADDR_DMA0CNT_L (REG_BASE + REG_OFFSET_DMA0CNT_L) #define REG_ADDR_DMA0CNT_H (REG_BASE + REG_OFFSET_DMA0CNT_H) #define REG_ADDR_DMA1 (REG_BASE + REG_OFFSET_DMA1) #define REG_ADDR_DMA1SAD (REG_BASE + REG_OFFSET_DMA1SAD) -#define REG_ADDR_DMA1SAD_L (REG_BASE + REG_OFFSET_DMA1SAD_L) -#define REG_ADDR_DMA1SAD_H (REG_BASE + REG_OFFSET_DMA1SAD_H) #define REG_ADDR_DMA1DAD (REG_BASE + REG_OFFSET_DMA1DAD) -#define REG_ADDR_DMA1DAD_L (REG_BASE + REG_OFFSET_DMA1DAD_L) -#define REG_ADDR_DMA1DAD_H (REG_BASE + REG_OFFSET_DMA1DAD_H) #define REG_ADDR_DMA1CNT (REG_BASE + REG_OFFSET_DMA1CNT) #define REG_ADDR_DMA1CNT_L (REG_BASE + REG_OFFSET_DMA1CNT_L) #define REG_ADDR_DMA1CNT_H (REG_BASE + REG_OFFSET_DMA1CNT_H) #define REG_ADDR_DMA2 (REG_BASE + REG_OFFSET_DMA2) #define REG_ADDR_DMA2SAD (REG_BASE + REG_OFFSET_DMA2SAD) -#define REG_ADDR_DMA2SAD_L (REG_BASE + REG_OFFSET_DMA2SAD_L) -#define REG_ADDR_DMA2SAD_H (REG_BASE + REG_OFFSET_DMA2SAD_H) #define REG_ADDR_DMA2DAD (REG_BASE + REG_OFFSET_DMA2DAD) -#define REG_ADDR_DMA2DAD_L (REG_BASE + REG_OFFSET_DMA2DAD_L) -#define REG_ADDR_DMA2DAD_H (REG_BASE + REG_OFFSET_DMA2DAD_H) #define REG_ADDR_DMA2CNT (REG_BASE + REG_OFFSET_DMA2CNT) #define REG_ADDR_DMA2CNT_L (REG_BASE + REG_OFFSET_DMA2CNT_L) #define REG_ADDR_DMA2CNT_H (REG_BASE + REG_OFFSET_DMA2CNT_H) #define REG_ADDR_DMA3 (REG_BASE + REG_OFFSET_DMA3) #define REG_ADDR_DMA3SAD (REG_BASE + REG_OFFSET_DMA3SAD) -#define REG_ADDR_DMA3SAD_L (REG_BASE + REG_OFFSET_DMA3SAD_L) -#define REG_ADDR_DMA3SAD_H (REG_BASE + REG_OFFSET_DMA3SAD_H) #define REG_ADDR_DMA3DAD (REG_BASE + REG_OFFSET_DMA3DAD) -#define REG_ADDR_DMA3DAD_L (REG_BASE + REG_OFFSET_DMA3DAD_L) -#define REG_ADDR_DMA3DAD_H (REG_BASE + REG_OFFSET_DMA3DAD_H) #define REG_ADDR_DMA3CNT (REG_BASE + REG_OFFSET_DMA3CNT) #define REG_ADDR_DMA3CNT_L (REG_BASE + REG_OFFSET_DMA3CNT_L) #define REG_ADDR_DMA3CNT_H (REG_BASE + REG_OFFSET_DMA3CNT_H) +#define REG_ADDR_TMCNT (REG_BASE + REG_OFFSET_TMCNT) #define REG_ADDR_TM0CNT (REG_BASE + REG_OFFSET_TM0CNT) #define REG_ADDR_TM0CNT_L (REG_BASE + REG_OFFSET_TM0CNT_L) #define REG_ADDR_TM0CNT_H (REG_BASE + REG_OFFSET_TM0CNT_H) @@ -344,11 +346,152 @@ #define REG_DISPCNT (*(vu16 *)REG_ADDR_DISPCNT) #define REG_DISPSTAT (*(vu16 *)REG_ADDR_DISPSTAT) #define REG_VCOUNT (*(vu16 *)REG_ADDR_VCOUNT) +#define REG_BG0CNT (*(vu16 *)REG_ADDR_BG0CNT) +#define REG_BG1CNT (*(vu16 *)REG_ADDR_BG1CNT) +#define REG_BG2CNT (*(vu16 *)REG_ADDR_BG2CNT) +#define REG_BG3CNT (*(vu16 *)REG_ADDR_BG3CNT) +#define REG_BG0HOFS (*(vu16 *)REG_ADDR_BG0HOFS) +#define REG_BG0VOFS (*(vu16 *)REG_ADDR_BG0VOFS) +#define REG_BG1HOFS (*(vu16 *)REG_ADDR_BG1HOFS) +#define REG_BG1VOFS (*(vu16 *)REG_ADDR_BG1VOFS) +#define REG_BG2HOFS (*(vu16 *)REG_ADDR_BG2HOFS) +#define REG_BG2VOFS (*(vu16 *)REG_ADDR_BG2VOFS) +#define REG_BG3HOFS (*(vu16 *)REG_ADDR_BG3HOFS) +#define REG_BG3VOFS (*(vu16 *)REG_ADDR_BG3VOFS) +#define REG_BG2PA (*(vu16 *)REG_ADDR_BG2PA) +#define REG_BG2PB (*(vu16 *)REG_ADDR_BG2PB) +#define REG_BG2PC (*(vu16 *)REG_ADDR_BG2PC) +#define REG_BG2PD (*(vu16 *)REG_ADDR_BG2PD) +#define REG_BG2X (*(vu32 *)REG_ADDR_BG2X) +#define REG_BG2X_L (*(vu16 *)REG_ADDR_BG2X_L) +#define REG_BG2X_H (*(vu16 *)REG_ADDR_BG2X_H) +#define REG_BG2Y (*(vu32 *)REG_ADDR_BG2Y) +#define REG_BG2Y_L (*(vu16 *)REG_ADDR_BG2Y_L) +#define REG_BG2Y_H (*(vu16 *)REG_ADDR_BG2Y_H) +#define REG_BG3PA (*(vu16 *)REG_ADDR_BG3PA) +#define REG_BG3PB (*(vu16 *)REG_ADDR_BG3PB) +#define REG_BG3PC (*(vu16 *)REG_ADDR_BG3PC) +#define REG_BG3PD (*(vu16 *)REG_ADDR_BG3PD) +#define REG_BG3X (*(vu32 *)REG_ADDR_BG3X) +#define REG_BG3X_L (*(vu16 *)REG_ADDR_BG3X_L) +#define REG_BG3X_H (*(vu16 *)REG_ADDR_BG3X_H) +#define REG_BG3Y (*(vu32 *)REG_ADDR_BG3Y) +#define REG_BG3Y_L (*(vu16 *)REG_ADDR_BG3Y_L) +#define REG_BG3Y_H (*(vu16 *)REG_ADDR_BG3Y_H) +#define REG_WIN0H (*(vu16 *)REG_ADDR_WIN0H) +#define REG_WIN1H (*(vu16 *)REG_ADDR_WIN1H) +#define REG_WIN0V (*(vu16 *)REG_ADDR_WIN0V) +#define REG_WIN1V (*(vu16 *)REG_ADDR_WIN1V) +#define REG_WININ (*(vu16 *)REG_ADDR_WININ) +#define REG_WINOUT (*(vu16 *)REG_ADDR_WINOUT) +#define REG_MOSAIC (*(vu16 *)REG_ADDR_MOSAIC) +#define REG_BLDCNT (*(vu16 *)REG_ADDR_BLDCNT) +#define REG_BLDALPHA (*(vu16 *)REG_ADDR_BLDALPHA) +#define REG_BLDY (*(vu16 *)REG_ADDR_BLDY) + +#define REG_SOUND1CNT_L (*(vu16 *)REG_ADDR_SOUND1CNT_L) +#define REG_NR10 (*(vu8 *)REG_ADDR_NR10) +#define REG_SOUND1CNT_H (*(vu16 *)REG_ADDR_SOUND1CNT_H) +#define REG_NR11 (*(vu8 *)REG_ADDR_NR11) +#define REG_NR12 (*(vu8 *)REG_ADDR_NR12) +#define REG_SOUND1CNT_X (*(vu16 *)REG_ADDR_SOUND1CNT_X) +#define REG_NR13 (*(vu8 *)REG_ADDR_NR13) +#define REG_NR14 (*(vu8 *)REG_ADDR_NR14) +#define REG_SOUND2CNT_L (*(vu16 *)REG_ADDR_SOUND2CNT_L) +#define REG_NR21 (*(vu8 *)REG_ADDR_NR21) +#define REG_NR22 (*(vu8 *)REG_ADDR_NR22) +#define REG_SOUND2CNT_H (*(vu16 *)REG_ADDR_SOUND2CNT_H) +#define REG_NR23 (*(vu8 *)REG_ADDR_NR23) +#define REG_NR24 (*(vu8 *)REG_ADDR_NR24) +#define REG_SOUND3CNT_L (*(vu16 *)REG_ADDR_SOUND3CNT_L) +#define REG_NR30 (*(vu8 *)REG_ADDR_NR30) +#define REG_SOUND3CNT_H (*(vu16 *)REG_ADDR_SOUND3CNT_H) +#define REG_NR31 (*(vu8 *)REG_ADDR_NR31) +#define REG_NR32 (*(vu8 *)REG_ADDR_NR32) +#define REG_SOUND3CNT_X (*(vu16 *)REG_ADDR_SOUND3CNT_X) +#define REG_NR33 (*(vu8 *)REG_ADDR_NR33) +#define REG_NR34 (*(vu8 *)REG_ADDR_NR34) +#define REG_SOUND4CNT_L (*(vu16 *)REG_ADDR_SOUND4CNT_L) +#define REG_NR41 (*(vu8 *)REG_ADDR_NR41) +#define REG_NR42 (*(vu8 *)REG_ADDR_NR42) +#define REG_SOUND4CNT_H (*(vu16 *)REG_ADDR_SOUND4CNT_H) +#define REG_NR43 (*(vu8 *)REG_ADDR_NR43) +#define REG_NR44 (*(vu8 *)REG_ADDR_NR44) +#define REG_SOUNDCNT_L (*(vu16 *)REG_ADDR_SOUNDCNT_L) +#define REG_NR50 (*(vu8 *)REG_ADDR_NR50) +#define REG_NR51 (*(vu8 *)REG_ADDR_NR51) +#define REG_SOUNDCNT_H (*(vu16 *)REG_ADDR_SOUNDCNT_H) +#define REG_SOUNDCNT_X (*(vu16 *)REG_ADDR_SOUNDCNT_X) +#define REG_NR52 (*(vu8 *)REG_ADDR_NR52) +#define REG_SOUNDBIAS (*(vu16 *)REG_ADDR_SOUNDBIAS) +#define REG_SOUNDBIAS_L (*(vu8 *)REG_ADDR_SOUNDBIAS_L) +#define REG_SOUNDBIAS_H (*(vu8 *)REG_ADDR_SOUNDBIAS_H) +#define REG_WAVE_RAM0 (*(vu32 *)REG_ADDR_WAVE_RAM0) +#define REG_WAVE_RAM1 (*(vu32 *)REG_ADDR_WAVE_RAM1) +#define REG_WAVE_RAM2 (*(vu32 *)REG_ADDR_WAVE_RAM2) +#define REG_WAVE_RAM3 (*(vu32 *)REG_ADDR_WAVE_RAM3) +#define REG_FIFO_A (*(vu32 *)REG_ADDR_FIFO_A) +#define REG_FIFO_B (*(vu32 *)REG_ADDR_FIFO_B) + +#define REG_DMA0SAD (*(vu32 *)REG_ADDR_DMA0SAD) +#define REG_DMA0DAD (*(vu32 *)REG_ADDR_DMA0DAD) +#define REG_DMA0CNT (*(vu32 *)REG_ADDR_DMA0CNT) +#define REG_DMA0CNT_L (*(vu16 *)REG_ADDR_DMA0CNT_L) +#define REG_DMA0CNT_H (*(vu16 *)REG_ADDR_DMA0CNT_H) + +#define REG_DMA1SAD (*(vu32 *)REG_ADDR_DMA1SAD) +#define REG_DMA1DAD (*(vu32 *)REG_ADDR_DMA1DAD) +#define REG_DMA1CNT (*(vu32 *)REG_ADDR_DMA1CNT) +#define REG_DMA1CNT_L (*(vu16 *)REG_ADDR_DMA1CNT_L) +#define REG_DMA1CNT_H (*(vu16 *)REG_ADDR_DMA1CNT_H) + +#define REG_DMA2SAD (*(vu32 *)REG_ADDR_DMA2SAD) +#define REG_DMA2DAD (*(vu32 *)REG_ADDR_DMA2DAD) +#define REG_DMA2CNT (*(vu32 *)REG_ADDR_DMA2CNT) +#define REG_DMA2CNT_L (*(vu16 *)REG_ADDR_DMA2CNT_L) +#define REG_DMA2CNT_H (*(vu16 *)REG_ADDR_DMA2CNT_H) + +#define REG_DMA3SAD (*(vu32 *)REG_ADDR_DMA3SAD) +#define REG_DMA3DAD (*(vu32 *)REG_ADDR_DMA3DAD) +#define REG_DMA3CNT (*(vu32 *)REG_ADDR_DMA3CNT) +#define REG_DMA3CNT_L (*(vu16 *)REG_ADDR_DMA3CNT_L) +#define REG_DMA3CNT_H (*(vu16 *)REG_ADDR_DMA3CNT_H) + +#define REG_TMCNT(n) (*(vu16 *)(REG_ADDR_TMCNT + ((n) * 4))) +#define REG_TM0CNT (*(vu32 *)REG_ADDR_TM0CNT) +#define REG_TM0CNT_L (*(vu16 *)REG_ADDR_TM0CNT_L) +#define REG_TM0CNT_H (*(vu16 *)REG_ADDR_TM0CNT_H) +#define REG_TM1CNT (*(vu32 *)REG_ADDR_TM1CNT) +#define REG_TM1CNT_L (*(vu16 *)REG_ADDR_TM1CNT_L) +#define REG_TM1CNT_H (*(vu16 *)REG_ADDR_TM1CNT_H) +#define REG_TM2CNT (*(vu32 *)REG_ADDR_TM2CNT) +#define REG_TM2CNT_L (*(vu16 *)REG_ADDR_TM2CNT_L) +#define REG_TM2CNT_H (*(vu16 *)REG_ADDR_TM2CNT_H) +#define REG_TM3CNT (*(vu32 *)REG_ADDR_TM3CNT) +#define REG_TM3CNT_L (*(vu16 *)REG_ADDR_TM3CNT_L) +#define REG_TM3CNT_H (*(vu16 *)REG_ADDR_TM3CNT_H) + +#define REG_SIOCNT (*(vu16 *)REG_ADDR_SIOCNT) +#define REG_SIODATA8 (*(vu16 *)REG_ADDR_SIODATA8) +#define REG_SIODATA32 (*(vu32 *)REG_ADDR_SIODATA32) +#define REG_SIOMLT_SEND (*(vu16 *)REG_ADDR_SIOMLT_SEND) +#define REG_SIOMLT_RECV (*(vu64 *)REG_ADDR_SIOMLT_RECV) +#define REG_SIOMULTI0 (*(vu16 *)REG_ADDR_SIOMULTI0) +#define REG_SIOMULTI1 (*(vu16 *)REG_ADDR_SIOMULTI1) +#define REG_SIOMULTI2 (*(vu16 *)REG_ADDR_SIOMULTI2) +#define REG_SIOMULTI3 (*(vu16 *)REG_ADDR_SIOMULTI3) + +#define REG_KEYINPUT (*(vu16 *)REG_ADDR_KEYINPUT) +#define REG_KEYCNT (*(vu16 *)REG_ADDR_KEYCNT) + +#define REG_RCNT (*(vu16 *)REG_ADDR_RCNT) #define REG_IME (*(vu16 *)REG_ADDR_IME) #define REG_IE (*(vu16 *)REG_ADDR_IE) #define REG_IF (*(vu16 *)REG_ADDR_IF) +#define REG_WAITCNT (*(vu16 *)REG_ADDR_WAITCNT) + // I/O register fields // DISPCNT @@ -360,6 +503,15 @@ #define DISPCNT_MODE_5 0x0005 #define DISPCNT_OBJ_1D_MAP 0x0040 #define DISPCNT_FORCED_BLANK 0x0080 +#define DISPCNT_BG0_ON 0x0100 +#define DISPCNT_BG1_ON 0x0200 +#define DISPCNT_BG2_ON 0x0400 +#define DISPCNT_BG3_ON 0x0800 +#define DISPCNT_BG_ALL_ON 0x0F00 +#define DISPCNT_OBJ_ON 0x1000 +#define DISPCNT_WIN0_ON 0x2000 +#define DISPCNT_WIN1_ON 0x4000 +#define DISPCNT_OBJWIN_ON 0x8000 // DISPSTAT #define DISPSTAT_VBLANK 0x0001 // in V-Blank @@ -369,6 +521,102 @@ #define DISPSTAT_HBLANK_INTR 0x0010 // H-Blank interrupt enabled #define DISPSTAT_VCOUNT_INTR 0x0020 // V-Count interrupt enabled +// SOUNDCNT_H +#define SOUND_CGB_MIX_QUARTER 0x0000 +#define SOUND_CGB_MIX_HALF 0x0001 +#define SOUND_CGB_MIX_FULL 0x0002 +#define SOUND_A_MIX_HALF 0x0000 +#define SOUND_A_MIX_FULL 0x0004 +#define SOUND_B_MIX_HALF 0x0000 +#define SOUND_B_MIX_FULL 0x0008 +#define SOUND_ALL_MIX_FULL 0x000E +#define SOUND_A_RIGHT_OUTPUT 0x0100 +#define SOUND_A_LEFT_OUTPUT 0x0200 +#define SOUND_A_TIMER_0 0x0000 +#define SOUND_A_TIMER_1 0x0400 +#define SOUND_A_FIFO_RESET 0x0800 +#define SOUND_B_RIGHT_OUTPUT 0x1000 +#define SOUND_B_LEFT_OUTPUT 0x2000 +#define SOUND_B_TIMER_0 0x0000 +#define SOUND_B_TIMER_1 0x4000 +#define SOUND_B_FIFO_RESET 0x8000 + +// SOUNDCNT_X +#define SOUND_1_ON 0x0001 +#define SOUND_2_ON 0x0002 +#define SOUND_3_ON 0x0004 +#define SOUND_4_ON 0x0008 +#define SOUND_MASTER_ENABLE 0x0080 + +// DMA +#define DMA_DEST_INC 0x0000 +#define DMA_DEST_DEC 0x0020 +#define DMA_DEST_FIXED 0x0040 +#define DMA_DEST_RELOAD 0x0060 +#define DMA_SRC_INC 0x0000 +#define DMA_SRC_DEC 0x0080 +#define DMA_SRC_FIXED 0x0100 +#define DMA_REPEAT 0x0200 +#define DMA_16BIT 0x0000 +#define DMA_32BIT 0x0400 +#define DMA_DREQ_ON 0x0800 +#define DMA_START_NOW 0x0000 +#define DMA_START_VBLANK 0x1000 +#define DMA_START_HBLANK 0x2000 +#define DMA_START_SPECIAL 0x3000 +#define DMA_START_MASK 0x3000 +#define DMA_INTR_ENABLE 0x4000 +#define DMA_ENABLE 0x8000 + +// timer +#define TIMER_1CLK 0x00 +#define TIMER_64CLK 0x01 +#define TIMER_256CLK 0x02 +#define TIMER_1024CLK 0x03 +#define TIMER_INTR_ENABLE 0x40 +#define TIMER_ENABLE 0x80 + +// serial +#define SIO_8BIT_MODE 0x0000 // Normal 8-bit communication mode +#define SIO_32BIT_MODE 0x1000 // Normal 32-bit communication mode +#define SIO_MULTI_MODE 0x2000 // Multi-player communication mode +#define SIO_UART_MODE 0x3000 // UART communication mode + +#define SIO_9600_BPS 0x0000 // baud rate 9600 bps +#define SIO_38400_BPS 0x0001 // 38400 bps +#define SIO_57600_BPS 0x0002 // 57600 bps +#define SIO_115200_BPS 0x0003 // 115200 bps + +#define SIO_MULTI_SI 0x0004 // Multi-player communication SI terminal +#define SIO_MULTI_SD 0x0008 // SD terminal + +#define SIO_ERROR 0x0040 // Detect error +#define SIO_START 0x0080 // Start transfer +#define SIO_ENABLE 0x0080 // Enable SIO + +#define SIO_INTR_ENABLE 0x4000 + +#define SIO_MULTI_SI_SHIFT 2 +#define SIO_MULTI_SI_MASK 0x1 +#define SIO_MULTI_DI_SHIFT 3 +#define SIO_MULTI_DI_MASK 0x1 + +// keys +#define A_BUTTON 0x0001 +#define B_BUTTON 0x0002 +#define SELECT_BUTTON 0x0004 +#define START_BUTTON 0x0008 +#define DPAD_RIGHT 0x0010 +#define DPAD_LEFT 0x0020 +#define DPAD_UP 0x0040 +#define DPAD_DOWN 0x0080 +#define R_BUTTON 0x0100 +#define L_BUTTON 0x0200 +#define KEYS_MASK 0x03FF +#define KEY_INTR_ENABLE 0x0400 +#define KEY_OR_INTR 0x0000 +#define KEY_AND_INTR 0x8000 + // interrupt flags #define INTR_FLAG_VBLANK (1 << 0) #define INTR_FLAG_HBLANK (1 << 1) @@ -385,4 +633,49 @@ #define INTR_FLAG_KEYPAD (1 << 12) #define INTR_FLAG_GAMEPAK (1 << 13) +// WAITCNT +#define WAITCNT_SRAM_4 (0 << 0) +#define WAITCNT_SRAM_3 (1 << 0) +#define WAITCNT_SRAM_2 (2 << 0) +#define WAITCNT_SRAM_8 (3 << 0) +#define WAITCNT_SRAM_MASK (3 << 0) + +#define WAITCNT_WS0_N_4 (0 << 2) +#define WAITCNT_WS0_N_3 (1 << 2) +#define WAITCNT_WS0_N_2 (2 << 2) +#define WAITCNT_WS0_N_8 (3 << 2) +#define WAITCNT_WS0_N_MASK (3 << 2) + +#define WAITCNT_WS0_S_2 (0 << 4) +#define WAITCNT_WS0_S_1 (1 << 4) + +#define WAITCNT_WS1_N_4 (0 << 5) +#define WAITCNT_WS1_N_3 (1 << 5) +#define WAITCNT_WS1_N_2 (2 << 5) +#define WAITCNT_WS1_N_8 (3 << 5) +#define WAITCNT_WS1_N_MASK (3 << 5) + +#define WAITCNT_WS1_S_4 (0 << 7) +#define WAITCNT_WS1_S_1 (1 << 7) + +#define WAITCNT_WS2_N_4 (0 << 8) +#define WAITCNT_WS2_N_3 (1 << 8) +#define WAITCNT_WS2_N_2 (2 << 8) +#define WAITCNT_WS2_N_8 (3 << 8) +#define WAITCNT_WS2_N_MASK (3 << 8) + +#define WAITCNT_WS2_S_8 (0 << 10) +#define WAITCNT_WS2_S_1 (1 << 10) + +#define WAITCNT_PHI_OUT_NONE (0 << 11) +#define WAITCNT_PHI_OUT_4MHZ (1 << 11) +#define WAITCNT_PHI_OUT_8MHZ (2 << 11) +#define WAITCNT_PHI_OUT_16MHZ (3 << 11) +#define WAITCNT_PHI_OUT_MASK (3 << 11) + +#define WAITCNT_PREFETCH_ENABLE (1 << 14) + +#define WAITCNT_AGB (0 << 15) +#define WAITCNT_CGB (1 << 15) + #endif // GUARD_GBA_IO_REG_H diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h new file mode 100644 index 000000000..84b448243 --- /dev/null +++ b/include/gba/m4a_internal.h @@ -0,0 +1,462 @@ +#include "gba/gba.h" + +// ASCII encoding of 'Smsh' in reverse +// This is presumably short for SMASH, the developer of MKS4AGB. +#define ID_NUMBER 0x68736D53 + +#define C_V 0x40 // center value for PAN, BEND, and TUNE + +#define SOUND_MODE_REVERB_VAL 0x0000007F +#define SOUND_MODE_REVERB_SET 0x00000080 +#define SOUND_MODE_MAXCHN 0x00000F00 +#define SOUND_MODE_MAXCHN_SHIFT 8 +#define SOUND_MODE_MASVOL 0x0000F000 +#define SOUND_MODE_MASVOL_SHIFT 12 +#define SOUND_MODE_FREQ_05734 0x00010000 +#define SOUND_MODE_FREQ_07884 0x00020000 +#define SOUND_MODE_FREQ_10512 0x00030000 +#define SOUND_MODE_FREQ_13379 0x00040000 +#define SOUND_MODE_FREQ_15768 0x00050000 +#define SOUND_MODE_FREQ_18157 0x00060000 +#define SOUND_MODE_FREQ_21024 0x00070000 +#define SOUND_MODE_FREQ_26758 0x00080000 +#define SOUND_MODE_FREQ_31536 0x00090000 +#define SOUND_MODE_FREQ_36314 0x000A0000 +#define SOUND_MODE_FREQ_40137 0x000B0000 +#define SOUND_MODE_FREQ_42048 0x000C0000 +#define SOUND_MODE_FREQ 0x000F0000 +#define SOUND_MODE_FREQ_SHIFT 16 +#define SOUND_MODE_DA_BIT_9 0x00800000 +#define SOUND_MODE_DA_BIT_8 0x00900000 +#define SOUND_MODE_DA_BIT_7 0x00A00000 +#define SOUND_MODE_DA_BIT_6 0x00B00000 +#define SOUND_MODE_DA_BIT 0x00B00000 +#define SOUND_MODE_DA_BIT_SHIFT 20 + +struct WaveData +{ + u16 type; + u16 status; + u32 freq; + u32 loopStart; + u32 size; // number of samples + s8 data[1]; // samples +}; + +#define TONEDATA_TYPE_CGB 0x07 +#define TONEDATA_TYPE_FIX 0x08 +#define TONEDATA_TYPE_SPL 0x40 // key split +#define TONEDATA_TYPE_RHY 0x80 // rhythm + +#define TONEDATA_P_S_PAN 0xc0 +#define TONEDATA_P_S_PAM TONEDATA_P_S_PAN + +struct ToneData +{ + u8 type; + u8 key; + u8 length; // sound length (compatible sound) + u8 pan_sweep; // pan or sweep (compatible sound ch. 1) + struct WaveData *wav; + u8 attack; + u8 decay; + u8 sustain; + u8 release; +}; + +struct CgbChannel +{ + u8 sf; + u8 ty; + u8 rightVolume; + u8 leftVolume; + u8 at; + u8 de; + u8 su; + u8 re; + u8 ky; + u8 ev; + u8 eg; + u8 ec; + u8 echoVolume; + u8 echoLength; + u8 d1; + u8 d2; + u8 gt; + u8 mk; + u8 ve; + u8 pr; + u8 rp; + u8 d3[3]; + u8 d5; + u8 sg; + u8 n4; + u8 pan; + u8 panMask; + u8 mo; + u8 le; + u8 sw; + u32 fr; + u32 wp; + u32 cp; + u32 tp; + u32 pp; + u32 np; + u8 d4[8]; +}; + +struct MusicPlayerTrack; + +struct SoundChannel +{ + u8 status; + u8 type; + u8 rightVolume; + u8 leftVolume; + u8 attack; + u8 decay; + u8 sustain; + u8 release; + u8 ky; + u8 ev; + u8 er; + u8 el; + u8 echoVolume; + u8 echoLength; + u8 d1; + u8 d2; + u8 gt; + u8 mk; + u8 ve; + u8 pr; + u8 rp; + u8 d3[3]; + u32 ct; + u32 fw; + u32 freq; + struct WaveData *wav; + u32 cp; + struct MusicPlayerTrack *track; + u32 pp; + u32 np; + u32 d4; + u16 xpi; + u16 xpc; +}; + +#define MAX_DIRECTSOUND_CHANNELS 12 + +#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer + +struct SoundInfo +{ + // This field is normally equal to ID_NUMBER but it is set to other + // values during sensitive operations for locking purposes. + // This field should be volatile but isn't. This could potentially cause + // race conditions. + u32 ident; + + vu8 pcmDmaCounter; + + // Direct Sound + u8 reverb; + u8 maxChans; + u8 masterVolume; + u8 freq; + + u8 mode; + u8 c15; + u8 pcmDmaPeriod; // number of V-blanks per PCM DMA + u8 maxLines; + u8 gap[3]; + s32 pcmSamplesPerVBlank; + s32 pcmFreq; + s32 divFreq; + struct CgbChannel *cgbChans; + u32 func; + u32 intp; + void (*CgbSound)(void); + void (*CgbOscOff)(u8); + u32 (*MidiKeyToCgbFreq)(u8, u8, u8); + u32 MPlayJumpTable; + u32 plynote; + u32 ExtVolPit; + u8 gap2[16]; + struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS]; + s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2]; +}; + +struct SongHeader +{ + u8 trackCount; + u8 blockCount; + u8 priority; + u8 reverb; + struct ToneData *tone; + u8 *part[1]; +}; + +struct PokemonCrySong +{ + u8 trackCount; + u8 blockCount; + u8 priority; + u8 reverb; + struct ToneData *tone; + u8 *part[2]; + u8 gap; + u8 part0; // 0x11 + u8 tuneValue; // 0x12 + u8 gotoCmd; // 0x13 + u32 gotoTarget; // 0x14 + u8 part1; // 0x18 + u8 tuneValue2; // 0x19 + u8 cont[2]; // 0x1A + u8 volCmd; // 0x1C + u8 volumeValue; // 0x1D + u8 unkCmd0D[2]; // 0x1E + u32 unkCmd0DParam; // 0x20 + u8 xreleCmd[2]; // 0x24 + u8 releaseValue; // 0x26 + u8 panCmd; + u8 panValue; // 0x28 + u8 tieCmd; // 0x29 + u8 tieKeyValue; // 0x2A + u8 tieVelocityValue; // 0x2B + u8 unkCmd0C[2]; // 0x2C + u16 unkCmd0CParam; // 0x2E + u8 end[2]; // 0x30 +}; + +#define MPT_FLG_VOLSET 0x01 +#define MPT_FLG_VOLCHG 0x03 +#define MPT_FLG_PITSET 0x04 +#define MPT_FLG_PITCHG 0x0C +#define MPT_FLG_START 0x40 +#define MPT_FLG_EXIST 0x80 + +struct MusicPlayerTrack +{ + u8 flags; + u8 wait; + u8 patternLevel; + u8 repN; + u8 gateTime; + u8 key; + u8 velocity; + u8 runningStatus; + u8 keyM; + u8 pitM; + s8 keyShift; + s8 keyShiftX; + s8 tune; + u8 pitX; + s8 bend; + u8 bendRange; + u8 volMR; + u8 volML; + u8 vol; + u8 volX; + s8 pan; + s8 panX; + s8 modM; + u8 mod; + u8 modT; + u8 lfoSpeed; + u8 lfoSpeedC; + u8 lfoDelay; + u8 lfoDelayC; + u8 priority; + u8 echoVolume; + u8 echoLength; + struct SoundChannel *chan; + struct ToneData tone; + u8 gap[10]; + u16 unk_3A; + u32 unk_3C; + u8 *cmdPtr; + u8 *patternStack[3]; +}; + +#define MUSICPLAYER_STATUS_TRACK 0x0000ffff +#define MUSICPLAYER_STATUS_PAUSE 0x80000000 + +#define MAX_MUSICPLAYER_TRACKS 16 + +#define TEMPORARY_FADE 0x0001 +#define FADE_IN 0x0002 +#define FADE_VOL_MAX 64 +#define FADE_VOL_SHIFT 2 + +struct MusicPlayerInfo +{ + struct SongHeader *songHeader; + u32 status; + u8 trackCount; + u8 priority; + u8 cmd; + u8 unk_B; + u32 clock; + u8 gap[8]; + u8 *memAccArea; + u16 tempoD; + u16 tempoU; + u16 tempoI; + u16 tempoC; + u16 fadeOI; + u16 fadeOC; + u16 fadeOV; + struct MusicPlayerTrack *tracks; + struct ToneData *tone; + u32 ident; + u32 func; + u32 intp; +}; + +struct MusicPlayer +{ + struct MusicPlayerInfo *info; + struct MusicPlayerTrack *track; + u8 unk_8; + u16 unk_A; +}; + +struct Song +{ + struct SongHeader *header; + u16 ms; + u16 me; +}; + +extern const struct MusicPlayer gMPlayTable[]; +extern const struct Song gSongTable[]; + + + +extern u8 gMPlayMemAccArea[]; + +//u8 gPokemonCrySong[52]; +//u8 gPokemonCrySongs[52 * MAX_POKEMON_CRIES]; + +#define MAX_POKEMON_CRIES 2 + +extern struct PokemonCrySong gPokemonCrySong; +extern struct PokemonCrySong gPokemonCrySongs[]; + +extern struct MusicPlayerInfo gPokemonCryMusicPlayers[]; +extern struct MusicPlayerTrack gPokemonCryTracks[]; + +extern char SoundMainRAM[]; + +extern void *gMPlayJumpTable[]; + +typedef void (*XcmdFunc)(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +extern const XcmdFunc gXcmdTable[]; + +extern struct CgbChannel gCgbChans[]; + +extern const u8 gScaleTable[]; +extern const u32 gFreqTable[]; +extern const u16 gPcmSamplesPerVBlankTable[]; + +extern const u8 gCgbScaleTable[]; +extern const s16 gCgbFreqTable[]; +extern const u8 gNoiseTable[]; + +extern const struct PokemonCrySong gPokemonCrySongTemplate; + +extern const struct ToneData voicegroup_842FC88; + +extern char gNumMusicPlayers[]; +extern char gMaxLines[]; + +#define NUM_MUSIC_PLAYERS ((u16)gNumMusicPlayers) +#define MAX_LINES ((u32)gMaxLines) + +u32 umul3232H32(u32 multiplier, u32 multiplicand); +void SoundMain(void); +void SoundMainBTM(void); +void TrackStop(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track); +void MPlayMain(void); +void RealClearChain(void *x); + +void MPlayContinue(struct MusicPlayerInfo *mplayInfo); +void MPlayStart(struct MusicPlayerInfo *mplayInfo, struct SongHeader *songHeader); +void m4aMPlayStop(struct MusicPlayerInfo *mplayInfo); +void FadeOutBody(struct MusicPlayerInfo *mplayInfo); +void TrkVolPitSet(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track); +void MPlayFadeOut(struct MusicPlayerInfo *mplayInfo, u16 speed); +void ClearChain(void *x); +void Clear64byte(void *addr); +void SoundInit(struct SoundInfo *soundInfo); +void MPlayExtender(struct CgbChannel *cgbChans); +void m4aSoundMode(u32 mode); +void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track, u8 a3); +void CgbSound(void); +void CgbOscOff(u8); +u32 MidiKeyToCgbFreq(u8, u8, u8); +void DummyFunc(void); +void MPlayJumpTableCopy(void **mplayJumpTable); +void SampleFreqSet(u32 freq); +void m4aSoundVSyncOn(void); +void m4aSoundVSyncOff(void); + +void m4aMPlayTempoControl(struct MusicPlayerInfo *mplayInfo, u16 tempo); +void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 volume); +void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 pitch); +void m4aMPlayPanpotControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s8 pan); +void ClearModM(struct MusicPlayerTrack *track); +void m4aMPlayModDepthSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 modDepth); +void m4aMPlayLFOSpeedSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 lfoSpeed); + +struct MusicPlayerInfo *SetPokemonCryTone(struct ToneData *tone); +void SetPokemonCryVolume(u8 val); +void SetPokemonCryPanpot(s8 val); +void SetPokemonCryPitch(s16 val); +void SetPokemonCryLength(u16 val); +void SetPokemonCryRelease(u8 val); +void SetPokemonCryProgress(u32 val); +int IsPokemonCryPlaying(struct MusicPlayerInfo *mplayInfo); +void SetPokemonCryChorus(s8 val); +void SetPokemonCryStereo(u32 val); +void SetPokemonCryPriority(u8 val); + +// sound command handler functions +void ply_fine(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_goto(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_patt(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_pend(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_rept(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_memacc(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_prio(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_tempo(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_keysh(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_voice(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_vol(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_pan(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_bend(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_bendr(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_lfos(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_lfodl(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_mod(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_modt(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *); + +// extended sound command handler functions +void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xwave(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xtype(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xatta(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xdeca(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xsust(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xrele(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xiecv(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xiecl(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xleng(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xswee(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xcmd_0C(struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_xcmd_0D(struct MusicPlayerInfo *, struct MusicPlayerTrack *); diff --git a/include/gba/macro.h b/include/gba/macro.h index 5578f90ba..62d3e73fa 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -1,15 +1,85 @@ #ifndef GUARD_GBA_MACRO_H #define GUARD_GBA_MACRO_H -#define CPU_FILL(dest, value, size, bit) \ -do { \ +#define CPU_FILL(value, dest, size, bit) \ +{ \ vu##bit tmp = (vu##bit)(value); \ CpuSet((void *)&tmp, \ dest, \ CPU_SET_##bit##BIT | CPU_SET_SRC_FIXED | ((size)/(bit/8) & 0x1FFFFF)); \ -} while (0) +} -#define CpuFill16(dest, value, size) CPU_FILL(dest, value, size, 16) -#define CpuFill32(dest, value, size) CPU_FILL(dest, value, size, 32) +#define CpuFill16(value, dest, size) CPU_FILL(value, dest, size, 16) +#define CpuFill32(value, dest, size) CPU_FILL(value, dest, size, 32) + +#define CPU_COPY(src, dest, size, bit) CpuSet(src, dest, CPU_SET_##bit##BIT | ((size)/(bit/8) & 0x1FFFFF)) + +#define CpuCopy16(src, dest, size) CPU_COPY(src, dest, size, 16) +#define CpuCopy32(src, dest, size) CPU_COPY(src, dest, size, 32) + +#define CpuFastFill(value, dest, size) \ +{ \ + vu32 tmp = (vu32)(value); \ + CpuFastSet((void *)&tmp, \ + dest, \ + CPU_FAST_SET_SRC_FIXED | ((size)/(32/8) & 0x1FFFFF)); \ +} + +#define CpuFastCopy(src, dest, size) CpuFastSet(src, dest, ((size)/(32/8) & 0x1FFFFF)) + +#define DmaSet(dmaNum, src, dest, control) \ +{ \ + vu32 *dmaRegs = (vu32 *)REG_ADDR_DMA##dmaNum; \ + dmaRegs[0] = (vu32)(src); \ + dmaRegs[1] = (vu32)(dest); \ + dmaRegs[2] = (vu32)(control); \ + dmaRegs[2]; \ +} + +#define DMA_FILL(dmaNum, value, dest, size, bit) \ +{ \ + vu##bit tmp = (vu##bit)(value); \ + DmaSet(dmaNum, \ + &tmp, \ + dest, \ + (DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_FIXED | DMA_DEST_INC) << 16 \ + | ((size)/(bit/8))); \ +} + +#define DmaFill16(dmaNum, value, dest, size) DMA_FILL(dmaNum, value, dest, size, 16) +#define DmaFill32(dmaNum, value, dest, size) DMA_FILL(dmaNum, value, dest, size, 32) + +// Note that the DMA clear macros cause the DMA control value to be calculated +// at runtime rather than compile time. The size is divided by the DMA transfer +// unit size (2 or 4 bytes) and then combined with the DMA control flags using a +// bitwise OR operation. + +#define DMA_CLEAR(dmaNum, dest, size, bit) \ +{ \ + vu##bit *_dest = (vu##bit *)(dest); \ + u32 _size = size; \ + DmaFill##bit(dmaNum, 0, _dest, _size); \ +} + +#define DmaClear16(dmaNum, dest, size) DMA_CLEAR(dmaNum, dest, size, 16) +#define DmaClear32(dmaNum, dest, size) DMA_CLEAR(dmaNum, dest, size, 32) + +#define DMA_COPY(dmaNum, src, dest, size, bit) \ + DmaSet(dmaNum, \ + src, \ + dest, \ + (DMA_ENABLE | DMA_START_NOW | DMA_##bit##BIT | DMA_SRC_INC | DMA_DEST_INC) << 16 \ + | ((size)/(bit/8))) + +#define DmaCopy16(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 16) +#define DmaCopy32(dmaNum, src, dest, size) DMA_COPY(dmaNum, src, dest, size, 32) + +#define DmaStop(dmaNum) \ +{ \ + vu16 *dmaRegs = (vu16 *)REG_ADDR_DMA##dmaNum; \ + dmaRegs[5] &= ~(DMA_START_MASK | DMA_DREQ_ON | DMA_REPEAT); \ + dmaRegs[5] &= ~DMA_ENABLE; \ + dmaRegs[5]; \ +} #endif // GUARD_GBA_MACRO_H diff --git a/include/gba/syscall.h b/include/gba/syscall.h index 0f4198b44..3f41abba1 100644 --- a/include/gba/syscall.h +++ b/include/gba/syscall.h @@ -1,10 +1,32 @@ #ifndef GUARD_GBA_SYSCALL_H #define GUARD_GBA_SYSCALL_H +#define RESET_EWRAM 0x01 +#define RESET_IWRAM 0x02 +#define RESET_PALETTE 0x04 +#define RESET_VRAM 0x08 +#define RESET_OAM 0x10 +#define RESET_SIO_REGS 0x20 +#define RESET_SOUND_REGS 0x40 +#define RESET_REGS 0x80 +#define RESET_ALL 0xFF + +void SoftReset(u32 resetFlags); + +void RegisterRamReset(u32 resetFlags); + +void VBlankIntrWait(void); + #define CPU_SET_SRC_FIXED 0x01000000 #define CPU_SET_16BIT 0x00000000 #define CPU_SET_32BIT 0x04000000 -extern void CpuSet(void *src, void *dest, u32 controlData); +void CpuSet(const void *src, void *dest, u32 control); + +#define CPU_FAST_SET_SRC_FIXED 0x01000000 + +void CpuFastSet(const void *src, void *dest, u32 control); + +void ObjAffineSet(struct ObjAffineSrcData *src, void *dest, s32 count, s32 offset); #endif // GUARD_GBA_SYSCALL_H diff --git a/include/gba/types.h b/include/gba/types.h new file mode 100644 index 000000000..be7390d5a --- /dev/null +++ b/include/gba/types.h @@ -0,0 +1,108 @@ +#ifndef GUARD_GBA_TYPES_H +#define GUARD_GBA_TYPES_H + +#include + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + +typedef volatile u8 vu8; +typedef volatile u16 vu16; +typedef volatile u32 vu32; +typedef volatile u64 vu64; +typedef volatile s8 vs8; +typedef volatile s16 vs16; +typedef volatile s32 vs32; +typedef volatile s64 vs64; + +typedef float f32; +typedef double f64; + +typedef u8 bool8; +typedef u16 bool16; +typedef u32 bool32; + +struct PlttData +{ + u16 r:5; // red + u16 g:5; // green + u16 b:5; // blue + u16 unused_15:1; +}; + +struct OamData +{ + /*0x00*/ u32 y:8; + /*0x01*/ u32 affineMode:2; + u32 objMode:2; + u32 mosaic:1; + u32 bpp:1; + u32 shape:2; + + /*0x02*/ u32 x:9; + u32 matrixNum:5; // bits 3/4 are h-flip/v-flip if not in affine mode + u32 size:2; + + /*0x04*/ u16 tileNum:10; + u16 priority:2; + u16 paletteNum:4; + /*0x06*/ u16 affineParam; +}; + +#define ST_OAM_OBJ_NORMAL 0 +#define ST_OAM_OBJ_BLEND 1 +#define ST_OAM_OBJ_WINDOW 2 + +#define ST_OAM_AFFINE_OFF 0 +#define ST_OAM_AFFINE_NORMAL 1 +#define ST_OAM_AFFINE_ERASE 2 +#define ST_OAM_AFFINE_DOUBLE 3 + +#define ST_OAM_AFFINE_ON_MASK 1 +#define ST_OAM_AFFINE_DOUBLE_MASK 2 + +#define ST_OAM_4BPP 0 +#define ST_OAM_8BPP 1 + +#define ST_OAM_SQUARE 0 +#define ST_OAM_H_RECTANGLE 1 +#define ST_OAM_V_RECTANGLE 2 + +struct ObjAffineSrcData +{ + s16 xScale; + s16 yScale; + u16 rotation; +}; + +// Multi-player SIO Control Structure +struct SioMultiCnt +{ + u16 baudRate:2; // baud rate + u16 si:1; // SI terminal + u16 sd:1; // SD terminal + u16 id:2; // ID + u16 error:1; // error flag + u16 enable:1; // SIO enable + u16 unused_11_8:4; + u16 mode:2; // communication mode (should equal 2) + u16 intrEnable:1; // IRQ enable + u16 unused_15:1; + u16 data; // data +}; + +#define ST_SIO_MULTI_MODE 2 // Multi-player communication mode + +// baud rate +#define ST_SIO_9600_BPS 0 // 9600 bps +#define ST_SIO_38400_BPS 1 // 38400 bps +#define ST_SIO_57600_BPS 2 // 57600 bps +#define ST_SIO_115200_BPS 3 // 115200 bps + +#endif // GUARD_GBA_TYPES_H diff --git a/include/global.h b/include/global.h index 37473afc8..0047fcbdb 100644 --- a/include/global.h +++ b/include/global.h @@ -1,34 +1,6 @@ #ifndef GUARD_GLOBAL_H #define GUARD_GLOBAL_H -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef signed char s8; -typedef signed short s16; -typedef signed int s32; - -typedef volatile u8 vu8; -typedef volatile u16 vu16; -typedef volatile u32 vu32; -typedef volatile s8 vs8; -typedef volatile s16 vs16; -typedef volatile s32 vs32; - -typedef float f32; -typedef double f64; - -typedef u8 bool8; -typedef u16 bool16; -typedef u32 bool32; - -#define NULL (void *)0 - -#define TRUE 1 -#define FALSE 0 - -#include "gba/io_reg.h" -#include "gba/syscall.h" -#include "gba/macro.h" +#include "gba/gba.h" #endif // GUARD_GLOBAL_H diff --git a/include/task.h b/include/task.h new file mode 100644 index 000000000..a536bcab5 --- /dev/null +++ b/include/task.h @@ -0,0 +1,29 @@ +#ifndef GUARD_TASK_H +#define GUARD_TASK_H + +typedef void (*TaskFunc)(u8 taskId); + +struct Task +{ + TaskFunc func; + bool8 isActive; + u8 prev; + u8 next; + u8 priority; + s16 data[16]; +}; + +extern struct Task gTasks[]; + +void ResetTasks(); +u8 CreateTask(TaskFunc func, u8 priority); +void DestroyTask(u8 taskId); +void RunTasks(); +void TaskDummy(u8 taskId); +void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc); +void SwitchTaskToFollowupFunc(u8 taskId); +bool8 FuncIsActiveTask(TaskFunc func); +u8 FindTaskIdByFunc(TaskFunc func); +u8 GetTaskCount(); + +#endif // GUARD_TASK_H diff --git a/iwram_syms.txt b/iwram_syms.txt index 4e5f17289..48398ad64 100644 --- a/iwram_syms.txt +++ b/iwram_syms.txt @@ -10,3 +10,5 @@ gGpuRegWaitingList = 0x03000878; gGpuRegBufferLocked = 0x030008D8; gShouldSyncRegIE = 0x030008D9; gRegIE = 0x030008DA; + +gTasks = 0x3005E00; diff --git a/ld_script.txt b/ld_script.txt index 6ab6fbee2..c56a3fd14 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -43,7 +43,7 @@ SECTIONS { asm/rom_8032654.o(.text); asm/tileset_animation.o(.text); asm/rom_80A18F4.o(.text); - asm/task.o(.text); + src/task.o(.text); asm/rom_80A92F4.o(.text); asm/multiboot.o(.text); asm/rom_81BAD84.o(.text); diff --git a/src/malloc.c b/src/malloc.c index 8bfaf5ef0..c93e096c2 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -135,7 +135,7 @@ void *AllocZeroedInternal(void *heapStart, u32 size) if (size & 3) size = 4 * ((size / 4) + 1); - CpuFill32(mem, 0, size); + CpuFill32(0, mem, size); } return mem; diff --git a/src/task.c b/src/task.c new file mode 100644 index 000000000..160e4dbff --- /dev/null +++ b/src/task.c @@ -0,0 +1,313 @@ +#include "global.h" +#include "task.h" + +#define NUM_TASKS 16 + +#define HEAD_SENTINEL 0xFE +#define TAIL_SENTINEL 0xFF + +struct Task gTasks[NUM_TASKS]; + +static void InsertTask(u8 newTaskId); +static u8 FindFirstActiveTask(); + +void ResetTasks() +{ + u8 i; + + for (i = 0; i < NUM_TASKS; i++) + { + gTasks[i].isActive = FALSE; + gTasks[i].func = TaskDummy; + gTasks[i].prev = i; + gTasks[i].next = i + 1; + gTasks[i].priority = -1; + memset(gTasks[i].data, 0, sizeof(gTasks[i].data)); + } + + gTasks[0].prev = HEAD_SENTINEL; + gTasks[NUM_TASKS - 1].next = TAIL_SENTINEL; +} + +u8 CreateTask(TaskFunc func, u8 priority) +{ + u8 i; + + for (i = 0; i < NUM_TASKS; i++) + { + if (!gTasks[i].isActive) + { + gTasks[i].func = func; + gTasks[i].priority = priority; + InsertTask(i); + memset(gTasks[i].data, 0, sizeof(gTasks[i].data)); + gTasks[i].isActive = TRUE; + return i; + } + } + + return 0; +} + +#ifdef NONMATCHING +static void InsertTask(u8 newTaskId) +{ + u8 taskId = FindFirstActiveTask(); + + if (taskId == NUM_TASKS) + { + // The new task is the only task. + gTasks[newTaskId].prev = HEAD_SENTINEL; + gTasks[newTaskId].next = TAIL_SENTINEL; + return; + } + + for (;;) + { + if (gTasks[newTaskId].priority < gTasks[taskId].priority) + { + // We've found a task with a higher priority value, + // so we insert the new task before it. + gTasks[newTaskId].prev = gTasks[taskId].prev; + gTasks[newTaskId].next = taskId; + + if (gTasks[taskId].prev != HEAD_SENTINEL) + gTasks[gTasks[taskId].prev].next = newTaskId; + + gTasks[taskId].prev = newTaskId; + return; + } + + if (gTasks[taskId].next != TAIL_SENTINEL) + taskId = gTasks[taskId].next; + else + break; + } + + // We've reached the end. + gTasks[newTaskId].prev = taskId; + gTasks[newTaskId].next = gTasks[taskId].next; + gTasks[taskId].next = newTaskId; +} +#else +__attribute__((naked)) +static void InsertTask(u8 newTaskId) +{ + asm("push {r4, r5, r6, r7, lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + lsl r0, r0, #24\n\ + lsr r4, r0, #24\n\ + bl FindFirstActiveTask\n\ + lsl r0, r0, #24\n\ + lsr r1, r0, #24\n\ + cmp r1, #16\n\ + bne .LInsertTask_foundActiveTask\n\ + ldr r1, .LInsertTask_gTasks1\n\ + lsl r0, r4, #2\n\ + add r0, r0, r4\n\ + lsl r0, r0, #3\n\ + add r0, r0, r1\n\ + mov r1, #254\n\ + strb r1, [r0, #5]\n\ + mov r1, #255\n\ + strb r1, [r0, #6]\n\ + b .LInsertTask_done\n\ + .align 2, 0\n\ +.LInsertTask_gTasks1:\n\ + .word gTasks\n\ +.LInsertTask_foundActiveTask:\n\ + ldr r6, .LInsertTask_gTasks2\n\ + lsl r0, r4, #2\n\ + mov r12, r0\n\ + mov r8, r6\n\ + add r0, r0, r4\n\ + lsl r0, r0, #3\n\ + add r2, r0, r6\n\ +.LInsertTask_loop:\n\ + lsl r0, r1, #2\n\ + add r0, r0, r1\n\ + lsl r5, r0, #3\n\ + mov r7, r8\n\ + add r3, r5, r7\n\ + ldrb r0, [r2, #7]\n\ + ldrb r7, [r3, #7]\n\ + cmp r0, r7\n\ + bcs .LInsertTask_next\n\ + ldrb r0, [r3, #5]\n\ + strb r0, [r2, #5]\n\ + strb r1, [r2, #6]\n\ + ldrb r0, [r3, #5]\n\ + cmp r0, #254\n\ + beq .LInsertTask_insertAtHead\n\ + add r1, r0, #0\n\ + lsl r0, r1, #2\n\ + add r0, r0, r1\n\ + lsl r0, r0, #3\n\ + add r0, r0, r8\n\ + strb r4, [r0, #6]\n\ +.LInsertTask_insertAtHead:\n\ + strb r4, [r3, #5]\n\ + b .LInsertTask_done\n\ + .align 2, 0\n\ +.LInsertTask_gTasks2:\n\ + .word gTasks\n\ +.LInsertTask_next:\n\ + ldrb r0, [r3, #6]\n\ + cmp r0, #255\n\ + beq .LInsertTask_insertAtTail\n\ + add r1, r0, #0\n\ + b .LInsertTask_loop\n\ +.LInsertTask_insertAtTail:\n\ + mov r2, r12\n\ + add r0, r2, r4\n\ + lsl r0, r0, #3\n\ + add r0, r0, r6\n\ + strb r1, [r0, #5]\n\ + add r2, r5, r6\n\ + ldrb r1, [r2, #6]\n\ + strb r1, [r0, #6]\n\ + strb r4, [r2, #6]\n\ +.LInsertTask_done:\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4, r5, r6, r7}\n\ + pop {r0}\n\ + bx r0\n"); +} +#endif // NONMATCHING + +void DestroyTask(u8 taskId) +{ + if (gTasks[taskId].isActive) + { + gTasks[taskId].isActive = FALSE; + + if (gTasks[taskId].prev == HEAD_SENTINEL) + { + if (gTasks[taskId].next != TAIL_SENTINEL) + gTasks[gTasks[taskId].next].prev = HEAD_SENTINEL; + } + else + { + if (gTasks[taskId].next == TAIL_SENTINEL) + { + gTasks[gTasks[taskId].prev].next = TAIL_SENTINEL; + } + else + { + gTasks[gTasks[taskId].prev].next = gTasks[taskId].next; + gTasks[gTasks[taskId].next].prev = gTasks[taskId].prev; + } + } + } +} + +void RunTasks() +{ + u8 taskId = FindFirstActiveTask(); + + if (taskId != NUM_TASKS) + { + do + { + gTasks[taskId].func(taskId); + taskId = gTasks[taskId].next; + } while (taskId != TAIL_SENTINEL); + } +} + +static u8 FindFirstActiveTask() +{ + u8 taskId; + + for (taskId = 0; taskId < NUM_TASKS; taskId++) + if (gTasks[taskId].isActive == TRUE && gTasks[taskId].prev == HEAD_SENTINEL) + break; + + return taskId; +} + +void TaskDummy(u8 taskId) +{ +} + +#define TASK_DATA_OP(taskId, offset, op) \ +{ \ + u32 tasksAddr = (u32)gTasks; \ + u32 addr = taskId * sizeof(struct Task) + offset; \ + u32 dataAddr = tasksAddr + offsetof(struct Task, data); \ + addr += dataAddr; \ + op; \ +} + +void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc) +{ + TASK_DATA_OP(taskId, 28, *((u16 *)addr) = (u32)followupFunc) + TASK_DATA_OP(taskId, 30, *((u16 *)addr) = (u32)followupFunc >> 16) + gTasks[taskId].func = func; +} + +void SwitchTaskToFollowupFunc(u8 taskId) +{ + s32 func; + + gTasks[taskId].func = NULL; + + TASK_DATA_OP(taskId, 28, func = *((u16 *)addr)) + TASK_DATA_OP(taskId, 30, func |= *((s16 *)addr) << 16) + + gTasks[taskId].func = (TaskFunc)func; +} + +bool8 FuncIsActiveTask(TaskFunc func) +{ + u8 i; + + for (i = 0; i < NUM_TASKS; i++) + if (gTasks[i].isActive == TRUE && gTasks[i].func == func) + return TRUE; + + return FALSE; +} + +u8 FindTaskIdByFunc(TaskFunc func) +{ + s32 i; + + for (i = 0; i < NUM_TASKS; i++) + if (gTasks[i].isActive == TRUE && gTasks[i].func == func) + return (u8)i; + + return -1; +} + +u8 GetTaskCount() +{ + u8 i; + u8 count = 0; + + for (i = 0; i < NUM_TASKS; i++) + if (gTasks[i].isActive == TRUE) + count++; + + return count; +} + +void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value) +{ + if (dataElem <= 0xE) + { + gTasks[taskId].data[dataElem] = value; + gTasks[taskId].data[dataElem + 1] = value >> 16; + } + return; +} + +u32 GetWordTaskArg(u8 taskId, u8 dataElem) +{ + if (dataElem <= 0xE) + return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16); + else + return 0; +}