1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-10 01:44:36 +00:00

[ntsc-1.0/1.1] Match PAL 1.0 viconfig changes (#2231)

* [ntsc-1.0/1.1] Match viconfig changes

* SREG(48) -> R_VI_MODE_EDIT_STATE
This commit is contained in:
cadmic 2024-09-27 13:44:35 -07:00 committed by GitHub
parent 86a146db24
commit c6160e1980
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 148 additions and 40 deletions

View file

@ -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);