From 9496ea78e5d7df2a6e9533f3ca4956f46567a797 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Sat, 11 Dec 2021 22:59:46 -0500 Subject: [PATCH 1/3] Fix mislabeled ScreenViewport struct values, created simple macros for video with and height calcls, and found a match for func_80066940 --- src/camera.c | 104 +++++++++++++++++++++---------------------- src/camera.h | 6 +-- src/font.c | 7 ++- src/menu.c | 4 +- src/unknown_078050.c | 3 +- src/video.c | 2 +- src/video.h | 9 ++++ 7 files changed, 72 insertions(+), 63 deletions(-) diff --git a/src/camera.c b/src/camera.c index ce8f89bd..628841dc 100644 --- a/src/camera.c +++ b/src/camera.c @@ -29,6 +29,10 @@ const char D_800E7048[] = "camPopModelMtx: bsp stack negative overflow!!\n"; s8 D_800DD060 = 0; +// x1, y1, x2, y2 +// posX, posY, width, height +// scissorX1, scissorY1, scissorX2, scissorY2 +// flags #define DEFAULT_VIEWPORT \ 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, \ SCREEN_WIDTH_HALF, SCREEN_HEIGHT_HALF, SCREEN_WIDTH, SCREEN_HEIGHT, \ @@ -161,7 +165,7 @@ void func_80065EA0(void) { D_80120D18 = 0; D_80120D15 = 0; D_800DD060 = 0; - while (IO_READ(PI_STATUS_REG) & 3) { + while (IO_READ(PI_STATUS_REG) & PI_STATUS_ERROR) { } if ((D_B0000578 & 0xFFFF) != 0x8965) { D_800DD060 = 1; @@ -447,66 +451,58 @@ s32 func_80066910(s32 viewPortIndex) { return gScreenViewports[viewPortIndex].flags & VIEWPORT_UNK_01; } -#ifdef NON_MATCHING - -// Should be functionally equivalent. -// proposed name: reesize_viewport -void func_80066940(s32 viewPortIndex, s32 x1, s32 x2, s32 y1, s32 y2) { +// proposed name: resize_viewport +void func_80066940(s32 viewPortIndex, s32 x1, s32 y1, s32 x2, s32 y2) { s32 widthAndHeight, width, height; - s32 tempX1; - s32 tempY2; - s32 tempX2; + s32 temp; widthAndHeight = get_video_width_and_height_as_s32(); - width = widthAndHeight & 0xFFFF; - // Placement issues with the height variable. - height = (widthAndHeight >> 0x10) & 0xFFFF; - tempY2 = y2; - tempX2 = x2; - tempX1 = x1; + height = GET_VIDEO_HEIGHT(widthAndHeight) & 0xFFFF; + width = GET_VIDEO_WIDTH(widthAndHeight); + if (x2 < x1) { - tempX1 = x2; - tempX2 = x1; + temp = x1; + x1 = x2; + x2 = temp; } if (y2 < y1) { + temp = y1; y1 = y2; - tempY2 = y1; + y2 = temp; } - if ((tempX1 >= width) || (tempX2 < 0) || (y1 >= height) || (tempY2 < 0)) { + + if ((x1 >= width) || (x2 < 0) || (y1 >= height) || (y2 < 0)) { gScreenViewports[viewPortIndex].scissorX1 = 0; gScreenViewports[viewPortIndex].scissorY1 = 0; gScreenViewports[viewPortIndex].scissorX2 = 0; gScreenViewports[viewPortIndex].scissorY2 = 0; } else { - if (tempX1 < 0) { + if (x1 < 0) { gScreenViewports[viewPortIndex].scissorX1 = 0; } else { - gScreenViewports[viewPortIndex].scissorX1 = tempX1; + gScreenViewports[viewPortIndex].scissorX1 = x1; } if (y1 < 0) { gScreenViewports[viewPortIndex].scissorY1 = 0; } else { gScreenViewports[viewPortIndex].scissorY1 = y1; } - if (tempX2 >= width) { + if (x2 >= width) { gScreenViewports[viewPortIndex].scissorX2 = width - 1; } else { - gScreenViewports[viewPortIndex].scissorX2 = tempX2; + gScreenViewports[viewPortIndex].scissorX2 = x2; } - if (tempY2 >= height) { + if (y2 >= height) { gScreenViewports[viewPortIndex].scissorY2 = height - 1; } else { - gScreenViewports[viewPortIndex].scissorY2 = tempY2; + gScreenViewports[viewPortIndex].scissorY2 = y2; } } gScreenViewports[viewPortIndex].y1 = y1; - gScreenViewports[viewPortIndex].x1 = tempX1; - gScreenViewports[viewPortIndex].x2 = tempX2; - gScreenViewports[viewPortIndex].y2 = tempY2; + gScreenViewports[viewPortIndex].x1 = x1; + gScreenViewports[viewPortIndex].x2 = x2; + gScreenViewports[viewPortIndex].y2 = y2; } -#else -GLOBAL_ASM("asm/non_matchings/camera/func_80066940.s") -#endif /** * Set the selected viewport's coordinate offsets and view size. @@ -562,8 +558,8 @@ s32 copy_viewport_background_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, */ void copy_viewport_frame_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 *x2, s32 *y2) { *x1 = gScreenViewports[viewPortIndex].x1; - *y1 = gScreenViewports[viewPortIndex].x2; - *x2 = gScreenViewports[viewPortIndex].y1; + *y1 = gScreenViewports[viewPortIndex].y1; + *x2 = gScreenViewports[viewPortIndex].x2; *y2 = gScreenViewports[viewPortIndex].y2; } @@ -571,11 +567,11 @@ void copy_viewport_frame_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 * Unused function that sets the passed values to the framebuffer's size in coordinates. */ UNUSED void copy_framebuffer_size_to_coords(s32 *x1, s32 *y1, s32 *x2, s32 *y2) { - u32 width = get_video_width_and_height_as_s32(); + u32 widthAndHeight = get_video_width_and_height_as_s32(); *x1 = 0; *y1 = 0; - *x2 = width & 0xFFFF; - *y2 = width >> 16; + *x2 = GET_VIDEO_WIDTH(widthAndHeight); + *y2 = GET_VIDEO_HEIGHT(widthAndHeight); } #ifdef NON_MATCHING @@ -592,7 +588,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { u32 temp_a2; u32 temp_a3; u32 temp_t0; - u32 temp_t1; + u32 width; u32 widthAndHeight; u32 temp_v0_6; u32 phi_a1; @@ -619,11 +615,11 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { } return; } - temp_t1 = widthAndHeight & 0xFFFF; + width = GET_VIDEO_WIDTH(widthAndHeight); if (gNumberOfViewports == VIEWPORTS_COUNT_3_PLAYERS) { gNumberOfViewports = VIEWPORTS_COUNT_4_PLAYERS; } - temp_a2 = temp_t1 >> 1; + temp_a2 = width >> 1; sp54 = temp_a2; sp58 = temp_a3; if (osTvType == TV_TYPE_PAL) { @@ -636,7 +632,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { if (osTvType == TV_TYPE_PAL) { phi_t3 = sp58 - 0x12; } - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, temp_t0); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, width, temp_t0); sp4C = temp_a2; break; case VIEWPORTS_COUNT_2_PLAYERS: @@ -646,20 +642,20 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { if (osTvType == TV_TYPE_PAL) { phi_t3 = temp_v0_6 - 0xC; } - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, (temp_a3 - (temp_t0 >> 7))); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, width, (temp_a3 - (temp_t0 >> 7))); } else { - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, (temp_a3 + (temp_t0 >> 7)), temp_t1, (temp_t0 - (temp_t0 >> 7))); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, (temp_a3 + (temp_t0 >> 7)), width, (temp_t0 - (temp_t0 >> 7))); phi_t3 = temp_a3 + (temp_t0 >> 2); } sp4C = temp_a2; break; case VIEWPORTS_COUNT_3_PLAYERS: if (D_80120CE4 == 0) { - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_a2 - (temp_t1 >> 8), temp_t0); - phi_a1 = temp_t1 >> 2; + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_a2 - (width >> 8), temp_t0); + phi_a1 = width >> 2; } else { - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), 0, temp_t1 - (temp_t1 >> 8), temp_t0); - phi_a1 = temp_a2 + (temp_t1 >> 2); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (width >> 8), 0, width - (width >> 8), temp_t0); + phi_a1 = temp_a2 + (width >> 2); } sp4C = phi_a1; phi_t3 = sp58; @@ -669,21 +665,21 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { sp54 = temp_a2 >> 1; switch (D_80120CE4) { case 0: - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0.0f, 0.0f, (temp_a2 - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7))); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0.0f, 0.0f, (temp_a2 - (width >> 8)), (temp_a3 - (temp_t0 >> 7))); phi_t5 = 0; phi_t4 = 0; case 1: - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, (temp_a2 + (temp_t1 >> 8)), 0, ((temp_a2 * 2) - (temp_t1 >> 8)), (temp_a3 - (temp_t0 >> 7))); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, (temp_a2 + (width >> 8)), 0, ((temp_a2 * 2) - (width >> 8)), (temp_a3 - (temp_t0 >> 7))); phi_t5 = 0; phi_t4 = temp_a2; break; case 2: - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, temp_a3 + (temp_t0 >> 7), temp_a2 - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7)); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, temp_a3 + (temp_t0 >> 7), temp_a2 - (width >> 8), (temp_a3 * 2) - (temp_t0 >> 7)); phi_t5 = temp_a3; phi_t4 = 0; break; case 3: - gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (temp_t1 >> 8), temp_a3 + (temp_t0 >> 7), (temp_a2 * 2) - (temp_t1 >> 8), (temp_a3 * 2) - (temp_t0 >> 7)); + gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, temp_a2 + (width >> 8), temp_a3 + (temp_t0 >> 7), (temp_a2 * 2) - (width >> 8), (temp_a3 * 2) - (temp_t0 >> 7)); phi_t5 = temp_a3; phi_t4 = temp_a2; break; @@ -738,8 +734,8 @@ void func_80067F2C(Gfx **dlist, s32 *arg1) { s32 i, j; widthAndHeight = get_video_width_and_height_as_s32(); - height = widthAndHeight >> 0x10; - width = widthAndHeight & 0xFFFF; + height = GET_VIDEO_HEIGHT(widthAndHeight); + width = GET_VIDEO_WIDTH(widthAndHeight); func_8006F870(gOrthoMatrix, *arg1); D_80120D88[0] = *arg1; D_800DD148[D_80120CE4 + 5].vp.vscale[0] = width * 2; @@ -796,8 +792,8 @@ void func_800682AC(Gfx **dlist) { u32 widthAndHeight, width, height; D_80120CE4 = 4; widthAndHeight = get_video_width_and_height_as_s32(); - height = widthAndHeight >> 0x10; - width = widthAndHeight & 0xFFFF; + height = GET_VIDEO_HEIGHT(widthAndHeight); + width = GET_VIDEO_WIDTH(widthAndHeight); if (!(gScreenViewports[D_80120CE4].flags & VIEWPORT_UNK_01)) { gDPSetScissor((*dlist)++, G_SC_NON_INTERLACE, 0, 0, width - 1, height - 1); func_80068158(dlist, width >> 1, height >> 1, width >> 1, height >> 1); diff --git a/src/camera.h b/src/camera.h index b8955939..20f1e4a1 100644 --- a/src/camera.h +++ b/src/camera.h @@ -54,8 +54,8 @@ extern s8 D_800DD060; /* Size: 0x34 bytes. */ typedef struct ScreenViewport { /* 0x00 */ s32 x1; - /* 0x04 */ s32 x2; - /* 0x08 */ s32 y1; + /* 0x04 */ s32 y1; + /* 0x08 */ s32 x2; /* 0x0C */ s32 y2; /* 0x10 */ s32 posX; /* 0x14 */ s32 posY; @@ -127,7 +127,7 @@ void func_800665E8(s32 arg0); void func_80066818(s32 viewPortIndex, s32 arg1); void func_80066894(s32 viewPortIndex, s32 arg1); s32 func_80066910(s32 viewPortIndex); -void func_80066940(s32 viewPortIndex, s32 posX, s32 posY, s32 width, s32 height); +void func_80066940(s32 viewPortIndex, s32 x1, s32 y1, s32 x2, s32 y2); void set_viewport_properties(s32 viewPortIndex, s32 x1, s32 x2, s32 y1, s32 y2); s32 copy_viewport_background_size_to_coords(s32 viewPortIndex, s32 *x1, s32 *y1, s32 *x2, s32 *y2); void copy_viewport_frame_size_to_coords(s32 viewPortIndex, s32 *arg1, s32 *arg2, s32 *arg3, s32 *arg4); diff --git a/src/font.c b/src/font.c index f8c34f4d..bd15a94d 100644 --- a/src/font.c +++ b/src/font.c @@ -619,8 +619,11 @@ GLOBAL_ASM("asm/non_matchings/font/s32_to_string.s") * lrx, lry = lower-right position */ void render_fill_rectangle(Gfx **dlist, s32 ulx, s32 uly, s32 lrx, s32 lry) { - u32 temp_v0 = get_video_width_and_height_as_s32(); - if (lrx >= 0 && ulx < (temp_v0 & 0xFFFF) && lry >= 0 && uly < (temp_v0 >> 16)) { + u32 widthAndHeight = get_video_width_and_height_as_s32(); + u32 width = GET_VIDEO_WIDTH(widthAndHeight); + u32 height = GET_VIDEO_HEIGHT(widthAndHeight); + + if (lrx >= 0 && ulx < width && lry >= 0 && uly < height) { if (ulx < 0) { ulx = 0; } diff --git a/src/menu.c b/src/menu.c index a378ea78..b8aeb175 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2170,10 +2170,10 @@ void menu_logos_screen_init(void) { sBootScreenTimer = 16.0f; set_background_fill_colour(0, 0, 0); if (osTvType == TV_TYPE_PAL) { - func_80066940(0, 0, 38, SCREEN_WIDTH, 224); + func_80066940(0, 0, 38, SCREEN_WIDTH, SCREEN_HEIGHT - 16); set_viewport_properties(0, VIEWPORT_AUTO, VIEWPORT_AUTO, SCREEN_WIDTH, SCREEN_HEIGHT + 44); } else { - func_80066940(0, 0, 40, SCREEN_WIDTH, 196); + func_80066940(0, 0, 40, SCREEN_WIDTH, SCREEN_HEIGHT - 44); set_viewport_properties(0, VIEWPORT_AUTO, VIEWPORT_AUTO, SCREEN_WIDTH, SCREEN_HEIGHT); } func_80066610(); diff --git a/src/unknown_078050.c b/src/unknown_078050.c index 2ea9dc83..424e2c8d 100644 --- a/src/unknown_078050.c +++ b/src/unknown_078050.c @@ -5,6 +5,7 @@ #include "types.h" #include "structs.h" #include "macros.h" +#include "video.h" //#include "lib/src/unknown_0D24D0.h" /************ .data ************/ @@ -277,7 +278,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_078050/render_background.s") * afterwards, alls the draw command that initialises all the rendermodes, ready for use. */ void init_rdp_and_framebuffer(Gfx **dlist) { - s32 width = get_video_width_and_height_as_s32() & 0xFFF; + s32 width = GET_VIDEO_WIDTH(get_video_width_and_height_as_s32()); gDPSetColorImage((*dlist)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, 0x01000000); gDPSetDepthImage((*dlist)++, 0x2000000); gSPDisplayList((*dlist)++, dRdpInit); diff --git a/src/video.c b/src/video.c index 78c82a63..5afa44d4 100644 --- a/src/video.c +++ b/src/video.c @@ -120,7 +120,7 @@ UNUSED void set_video_width_and_height_from_index(s32 fbIndex) { } /** - * Return the current framebuffer dimenions as a single s32 value. + * Return the current framebuffer dimensions as a single s32 value. * The high 16 bits are the height of the frame, and the low 16 bits are the width. */ s32 get_video_width_and_height_as_s32(void) { diff --git a/src/video.h b/src/video.h index f80c53c6..db4aedd9 100644 --- a/src/video.h +++ b/src/video.h @@ -32,6 +32,15 @@ #define HEIGHT_RATIO_NTSC (LOW_RES_NTSC_HEIGHT / LOW_RES_NTSC_HEIGHT) #define HEIGHT_RATIO_MPAL (LOW_RES_MPAL_HEIGHT / LOW_RES_NTSC_HEIGHT) +/** + * The video width is the lower 16 bits of the returned 32 bit value + */ +#define GET_VIDEO_WIDTH(width_and_height) (width_and_height & 0xFFFF) +/** + * The video width is the higher 16 bits of the returned 32 bit value + */ +#define GET_VIDEO_HEIGHT(width_and_height) (width_and_height >> 16) + /** * Values for the rate game logic will work depending on the framerate. Vanilla DKR will default to LOGIC_30FPS (2) */ From e9dc3e7adf7de30b488b3d89b223f28fe0c16c41 Mon Sep 17 00:00:00 2001 From: AntonioCastelli Date: Sun, 12 Dec 2021 14:10:02 -0800 Subject: [PATCH 2/3] Disabled non-equivalent function. (#193) * Refactored variable. From comment in https://github.com/DavidSM64/Diddy-Kong-Racing/pull/189. * Disabled non-equivalent function. https://discord.com/channels/617205155074539529/683041013563916402/915436777035165766 --- src/unknown_0255E0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unknown_0255E0.c b/src/unknown_0255E0.c index 805c409d..daef1b60 100644 --- a/src/unknown_0255E0.c +++ b/src/unknown_0255E0.c @@ -506,8 +506,8 @@ void render_level_geometry_and_objects(void) { GLOBAL_ASM("asm/non_matchings/unknown_0255E0/render_level_geometry_and_objects.s") #endif -// *Should *be functionally equivalent. -#ifdef NON_MATCHING +// Breaks on everdrive. +#if 0 // nonOpaque: 0 for solid geometry, 1 for transparent geometry. void render_level_segment(s32 segmentId, s32 nonOpaque) { LevelModelSegment *segment = &gCurrentLevelModel->segments[segmentId]; // spAC From c1bb834e0b769bc6a97a3c8a23eea9ee9594f68c Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Mon, 13 Dec 2021 09:00:02 -0500 Subject: [PATCH 3/3] Delete func_80066940.s as it's now matching --- asm/non_matchings/camera/func_80066940.s | 104 ----------------------- 1 file changed, 104 deletions(-) delete mode 100644 asm/non_matchings/camera/func_80066940.s diff --git a/asm/non_matchings/camera/func_80066940.s b/asm/non_matchings/camera/func_80066940.s deleted file mode 100644 index e0587fbf..00000000 --- a/asm/non_matchings/camera/func_80066940.s +++ /dev/null @@ -1,104 +0,0 @@ -glabel func_80066940 -/* 067540 80066940 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 067544 80066944 AFBF001C */ sw $ra, 0x1c($sp) -/* 067548 80066948 AFB00018 */ sw $s0, 0x18($sp) -/* 06754C 8006694C 00C08025 */ move $s0, $a2 -/* 067550 80066950 AFA40020 */ sw $a0, 0x20($sp) -/* 067554 80066954 AFA50024 */ sw $a1, 0x24($sp) -/* 067558 80066958 0C01E948 */ jal get_video_width_and_height_as_s32 -/* 06755C 8006695C AFA7002C */ sw $a3, 0x2c($sp) -/* 067560 80066960 8FA50024 */ lw $a1, 0x24($sp) -/* 067564 80066964 8FA7002C */ lw $a3, 0x2c($sp) -/* 067568 80066968 8FA80020 */ lw $t0, 0x20($sp) -/* 06756C 8006696C 8FA60030 */ lw $a2, 0x30($sp) -/* 067570 80066970 00E5082A */ slt $at, $a3, $a1 -/* 067574 80066974 10200004 */ beqz $at, .L80066988 -/* 067578 80066978 3044FFFF */ andi $a0, $v0, 0xffff -/* 06757C 8006697C 00A01825 */ move $v1, $a1 -/* 067580 80066980 00E02825 */ move $a1, $a3 -/* 067584 80066984 00603825 */ move $a3, $v1 -.L80066988: -/* 067588 80066988 00D0082A */ slt $at, $a2, $s0 -/* 06758C 8006698C 10200003 */ beqz $at, .L8006699C -/* 067590 80066990 02001825 */ move $v1, $s0 -/* 067594 80066994 00C08025 */ move $s0, $a2 -/* 067598 80066998 00603025 */ move $a2, $v1 -.L8006699C: -/* 06759C 8006699C 00A4082A */ slt $at, $a1, $a0 -/* 0675A0 800669A0 10200008 */ beqz $at, .L800669C4 -/* 0675A4 800669A4 00087880 */ sll $t7, $t0, 2 -/* 0675A8 800669A8 04E00006 */ bltz $a3, .L800669C4 -/* 0675AC 800669AC 00021C03 */ sra $v1, $v0, 0x10 -/* 0675B0 800669B0 306EFFFF */ andi $t6, $v1, 0xffff -/* 0675B4 800669B4 020E082A */ slt $at, $s0, $t6 -/* 0675B8 800669B8 10200002 */ beqz $at, .L800669C4 -/* 0675BC 800669BC 01C01825 */ move $v1, $t6 -/* 0675C0 800669C0 04C1000C */ bgez $a2, .L800669F4 -.L800669C4: -/* 0675C4 800669C4 01E87823 */ subu $t7, $t7, $t0 -/* 0675C8 800669C8 000F7880 */ sll $t7, $t7, 2 -/* 0675CC 800669CC 01E87821 */ addu $t7, $t7, $t0 -/* 0675D0 800669D0 3C18800E */ lui $t8, %hi(gScreenViewports) # $t8, 0x800e -/* 0675D4 800669D4 2718D064 */ addiu $t8, %lo(gScreenViewports) # addiu $t8, $t8, -0x2f9c -/* 0675D8 800669D8 000F7880 */ sll $t7, $t7, 2 -/* 0675DC 800669DC 01F81021 */ addu $v0, $t7, $t8 -/* 0675E0 800669E0 AC400020 */ sw $zero, 0x20($v0) -/* 0675E4 800669E4 AC400024 */ sw $zero, 0x24($v0) -/* 0675E8 800669E8 AC400028 */ sw $zero, 0x28($v0) -/* 0675EC 800669EC 10000026 */ b .L80066A88 -/* 0675F0 800669F0 AC40002C */ sw $zero, 0x2c($v0) -.L800669F4: -/* 0675F4 800669F4 04A1000B */ bgez $a1, .L80066A24 -/* 0675F8 800669F8 00E4082A */ slt $at, $a3, $a0 -/* 0675FC 800669FC 0008C880 */ sll $t9, $t0, 2 -/* 067600 80066A00 0328C823 */ subu $t9, $t9, $t0 -/* 067604 80066A04 0019C880 */ sll $t9, $t9, 2 -/* 067608 80066A08 0328C821 */ addu $t9, $t9, $t0 -/* 06760C 80066A0C 3C09800E */ lui $t1, %hi(gScreenViewports) # $t1, 0x800e -/* 067610 80066A10 2529D064 */ addiu $t1, %lo(gScreenViewports) # addiu $t1, $t1, -0x2f9c -/* 067614 80066A14 0019C880 */ sll $t9, $t9, 2 -/* 067618 80066A18 03291021 */ addu $v0, $t9, $t1 -/* 06761C 80066A1C 1000000A */ b .L80066A48 -/* 067620 80066A20 AC400020 */ sw $zero, 0x20($v0) -.L80066A24: -/* 067624 80066A24 00085080 */ sll $t2, $t0, 2 -/* 067628 80066A28 01485023 */ subu $t2, $t2, $t0 -/* 06762C 80066A2C 000A5080 */ sll $t2, $t2, 2 -/* 067630 80066A30 01485021 */ addu $t2, $t2, $t0 -/* 067634 80066A34 3C0B800E */ lui $t3, %hi(gScreenViewports) # $t3, 0x800e -/* 067638 80066A38 256BD064 */ addiu $t3, %lo(gScreenViewports) # addiu $t3, $t3, -0x2f9c -/* 06763C 80066A3C 000A5080 */ sll $t2, $t2, 2 -/* 067640 80066A40 014B1021 */ addu $v0, $t2, $t3 -/* 067644 80066A44 AC450020 */ sw $a1, 0x20($v0) -.L80066A48: -/* 067648 80066A48 06010003 */ bgez $s0, .L80066A58 -/* 06764C 80066A4C 00000000 */ nop -/* 067650 80066A50 10000002 */ b .L80066A5C -/* 067654 80066A54 AC400024 */ sw $zero, 0x24($v0) -.L80066A58: -/* 067658 80066A58 AC500024 */ sw $s0, 0x24($v0) -.L80066A5C: -/* 06765C 80066A5C 14200003 */ bnez $at, .L80066A6C -/* 067660 80066A60 248CFFFF */ addiu $t4, $a0, -1 -/* 067664 80066A64 10000002 */ b .L80066A70 -/* 067668 80066A68 AC4C0028 */ sw $t4, 0x28($v0) -.L80066A6C: -/* 06766C 80066A6C AC470028 */ sw $a3, 0x28($v0) -.L80066A70: -/* 067670 80066A70 00C3082A */ slt $at, $a2, $v1 -/* 067674 80066A74 14200003 */ bnez $at, .L80066A84 -/* 067678 80066A78 246DFFFF */ addiu $t5, $v1, -1 -/* 06767C 80066A7C 10000002 */ b .L80066A88 -/* 067680 80066A80 AC4D002C */ sw $t5, 0x2c($v0) -.L80066A84: -/* 067684 80066A84 AC46002C */ sw $a2, 0x2c($v0) -.L80066A88: -/* 067688 80066A88 8FBF001C */ lw $ra, 0x1c($sp) -/* 06768C 80066A8C AC500004 */ sw $s0, 4($v0) -/* 067690 80066A90 8FB00018 */ lw $s0, 0x18($sp) -/* 067694 80066A94 AC450000 */ sw $a1, ($v0) -/* 067698 80066A98 AC470008 */ sw $a3, 8($v0) -/* 06769C 80066A9C AC46000C */ sw $a2, 0xc($v0) -/* 0676A0 80066AA0 03E00008 */ jr $ra -/* 0676A4 80066AA4 27BD0020 */ addiu $sp, $sp, 0x20 -