mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Preliminary fixes for boot/libultra (#1032)
* Preliminary fixes * Missed a NULL
This commit is contained in:
parent
09f0dc84b8
commit
982e7be1f7
31 changed files with 68 additions and 88 deletions
16
asm/entry.s
16
asm/entry.s
|
@ -7,21 +7,23 @@
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
|
|
||||||
|
.set BOOT_STACK_SIZE, 0x400
|
||||||
|
|
||||||
glabel entrypoint # 0x80000400
|
glabel entrypoint # 0x80000400
|
||||||
lui $t0, %hi(_bootSegmentBssStart) # $t0, 0x8001
|
lui $t0, %hi(_bootSegmentBssStart)
|
||||||
addiu $t0, %lo(_bootSegmentBssStart) # addiu $t0, $t0, 0x2370
|
addiu $t0, %lo(_bootSegmentBssStart)
|
||||||
li $t1, %lo(_bootSegmentBssSize) # li $t1, 0x4A30
|
li $t1, %lo(_bootSegmentBssSize)
|
||||||
.L8000040C:
|
.L8000040C:
|
||||||
addi $t1, $t1, -8
|
addi $t1, $t1, -8
|
||||||
sw $zero, ($t0)
|
sw $zero, ($t0)
|
||||||
sw $zero, 4($t0)
|
sw $zero, 4($t0)
|
||||||
bnez $t1, .L8000040C
|
bnez $t1, .L8000040C
|
||||||
addi $t0, $t0, 8
|
addi $t0, $t0, 8
|
||||||
lui $t2, %hi(bootproc) # $t2, 0x8000
|
lui $t2, %hi(bootproc)
|
||||||
lui $sp, %hi(gMainThread) # $sp, 0x8001
|
lui $sp, %hi(sBootThreadStack + BOOT_STACK_SIZE)
|
||||||
addiu $t2, %lo(bootproc) # addiu $t2, $t2, 0x0498
|
addiu $t2, %lo(bootproc)
|
||||||
jr $t2
|
jr $t2
|
||||||
addiu $sp, %lo(gMainThread) # addiu $sp, $sp, 0x2D60
|
addiu $sp, %lo(sBootThreadStack + BOOT_STACK_SIZE)
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
|
|
|
@ -49,13 +49,13 @@ glabel osInvalDCache
|
||||||
/* 006E84 80006284 00000000 */ nop
|
/* 006E84 80006284 00000000 */ nop
|
||||||
|
|
||||||
.L80006288:
|
.L80006288:
|
||||||
/* 006E88 80006288 3C088000 */ lui $t0, %hi(D_80000010) # $t0, 0x8000
|
/* 006E88 80006288 3C088000 */ lui $t0, 0x8000
|
||||||
/* 006E8C 8000628C 010B4821 */ addu $t1, $t0, $t3
|
/* 006E8C 8000628C 010B4821 */ addu $t1, $t0, $t3
|
||||||
/* 006E90 80006290 2529FFF0 */ addiu $t1, $t1, -0x10
|
/* 006E90 80006290 2529FFF0 */ addiu $t1, $t1, -0x10
|
||||||
.L80006294:
|
.L80006294:
|
||||||
/* 006E94 80006294 BD010000 */ cache 1, ($t0)
|
/* 006E94 80006294 BD010000 */ cache 1, ($t0)
|
||||||
/* 006E98 80006298 0109082B */ sltu $at, $t0, $t1
|
/* 006E98 80006298 0109082B */ sltu $at, $t0, $t1
|
||||||
/* 006E9C 8000629C 1420FFFD */ bnez $at, .L80006294
|
/* 006E9C 8000629C 1420FFFD */ bnez $at, .L80006294
|
||||||
/* 006EA0 800062A0 25080010 */ addiu $t0, %lo(D_80000010) # addiu $t0, $t0, 0x10
|
/* 006EA0 800062A0 25080010 */ addiu $t0, 0x10
|
||||||
/* 006EA4 800062A4 03E00008 */ jr $ra
|
/* 006EA4 800062A4 03E00008 */ jr $ra
|
||||||
/* 006EA8 800062A8 00000000 */ nop
|
/* 006EA8 800062A8 00000000 */ nop
|
||||||
|
|
|
@ -34,13 +34,13 @@ glabel osInvalICache
|
||||||
/* 006D9C 8000619C 00000000 */ nop
|
/* 006D9C 8000619C 00000000 */ nop
|
||||||
|
|
||||||
.L800061A0:
|
.L800061A0:
|
||||||
/* 006DA0 800061A0 3C088000 */ lui $t0, %hi(D_80000020) # $t0, 0x8000
|
/* 006DA0 800061A0 3C088000 */ lui $t0, 0x8000
|
||||||
/* 006DA4 800061A4 010B4821 */ addu $t1, $t0, $t3
|
/* 006DA4 800061A4 010B4821 */ addu $t1, $t0, $t3
|
||||||
/* 006DA8 800061A8 2529FFE0 */ addiu $t1, $t1, -0x20
|
/* 006DA8 800061A8 2529FFE0 */ addiu $t1, $t1, -0x20
|
||||||
.L800061AC:
|
.L800061AC:
|
||||||
/* 006DAC 800061AC BD000000 */ cache 0, ($t0)
|
/* 006DAC 800061AC BD000000 */ cache 0, ($t0)
|
||||||
/* 006DB0 800061B0 0109082B */ sltu $at, $t0, $t1
|
/* 006DB0 800061B0 0109082B */ sltu $at, $t0, $t1
|
||||||
/* 006DB4 800061B4 1420FFFD */ bnez $at, .L800061AC
|
/* 006DB4 800061B4 1420FFFD */ bnez $at, .L800061AC
|
||||||
/* 006DB8 800061B8 25080020 */ addiu $t0, %lo(D_80000020) # addiu $t0, $t0, 0x20
|
/* 006DB8 800061B8 25080020 */ addiu $t0, 0x20
|
||||||
/* 006DBC 800061BC 03E00008 */ jr $ra
|
/* 006DBC 800061BC 03E00008 */ jr $ra
|
||||||
/* 006DC0 800061C0 00000000 */ nop
|
/* 006DC0 800061C0 00000000 */ nop
|
||||||
|
|
|
@ -34,13 +34,13 @@ glabel osWritebackDCache
|
||||||
/* 00530C 8000470C 00000000 */ nop
|
/* 00530C 8000470C 00000000 */ nop
|
||||||
|
|
||||||
.L80004710:
|
.L80004710:
|
||||||
/* 005310 80004710 3C088000 */ lui $t0, %hi(D_80000010) # $t0, 0x8000
|
/* 005310 80004710 3C088000 */ lui $t0, 0x8000
|
||||||
/* 005314 80004714 010B4821 */ addu $t1, $t0, $t3
|
/* 005314 80004714 010B4821 */ addu $t1, $t0, $t3
|
||||||
/* 005318 80004718 2529FFF0 */ addiu $t1, $t1, -0x10
|
/* 005318 80004718 2529FFF0 */ addiu $t1, $t1, -0x10
|
||||||
.L8000471C:
|
.L8000471C:
|
||||||
/* 00531C 8000471C BD010000 */ cache 1, ($t0)
|
/* 00531C 8000471C BD010000 */ cache 1, ($t0)
|
||||||
/* 005320 80004720 0109082B */ sltu $at, $t0, $t1
|
/* 005320 80004720 0109082B */ sltu $at, $t0, $t1
|
||||||
/* 005324 80004724 1420FFFD */ bnez $at, .L8000471C
|
/* 005324 80004724 1420FFFD */ bnez $at, .L8000471C
|
||||||
/* 005328 80004728 25080010 */ addiu $t0, %lo(D_80000010) # addiu $t0, $t0, 0x10
|
/* 005328 80004728 25080010 */ addiu $t0, 0x10
|
||||||
/* 00532C 8000472C 03E00008 */ jr $ra
|
/* 00532C 8000472C 03E00008 */ jr $ra
|
||||||
/* 005330 80004730 00000000 */ nop
|
/* 005330 80004730 00000000 */ nop
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
.balign 16
|
.balign 16
|
||||||
|
|
||||||
glabel osWritebackDCacheAll
|
glabel osWritebackDCacheAll
|
||||||
/* B7D630 80106490 3C088000 */ lui $t0, %hi(D_80000010) # $t0, 0x8000
|
/* B7D630 80106490 3C088000 */ lui $t0, 0x8000
|
||||||
/* B7D634 80106494 240A2000 */ li $t2, 8192
|
/* B7D634 80106494 240A2000 */ li $t2, 8192
|
||||||
/* B7D638 80106498 010A4821 */ addu $t1, $t0, $t2
|
/* B7D638 80106498 010A4821 */ addu $t1, $t0, $t2
|
||||||
/* B7D63C 8010649C 2529FFF0 */ addiu $t1, $t1, -0x10
|
/* B7D63C 8010649C 2529FFF0 */ addiu $t1, $t1, -0x10
|
||||||
|
@ -18,6 +18,6 @@ glabel osWritebackDCacheAll
|
||||||
/* B7D640 801064A0 BD010000 */ cache 1, ($t0)
|
/* B7D640 801064A0 BD010000 */ cache 1, ($t0)
|
||||||
/* B7D644 801064A4 0109082B */ sltu $at, $t0, $t1
|
/* B7D644 801064A4 0109082B */ sltu $at, $t0, $t1
|
||||||
/* B7D648 801064A8 1420FFFD */ bnez $at, .L801064A0
|
/* B7D648 801064A8 1420FFFD */ bnez $at, .L801064A0
|
||||||
/* B7D64C 801064AC 25080010 */ addiu $t0, %lo(D_80000010) # addiu $t0, $t0, 0x10
|
/* B7D64C 801064AC 25080010 */ addiu $t0, 0x10
|
||||||
/* B7D650 801064B0 03E00008 */ jr $ra
|
/* B7D650 801064B0 03E00008 */ jr $ra
|
||||||
/* B7D654 801064B4 00000000 */ nop
|
/* B7D654 801064B4 00000000 */ nop
|
||||||
|
|
|
@ -160,8 +160,8 @@ OSViContext* __osViGetCurrentContext(void);
|
||||||
void osStartThread(OSThread* thread);
|
void osStartThread(OSThread* thread);
|
||||||
void osViSetYScale(f32 scale);
|
void osViSetYScale(f32 scale);
|
||||||
void osViSetXScale(f32 value);
|
void osViSetXScale(f32 value);
|
||||||
void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg);
|
void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void), void* sp);
|
||||||
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg);
|
void __osGetHWIntrRoutine(OSHWIntr interrupt, s32 (**handlerOut)(void), void** spOut);
|
||||||
void __osSetWatchLo(u32);
|
void __osSetWatchLo(u32);
|
||||||
|
|
||||||
EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params);
|
EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params);
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#define PI_STATUS_BUSY 0x1
|
#define PI_STATUS_BUSY 0x1
|
||||||
#define PI_STATUS_IOBUSY 0x2
|
#define PI_STATUS_IOBUSY 0x2
|
||||||
#define PI_STATUS_ERROR 0x3
|
#define PI_STATUS_ERROR 0x4
|
||||||
|
|
||||||
#define PI_STATUS_RESET_CONTROLLER 0x1
|
#define PI_STATUS_RESET_CONTROLLER 0x1
|
||||||
#define PI_STATUS_CLEAR_INTR 0x2
|
#define PI_STATUS_CLEAR_INTR 0x2
|
||||||
|
|
|
@ -12,8 +12,8 @@ typedef struct {
|
||||||
} OSMgrArgs; // size = 0x1C
|
} OSMgrArgs; // size = 0x1C
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ OSMesgQueue* queue;
|
/* 0x00 */ s32 (*handler)(void);
|
||||||
/* 0x04 */ OSMesg msg;
|
/* 0x04 */ void* sp;
|
||||||
} __osHwInt; // size = 0x08
|
} __osHwInt; // size = 0x08
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
#define ULTRA64_INTERRUPT_H
|
#define ULTRA64_INTERRUPT_H
|
||||||
|
|
||||||
typedef u32 OSIntMask;
|
typedef u32 OSIntMask;
|
||||||
|
typedef u32 OSHWIntr;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,16 +44,16 @@ typedef struct {
|
||||||
} __OSThreadprofile; // size = 0x10
|
} __OSThreadprofile; // size = 0x10
|
||||||
|
|
||||||
typedef struct OSThread {
|
typedef struct OSThread {
|
||||||
/*0x00*/ struct OSThread* next;
|
/* 0x00 */ struct OSThread* next;
|
||||||
/*0x04*/ OSPri priority;
|
/* 0x04 */ OSPri priority;
|
||||||
/*0x08*/ struct OSThread** queue;
|
/* 0x08 */ struct OSThread** queue;
|
||||||
/*0x0C*/ struct OSThread* tlnext;
|
/* 0x0C */ struct OSThread* tlnext;
|
||||||
/*0x10*/ u16 state;
|
/* 0x10 */ u16 state;
|
||||||
/*0x12*/ u16 flags;
|
/* 0x12 */ u16 flags;
|
||||||
/*0x14*/ OSId id;
|
/* 0x14 */ OSId id;
|
||||||
/*0x18*/ s32 fp;
|
/* 0x18 */ s32 fp;
|
||||||
/*0x1C*/ __OSThreadprofile* thprof;
|
/* 0x1C */ __OSThreadprofile* thprof;
|
||||||
/*0x20*/ __OSThreadContext context;
|
/* 0x20 */ __OSThreadContext context;
|
||||||
} OSThread; // size = 0x1B0
|
} OSThread; // size = 0x1B0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,17 +14,11 @@ extern Gfx D_060257B8[];
|
||||||
extern Gfx D_0602A738[];
|
extern Gfx D_0602A738[];
|
||||||
extern Gfx D_0602CB48[];
|
extern Gfx D_0602CB48[];
|
||||||
|
|
||||||
//extern ? D_80000004;
|
|
||||||
//extern ? D_80000008;
|
|
||||||
//extern ? D_8000000C;
|
|
||||||
//extern ? D_80000010;
|
|
||||||
//extern ? D_80000020;
|
|
||||||
|
|
||||||
extern u32 osTvType;
|
extern u32 osTvType;
|
||||||
extern u32 osRomBase;
|
extern u32 osRomBase;
|
||||||
extern u32 osResetType;
|
extern u32 osResetType;
|
||||||
extern u32 osMemSize;
|
extern u32 osMemSize;
|
||||||
extern u8 osAppNmiBuffer[];
|
extern u8 osAppNmiBuffer[0x40];
|
||||||
|
|
||||||
extern u8 D_80009320[];
|
extern u8 D_80009320[];
|
||||||
extern u8 D_800093F0[];
|
extern u8 D_800093F0[];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ultra64/internal.h"
|
#include "ultra64/internal.h"
|
||||||
|
|
||||||
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg) {
|
void __osGetHWIntrRoutine(OSHWIntr interrupt, s32 (**handlerOut)(void), void** spOut) {
|
||||||
*outQueue = __osHwIntTable[idx].queue;
|
*handlerOut = __osHwIntTable[interrupt].handler;
|
||||||
*outMsg = __osHwIntTable[idx].msg;
|
*spOut = __osHwIntTable[interrupt].sp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
void __osResetGlobalIntMask(u32 mask) {
|
void __osResetGlobalIntMask(u32 mask) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
__OSGlobalIntMask &= ~(mask & ~0x401);
|
__OSGlobalIntMask &= ~(mask & ~0x401);
|
||||||
__osRestoreInt(prevInt);
|
__osRestoreInt(prevInt);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
void __osSetGlobalIntMask(u32 mask) {
|
void __osSetGlobalIntMask(u32 mask) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
__OSGlobalIntMask |= mask;
|
__OSGlobalIntMask |= mask;
|
||||||
__osRestoreInt(prevInt);
|
__osRestoreInt(prevInt);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ultra64/internal.h"
|
#include "ultra64/internal.h"
|
||||||
|
|
||||||
void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg) {
|
void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void), void* sp) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
__osHwIntTable[idx].queue = queue;
|
__osHwIntTable[interrupt].handler = handler;
|
||||||
__osHwIntTable[idx].msg = msg;
|
__osHwIntTable[interrupt].sp = sp;
|
||||||
|
|
||||||
__osRestoreInt(prevInt);
|
__osRestoreInt(prevInt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ void __osInitialize_common(void) {
|
||||||
osClockRate = (u64)((osClockRate * 3ll) / 4ull);
|
osClockRate = (u64)((osClockRate * 3ll) / 4ull);
|
||||||
|
|
||||||
if (!osResetType) {
|
if (!osResetType) {
|
||||||
bzero(osAppNmiBuffer, 0x40);
|
bzero(osAppNmiBuffer, sizeof(osAppNmiBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osTvType == OS_TV_PAL) {
|
if (osTvType == OS_TV_PAL) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
void osDestroyThread(OSThread* thread) {
|
void osDestroyThread(OSThread* thread) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
register OSThread* s1;
|
register OSThread* s1;
|
||||||
register OSThread* s2;
|
register OSThread* s2;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
|
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
while (mq->validCount >= mq->msgCount) {
|
while (mq->validCount >= mq->msgCount) {
|
||||||
if (flag == OS_MESG_BLOCK) {
|
if (flag == OS_MESG_BLOCK) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) {
|
s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
while (mq->validCount == 0) {
|
while (mq->validCount == 0) {
|
||||||
if (flag == OS_MESG_NOBLOCK) {
|
if (flag == OS_MESG_NOBLOCK) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data) {
|
||||||
s32 status;
|
s32 status;
|
||||||
OSPiHandle* curHandle;
|
OSPiHandle* curHandle;
|
||||||
|
|
||||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
|
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr
|
||||||
s32 status;
|
s32 status;
|
||||||
OSPiHandle* curHandle;
|
OSPiHandle* curHandle;
|
||||||
|
|
||||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
|
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) {
|
||||||
s32 status;
|
s32 status;
|
||||||
OSPiHandle* curHandle;
|
OSPiHandle* curHandle;
|
||||||
|
|
||||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
|
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size) {
|
s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size) {
|
||||||
register s32 status = HW_REG(PI_STATUS_REG, u32);
|
register s32 status = HW_REG(PI_STATUS_REG, u32);
|
||||||
|
|
||||||
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
|
while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
status = HW_REG(PI_STATUS_REG, u32);
|
status = HW_REG(PI_STATUS_REG, u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ OSPiHandle* osCartRomInit(void) {
|
||||||
__CartRomHandle.speed = 0;
|
__CartRomHandle.speed = 0;
|
||||||
bzero(&__CartRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
bzero(&__CartRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
||||||
|
|
||||||
while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) {
|
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ OSPiHandle __DriveRomHandle;
|
||||||
OSPiHandle* osDriveRomInit(void) {
|
OSPiHandle* osDriveRomInit(void) {
|
||||||
register s32 status;
|
register s32 status;
|
||||||
register u32 a;
|
register u32 a;
|
||||||
register s32 prevInt;
|
register u32 prevInt;
|
||||||
static u32 D_8000AC70 = 1;
|
static u32 D_8000AC70 = 1;
|
||||||
|
|
||||||
__osPiGetAccess();
|
__osPiGetAccess();
|
||||||
|
@ -22,7 +22,7 @@ OSPiHandle* osDriveRomInit(void) {
|
||||||
__DriveRomHandle.speed = 0;
|
__DriveRomHandle.speed = 0;
|
||||||
bzero(&__DriveRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
bzero(&__DriveRomHandle.transferInfo, sizeof(__OSTranxInfo));
|
||||||
|
|
||||||
while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) {
|
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
void* osViGetNextFramebuffer(void) {
|
void* osViGetNextFramebuffer(void) {
|
||||||
s32 prevInt = __osDisableInt();
|
u32 prevInt = __osDisableInt();
|
||||||
void* buff = __osViNext->buffer;
|
void* buff = __osViNext->buffer;
|
||||||
|
|
||||||
__osRestoreInt(prevInt);
|
__osRestoreInt(prevInt);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
void osViSetYScale(f32 scale) {
|
void osViSetYScale(f32 scale) {
|
||||||
register s32 prevInt = __osDisableInt();
|
register u32 prevInt = __osDisableInt();
|
||||||
|
|
||||||
__osViNext->y.factor = scale;
|
__osViNext->y.factor = scale;
|
||||||
__osViNext->state |= 4;
|
__osViNext->state |= 4;
|
||||||
|
|
|
@ -1,21 +1,12 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ultra64/internal.h"
|
#include "ultra64/internal.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
u16 unk00;
|
|
||||||
u8 unk02;
|
|
||||||
u32 unk04;
|
|
||||||
u8 pad[0xC];
|
|
||||||
u16 unk14;
|
|
||||||
u16 unk16;
|
|
||||||
} viMesgStruct;
|
|
||||||
|
|
||||||
OSThread viThread;
|
OSThread viThread;
|
||||||
u8 viThreadStack[0x1000];
|
u8 viThreadStack[0x1000];
|
||||||
OSMesgQueue viEventQueue;
|
OSMesgQueue viEventQueue;
|
||||||
OSMesg viEventBuf[6];
|
OSMesg viEventBuf[6];
|
||||||
viMesgStruct viRetraceMsg;
|
OSIoMesg viRetraceMsg;
|
||||||
viMesgStruct viCounterMsg;
|
OSIoMesg viCounterMsg;
|
||||||
OSMgrArgs __osViDevMgr = { 0 };
|
OSMgrArgs __osViDevMgr = { 0 };
|
||||||
u32 __additional_scanline = 0;
|
u32 __additional_scanline = 0;
|
||||||
|
|
||||||
|
@ -30,12 +21,12 @@ void osCreateViManager(OSPri pri) {
|
||||||
__osTimerServicesInit();
|
__osTimerServicesInit();
|
||||||
__additional_scanline = 0;
|
__additional_scanline = 0;
|
||||||
osCreateMesgQueue(&viEventQueue, viEventBuf, 5);
|
osCreateMesgQueue(&viEventQueue, viEventBuf, 5);
|
||||||
viRetraceMsg.unk00 = 13;
|
viRetraceMsg.hdr.type = 13;
|
||||||
viRetraceMsg.unk02 = 0;
|
viRetraceMsg.hdr.pri = 0;
|
||||||
viRetraceMsg.unk04 = 0;
|
viRetraceMsg.hdr.retQueue = NULL;
|
||||||
viCounterMsg.unk00 = 14;
|
viCounterMsg.hdr.type = 14;
|
||||||
viCounterMsg.unk02 = 0;
|
viCounterMsg.hdr.pri = 0;
|
||||||
viCounterMsg.unk04 = 0;
|
viCounterMsg.hdr.retQueue = NULL;
|
||||||
osSetEventMesg(OS_EVENT_VI, &viEventQueue, &viRetraceMsg);
|
osSetEventMesg(OS_EVENT_VI, &viEventQueue, &viRetraceMsg);
|
||||||
osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg);
|
osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg);
|
||||||
newPri = -1;
|
newPri = -1;
|
||||||
|
@ -68,10 +59,9 @@ void viMgrMain(void* vargs) {
|
||||||
OSMgrArgs* args;
|
OSMgrArgs* args;
|
||||||
static u16 viRetrace;
|
static u16 viRetrace;
|
||||||
u32 addTime;
|
u32 addTime;
|
||||||
viMesgStruct* mesg;
|
OSIoMesg* mesg = NULL;
|
||||||
u32 temp = 0; // always 0
|
u32 temp = 0; // always 0
|
||||||
|
|
||||||
mesg = NULL;
|
|
||||||
viRetrace = __osViGetCurrentContext()->retraceCount;
|
viRetrace = __osViGetCurrentContext()->retraceCount;
|
||||||
if (viRetrace == 0) {
|
if (viRetrace == 0) {
|
||||||
viRetrace = 1;
|
viRetrace = 1;
|
||||||
|
@ -81,7 +71,7 @@ void viMgrMain(void* vargs) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
osRecvMesg(args->eventQueue, (OSMesg)&mesg, OS_MESG_BLOCK);
|
osRecvMesg(args->eventQueue, (OSMesg)&mesg, OS_MESG_BLOCK);
|
||||||
switch (mesg->unk00) {
|
switch (mesg->hdr.type) {
|
||||||
case 13:
|
case 13:
|
||||||
__osViSwapContext();
|
__osViSwapContext();
|
||||||
viRetrace--;
|
viRetrace--;
|
||||||
|
|
|
@ -5,7 +5,7 @@ s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* m
|
||||||
OSTimer* next;
|
OSTimer* next;
|
||||||
u32 count;
|
u32 count;
|
||||||
u32 value;
|
u32 value;
|
||||||
s32 prevInt;
|
u32 prevInt;
|
||||||
|
|
||||||
timer->next = NULL;
|
timer->next = NULL;
|
||||||
timer->prev = NULL;
|
timer->prev = NULL;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
s32 osStopTimer(OSTimer* timer) {
|
s32 osStopTimer(OSTimer* timer) {
|
||||||
register s32 prevInt;
|
register u32 prevInt;
|
||||||
OSTimer* next;
|
OSTimer* next;
|
||||||
|
|
||||||
if (!timer->next) {
|
if (!timer->next) {
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
// libultra OS symbols
|
// libultra OS symbols
|
||||||
D_80000000 = 0x80000000;
|
|
||||||
D_80000002 = 0x80000002;
|
|
||||||
D_80000004 = 0x80000004;
|
|
||||||
D_80000008 = 0x80000008;
|
|
||||||
D_8000000C = 0x8000000C;
|
|
||||||
D_80000010 = 0x80000010;
|
|
||||||
D_80000020 = 0x80000020;
|
|
||||||
osTvType = 0x80000300;
|
osTvType = 0x80000300;
|
||||||
osRomBase = 0x80000308;
|
osRomBase = 0x80000308;
|
||||||
osResetType = 0x8000030C;
|
osResetType = 0x8000030C;
|
||||||
|
|
Loading…
Reference in a new issue