summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2022-06-03 20:43:30 +0100
committerGitHub <noreply@github.com>2022-06-03 15:43:30 -0400
commit1738b19d63d65afd01e1043a5359502ffef2e40e (patch)
tree28046b3903f20dfeb34c0bbddea44450ce3e2308 /src/boot
parentee5ac838b693f14710954f361ad91936975d00b7 (diff)
More documentation for sched.c (#1219)
* More documentation for sched.c * VI retrace -> vertical retrace, attempt to clarify comment in viconfig * Further review changes, fix inconsistent capitalization of PreNMI (PRENMI -> PreNMI) * Fix typo Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Change TaskSwapBuffer, change comment on OS_SC_DRAM_DLIST to unimplemented * Rename SchedContext/gSchedContext to Scheduler/gScheduler * Comments fixes Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Format Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/idle.c6
-rw-r--r--src/boot/viconfig.c19
2 files changed, 15 insertions, 10 deletions
diff --git a/src/boot/idle.c b/src/boot/idle.c
index f4e3715d7..8e72b8256 100644
--- a/src/boot/idle.c
+++ b/src/boot/idle.c
@@ -10,7 +10,7 @@ OSViMode gViConfigMode;
u8 D_80013960;
s8 D_80009430 = 1;
-vu8 gViConfigUseDefault = 1;
+vu8 gViConfigBlack = true;
u8 gViConfigAdditionalScanLines = 0;
u32 gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF;
f32 gViConfigXScale = 1.0;
@@ -75,8 +75,8 @@ void Idle_ThreadEntry(void* arg) {
D_80009430 = 1;
osViSetMode(&gViConfigMode);
- ViConfig_UpdateVi(1);
- osViBlack(1);
+ ViConfig_UpdateVi(true);
+ osViBlack(true);
osViSwapBuffer(0x803DA80); //! @bug Invalid vram address (probably intended to be 0x803DA800)
osCreatePiManager(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x400, "main");
diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c
index 4c6830c99..38942097f 100644
--- a/src/boot/viconfig.c
+++ b/src/boot/viconfig.c
@@ -2,16 +2,21 @@
#include "vt.h"
// this should probably go elsewhere but right now viconfig.o is the only object between idle and z_std_dma
-OSPiHandle* gCartHandle = 0;
+OSPiHandle* gCartHandle = NULL;
+
+void ViConfig_UpdateVi(u32 black) {
+ if (black) {
+ // Black the screen on next call to ViConfig_UpdateBlack, skip most VI configuration
-void ViConfig_UpdateVi(u32 mode) {
- if (mode != 0) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "osViSetYScale1(%f);\n" VT_RST, 1.0f);
if (osTvType == OS_TV_PAL) {
osViSetMode(&osViModePalLan1);
}
+ // Reset the VI y scale. The VI y scale is different between NTSC (1.0) and PAL (0.833)
+ // and should be reset to 1.0 during PreNMI to ensure there are no issues when restarting.
+ // (see section 30.4.3 VI Processing with PreNMI Events in the N64 Programming Manual)
osViSetYScale(1.0f);
} else {
osViSetMode(&gViConfigMode);
@@ -34,13 +39,13 @@ void ViConfig_UpdateVi(u32 mode) {
}
}
- gViConfigUseDefault = mode;
+ gViConfigBlack = black;
}
void ViConfig_UpdateBlack(void) {
- if (gViConfigUseDefault != 0) {
- osViBlack(1);
+ if (gViConfigBlack) {
+ osViBlack(true);
} else {
- osViBlack(0);
+ osViBlack(false);
}
}