From 16b9c39f5f62039903337f8e4411791f4aeb6acc Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Fri, 10 Sep 2021 08:22:05 -0400 Subject: [PATCH] Set TV_TYPE_PAL constants where appropriate and clarify more data types --- src/camera.c | 10 +++++----- src/fade_transition.c | 3 ++- src/game_text.c | 5 +++-- src/menu.c | 14 +++++++------- src/unknown_06B2B0.c | 14 +++++++------- src/unknown_0ABDF0.c | 3 ++- src/video.c | 6 +++--- 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/camera.c b/src/camera.c index 601338d9..60166422 100644 --- a/src/camera.c +++ b/src/camera.c @@ -597,14 +597,14 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { temp_a2 = temp_t1 >> 1; sp54 = temp_a2; sp58 = temp_a3; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { sp58 = 0x91; } switch(gNumberOfViewports) { case VIEWPORTS_COUNT_1_PLAYER: phi_t3 = sp58; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { phi_t3 = sp58 - 0x12; } gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, temp_t0) @@ -614,7 +614,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { if (D_80120CE4 == 0) { temp_v0_6 = temp_t0 >> 2; phi_t3 = temp_v0_6; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { phi_t3 = temp_v0_6 - 0xC; } gDPSetScissor((*dlist)++, SCISSOR_INTERLACE, 0, 0, temp_t1, (temp_a3 - (temp_t0 >> 7))) @@ -669,7 +669,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { } phi_t3 = phi_t5 + sp58; sp4C = phi_t4 + sp54; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { phi_t3 -= 6; if (D_80120CE4 < 2) { phi_t3 -= 0x14; @@ -682,7 +682,7 @@ void func_80066CDC(Gfx **dlist, s32 arg1) { break; } - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { sp4C -= 4; } func_80068158(dlist, sp54, sp58, sp4C, phi_t3); diff --git a/src/fade_transition.c b/src/fade_transition.c index d0920bb5..bc0b0d75 100644 --- a/src/fade_transition.c +++ b/src/fade_transition.c @@ -8,6 +8,7 @@ #include "f3ddkr.h" #include "asset_sections.h" #include "memory.h" +#include "PR/libultra.h" /************ .data ************/ @@ -353,7 +354,7 @@ s32 func_800C0494(s32 arg0) { void render_fade_transition(s32 dlist, s32 arg1, s32 arg2) { if (D_800E31AC != 0) { - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { func_80067F20(1.4f); } else { func_80067F20(1.2f); diff --git a/src/game_text.c b/src/game_text.c index f0b60410..60675404 100644 --- a/src/game_text.c +++ b/src/game_text.c @@ -6,6 +6,7 @@ #include "f3ddkr.h" #include "asset_sections.h" #include "memory.h" +#include "PR/libultra.h" /************ .data ************/ @@ -81,7 +82,7 @@ void func_800C29F0(void) { D_8012A7BA = 0; D_8012A7AE = 0x20; D_8012A7B2 = 0x120; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { D_8012A7B0 = 0xE0; D_8012A7B4 = 0xF8; } else { @@ -168,7 +169,7 @@ void func_800C314C(void) { } void func_800C3158(s32 arg0, f32 arg1) { - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { D_800E3678 = arg1 * 50.0; } else { D_800E3678 = arg1 * 60.0; diff --git a/src/menu.c b/src/menu.c index b72d9793..0eb3ecf6 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2271,7 +2271,7 @@ void func_800829F8(s32 arg0, s32 arg1) { set_text_color(255, 255, 255, 0, 0xFF); set_text_background_color(0, 0, 0, 0); temp = 0xD0; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { temp = 0xEA; } draw_text(arg0, -0x8000, temp, gMenuText[151], 0xC); @@ -2282,7 +2282,7 @@ void menu_logos_screen_init(void) { gMenuDelay = 0; D_80126450 = 16.0f; // 16 seconds func_80077B5C(0, 0, 0); - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { func_80066940(0, 0, 0x26, 0x140, 0xE0); func_80066AA8(0, 0x8000, 0x8000, 0x140, 0x11C); } else { @@ -3123,7 +3123,7 @@ void func_800887E8(void) { D_801263D8 = 0; func_8009C6D4(0x3F); func_8008E4B0(); - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { D_80126BB4 = 8; } else { D_80126BB4 = 7; @@ -3642,7 +3642,7 @@ void draw_character_select_text(s32 arg0) { draw_text(&D_801263A0, 0xA0, 0x20, gMenuText[135], 0xC); if (gNumberOfReadyPlayers == gNumberOfActivePlayers && gNumberOfActivePlayers > 0) { yPos = 0xD0; - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { yPos = 0xEA; } draw_text(&D_801263A0, 0xA0, yPos, D_800E8230 /* "OK?" */, 0xC); @@ -3938,7 +3938,7 @@ void func_8008C698(s32 arg0) { (&((unk80126460*)D_80126460)[temp] + 1)->elem[1].filterAlpha = filterAlpha; } - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { D_800DF79C = 0xC; D_800DF7A0 = 0; } else { @@ -5354,7 +5354,7 @@ void func_800983C0(s32 arg0) { s8* sp20; sp20 = get_misc_asset(0x1A); - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { sp2C = 0x12; } else { sp2C = 0; @@ -5675,7 +5675,7 @@ void menu_credits_init(void) { D_80126BD8 = 0; D_80126BE0 = 0; func_80077B5C(0, 0, 0); - if (osTvType == 0) { + if (osTvType == TV_TYPE_PAL) { func_80066940(0, 0, 0x26, 0x140, 0xE0); func_80066AA8(0, 0x8000, 0x8000, 0x140, 0x11C); } else { diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index e44e8761..28b623e2 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -167,8 +167,8 @@ s32 gCurrNumF3dCmdsPerPlayer; s32 gCurrNumHudMatPerPlayer; s32 gCurrNumHudTrisPerPlayer; s32 gCurrNumHudVertsPerPlayer; -s32 D_80123538[3]; -s32 D_80123544; +OSScClient *D_80123538[3]; +OSMesg *D_80123544; OSMesgQueue *D_80123548; s32 D_8012354C; s32 D_80123550[4]; @@ -853,7 +853,7 @@ void thread3_main(s32 arg0) { } void func_8006C3E0(void) { - s32 sp24; + s32 mode; init_main_memory_pool(); func_800C6170(); @@ -865,14 +865,14 @@ void func_8006C3E0(void) { D_80123518 = 0; if (osTvType == TV_TYPE_PAL) { - sp24 = 14; + mode = 14; } else if (osTvType == TV_TYPE_NTSC) { - sp24 = 0; + mode = 0; } else if (osTvType == TV_TYPE_MPAL) { - sp24 = 28; + mode = 28; } - osCreateScheduler(&D_80121260, &D_801234E8, 0xD, sp24, 1); + osCreateScheduler(&D_80121260, &D_801234E8, /*priority*/ 13, (u8) mode, 1); D_800DD3A0 = 0; if (func_8006EFB8() == 0) { D_800DD3A0 = 1; diff --git a/src/unknown_0ABDF0.c b/src/unknown_0ABDF0.c index 3f067980..2737b15e 100644 --- a/src/unknown_0ABDF0.c +++ b/src/unknown_0ABDF0.c @@ -5,6 +5,7 @@ #include "macros.h" #include "structs.h" #include "f3ddkr.h" +#include "PR/libultra.h" typedef struct { s16 unk0; @@ -282,7 +283,7 @@ void func_800AD220(void) { } void func_800AD2C4(s32 arg0, s32 arg1, f32 arg2) { - D_800E2C78 = osTvType == 0 ? 50.0 * arg2 : 60.0 * arg2; + D_800E2C78 = osTvType == TV_TYPE_PAL ? 50.0 * arg2 : 60.0 * arg2; D_800E2C68 = arg0; D_800E2C64 = (D_800E2C68 - D_800E2C60) / D_800E2C78; D_800E2C74 = arg1; diff --git a/src/video.c b/src/video.c index 69520cf4..16d0cced 100644 --- a/src/video.c +++ b/src/video.c @@ -48,7 +48,7 @@ s32 D_801262E8[8]; u8 D_80126308; u8 D_80126309; s32 D_8012630C; -s32 D_80126310; +OSScClient *D_80126310; /******************************/ @@ -60,7 +60,7 @@ void init_framebuffer(s32); void func_8007A974(void); void swap_framebuffers(void); -void init_video(s32 arg0, OSSched *sc) { +void init_video(s32 videoModeIndex, OSSched *sc) { if (osTvType == TV_TYPE_PAL) { gVideoRefreshRate = REFRESH_50HZ; gVideoAspectRatio = ASPECT_RATIO_PAL; @@ -83,7 +83,7 @@ void init_video(s32 arg0, OSSched *sc) { } func_8007A974(); - set_video_mode_index(arg0); + set_video_mode_index(videoModeIndex); gVideoFramebuffers[0] = 0; gVideoFramebuffers[1] = 0; init_framebuffer(0);