From c3c790527d15d50f3c30bc047ed42785ced1d0e3 Mon Sep 17 00:00:00 2001 From: Dalrik Date: Fri, 1 Oct 2021 07:14:54 -0400 Subject: [PATCH] Decomp pause_sort_item_list and pause_draw_rect (#453) * WIP pause_sort_item_list * Decomp pause_draw_rect and pause_sort_item_list The match on pause_sort_item_list is very sketchy, there's probably a much simpler way to write the function that I can't find * Review for 135EE0 --- include/common_structs.h | 2 +- include/enums.h | 21 +++ src/curtains.c | 4 +- src/pause/135EE0.c | 138 ++++++++++++++++- .../pause/135EE0/pause_draw_rect.s | 144 ------------------ .../pause/135EE0/pause_sort_item_list.s | 96 ------------ 6 files changed, 159 insertions(+), 246 deletions(-) delete mode 100644 ver/us/asm/nonmatchings/pause/135EE0/pause_draw_rect.s delete mode 100644 ver/us/asm/nonmatchings/pause/135EE0/pause_sort_item_list.s diff --git a/include/common_structs.h b/include/common_structs.h index 2521dc05df..20a4417b16 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1953,7 +1953,7 @@ typedef struct MenuWindowBP { } MenuWindowBP; // size = 0x24; typedef struct { - /* 0x00 */ s8 flags; + /* 0x00 */ u8 flags; /* 0x01 */ s8 panelID; // ? /* 0x02 */ s8 unk_02; // related to heirarchy somehow - sibling? group? /* 0x03 */ s8 parent; // ? diff --git a/include/enums.h b/include/enums.h index 80da89dd80..4ff457f99c 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1765,4 +1765,25 @@ enum MoveIDs { MOVE_UNK_184 = 184, }; +enum GameModeIDs { + GAME_MODE_STARTUP, + GAME_MODE_LOGOS, + GAME_MODE_TITLE_SCREEN, + GAME_MODE_ENTER_DEMO, + GAME_MODE_CHANGE_MAP, + GAME_MODE_UNK_5, + GAME_MODE_ENTER_WORLD, + GAME_MODE_WORLD, + GAME_MODE_BATTLE, + GAME_MODE_END_BATTLE, + GAME_MODE_PAUSE, + GAME_MODE_UNPAUSE, + GAME_MODE_LANGUAGE_SELECT, + GAME_MODE_EXIT_LANGUAGE_SELECT, + GAME_MODE_FILE_SELECT, + GAME_MODE_EXIT_FILE_SELECT, + GAME_MODE_INTRO, + GAME_MODE_DEMO, +}; + #endif diff --git a/src/curtains.c b/src/curtains.c index 575b188b38..fddfa97a18 100644 --- a/src/curtains.c +++ b/src/curtains.c @@ -259,7 +259,9 @@ void render_curtains(void) { } if (!(gGameStatusPtr->contBitPattern & 1)) { - if ((get_game_mode() == 0x10) || (get_game_mode() == 2) || (gGameStatusPtr->demoState != 0)) { + if ((get_game_mode() == GAME_MODE_INTRO) + || (get_game_mode() == GAME_MODE_TITLE_SCREEN) + || (gGameStatusPtr->demoState != 0)) { s32 alpha = ((gGameStatusPtr->frameCounter) % 0x18) << 5; if (alpha > 255) { diff --git a/src/pause/135EE0.c b/src/pause/135EE0.c index 611ac6c02c..3089eedc49 100644 --- a/src/pause/135EE0.c +++ b/src/pause/135EE0.c @@ -22,9 +22,84 @@ void pause_set_cursor_opacity(s32 val) { INCLUDE_ASM(s32, "pause/135EE0", pause_set_cursor_opacity); #endif -INCLUDE_ASM(s32, "pause/135EE0", func_80242BAC); +// Delay slot issue with D_8024EFB4 (needs .data) +#ifdef NON_MATCHING +extern s32 D_8024EFB4; +void func_80242BAC(s32 windowID, s32 posX, s32 posY) { + Window* window = &gWindows[windowID]; + + if (D_8024EFB4 != 0 + || get_game_mode() == GAME_MODE_EXIT_FILE_SELECT + || get_game_mode() == GAME_MODE_EXIT_LANGUAGE_SELECT) { + if (D_8024EFB4 != 0) { + s32 i; + + for (i = 0x16; i < 0x2C; i++) { + Window* window = &gWindows[i]; + s8 parent = window->parent; + + if ((parent == -1 || parent == 0x16) && (window->flags & 8)) { + break; + } + } + if (i >= 0x2C) { + D_8024EFB4 = 0; + } + } + gPauseMenuTargetPosX = posX; + gPauseMenuCursorPosX = posX; + gPauseMenuTargetPosY = posY; + gPauseMenuCursorPosY = posY; + + } else if ((window->flags & 8) == 0 && (window->parent == -1 || !(gWindows[window->parent].flags & 8))) { + gPauseMenuTargetPosX = posX; + gPauseMenuCursorPosX = posX; + gPauseMenuTargetPosY = posY; + gPauseMenuCursorPosY = posY; + } +} +#else +INCLUDE_ASM(s32, "pause/135EE0", func_80242BAC); +#endif + +// Delay slot issue with gPauseMenuCursorPosY (needs .data) +#ifdef NON_MATCHING +extern s32 D_8024EFB4; + +void func_80242D04(s32 windowID, s32 posX, s32 posY) { + Window* window = &gWindows[windowID]; + + if (D_8024EFB4 != 0 + || get_game_mode() == GAME_MODE_EXIT_FILE_SELECT + || get_game_mode() == GAME_MODE_EXIT_LANGUAGE_SELECT) { + if (D_8024EFB4 != 0) { + s32 i; + + for (i = 0x16; i < 0x2C; i++) { + Window* window = &gWindows[i]; + s8 parent = window->parent; + + if ((parent == -1 || parent == 0x16) && (window->flags & 8)) { + break; + } + } + if (i >= 0x2C) { + D_8024EFB4 = 0; + } + } + gPauseMenuTargetPosX = posX; + gPauseMenuCursorPosX = posX; + gPauseMenuTargetPosY = posY; + gPauseMenuCursorPosY = posY; + } else if ((window->flags & 8) == 0 && (window->parent == -1 || !(gWindows[window->parent].flags & 8))) { + gPauseMenuTargetPosX = posX; + gPauseMenuTargetPosY = posY; + } +} +#else INCLUDE_ASM(s32, "pause/135EE0", func_80242D04); +#endif // Delay slot issue with gPauseMenuCursorTargetOpacity (needs .data) #ifdef NON_MATCHING @@ -164,7 +239,62 @@ s32 pause_get_total_equipped_bp_cost(void) { return totalCost; } -INCLUDE_ASM(void, "pause/135EE0", pause_draw_rect, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 uls, - s32 ult, s32 dsdx, s32 dtdy); +void pause_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 uls, s32 ult, s32 dsdx, s32 dtdy) { + if (ulx <= -2688 || uly <= -2688 || lrx <= 0 || lry <= 0) { + return; + } + if (ulx >= 1280 || uly >= 960 || lrx >= 2688 || lry >= 2688) { + return; + } + gSPScisTextureRectangle(gMasterGfxPos++, ulx, uly, lrx, lry, tileDescriptor, uls, ult, dsdx, dtdy); +} -INCLUDE_ASM(s32, "pause/135EE0", pause_sort_item_list); +void pause_sort_item_list(s16* arr, s32 len, s32 (*compare)(s16*, s16 *)) { + if (len < 2) { + // Trivially sorted + return; + } else if (len == 2) { + // Trivial 2-element sort + if (compare(&arr[0], &arr[1]) > 0) { + s16 temp = arr[0]; + arr[0] = arr[1]; + arr[1] = temp; + } + return; + } else { + // Nontrivial sort required, use shell sort + u32 gap = 1; + s16* end; + + while (gap < len) { + gap = gap * 2 + 1; + } + + end = &arr[len]; + while ((gap /= 2) != 0) { + s16* window_end; + + for (window_end = &arr[gap]; window_end < end; window_end++) { + s16* cur_elem = window_end - gap; + + // This could be written simpler as a while loop, but the compiler figures out that it only needs to do + // the "cur_elem < end" check on the first iteration in that case + if (cur_elem >= arr && cur_elem < end) { + do { + s16* elem_a = cur_elem; + s16* elem_b = cur_elem + gap; + + if (compare(elem_a, elem_b) > 0) { + s16 temp = *elem_a; + *elem_a = *elem_b; + *elem_b = temp; + cur_elem -= gap; + } else { + break; + } + } while (cur_elem >= arr && cur_elem < end); + } + } + } + } +} diff --git a/ver/us/asm/nonmatchings/pause/135EE0/pause_draw_rect.s b/ver/us/asm/nonmatchings/pause/135EE0/pause_draw_rect.s deleted file mode 100644 index 6dc62c141e..0000000000 --- a/ver/us/asm/nonmatchings/pause/135EE0/pause_draw_rect.s +++ /dev/null @@ -1,144 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel pause_draw_rect -/* 137B98 80244858 2882F581 */ slti $v0, $a0, -0xa7f -/* 137B9C 8024485C 8FA90014 */ lw $t1, 0x14($sp) -/* 137BA0 80244860 8FAA0018 */ lw $t2, 0x18($sp) -/* 137BA4 80244864 8FAB001C */ lw $t3, 0x1c($sp) -/* 137BA8 80244868 8FAC0020 */ lw $t4, 0x20($sp) -/* 137BAC 8024486C 14400075 */ bnez $v0, .L80244A44 -/* 137BB0 80244870 28A2F581 */ slti $v0, $a1, -0xa7f -/* 137BB4 80244874 14400073 */ bnez $v0, .L80244A44 -/* 137BB8 80244878 00000000 */ nop -/* 137BBC 8024487C 18C00071 */ blez $a2, .L80244A44 -/* 137BC0 80244880 00000000 */ nop -/* 137BC4 80244884 18E0006F */ blez $a3, .L80244A44 -/* 137BC8 80244888 28820500 */ slti $v0, $a0, 0x500 -/* 137BCC 8024488C 1040006D */ beqz $v0, .L80244A44 -/* 137BD0 80244890 28A203C0 */ slti $v0, $a1, 0x3c0 -/* 137BD4 80244894 1040006B */ beqz $v0, .L80244A44 -/* 137BD8 80244898 28C20A80 */ slti $v0, $a2, 0xa80 -/* 137BDC 8024489C 10400069 */ beqz $v0, .L80244A44 -/* 137BE0 802448A0 28E20A80 */ slti $v0, $a3, 0xa80 -/* 137BE4 802448A4 10400067 */ beqz $v0, .L80244A44 -/* 137BE8 802448A8 00000000 */ nop -/* 137BEC 802448AC 3C02800A */ lui $v0, %hi(gMasterGfxPos) -/* 137BF0 802448B0 2442A66C */ addiu $v0, $v0, %lo(gMasterGfxPos) -/* 137BF4 802448B4 8C480000 */ lw $t0, ($v0) -/* 137BF8 802448B8 25030008 */ addiu $v1, $t0, 8 -/* 137BFC 802448BC AC430000 */ sw $v1, ($v0) -/* 137C00 802448C0 00061400 */ sll $v0, $a2, 0x10 -/* 137C04 802448C4 00021403 */ sra $v0, $v0, 0x10 -/* 137C08 802448C8 18400005 */ blez $v0, .L802448E0 -/* 137C0C 802448CC 30420FFF */ andi $v0, $v0, 0xfff -/* 137C10 802448D0 00021300 */ sll $v0, $v0, 0xc -/* 137C14 802448D4 3C03E400 */ lui $v1, 0xe400 -/* 137C18 802448D8 08091239 */ j .L802448E4 -/* 137C1C 802448DC 00431825 */ or $v1, $v0, $v1 -.L802448E0: -/* 137C20 802448E0 3C03E400 */ lui $v1, 0xe400 -.L802448E4: -/* 137C24 802448E4 00071400 */ sll $v0, $a3, 0x10 -/* 137C28 802448E8 00021403 */ sra $v0, $v0, 0x10 -/* 137C2C 802448EC 18400004 */ blez $v0, .L80244900 -/* 137C30 802448F0 AD030000 */ sw $v1, ($t0) -/* 137C34 802448F4 30420FFF */ andi $v0, $v0, 0xfff -/* 137C38 802448F8 00621025 */ or $v0, $v1, $v0 -/* 137C3C 802448FC AD020000 */ sw $v0, ($t0) -.L80244900: -/* 137C40 80244900 8FA20010 */ lw $v0, 0x10($sp) -/* 137C44 80244904 30420007 */ andi $v0, $v0, 7 -/* 137C48 80244908 00021E00 */ sll $v1, $v0, 0x18 -/* 137C4C 8024490C 00041400 */ sll $v0, $a0, 0x10 -/* 137C50 80244910 00023403 */ sra $a2, $v0, 0x10 -/* 137C54 80244914 18C00003 */ blez $a2, .L80244924 -/* 137C58 80244918 30C20FFF */ andi $v0, $a2, 0xfff -/* 137C5C 8024491C 00021300 */ sll $v0, $v0, 0xc -/* 137C60 80244920 00621825 */ or $v1, $v1, $v0 -.L80244924: -/* 137C64 80244924 00051400 */ sll $v0, $a1, 0x10 -/* 137C68 80244928 00021403 */ sra $v0, $v0, 0x10 -/* 137C6C 8024492C 18400004 */ blez $v0, .L80244940 -/* 137C70 80244930 AD030004 */ sw $v1, 4($t0) -/* 137C74 80244934 30420FFF */ andi $v0, $v0, 0xfff -/* 137C78 80244938 00621025 */ or $v0, $v1, $v0 -/* 137C7C 8024493C AD020004 */ sw $v0, 4($t0) -.L80244940: -/* 137C80 80244940 3C03800A */ lui $v1, %hi(gMasterGfxPos) -/* 137C84 80244944 2463A66C */ addiu $v1, $v1, %lo(gMasterGfxPos) -/* 137C88 80244948 8C620000 */ lw $v0, ($v1) -/* 137C8C 8024494C 0040202D */ daddu $a0, $v0, $zero -/* 137C90 80244950 24420008 */ addiu $v0, $v0, 8 -/* 137C94 80244954 AC620000 */ sw $v0, ($v1) -/* 137C98 80244958 3C02E100 */ lui $v0, 0xe100 -/* 137C9C 8024495C AC820000 */ sw $v0, ($a0) -/* 137CA0 80244960 04C10012 */ bgez $a2, .L802449AC -/* 137CA4 80244964 24840004 */ addiu $a0, $a0, 4 -/* 137CA8 80244968 000B1400 */ sll $v0, $t3, 0x10 -/* 137CAC 8024496C 00021403 */ sra $v0, $v0, 0x10 -/* 137CB0 80244970 04410007 */ bgez $v0, .L80244990 -/* 137CB4 80244974 00C20018 */ mult $a2, $v0 -/* 137CB8 80244978 00006812 */ mflo $t5 -/* 137CBC 8024497C 000D11C3 */ sra $v0, $t5, 7 -/* 137CC0 80244980 04410008 */ bgez $v0, .L802449A4 -/* 137CC4 80244984 01221023 */ subu $v0, $t1, $v0 -/* 137CC8 80244988 08091268 */ j .L802449A0 -/* 137CCC 8024498C 0000102D */ daddu $v0, $zero, $zero -.L80244990: -/* 137CD0 80244990 00006812 */ mflo $t5 -/* 137CD4 80244994 000D11C3 */ sra $v0, $t5, 7 -/* 137CD8 80244998 5C400001 */ bgtzl $v0, .L802449A0 -/* 137CDC 8024499C 0000102D */ daddu $v0, $zero, $zero -.L802449A0: -/* 137CE0 802449A0 01221023 */ subu $v0, $t1, $v0 -.L802449A4: -/* 137CE4 802449A4 0809126C */ j .L802449B0 -/* 137CE8 802449A8 00023400 */ sll $a2, $v0, 0x10 -.L802449AC: -/* 137CEC 802449AC 00093400 */ sll $a2, $t1, 0x10 -.L802449B0: -/* 137CF0 802449B0 04A10016 */ bgez $a1, .L80244A0C -/* 137CF4 802449B4 3142FFFF */ andi $v0, $t2, 0xffff -/* 137CF8 802449B8 000C1400 */ sll $v0, $t4, 0x10 -/* 137CFC 802449BC 00021C03 */ sra $v1, $v0, 0x10 -/* 137D00 802449C0 0461000A */ bgez $v1, .L802449EC -/* 137D04 802449C4 00051400 */ sll $v0, $a1, 0x10 -/* 137D08 802449C8 00021403 */ sra $v0, $v0, 0x10 -/* 137D0C 802449CC 00430018 */ mult $v0, $v1 -/* 137D10 802449D0 00006812 */ mflo $t5 -/* 137D14 802449D4 000D11C3 */ sra $v0, $t5, 7 -/* 137D18 802449D8 04420001 */ bltzl $v0, .L802449E0 -/* 137D1C 802449DC 0000102D */ daddu $v0, $zero, $zero -.L802449E0: -/* 137D20 802449E0 01421023 */ subu $v0, $t2, $v0 -/* 137D24 802449E4 08091283 */ j .L80244A0C -/* 137D28 802449E8 3042FFFF */ andi $v0, $v0, 0xffff -.L802449EC: -/* 137D2C 802449EC 00021403 */ sra $v0, $v0, 0x10 -/* 137D30 802449F0 00430018 */ mult $v0, $v1 -/* 137D34 802449F4 00006812 */ mflo $t5 -/* 137D38 802449F8 000D11C3 */ sra $v0, $t5, 7 -/* 137D3C 802449FC 5C400001 */ bgtzl $v0, .L80244A04 -/* 137D40 80244A00 0000102D */ daddu $v0, $zero, $zero -.L80244A04: -/* 137D44 80244A04 01421023 */ subu $v0, $t2, $v0 -/* 137D48 80244A08 3042FFFF */ andi $v0, $v0, 0xffff -.L80244A0C: -/* 137D4C 80244A0C 00C21025 */ or $v0, $a2, $v0 -/* 137D50 80244A10 AC820000 */ sw $v0, ($a0) -/* 137D54 80244A14 3C03800A */ lui $v1, %hi(gMasterGfxPos) -/* 137D58 80244A18 2463A66C */ addiu $v1, $v1, %lo(gMasterGfxPos) -/* 137D5C 80244A1C 8C620000 */ lw $v0, ($v1) -/* 137D60 80244A20 0040202D */ daddu $a0, $v0, $zero -/* 137D64 80244A24 24420008 */ addiu $v0, $v0, 8 -/* 137D68 80244A28 AC620000 */ sw $v0, ($v1) -/* 137D6C 80244A2C 3C02F100 */ lui $v0, 0xf100 -/* 137D70 80244A30 AC820000 */ sw $v0, ($a0) -/* 137D74 80244A34 000B1400 */ sll $v0, $t3, 0x10 -/* 137D78 80244A38 3183FFFF */ andi $v1, $t4, 0xffff -/* 137D7C 80244A3C 00431025 */ or $v0, $v0, $v1 -/* 137D80 80244A40 AC820004 */ sw $v0, 4($a0) -.L80244A44: -/* 137D84 80244A44 03E00008 */ jr $ra -/* 137D88 80244A48 00000000 */ nop diff --git a/ver/us/asm/nonmatchings/pause/135EE0/pause_sort_item_list.s b/ver/us/asm/nonmatchings/pause/135EE0/pause_sort_item_list.s deleted file mode 100644 index e24c7ad0e0..0000000000 --- a/ver/us/asm/nonmatchings/pause/135EE0/pause_sort_item_list.s +++ /dev/null @@ -1,96 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel pause_sort_item_list -/* 137D8C 80244A4C 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 137D90 80244A50 AFB60028 */ sw $s6, 0x28($sp) -/* 137D94 80244A54 0080B02D */ daddu $s6, $a0, $zero -/* 137D98 80244A58 AFB7002C */ sw $s7, 0x2c($sp) -/* 137D9C 80244A5C 00C0B82D */ daddu $s7, $a2, $zero -/* 137DA0 80244A60 28A20002 */ slti $v0, $a1, 2 -/* 137DA4 80244A64 AFBF0030 */ sw $ra, 0x30($sp) -/* 137DA8 80244A68 AFB50024 */ sw $s5, 0x24($sp) -/* 137DAC 80244A6C AFB40020 */ sw $s4, 0x20($sp) -/* 137DB0 80244A70 AFB3001C */ sw $s3, 0x1c($sp) -/* 137DB4 80244A74 AFB20018 */ sw $s2, 0x18($sp) -/* 137DB8 80244A78 AFB10014 */ sw $s1, 0x14($sp) -/* 137DBC 80244A7C 14400038 */ bnez $v0, .L80244B60 -/* 137DC0 80244A80 AFB00010 */ sw $s0, 0x10($sp) -/* 137DC4 80244A84 24020002 */ addiu $v0, $zero, 2 -/* 137DC8 80244A88 14A2000A */ bne $a1, $v0, .L80244AB4 -/* 137DCC 80244A8C 24140001 */ addiu $s4, $zero, 1 -/* 137DD0 80244A90 02E0F809 */ jalr $s7 -/* 137DD4 80244A94 02C22821 */ addu $a1, $s6, $v0 -/* 137DD8 80244A98 18400031 */ blez $v0, .L80244B60 -/* 137DDC 80244A9C 00000000 */ nop -/* 137DE0 80244AA0 96C20002 */ lhu $v0, 2($s6) -/* 137DE4 80244AA4 96C30000 */ lhu $v1, ($s6) -/* 137DE8 80244AA8 A6C20000 */ sh $v0, ($s6) -/* 137DEC 80244AAC 080912D8 */ j .L80244B60 -/* 137DF0 80244AB0 A6C30002 */ sh $v1, 2($s6) -.L80244AB4: -/* 137DF4 80244AB4 0285102B */ sltu $v0, $s4, $a1 -/* 137DF8 80244AB8 50400007 */ beql $v0, $zero, .L80244AD8 -/* 137DFC 80244ABC 0014A042 */ srl $s4, $s4, 1 -/* 137E00 80244AC0 00141040 */ sll $v0, $s4, 1 -.L80244AC4: -/* 137E04 80244AC4 24540001 */ addiu $s4, $v0, 1 -/* 137E08 80244AC8 0285102B */ sltu $v0, $s4, $a1 -/* 137E0C 80244ACC 1440FFFD */ bnez $v0, .L80244AC4 -/* 137E10 80244AD0 00141040 */ sll $v0, $s4, 1 -/* 137E14 80244AD4 0014A042 */ srl $s4, $s4, 1 -.L80244AD8: -/* 137E18 80244AD8 00051040 */ sll $v0, $a1, 1 -/* 137E1C 80244ADC 12800020 */ beqz $s4, .L80244B60 -/* 137E20 80244AE0 02C2A821 */ addu $s5, $s6, $v0 -.L80244AE4: -/* 137E24 80244AE4 00141840 */ sll $v1, $s4, 1 -/* 137E28 80244AE8 02C39021 */ addu $s2, $s6, $v1 -/* 137E2C 80244AEC 0255102B */ sltu $v0, $s2, $s5 -/* 137E30 80244AF0 10400019 */ beqz $v0, .L80244B58 -/* 137E34 80244AF4 00141042 */ srl $v0, $s4, 1 -/* 137E38 80244AF8 0060982D */ daddu $s3, $v1, $zero -/* 137E3C 80244AFC 02538023 */ subu $s0, $s2, $s3 -.L80244B00: -/* 137E40 80244B00 080912CD */ j .L80244B34 -/* 137E44 80244B04 0216102B */ sltu $v0, $s0, $s6 -.L80244B08: -/* 137E48 80244B08 02138821 */ addu $s1, $s0, $s3 -/* 137E4C 80244B0C 02E0F809 */ jalr $s7 -/* 137E50 80244B10 0220282D */ daddu $a1, $s1, $zero -/* 137E54 80244B14 5840000C */ blezl $v0, .L80244B48 -/* 137E58 80244B18 26520002 */ addiu $s2, $s2, 2 -/* 137E5C 80244B1C 96220000 */ lhu $v0, ($s1) -/* 137E60 80244B20 96030000 */ lhu $v1, ($s0) -/* 137E64 80244B24 A6020000 */ sh $v0, ($s0) -/* 137E68 80244B28 02138023 */ subu $s0, $s0, $s3 -/* 137E6C 80244B2C 0216102B */ sltu $v0, $s0, $s6 -/* 137E70 80244B30 A6230000 */ sh $v1, ($s1) -.L80244B34: -/* 137E74 80244B34 14400003 */ bnez $v0, .L80244B44 -/* 137E78 80244B38 0215102B */ sltu $v0, $s0, $s5 -/* 137E7C 80244B3C 1440FFF2 */ bnez $v0, .L80244B08 -/* 137E80 80244B40 0200202D */ daddu $a0, $s0, $zero -.L80244B44: -/* 137E84 80244B44 26520002 */ addiu $s2, $s2, 2 -.L80244B48: -/* 137E88 80244B48 0255102B */ sltu $v0, $s2, $s5 -/* 137E8C 80244B4C 5440FFEC */ bnel $v0, $zero, .L80244B00 -/* 137E90 80244B50 02538023 */ subu $s0, $s2, $s3 -/* 137E94 80244B54 00141042 */ srl $v0, $s4, 1 -.L80244B58: -/* 137E98 80244B58 1440FFE2 */ bnez $v0, .L80244AE4 -/* 137E9C 80244B5C 0040A02D */ daddu $s4, $v0, $zero -.L80244B60: -/* 137EA0 80244B60 8FBF0030 */ lw $ra, 0x30($sp) -/* 137EA4 80244B64 8FB7002C */ lw $s7, 0x2c($sp) -/* 137EA8 80244B68 8FB60028 */ lw $s6, 0x28($sp) -/* 137EAC 80244B6C 8FB50024 */ lw $s5, 0x24($sp) -/* 137EB0 80244B70 8FB40020 */ lw $s4, 0x20($sp) -/* 137EB4 80244B74 8FB3001C */ lw $s3, 0x1c($sp) -/* 137EB8 80244B78 8FB20018 */ lw $s2, 0x18($sp) -/* 137EBC 80244B7C 8FB10014 */ lw $s1, 0x14($sp) -/* 137EC0 80244B80 8FB00010 */ lw $s0, 0x10($sp) -/* 137EC4 80244B84 03E00008 */ jr $ra -/* 137EC8 80244B88 27BD0038 */ addiu $sp, $sp, 0x38 -/* 137ECC 80244B8C 00000000 */ nop