mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Match vi.c
This commit is contained in:
@@ -46,7 +46,7 @@ void osInitialize() {
|
||||
osMapTLBRdb();
|
||||
osPiRawReadIo(4, &clock); //TODO: remove magic constant;
|
||||
clock &= ~0xf; //clear lower 4 bits
|
||||
if (clock != 0) {
|
||||
if (clock) {
|
||||
osClockRate = clock;
|
||||
}
|
||||
osClockRate = osClockRate * 3 / 4;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "libultra_internal.h"
|
||||
|
||||
extern OSDevMgr __osPiDevMgr; //__osPiDevMgr;
|
||||
extern OSDevMgr __osPiDevMgr;
|
||||
|
||||
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *dramAddr, u32 size, OSMesgQueue *mq) {
|
||||
register s32 ret;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "macros.h"
|
||||
#include "libultra_internal.h"
|
||||
|
||||
extern OSTimer D_8012D200;
|
||||
OSTimer *__osTimerList = &D_8012D200;
|
||||
extern OSTimer __osBaseTimer;
|
||||
OSTimer *__osTimerList = &__osBaseTimer;
|
||||
|
||||
extern OSTime __osCurrentTime;
|
||||
extern u32 __osBaseCounter;
|
||||
@@ -16,7 +16,7 @@ extern u32 __osTimerCounter;
|
||||
OSTime __osInsertTimer(OSTimer *t);
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
//Seems to be a mistmatch based on where __osCurrentTime is defined.
|
||||
//Seems to be a mismatch based on where __osCurrentTime is defined.
|
||||
//Scratch proving that: https://decomp.me/scratch/OB3iP
|
||||
void __osTimerServicesInit(void) {
|
||||
__osCurrentTime = 0;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ OSTask tmp_task; //Supposed to be statically declared in sptask.c
|
||||
#define PI_Q_BUF_LEN 1
|
||||
OSMesg piAccessBuf[PI_Q_BUF_LEN]; //Should be static, but this works for now
|
||||
s32 __osPiAccessQueue[6];
|
||||
OSTimer D_8012D200;
|
||||
OSTimer __osBaseTimer;
|
||||
OSTime __osCurrentTime;
|
||||
s32 __osBaseCounter;
|
||||
s32 __osViIntrCount;
|
||||
|
||||
+32
-3
@@ -1,8 +1,37 @@
|
||||
/* The comment below is needed for this file to be picked up by generate_ld */
|
||||
/* RAM_POS: 0x800D2B10 */
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "libultra_internal.h"
|
||||
#include "viint.h"
|
||||
#include "video.h"
|
||||
|
||||
GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osViInit.s")
|
||||
extern OSViMode osViModeNtscLan1;
|
||||
extern OSViMode osViModePalLan1;
|
||||
extern OSViMode osViModeMpalLan1;
|
||||
extern __OSViContext vi[2];
|
||||
extern __OSViContext *__osViCurr;
|
||||
extern __OSViContext *__osViNext;
|
||||
extern s32 osViClock;
|
||||
|
||||
void __osViInit(void) {
|
||||
bzero(vi, sizeof(vi));
|
||||
__osViCurr = &vi[0];
|
||||
__osViNext = &vi[1];
|
||||
__osViNext->retraceCount = 1;
|
||||
__osViCurr->retraceCount = 1;
|
||||
if (osTvType == OS_TV_TYPE_PAL) {
|
||||
__osViNext->modep = &osViModePalLan1;
|
||||
osViClock = VI_PAL_CLOCK;
|
||||
} else if (osTvType == OS_TV_TYPE_MPAL) {
|
||||
__osViNext->modep = &osViModeMpalLan1;
|
||||
osViClock = VI_MPAL_CLOCK;
|
||||
} else {
|
||||
__osViNext->modep = &osViModeNtscLan1;
|
||||
osViClock = VI_NTSC_CLOCK;
|
||||
}
|
||||
__osViNext->state = VI_STATE_BLACK;
|
||||
__osViNext->control = __osViNext->modep->comRegs.ctrl;
|
||||
while (IO_READ(VI_CURRENT_REG) > 10); //wait for vsync?
|
||||
IO_WRITE(VI_CONTROL_REG, 0); //pixel size blank (no data, no sync)
|
||||
__osViSwapContext();
|
||||
}
|
||||
|
||||
+100
-15
@@ -1571,29 +1571,114 @@ s32 D_800E46C0[20] = {
|
||||
0x00000400, 0x002501FF, 0x000E0204, 0x00000002
|
||||
};
|
||||
|
||||
s32 D_800E4710[20] = {
|
||||
0x02000000, 0x0000311E, 0x00000140, 0x03E52239,
|
||||
0x0000020D, 0x00000C15, 0x0C150C15, 0x006C02EC,
|
||||
0x00000200, 0x00000000, 0x00000280, 0x00000400,
|
||||
0x002501FF, 0x000E0204, 0x00000002, 0x00000280,
|
||||
0x00000400, 0x002501FF, 0x000E0204, 0x00000002
|
||||
};
|
||||
OSViMode osViModeNtscLan1 = {
|
||||
OS_VI_NTSC_LAN1, // type
|
||||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON |
|
||||
VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl
|
||||
WIDTH(320), // width
|
||||
BURST(57, 34, 5, 62), // burst
|
||||
VSYNC(525), // vSync
|
||||
HSYNC(3093, 0), // hSync
|
||||
LEAP(3093, 3093), // leap
|
||||
HSTART(108, 748), // hStart
|
||||
SCALE(2, 0), // xScale
|
||||
VCURRENT(0), // vCurrent
|
||||
},
|
||||
{// fldRegs
|
||||
{
|
||||
//[0]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(37, 511), // vStart
|
||||
BURST(4, 2, 14, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
},
|
||||
{
|
||||
//[1]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(37, 511), // vStart
|
||||
BURST(4, 2, 14, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
}}};
|
||||
|
||||
s32 D_800E4760[20] = {
|
||||
s32 osViModePalLan1[20] = {
|
||||
0x10000000, 0x0000311E, 0x00000140, 0x0404233A,
|
||||
0x00000271, 0x00150C69, 0x0C6F0C6E, 0x00800300,
|
||||
0x00000200, 0x00000000, 0x00000280, 0x00000400,
|
||||
0x005F0239, 0x0009026B, 0x00000002, 0x00000280,
|
||||
0x00000400, 0x005F0239, 0x0009026B, 0x00000002
|
||||
};
|
||||
/*
|
||||
//TODO: Figure out why this doesn't match from libreultra
|
||||
OSViMode osViModePalLan1 = {
|
||||
OS_VI_PAL_LAN1, // type
|
||||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON |
|
||||
VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl
|
||||
WIDTH(320), // width
|
||||
BURST(58, 30, 4, 69), // burst
|
||||
VSYNC(625), // vSync
|
||||
HSYNC(3177, 23), // hSync
|
||||
LEAP(3183, 3181), // leap
|
||||
HSTART(128, 768), // hStart
|
||||
SCALE(2, 0), // xScale
|
||||
VCURRENT(0), // vCurrent
|
||||
},
|
||||
{// fldRegs
|
||||
{
|
||||
//[0]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(95, 569), // vStart
|
||||
BURST(107, 2, 9, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
},
|
||||
{
|
||||
//[1]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(95, 569), // vStart
|
||||
BURST(107, 2, 9, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
}}};
|
||||
*/
|
||||
|
||||
s32 D_800E47B0[20] = {
|
||||
0x1E000000, 0x0000311E, 0x00000140, 0x04651E39,
|
||||
0x0000020D, 0x00040C11, 0x0C190C1A, 0x006C02EC,
|
||||
0x00000200, 0x00000000, 0x00000280, 0x00000400,
|
||||
0x002501FF, 0x000E0204, 0x00000002, 0x00000280,
|
||||
0x00000400, 0x002501FF, 0x000E0204, 0x00000002
|
||||
};
|
||||
OSViMode osViModeMpalLan1 = {
|
||||
OS_VI_MPAL_LAN1, // type
|
||||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON |
|
||||
VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000, // ctrl
|
||||
WIDTH(320), // width
|
||||
BURST(57, 30, 5, 70), // burst
|
||||
VSYNC(525), // vSync
|
||||
HSYNC(3089, 4), // hSync
|
||||
LEAP(3097, 3098), // leap
|
||||
HSTART(108, 748), // hStart
|
||||
SCALE(2, 0), // xScale
|
||||
VCURRENT(0), // vCurrent
|
||||
},
|
||||
{// fldRegs
|
||||
{
|
||||
//[0]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(37, 511), // vStart
|
||||
BURST(4, 2, 14, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
},
|
||||
{
|
||||
//[1]
|
||||
ORIGIN(640), // origin
|
||||
SCALE(1, 0), // yScale
|
||||
HSTART(37, 511), // vStart
|
||||
BURST(4, 2, 14, 0), // vBurst
|
||||
VINTR(2), // vIntr
|
||||
}}};
|
||||
|
||||
// This needs to be moved.
|
||||
u32 __osPiAccessQueueEnabled = 0;
|
||||
|
||||
Reference in New Issue
Block a user