diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/game.c | 9 | ||||
| -rw-r--r-- | src/code/graph.c | 10 | ||||
| -rw-r--r-- | src/code/sched.c | 43 | ||||
| -rw-r--r-- | src/code/z_prenmi.c | 6 |
4 files changed, 67 insertions, 1 deletions
diff --git a/src/code/game.c b/src/code/game.c index 45362fb58..2b665e0d8 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -2,6 +2,7 @@ #include "fault.h" #include "libc64/os_malloc.h" #include "terminal.h" +#include "versions.h" #if PLATFORM_N64 #include "n64dd.h" #endif @@ -281,6 +282,14 @@ void GameState_Update(GameState* gameState) { func_800C4344(gameState); +#if OOT_VERSION < PAL_1_0 + if (R_VI_MODE_EDIT_STATE != VI_MODE_EDIT_STATE_INACTIVE) { + ViMode_Update(&sViMode, &gameState->input[0]); + gfxCtx->viMode = &sViMode.customViMode; + gfxCtx->viFeatures = sViMode.viFeatures; + } +#endif + #if OOT_DEBUG if (SREG(63) == 1u) { if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) { diff --git a/src/code/graph.c b/src/code/graph.c index 5aadf9cc8..2ecd87dd1 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -2,6 +2,7 @@ #include "fault.h" #include "terminal.h" #include "ucode_disas.h" +#include "versions.h" #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 @@ -140,10 +141,17 @@ void Graph_Init(GraphicsContext* gfxCtx) { gfxCtx->gfxPoolIdx = 0; gfxCtx->fbIdx = 0; gfxCtx->viMode = NULL; + +#if OOT_VERSION < PAL_1_0 + gfxCtx->viFeatures = 0; +#else gfxCtx->viFeatures = gViConfigFeatures; gfxCtx->xScale = gViConfigXScale; gfxCtx->yScale = gViConfigYScale; +#endif + osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); + #if OOT_DEBUG func_800D31F0(); Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); @@ -272,8 +280,10 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { cfb->viMode = gfxCtx->viMode; cfb->viFeatures = gfxCtx->viFeatures; +#if OOT_VERSION >= PAL_1_0 cfb->xScale = gfxCtx->xScale; cfb->yScale = gfxCtx->yScale; +#endif cfb->unk_10 = 0; cfb->updateRate = R_UPDATE_RATE; diff --git a/src/code/sched.c b/src/code/sched.c index 77860aa51..3374da65e 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -41,6 +41,7 @@ */ #include "global.h" #include "fault.h" +#include "versions.h" #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 @@ -53,7 +54,7 @@ OSTime sRSPAudioTimeStart; OSTime sRSPOtherTimeStart; OSTime sRDPTimeStart; -#if OOT_DEBUG +#if OOT_VERSION < PAL_1_0 || OOT_DEBUG vs32 sSchedDebugPrintfEnabled = false; #define SCHED_DEBUG_PRINTF \ @@ -115,10 +116,29 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) { #endif } +#if OOT_VERSION < PAL_1_0 + if (cfbInfo->viMode != NULL) { + osViSetMode(cfbInfo->viMode); + osViSetSpecialFeatures(cfbInfo->viFeatures); + } + if (1) {} + if (1) {} + if (1) {} + if (1) {} + if (1) {} +#endif + cfbInfo->unk_10 = 0; } void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) { +#if OOT_VERSION < PAL_1_0 + Sched_SwapFrameBufferImpl(cfbInfo); + if (sc->isFirstSwap) { + osViBlack(false); + sc->isFirstSwap = false; + } +#else if (sc->isFirstSwap) { sc->isFirstSwap = false; @@ -127,6 +147,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) { } } Sched_SwapFrameBufferImpl(cfbInfo); +#endif } void Sched_HandlePreNMI(Scheduler* sc) { @@ -162,7 +183,12 @@ void Sched_HandlePreNMI(Scheduler* sc) { void Sched_HandleNMI(Scheduler* sc) { // black the screen and reset the VI y scale just in time for NMI reset +#if OOT_VERSION < PAL_1_0 + osViSetYScale(1.0f); + osViBlack(true); +#else ViConfig_UpdateVi(true); +#endif } /** @@ -424,6 +450,13 @@ void Sched_RunTask(Scheduler* sc, OSScTask* spTask, OSScTask* dpTask) { // If the task also uses the RDP, set current running RDP task if (spTask == dpTask && sc->curRDPTask == NULL) { +#if OOT_VERSION < PAL_1_0 + // Unknown SCHED_DEBUG_PRINTF calls + if (sSchedDebugPrintfEnabled) {} + if (sSchedDebugPrintfEnabled) {} + if (sSchedDebugPrintfEnabled) {} +#endif + sc->curRDPTask = dpTask; sRDPTimeStart = sRSPGfxTimeStart; } @@ -467,7 +500,9 @@ void Sched_HandleNotification(Scheduler* sc) { void Sched_HandleRetrace(Scheduler* sc) { SCHED_DEBUG_PRINTF("%08d:scHandleRetrace %08x\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), osViGetCurrentFramebuffer()); +#if OOT_VERSION >= PAL_1_0 ViConfig_UpdateBlack(); +#endif sc->retraceCount++; // Retrace handlers run after VI context swap. The last swap buffer may now be the current buffer. @@ -649,6 +684,12 @@ void Sched_Init(Scheduler* sc, void* stack, OSPri priority, u8 viModeType, UNK_T // Create message queues for receiving interrupt events and tasks osCreateMesgQueue(&sc->interruptQueue, sc->interruptMsgBuf, ARRAY_COUNT(sc->interruptMsgBuf)); osCreateMesgQueue(&sc->cmdQueue, sc->cmdMsgBuf, ARRAY_COUNT(sc->cmdMsgBuf)); + +#if OOT_VERSION < PAL_1_0 + osViBlack(true); + osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF); +#endif + osSetEventMesg(OS_EVENT_SP, &sc->interruptQueue, (OSMesg)RSP_DONE_MSG); osSetEventMesg(OS_EVENT_DP, &sc->interruptQueue, (OSMesg)RDP_DONE_MSG); IrqMgr_AddClient(irqMgr, &sc->irqClient, &sc->interruptQueue); diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index 29ea097d6..e1bb15145 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "versions.h" void func_80092320(PreNMIState* this) { this->state.running = false; @@ -17,7 +18,12 @@ void PreNMI_Update(PreNMIState* this) { } if (this->timer == 0) { +#if OOT_VERSION < PAL_1_0 + osViSetYScale(1.0f); + osViBlack(true); +#else ViConfig_UpdateVi(true); +#endif func_80092320(this); return; } |
