From 55f7ffe3007a5ffe0ae358ba95a89798aaf4ad53 Mon Sep 17 00:00:00 2001 From: Fazana <52551480+FazanaJ@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:24:00 +0000 Subject: [PATCH] make requested changes --- .../controller_pak/func_8007431C.s | 2 +- .../controller_pak/func_800744DC.s | 2 +- .../controller_pak/func_800746F0.s | 4 +- .../controller_pak/func_8007497C.s | 2 +- src/audio.c | 10 +-- src/controller_pak.c | 2 +- src/fade_transition.c | 16 ++-- src/font.c | 8 +- src/font.h | 2 +- src/menu.c | 80 +++++++++---------- src/menu.h | 2 +- src/thread0_epc.c | 4 +- src/unknown_06B2B0.c | 62 +++++++------- src/unknown_06B2B0.h | 2 +- src/video.c | 24 +++--- src/video.h | 15 ++++ 16 files changed, 126 insertions(+), 111 deletions(-) diff --git a/asm/non_matchings/controller_pak/func_8007431C.s b/asm/non_matchings/controller_pak/func_8007431C.s index 746e97a8..f24a91ea 100644 --- a/asm/non_matchings/controller_pak/func_8007431C.s +++ b/asm/non_matchings/controller_pak/func_8007431C.s @@ -97,7 +97,7 @@ glabel func_8007431C /* 075070 80074470 1605FFFA */ bne $s0, $a1, .L8007445C /* 075074 80074474 24630004 */ addiu $v1, $v1, 4 .L80074478: -/* 075078 80074478 0C01BAB0 */ jal check_reset_pressed +/* 075078 80074478 0C01BAB0 */ jal is_reset_pressed /* 07507C 8007447C AFA60054 */ sw $a2, 0x54($sp) /* 075080 80074480 8FA60054 */ lw $a2, 0x54($sp) /* 075084 80074484 1440000C */ bnez $v0, .L800744B8 diff --git a/asm/non_matchings/controller_pak/func_800744DC.s b/asm/non_matchings/controller_pak/func_800744DC.s index 47e0f76c..08dd48ce 100644 --- a/asm/non_matchings/controller_pak/func_800744DC.s +++ b/asm/non_matchings/controller_pak/func_800744DC.s @@ -38,7 +38,7 @@ glabel func_800744DC /* 07515C 8007455C 02202025 */ move $a0, $s1 /* 075160 80074560 0C01CCBA */ jal func_800732E8 /* 075164 80074564 00402825 */ move $a1, $v0 -/* 075168 80074568 0C01BAB0 */ jal check_reset_pressed +/* 075168 80074568 0C01BAB0 */ jal is_reset_pressed /* 07516C 8007456C 00000000 */ nop /* 075170 80074570 8FA3002C */ lw $v1, 0x2c($sp) /* 075174 80074574 1440000C */ bnez $v0, .L800745A8 diff --git a/asm/non_matchings/controller_pak/func_800746F0.s b/asm/non_matchings/controller_pak/func_800746F0.s index e84aa228..c22faf6e 100644 --- a/asm/non_matchings/controller_pak/func_800746F0.s +++ b/asm/non_matchings/controller_pak/func_800746F0.s @@ -24,7 +24,7 @@ glabel func_800746F0 /* 075344 80074744 322F0001 */ andi $t7, $s1, 1 /* 075348 80074748 11E00011 */ beqz $t7, .L80074790 /* 07534C 8007474C AFB10028 */ sw $s1, 0x28($sp) -/* 075350 80074750 0C01BAB0 */ jal check_reset_pressed +/* 075350 80074750 0C01BAB0 */ jal is_reset_pressed /* 075354 80074754 24110018 */ li $s1, 24 /* 075358 80074758 1440000D */ bnez $v0, .L80074790 /* 07535C 8007475C 00008025 */ move $s0, $zero @@ -47,7 +47,7 @@ glabel func_800746F0 /* 075398 80074798 31090002 */ andi $t1, $t0, 2 /* 07539C 8007479C 11200012 */ beqz $t1, .L800747E8 /* 0753A0 800747A0 00000000 */ nop -/* 0753A4 800747A4 0C01BAB0 */ jal check_reset_pressed +/* 0753A4 800747A4 0C01BAB0 */ jal is_reset_pressed /* 0753A8 800747A8 24110018 */ li $s1, 24 /* 0753AC 800747AC 1440000E */ bnez $v0, .L800747E8 /* 0753B0 800747B0 00008025 */ move $s0, $zero diff --git a/asm/non_matchings/controller_pak/func_8007497C.s b/asm/non_matchings/controller_pak/func_8007497C.s index 01d33668..d02bc25e 100644 --- a/asm/non_matchings/controller_pak/func_8007497C.s +++ b/asm/non_matchings/controller_pak/func_8007497C.s @@ -37,7 +37,7 @@ glabel func_8007497C /* 075604 80074A04 01C2C025 */ or $t8, $t6, $v0 /* 075608 80074A08 01E3C825 */ or $t9, $t7, $v1 /* 07560C 80074A0C AE190004 */ sw $t9, 4($s0) -/* 075610 80074A10 0C01BAB0 */ jal check_reset_pressed +/* 075610 80074A10 0C01BAB0 */ jal is_reset_pressed /* 075614 80074A14 AE180000 */ sw $t8, ($s0) /* 075618 80074A18 14400008 */ bnez $v0, .L80074A3C /* 07561C 80074A1C 24020001 */ li $v0, 1 diff --git a/src/audio.c b/src/audio.c index 8d1a2793..9122dc68 100644 --- a/src/audio.c +++ b/src/audio.c @@ -281,12 +281,12 @@ void func_80000CBC(void) { set_relative_volume_for_music(musicRelativeVolume); } -void func_80000D00(u8 mulFactor) { +void func_80000D00(u8 updateRate) { s32 reg_s2; s32 j; if (D_80115D3C > 0) { - D_80115D38 += mulFactor; + D_80115D38 += updateRate; D_800DC650 = ((f32)D_80115D38) / ((f32)D_80115D3C); if ((f64)D_800DC650 > 1.0f) { @@ -297,7 +297,7 @@ void func_80000D00(u8 mulFactor) { set_relative_volume_for_music(musicRelativeVolume); } else if (D_80115D3C < 0) { - D_80115D38 -= mulFactor; + D_80115D38 -= updateRate; D_800DC650 = 1.0f - ((f32)D_80115D38) / ((f32)D_80115D3C); if ((f64)D_800DC650 < 0) { D_80115D38 = 0; @@ -308,9 +308,9 @@ void func_80000D00(u8 mulFactor) { } if (D_800DC658 > 0) { - //reg_arg0 = mulFactor; + //reg_arg0 = updateRate; for (reg_s2 = 0; reg_s2 < D_800DC658;) { - D_80115D48[reg_s2].unk2 -= mulFactor; + D_80115D48[reg_s2].unk2 -= updateRate; if (D_80115D48[reg_s2].unk2 <= 0) { j = reg_s2; func_80001D04(D_80115D48[reg_s2].unk0, D_80115D48[reg_s2].unk4); diff --git a/src/controller_pak.c b/src/controller_pak.c index d9cac03b..ce0334fc 100644 --- a/src/controller_pak.c +++ b/src/controller_pak.c @@ -350,7 +350,7 @@ s32 func_8007497C(u64 *arg0) { *arg0 <<= 8; *arg0 >>= 8; *arg0 |= (s64)((s32)func_8007480C(*arg0)) << 56; - if (check_reset_pressed() == 0) { + if (is_reset_pressed() == 0) { osEepromWrite(func_8006A100(), 0xF, (u8 *)arg0); } return 1; diff --git a/src/fade_transition.c b/src/fade_transition.c index 9c73ed56..2253289b 100644 --- a/src/fade_transition.c +++ b/src/fade_transition.c @@ -288,12 +288,12 @@ s32 func_800C01D8(FadeTransition *transition) { GLOBAL_ASM("asm/non_matchings/fade_transition/func_800C01D8.s") #endif -s32 func_800C0494(s32 mulFactor) { +s32 func_800C0494(s32 updateRate) { if (D_800E31A4 != 0) { D_800E31A4 = D_800E31A4 - 1; - mulFactor = 0; - } else if (mulFactor >= 6) { - mulFactor = 5; + updateRate = LOGIC_NULL; + } else if (updateRate >= LOGIC_10FPS) { + updateRate = LOGIC_12FPS; } if (D_800E31AC != 0) { @@ -308,19 +308,19 @@ s32 func_800C0494(s32 mulFactor) { } switch (gCurFaceTransition) { case FADE_FULLSCREEN: - func_800C0834(mulFactor); + func_800C0834(updateRate); break; case FADE_BARNDOOR_HORIZONTAL: case FADE_BARNDOOR_VERTICAL: case FADE_WAVES: case FADE_BARNDOOR_DIAGONAL: - func_800C1130(mulFactor); + func_800C1130(updateRate); break; case FADE_CIRCLE: - func_800C1EE8(mulFactor); + func_800C1EE8(updateRate); break; case FADE_DISABLED: - func_800C27A0(mulFactor); + func_800C27A0(updateRate); break; } } diff --git a/src/font.c b/src/font.c index 9d0affd7..bb5f036a 100644 --- a/src/font.c +++ b/src/font.c @@ -243,8 +243,8 @@ void func_800C4404(Gfx **displayList, char *text, s32 alignmentFlags) { void draw_text(Gfx **displayList, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) { DialogueBoxBackground *temp = &(*gDialogueBoxBackground)[0]; - temp->xpos = (xpos == POS_X_CENTRED) ? temp->width >> 1 : xpos; - temp->ypos = (ypos == POS_X_CENTRED) ? temp->height >> 1 : ypos; + temp->xpos = (xpos == POS_CENTRED) ? temp->width >> 1 : xpos; + temp->ypos = (ypos == POS_CENTRED) ? temp->height >> 1 : ypos; func_800C45A4(displayList, temp, text, alignmentFlags, 1.0f); } @@ -260,8 +260,8 @@ void func_800C44C0(Gfx **displayList, s32 arg1, char *text, s32 alignmentFlags) void func_800C4510(Gfx **displayList, s32 arg1, s32 xpos, s32 ypos, char *text, s32 alignmentFlags) { if (arg1 >= 0 && arg1 < 8) { DialogueBoxBackground *temp = &gDialogueBoxBackground[arg1]; - temp->xpos = (xpos == POS_X_CENTRED) ? temp->width >> 1 : xpos; - temp->ypos = (ypos == POS_X_CENTRED) ? temp->height >> 1 : ypos; + temp->xpos = (xpos == POS_CENTRED) ? temp->width >> 1 : xpos; + temp->ypos = (ypos == POS_CENTRED) ? temp->height >> 1 : ypos; func_800C45A4(displayList, temp, text, alignmentFlags, 1.0f); } } diff --git a/src/font.h b/src/font.h index 029be63f..7348a5ff 100644 --- a/src/font.h +++ b/src/font.h @@ -14,7 +14,7 @@ #include "f3ddkr.h" #include "textures_sprites.h" -#define POS_X_CENTRED -0x8000 +#define POS_CENTRED -0x8000 enum TextFonts { FONT_COLOURFUL, diff --git a/src/menu.c b/src/menu.c index a9f27abd..3a1114a1 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2140,10 +2140,10 @@ void func_800828B8(void) { } } -void func_800829F8(Gfx *dl, s32 mulFactor) { +void func_800829F8(Gfx *dl, s32 updateRate) { s32 temp; - D_800DF46C += mulFactor; + D_800DF46C += updateRate; if (D_800DF46C & 0x10) { load_menu_text(get_language()); @@ -2154,7 +2154,7 @@ void func_800829F8(Gfx *dl, s32 mulFactor) { if (osTvType == TV_TYPE_PAL) { temp = 0xEA; } - draw_text(dl, POS_X_CENTRED, temp, gMenuText[151], 0xC); + draw_text(dl, POS_CENTRED, temp, gMenuText[151], 0xC); } } @@ -2215,8 +2215,8 @@ s32 menu_logo_screen_loop(s32 arg0) { set_text_color(0xFF, 0xFF, 0, 0xFF, phi_v0); draw_text(&D_801263A0, 0x9F, yOffset + 0xD4, gRareCopyrightString, 0xC); draw_text(&D_801263A0, 0xA1, yOffset + 0xD4, gRareCopyrightString, 0xC); - draw_text(&D_801263A0, POS_X_CENTRED, yOffset + 0xD3, gRareCopyrightString, 0xC); - draw_text(&D_801263A0, POS_X_CENTRED, yOffset + 0xD5, gRareCopyrightString, 0xC); + draw_text(&D_801263A0, POS_CENTRED, yOffset + 0xD3, gRareCopyrightString, 0xC); + draw_text(&D_801263A0, POS_CENTRED, yOffset + 0xD5, gRareCopyrightString, 0xC); } sp20 = yOffset + 0xD4; if (D_80126450 > 8.0) { @@ -2225,7 +2225,7 @@ s32 menu_logo_screen_loop(s32 arg0) { phi_v0 = 0xFF; } set_text_color(0xFF, 0xFF, 0xFF, 0xFF, phi_v0); - draw_text(&D_801263A0, POS_X_CENTRED, sp20, gRareCopyrightString, 0xC); + draw_text(&D_801263A0, POS_CENTRED, sp20, gRareCopyrightString, 0xC); } return 0; } @@ -2349,7 +2349,7 @@ void func_800841B8(s32 arg0) { phi_a3 = 0; } set_text_color(255, 255, 255, phi_a3, 0xFF); - draw_text(&D_801263A0, POS_X_CENTRED, phi_s2, gOptionMenuStrings[phi_s1], 0xC); + draw_text(&D_801263A0, POS_CENTRED, phi_s2, gOptionMenuStrings[phi_s1], 0xC); phi_s1++; phi_s2 += 0x1C; @@ -3067,7 +3067,7 @@ void render_magic_codes_ui(s32 arg0) { alpha = temp; } set_text_color(0xFF, 0xFF, 0xFF, alpha, 0xFF); - draw_text(&D_801263A0, POS_X_CENTRED, yPos, gMagicCodeMenuStrings[i], 0xC); + draw_text(&D_801263A0, POS_CENTRED, yPos, gMagicCodeMenuStrings[i], 0xC); yPos += yIncr; } set_text_font(0); @@ -3075,15 +3075,15 @@ void render_magic_codes_ui(s32 arg0) { set_text_background_color(0, 0, 0x80, 0x80); if (gOptionsMenuItemIndex == 4) { if (D_80126C4C == -1) { - draw_text(&D_801263A0, POS_X_CENTRED, 0x90, gMenuText[18], 0xC); // gMenuText[18] = "Sorry, the code was incorrect" + draw_text(&D_801263A0, POS_CENTRED, 0x90, gMenuText[18], 0xC); // gMenuText[18] = "Sorry, the code was incorrect" } else { // Draw cheat code name. - draw_text(&D_801263A0, POS_X_CENTRED, 0x90, (char *)(*gCheatsAssetData) + (*gCheatsAssetData + 1)[D_80126C4C + 1], 0xC); + draw_text(&D_801263A0, POS_CENTRED, 0x90, (char *)(*gCheatsAssetData) + (*gCheatsAssetData + 1)[D_80126C4C + 1], 0xC); } } else if (5 == gOptionsMenuItemIndex) { - draw_text(&D_801263A0, POS_X_CENTRED, 0x90, D_80126C58, 0xC); + draw_text(&D_801263A0, POS_CENTRED, 0x90, D_80126C58, 0xC); } else if (gOptionsMenuItemIndex == 6) { - draw_text(&D_801263A0, POS_X_CENTRED, 0x90, gMenuText[19], 0xC); // gMenuText[19] = "All cheats have been deleted" + draw_text(&D_801263A0, POS_CENTRED, 0x90, gMenuText[19], 0xC); // gMenuText[19] = "All cheats have been deleted" } if (D_801263E0 != 0) { yPos = 0x78; @@ -3107,7 +3107,7 @@ void render_magic_codes_ui(s32 arg0) { set_current_text_colour(6, 0xFF, green, 0xFF, alpha, 0xFF); // gMenuText[148] = "CLEAR ALL CODES?", [149] = "OK", [150] = "CANCEL" - render_dialogue_text(6, POS_X_CENTRED, yPos, gMenuText[148 + i], 1, 4); + render_dialogue_text(6, POS_CENTRED, yPos, gMenuText[148 + i], 1, 4); if (i != 0) { yPos += 0x10; @@ -3199,7 +3199,7 @@ void render_magic_codes_list_menu_text(s32 arg0) { if (numOfUnlockedCheats == gOptionsMenuItemIndex) { set_text_color(0xFF, 0xFF, 0xFF, fp, 0xFF); } - draw_text(&D_801263A0, POS_X_CENTRED, s2, gMenuText[5], 4); // RETURN + draw_text(&D_801263A0, POS_CENTRED, s2, gMenuText[5], 4); // RETURN return; } if (D_801263BC & 8) { @@ -4379,7 +4379,7 @@ void render_track_select_setup_ui(s32 arg0) { set_text_font(2); set_text_color(0xC0, 0xC0, 0xFF, 0, D_800DF764); set_text_background_color(0, 0, 0, 0); - draw_text(&D_801263A0, POS_X_CENTRED, 0x2B, func_8006BDDC(gTrackIdForPreview), 0xC); // Draw track name? + draw_text(&D_801263A0, POS_CENTRED, 0x2B, func_8006BDDC(gTrackIdForPreview), 0xC); // Draw track name? sp84 = D_801263BC * 8; if (sp84 >= 0x100) { sp84 = 0x1FF - sp84; @@ -5951,17 +5951,17 @@ void func_8009CFB0(void) { } } -s32 func_8009CFEC(u32 arg0) { +s32 func_8009CFEC(u32 dialogueOption) { s32 result; - D_800DF4E4[arg0] = 0; - if ((func_800C3400() != 0) && (arg0 != 3)) { + D_800DF4E4[dialogueOption] = 0; + if ((func_800C3400() != 0) && (dialogueOption != DIALOG_CHALLENGE)) { return 0; } if (D_800DF4E0 != 0) { return 0; } - if (arg0 != 3) { + if (dialogueOption != 3) { func_8006F388(1); } result = 0; @@ -5970,7 +5970,7 @@ s32 func_8009CFEC(u32 arg0) { open_dialogue_box(1); set_current_dialogue_background_colour(1, 0, 0, 0, 0x80); func_8001F450(); - switch (arg0) { + switch (dialogueOption) { case DIALOG_TAJ: result = taj_menu_loop(); // Taj menu break; @@ -6011,7 +6011,7 @@ void render_dialogue_option(char *text, s32 yOffset, s32 optionID) { if (sDialogueOption == sDialogueOptionMax) { D_80126516 = optionID; } - render_dialogue_text(1, POS_X_CENTRED, gDialogOptionYOffset, text, 1, 4); + render_dialogue_text(1, POS_CENTRED, gDialogOptionYOffset, text, 1, 4); gDialogOptionYOffset = (s8)(gDialogOptionYOffset + yOffset); sDialogueOptionMax = (s8)(sDialogueOptionMax + 1); } @@ -6071,7 +6071,7 @@ s32 taj_menu_loop(void) { switch (sCurrentMenuID) { case 2: case 0x62: - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[40], 1, 4); // VEHICLE SELECT + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[40], 1, 4); // VEHICLE SELECT gDialogOptionYOffset = 30; render_dialogue_option(gMenuText[41], 20, 0); // CAR render_dialogue_option(gMenuText[42], 20, 1); // HOVERCRAFT @@ -6080,7 +6080,7 @@ s32 taj_menu_loop(void) { break; case 3: case 0x63: - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[45], 1, 4); // CHALLENGE SELECT + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[45], 1, 4); // CHALLENGE SELECT gDialogOptionYOffset = 30; if (settings->tajFlags & TAJ_FLAGS_CAR_CHAL_UNLOCKED) { gDialogOptionTangible = settings->tajFlags & TAJ_FLAGS_CAR_CHAL_COMPLETED; @@ -6106,7 +6106,7 @@ s32 taj_menu_loop(void) { break; case 1: D_800DF4DC = 0; - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[36], 1, 4); // OPTIONS + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[36], 1, 4); // OPTIONS gDialogOptionYOffset = 30; render_dialogue_option(gMenuText[37], 0x14, 0); // CHANGE VEHICLE if (settings->tajFlags & TAJ_FLAGS_UNLOCKED_A_CHALLENGE) { @@ -6226,8 +6226,8 @@ s32 func_8009D9F4(void) { playerInput = get_buttons_pressed_from_player(0); sDialogueOptionMax = 0; D_800DF4DC = 0; - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[49], 1, 4); // BETTER LUCK - render_dialogue_text(1, POS_X_CENTRED, 20, gMenuText[50], 1, 4); // NEXT TIME! + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[49], 1, 4); // BETTER LUCK + render_dialogue_text(1, POS_CENTRED, 20, gMenuText[50], 1, 4); // NEXT TIME! gDialogOptionYOffset = 50; render_dialogue_option(gMenuText[23], 20, 0); // TRY AGAIN render_dialogue_option(gMenuText[51], 20, 1); // EXIT @@ -6284,7 +6284,7 @@ s32 tt_menu_loop(void) { switch (sCurrentMenuID) { case TT_MENU_ROOT: case TT_MENU_EXIT: - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[36], 1, 4); // OPTIONS + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[36], 1, 4); // OPTIONS render_dialogue_option(gMenuText[71], 0x14, 3); // STATUS if (!is_in_two_player_adventure()) { if (is_time_trial_enabled()) { @@ -6354,7 +6354,7 @@ s32 tt_menu_loop(void) { sp38 -= sp24 * 8; sp24 = 0; while (D_801263A4[sp24] != NULL) { - render_dialogue_text(1, POS_X_CENTRED, sp38, D_801263A4[sp24], 1, 4); + render_dialogue_text(1, POS_CENTRED, sp38, D_801263A4[sp24], 1, 4); sp38 += 0x10; sp24++; } @@ -6374,7 +6374,7 @@ s32 tt_menu_loop(void) { case TT_MENU_INTRODUCTION: sp20 = 6; for (i = 52; gMenuText[i] != NULL; i++) { - render_dialogue_text(1, POS_X_CENTRED, sp20, gMenuText[i], 1, 4); + render_dialogue_text(1, POS_CENTRED, sp20, gMenuText[i], 1, 4); sp20 += 0x10; } if (buttonsPressed & (A_BUTTON | B_BUTTON)) { @@ -6383,9 +6383,9 @@ s32 tt_menu_loop(void) { } break; case TT_MENU_INSERT_CONT_PAK: - render_dialogue_text(1, POS_X_CENTRED, 34, gMenuText[159], 1, 4); // If you wish to use - render_dialogue_text(1, POS_X_CENTRED, 50, gMenuText[160], 1, 4); // the Controller Pak - render_dialogue_text(1, POS_X_CENTRED, 66, gMenuText[162], 1, 4); // insert it now! + render_dialogue_text(1, POS_CENTRED, 34, gMenuText[159], 1, 4); // If you wish to use + render_dialogue_text(1, POS_CENTRED, 50, gMenuText[160], 1, 4); // the Controller Pak + render_dialogue_text(1, POS_CENTRED, 66, gMenuText[162], 1, 4); // insert it now! if (buttonsPressed & (A_BUTTON | START_BUTTON)) { func_80001D04(0xEF, 0); D_80126398 = 0; @@ -6397,15 +6397,15 @@ s32 tt_menu_loop(void) { } break; case TT_MENU_INSERT_RUMBLE_PAK: - render_dialogue_text(1, POS_X_CENTRED, 34, gMenuText[159], 1, 4); // If you wish to use - render_dialogue_text(1, POS_X_CENTRED, 50, gMenuText[161], 1, 4); // the Rumble Pak - render_dialogue_text(1, POS_X_CENTRED, 66, gMenuText[162], 1, 4); // insert it now! + render_dialogue_text(1, POS_CENTRED, 34, gMenuText[159], 1, 4); // If you wish to use + render_dialogue_text(1, POS_CENTRED, 50, gMenuText[161], 1, 4); // the Rumble Pak + render_dialogue_text(1, POS_CENTRED, 66, gMenuText[162], 1, 4); // insert it now! if (buttonsPressed & (A_BUTTON | B_BUTTON | START_BUTTON)) { sCurrentMenuID = TT_MENU_ROOT; } break; case TT_MENU_SAVE_GHOST: - render_dialogue_text(1, POS_X_CENTRED, 50, gMenuText[124], 1, 4); // PLEASE WAIT + render_dialogue_text(1, POS_CENTRED, 50, gMenuText[124], 1, 4); // PLEASE WAIT D_80126398++; if (D_80126398 >= 5) { s32 result = func_8001B738(0) & 0xFF; @@ -6446,7 +6446,7 @@ s32 tt_menu_loop(void) { if ((sCurrentMenuID == TT_MENU_CONT_PAK_ERROR_1) || (sCurrentMenuID == TT_MENU_CONT_PAK_ERROR_2) || (sCurrentMenuID == TT_MENU_CONT_PAK_ERROR_3)) { - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[64], 1, 4); // PAK ERROR + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[64], 1, 4); // PAK ERROR } return currentOption; @@ -6465,7 +6465,7 @@ s32 trophy_race_cabinet_menu_loop(void) { set_dialogue_font(1, FONT_COLOURFUL); currentOption = 0; buttonsPressed = get_buttons_pressed_from_player(0); - render_dialogue_text(1, POS_X_CENTRED, 6, gMenuText[70], 1, 4); // TROPHY RACE + render_dialogue_text(1, POS_CENTRED, 6, gMenuText[70], 1, 4); // TROPHY RACE if (gControllersYAxisDirection[0] < 0) { sDialogueOption++; } else if (gControllersYAxisDirection[0] > 0) { @@ -6478,9 +6478,9 @@ s32 trophy_race_cabinet_menu_loop(void) { sDialogueOption = 1; } set_option_text_colour(sDialogueOption == 0); - render_dialogue_text(1, POS_X_CENTRED, 30, gMenuText[180], 1, 4); // ENTER TROPHY RACE + render_dialogue_text(1, POS_CENTRED, 30, gMenuText[180], 1, 4); // ENTER TROPHY RACE set_option_text_colour(sDialogueOption == 1); - render_dialogue_text(1, POS_X_CENTRED, 50, gMenuText[51], 1, 4); // EXIT + render_dialogue_text(1, POS_CENTRED, 50, gMenuText[51], 1, 4); // EXIT if (buttonsPressed & A_BUTTON) { currentOption = sDialogueOption + 1; } diff --git a/src/menu.h b/src/menu.h index 1e38c0a4..f011f43e 100644 --- a/src/menu.h +++ b/src/menu.h @@ -665,7 +665,7 @@ s32 menu_loop(Gfx **arg0, s32 **arg1, s32 **arg2, s32 **arg3, s32 arg4); void func_80081800(s32 arg0, s32 arg1, s32 arg2, u8 arg3, u8 arg4, u8 arg5, u8 arg6); void func_80081E54(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5); void func_800828B8(void); -void func_800829F8(Gfx *dl, s32 mulFactor); +void func_800829F8(Gfx *dl, s32 updateRate); void menu_logos_screen_init(void); s32 menu_logo_screen_loop(s32 arg0); void func_80082FAC(void); diff --git a/src/thread0_epc.c b/src/thread0_epc.c index a934fdd0..17fc5dc4 100644 --- a/src/thread0_epc.c +++ b/src/thread0_epc.c @@ -241,8 +241,8 @@ s32 func_800B76DC(void) { } } -void func_800B77D4(s32 mulFactor) { - D_800E3028 += mulFactor; +void func_800B77D4(s32 updateRate) { + D_800E3028 += updateRate; if (D_800E3028 >= 0x3D) { D_800E3028 = 0; D_800E3024++; diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index 93f3ede6..78a258c3 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -101,7 +101,7 @@ s8 D_800DD3F0 = 0; FadeTransition D_800DD3F4 = FADE_TRANSITION(128, FADE_COLOR_BLACK, 20, 0); // Unused? FadeTransition D_800DD3FC = FADE_TRANSITION(0, FADE_COLOR_WHITE, 20, -1); -s32 sLogicMulFactor = 12; +s32 sLogicUpdateRate = LOGIC_5FPS; FadeTransition D_800DD408 = FADE_TRANSITION(0, FADE_COLOR_WHITE, 30, -1); // Unused? char *D_800DD410[3] = { @@ -786,7 +786,7 @@ void thread3_main(s32 arg0) { D_80123520 = 0; sRenderContext = DRAW_INTRO; while (1) { - if (check_reset_pressed() != 0) { + if (is_reset_pressed()) { func_80072708(); audioStopThread(); stop_thread30(); @@ -862,7 +862,7 @@ void func_8006C3E0(void) { void render(void) { s32 phi_v0; s32 phi_v0_2; - s32 tempLogicMulFactor, tempLogicMulFactorMax; + s32 tempLogicUpdateRate, tempLogicUpdateRateMax; osSetTime(0); @@ -894,7 +894,7 @@ void render(void) { init_rsp(&gCurrDisplayList); init_rdp_and_framebuffer(&gCurrDisplayList); render_background(&gCurrDisplayList, &gCurrHudMat, 1); - D_800DD37C = func_8006A1C4(D_800DD37C, sLogicMulFactor); + D_800DD37C = func_8006A1C4(D_800DD37C, sLogicUpdateRate); if (func_800B76DC() != 0) { render_epc_lock_up_display(); sRenderContext = DRAW_CRASH_SCREEN; @@ -914,29 +914,29 @@ void render(void) { func_8006F43C(); break; case DRAW_MENU: // In a menu - func_8006DCF8(sLogicMulFactor); + func_8006DCF8(sLogicUpdateRate); break; case DRAW_GAME: // In game (Controlling a character) - func_8006CCF0(sLogicMulFactor); + func_8006CCF0(sLogicUpdateRate); break; case DRAW_CRASH_SCREEN: // EPC (lockup display) - func_800B77D4(sLogicMulFactor); + func_800B77D4(sLogicUpdateRate); break; } // This is a good spot to place custom text if you want it to overlay it over ALL the // menus & gameplay. - func_80000D00((u8)sLogicMulFactor); + func_80000D00((u8)sLogicUpdateRate); func_800B5F78(&gCurrDisplayList); func_800C56FC(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts); close_dialogue_box(4); func_800C5494(4); - if (func_800C0494(sLogicMulFactor) != 0) { + if (func_800C0494(sLogicUpdateRate) != 0) { render_fade_transition(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts); } if ((D_80123520 >= 8) && (func_8006F4C8() != 0)) { - func_800829F8(&gCurrDisplayList, sLogicMulFactor); + func_800829F8(&gCurrDisplayList, sLogicUpdateRate); } gDPFullSync(gCurrDisplayList++); @@ -962,15 +962,15 @@ void render(void) { } func_80070B04(gVideoLastFramebuffer, gVideoCurrFramebuffer, gVideoCurrFramebuffer + phi_v0_2); } - // tempLogicMulFactor will be set to a value 2 or higher, based on the framerate. + // tempLogicUpdateRate will be set to a value 2 or higher, based on the framerate. // the mul factor is hardcapped at 6, which happens at 10FPS. The mul factor // affects frameskipping, to maintain consistent game speed, through the (many) // dropped frames in DKR. - tempLogicMulFactor = func_8007A98C(D_800DD380); - sLogicMulFactor = tempLogicMulFactor; - tempLogicMulFactorMax = 6; - if (tempLogicMulFactor > tempLogicMulFactorMax) { - sLogicMulFactor = tempLogicMulFactorMax; + tempLogicUpdateRate = func_8007A98C(D_800DD380); + sLogicUpdateRate = tempLogicUpdateRate; + tempLogicUpdateRateMax = LOGIC_10FPS; + if (tempLogicUpdateRate > tempLogicUpdateRateMax) { + sLogicUpdateRate = tempLogicUpdateRateMax; } } @@ -985,7 +985,7 @@ void func_8006CAE4(s32 arg0, s32 arg1, s32 arg2) { } /** - * Calls load_level() with the same arguments except for the cutsceneId, + * Calls load_level() with the same arguments except for the cutsceneId, * which is the value at D_80123508. Also does some other stuff. * Needs a better name! */ @@ -1024,7 +1024,7 @@ void func_8006CC14(void) { #ifdef NON_MATCHING // Almost matching except for a couple minor issues. -void func_8006CCF0(s32 mulFactor) { +void func_8006CCF0(s32 updateRate) { s32 i, buttonHeldInputs, sp40, sp3C, buttonPressedInputs, phi_v1_2; sp40 = 0; @@ -1039,7 +1039,7 @@ void func_8006CCF0(s32 mulFactor) { buttonPressedInputs |= START_BUTTON; } if (!gIsPaused) { - func_80010994(mulFactor); + func_80010994(updateRate); if (func_80066510() == 0 || func_8001139C()) { if ((buttonPressedInputs & START_BUTTON) && (func_8006C2F0() == 0) && (D_800DD390 == 0) && (sRenderContext == DRAW_GAME) && (D_80123516 == 0) && (D_800DD394 == 0) && (D_800DD398 == 0)) { @@ -1051,7 +1051,7 @@ void func_8006CCF0(s32 mulFactor) { } else { func_80028FA0(1); } - D_800DD398 -= mulFactor; + D_800DD398 -= updateRate; if (D_800DD398 < 0) { D_800DD398 = 0; } @@ -1060,13 +1060,13 @@ void func_8006CCF0(s32 mulFactor) { } gParticlePtrList_flush(); func_8001BF20(); - func_80024D54(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, &gCurrHudTris, mulFactor); + func_80024D54(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, &gCurrHudTris, updateRate); if (sRenderContext == DRAW_GAME) { // Ignore the user's L/R/Z buttons. buttonHeldInputs &= ~(L_TRIG | R_TRIG | Z_TRIG); } if (D_80123516 != 0) { - i = func_80095728(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, mulFactor); + i = func_80095728(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, updateRate); switch (i - 1) { case 1: buttonHeldInputs |= (L_TRIG | Z_TRIG); @@ -1111,7 +1111,7 @@ void func_8006CCF0(s32 mulFactor) { break; } } - func_800C3440(mulFactor); + func_800C3440(updateRate); i = func_800C3400(); if (i != 0) { if (i == 2) { @@ -1123,7 +1123,7 @@ void func_8006CCF0(s32 mulFactor) { } } if (gIsPaused) { - i = func_80094170(&gCurrDisplayList, mulFactor); + i = func_80094170(&gCurrDisplayList, updateRate); switch (i - 1) { case 0: gIsPaused = FALSE; @@ -1172,7 +1172,7 @@ void func_8006CCF0(s32 mulFactor) { } init_rdp_and_framebuffer(&gCurrDisplayList); render_borders_for_multiplayer(&gCurrDisplayList); - func_800A8474(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, mulFactor); + func_800A8474(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, updateRate); func_80077268(&gCurrDisplayList); if (D_800DD39C != 0) { if (func_800214C4() != 0) { @@ -1184,7 +1184,7 @@ void func_8006CCF0(s32 mulFactor) { } phi_v1_2 = FALSE; if (D_800DD390 != 0) { - D_800DD390 -= mulFactor; + D_800DD390 -= updateRate; if (D_800DD390 <= 0) { D_800DD390 = 0; func_8006C1AC(0, 0, 0, 0); @@ -1193,7 +1193,7 @@ void func_8006CCF0(s32 mulFactor) { } } if (D_800DD394 > 0) { - D_800DD394 -= mulFactor; + D_800DD394 -= updateRate; if (D_800DD394 <= 0) { buttonHeldInputs = L_TRIG; switch (D_80123524) { @@ -1492,15 +1492,15 @@ void func_8006DC58(s32 arg0) { #ifdef NON_MATCHING // Minor & regalloc issues. -void func_8006DCF8(s32 mulFactor) { +void func_8006DCF8(s32 updateRate) { s32 menuLoopResult, temp, temp2, tempResult; gIsPaused = FALSE; D_80123516 = 0; if (!D_80123514 && D_801234F0) { - func_8006DC58(mulFactor); + func_8006DC58(updateRate); } - menuLoopResult = menu_loop(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, &gCurrHudTris, mulFactor); + menuLoopResult = menu_loop(&gCurrDisplayList, &gCurrHudMat, &gCurrHudVerts, &gCurrHudTris, updateRate); D_801234F0 = TRUE; if (menuLoopResult == -2) { D_801234F0 = FALSE; @@ -1772,7 +1772,7 @@ s8 func_8006EAB0(void) { return D_80123516; } -s32 check_reset_pressed(void) { +s32 is_reset_pressed(void) { if (D_80123560[0] == 0) { D_80123560[0] = (s32)((osRecvMesg(&gNMIMesgQueue, NULL, 0) + 1) != 0); } diff --git a/src/unknown_06B2B0.h b/src/unknown_06B2B0.h index 2f74a406..87e64eea 100644 --- a/src/unknown_06B2B0.h +++ b/src/unknown_06B2B0.h @@ -157,7 +157,7 @@ void func_8006EA58(void); Settings *get_settings(void); s8 is_game_paused(void); s8 func_8006EAB0(void); -s32 check_reset_pressed(void); +s32 is_reset_pressed(void); s32 func_8006EB14(void); void func_8006EB24(void); void func_8006EB40(void); diff --git a/src/video.c b/src/video.c index 5f1c7f1d..eb1f3ae9 100644 --- a/src/video.c +++ b/src/video.c @@ -233,9 +233,9 @@ void func_8007A974(void) { #ifdef NON_MATCHING // regalloc & stack issues s32 func_8007A98C(s32 arg0) { - s32 tempMulFactor; + s32 tempUpdateRate; - tempMulFactor = 1; + tempUpdateRate = LOGIC_60FPS; if (D_801262D0 != 0) { D_801262D0--; if (D_801262D0 == 0) { @@ -246,32 +246,32 @@ s32 func_8007A98C(s32 arg0) { swap_framebuffers(); } while (osRecvMesg(&D_801261A0, NULL, 0) != -1) { - s0 += 1; - s0 &= 0xFF; + tempUpdateRate += 1; + tempUpdateRate &= 0xFF; } - if (tempMulFactor < D_80126309) { + if (tempUpdateRate < D_80126309) { if (D_80126308 < 0x14) { D_80126308++; } if (D_80126308 == 0x14) { - D_80126309 = tempMulFactor; + D_80126309 = tempUpdateRate; D_80126308 = 0; } } else { D_80126308 = 0; - if ((D_80126309 >= tempMulFactor) || (D_801262E4 > tempMulFactor)) { - D_80126309 = tempMulFactor; + if ((D_80126309 >= tempUpdateRate) || (D_801262E4 > tempUpdateRate)) { + D_80126309 = tempUpdateRate; } } - while (tempMulFactor < D_80126309) { + while (tempUpdateRate < D_80126309) { osRecvMesg(&D_801261A0, NULL, 1); - tempMulFactor += 1; - tempMulFactor &= 0xFF; + tempUpdateRate += 1; + tempUpdateRate &= 0xFF; } osViSwapBuffer(gVideoLastFramebuffer); osRecvMesg(&D_801261A0, NULL, 1); - return tempMulFactor; + return tempUpdateRate; } #else GLOBAL_ASM("asm/non_matchings/video/func_8007A98C.s") diff --git a/src/video.h b/src/video.h index 6c810e53..c8e47d98 100644 --- a/src/video.h +++ b/src/video.h @@ -32,6 +32,21 @@ #define HEIGHT_RATIO_NTSC (LOW_RES_NTSC_HEIGHT / LOW_RES_NTSC_HEIGHT) #define HEIGHT_RATIO_MPAL (LOW_RES_MPAL_HEIGHT / LOW_RES_NTSC_HEIGHT) +/** + * Values for the rate game logic will work depending on the framerate. Vanilla DKR will default to LOGIC_30FPS (2) + */ + +enum LogicUpdateRates { + LOGIC_NULL, + LOGIC_60FPS, + LOGIC_30FPS, + LOGIC_20FPS, + LOGIC_15FPS, + LOGIC_12FPS, + LOGIC_10FPS, + LOGIC_5FPS = 12, +}; + extern s32 gVideoRefreshRate; extern u16 *gVideoDepthBuffer;