mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-14 21:40:03 +00:00
Miscellaneous libultra header fixes (#2139)
* Miscellaneous libultra header fixes * Fix bss? * Reword RCP timeout
This commit is contained in:
parent
53b2110373
commit
2ce648a7c6
19 changed files with 69 additions and 64 deletions
|
@ -15,7 +15,4 @@
|
|||
#define OS_PHYSICAL_TO_K0(x) (void*)(((u32)(x)+0x80000000))
|
||||
#define OS_PHYSICAL_TO_K1(x) (void*)(((u32)(x)+0xA0000000))
|
||||
|
||||
#define OS_MSEC_TO_CYCLES(n) OS_USEC_TO_CYCLES((n) * 1000)
|
||||
#define OS_SEC_TO_CYCLES(n) OS_MSEC_TO_CYCLES((n) * 1000)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -529,7 +529,7 @@
|
|||
#define VI_CTRL_ANTIALIAS_MODE_2 0x00200 // Bit [9:8] anti-alias mode: AA disabled, resampling enabled, operate as if everything is covered
|
||||
#define VI_CTRL_ANTIALIAS_MODE_3 0x00300 // Bit [9:8] anti-alias mode: AA disabled, resampling disabled, replicate pixels
|
||||
#define VI_CTRL_PIXEL_ADV_MASK 0x0F000 // [15:12] pixel advance mode
|
||||
#define VI_CTRL_PIXEL_ADV(n) (((n) << 12) & VI_CTRL_PIXEL_ADV_MASK) // Bit [15:12] pixel advance mode: Always 3 on N64
|
||||
#define VI_CTRL_PIXEL_ADV_3 0x03000 // Bit [15:12] pixel advance mode: Always 3 on N64
|
||||
#define VI_CTRL_DITHER_FILTER_ON 0x10000 // 16: dither-filter mode
|
||||
|
||||
/*
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
extern Mtx D_01000000;
|
||||
|
||||
extern u32 osTvType;
|
||||
extern u32 osRomBase;
|
||||
extern u32 osResetType;
|
||||
extern u32 osCicId;
|
||||
extern void* osRomBase;
|
||||
extern s32 osTvType;
|
||||
extern s32 osResetType;
|
||||
extern s32 osCicId;
|
||||
extern u32 osMemSize;
|
||||
extern u8 osAppNMIBuffer[0x40];
|
||||
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
#define SQ(x) ((x)*(x))
|
||||
#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z)
|
||||
|
||||
typedef union FloatInt {
|
||||
f32 f;
|
||||
u32 i;
|
||||
} FloatInt;
|
||||
|
||||
typedef struct Vec2f {
|
||||
f32 x, y;
|
||||
} Vec2f; // size = 0x08
|
||||
|
|
|
@ -144,7 +144,8 @@ void Fault_ClientRunTask(FaultClientTask* task) {
|
|||
|
||||
// Await done
|
||||
while (true) {
|
||||
osSetTimer(&timer, OS_SEC_TO_CYCLES(1), 0, &queue, (OSMesg)timerMsgVal);
|
||||
// Wait for 1 second
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(1000000), 0, &queue, (OSMesg)timerMsgVal);
|
||||
osRecvMesg(&queue, &recMsg, OS_MESG_BLOCK);
|
||||
|
||||
if (recMsg != (OSMesg)666) {
|
||||
|
@ -653,7 +654,7 @@ void Fault_Wait5Seconds(void) {
|
|||
|
||||
do {
|
||||
Fault_Sleep(1000 / 60);
|
||||
} while ((osGetTime() - start) < OS_SEC_TO_CYCLES(5) + 1);
|
||||
} while ((osGetTime() - start) <= OS_USEC_TO_CYCLES(5000000)); // 5 seconds
|
||||
|
||||
sFaultInstance->autoScroll = true;
|
||||
}
|
||||
|
|
|
@ -302,22 +302,22 @@ void GameState_Update(GameState* gameState) {
|
|||
gfxCtx->xScale = gViConfigXScale;
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
|
||||
if (SREG(63) == 6 || (SREG(63) == 2u && osTvType == OS_TV_NTSC)) {
|
||||
if (SREG(63) == 6 || (SREG(63) == 2u && (u32)osTvType == OS_TV_NTSC)) {
|
||||
gfxCtx->viMode = &osViModeNtscLan1;
|
||||
gfxCtx->yScale = 1.0f;
|
||||
}
|
||||
|
||||
if (SREG(63) == 5 || (SREG(63) == 2u && osTvType == OS_TV_MPAL)) {
|
||||
if (SREG(63) == 5 || (SREG(63) == 2u && (u32)osTvType == OS_TV_MPAL)) {
|
||||
gfxCtx->viMode = &osViModeMpalLan1;
|
||||
gfxCtx->yScale = 1.0f;
|
||||
}
|
||||
|
||||
if (SREG(63) == 4 || (SREG(63) == 2u && osTvType == OS_TV_PAL)) {
|
||||
if (SREG(63) == 4 || (SREG(63) == 2u && (u32)osTvType == OS_TV_PAL)) {
|
||||
gfxCtx->viMode = &osViModePalLan1;
|
||||
gfxCtx->yScale = 1.0f;
|
||||
}
|
||||
|
||||
if (SREG(63) == 3 || (SREG(63) == 2u && osTvType == OS_TV_PAL)) {
|
||||
if (SREG(63) == 3 || (SREG(63) == 2u && (u32)osTvType == OS_TV_PAL)) {
|
||||
gfxCtx->viMode = &osViModeFpalLan1;
|
||||
gfxCtx->yScale = 0.833f;
|
||||
}
|
||||
|
|
|
@ -179,6 +179,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||
{
|
||||
CfbInfo* cfb;
|
||||
|
||||
// Schedule a message to be handled in 3 seconds, for RCP timeout
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666);
|
||||
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
||||
|
|
|
@ -164,7 +164,7 @@ void IrqMgr_HandlePreNMI(IrqMgr* irqMgr) {
|
|||
sIrqMgrResetTime = irqMgr->resetTime = osGetTime();
|
||||
|
||||
// Schedule a PRENMI450 message to be handled in 450ms
|
||||
osSetTimer(&irqMgr->timer, OS_MSEC_TO_CYCLES(450), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI450_MSG);
|
||||
osSetTimer(&irqMgr->timer, OS_USEC_TO_CYCLES(450000), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI450_MSG);
|
||||
IrqMgr_JamMesgToClients(irqMgr, (OSMesg)&irqMgr->prenmiMsg);
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ void IrqMgr_HandlePreNMI450(IrqMgr* irqMgr) {
|
|||
irqMgr->resetStatus = IRQ_RESET_STATUS_NMI;
|
||||
|
||||
// Schedule a PRENMI480 message to be handled in 30ms
|
||||
osSetTimer(&irqMgr->timer, OS_MSEC_TO_CYCLES(30), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI480_MSG);
|
||||
osSetTimer(&irqMgr->timer, OS_USEC_TO_CYCLES(30000), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI480_MSG);
|
||||
// Send the NMI event to clients
|
||||
IrqMgr_SendMesgToClients(irqMgr, (OSMesg)&irqMgr->nmiMsg);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void IrqMgr_HandlePreNMI480(IrqMgr* irqMgr) {
|
|||
u32 result;
|
||||
|
||||
// Schedule a PRENMI500 message to be handled in 20ms
|
||||
osSetTimer(&irqMgr->timer, OS_MSEC_TO_CYCLES(20), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI500_MSG);
|
||||
osSetTimer(&irqMgr->timer, OS_USEC_TO_CYCLES(20000), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI500_MSG);
|
||||
|
||||
result = osAfterPreNMI();
|
||||
if (result != 0) {
|
||||
|
@ -207,7 +207,7 @@ void IrqMgr_HandlePreNMI480(IrqMgr* irqMgr) {
|
|||
// osAfterPreNMI failed, try again in 1ms
|
||||
//! @bug setting the same timer for a second time without letting the first one complete breaks
|
||||
//! the timer linked list
|
||||
osSetTimer(&irqMgr->timer, OS_MSEC_TO_CYCLES(1), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI480_MSG);
|
||||
osSetTimer(&irqMgr->timer, OS_USEC_TO_CYCLES(1000), 0, &irqMgr->queue, (OSMesg)IRQ_PRENMI480_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
* @note Original name: qrand.c
|
||||
*/
|
||||
#include "rand.h"
|
||||
#include "z64math.h"
|
||||
|
||||
#define RAND_MULTIPLIER 1664525
|
||||
#define RAND_INCREMENT 1013904223
|
||||
|
@ -59,7 +60,7 @@ static u32 sRandInt = 1;
|
|||
*
|
||||
* @note Orignal name: __qrand_itemp
|
||||
*/
|
||||
static fu sRandFloat;
|
||||
static FloatInt sRandFloat;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "macros.h"
|
||||
#include "sys_math3d.h"
|
||||
|
||||
#pragma increment_block_number "gc-eu:106 gc-eu-mq:106 gc-jp:106 gc-jp-ce:106 gc-jp-mq:106 gc-us:106 gc-us-mq:106"
|
||||
#pragma increment_block_number "gc-eu:103 gc-eu-mq:103 gc-jp:103 gc-jp-ce:103 gc-jp-mq:103 gc-us:103 gc-us-mq:103"
|
||||
|
||||
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
|
||||
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "terminal.h"
|
||||
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
|
||||
|
||||
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
|
||||
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
|
||||
|
||||
s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags);
|
||||
s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange);
|
||||
|
|
|
@ -85,7 +85,7 @@ void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antia
|
|||
yScaleHiOddField = modeF ? (loResInterlaced ? (F210(0.75) << 16) : (F210(0.5) << 16)) : 0;
|
||||
|
||||
viMode->customViMode.type = type;
|
||||
viMode->customViMode.comRegs.ctrl = VI_CTRL_PIXEL_ADV(3) | VI_CTRL_GAMMA_ON | VI_CTRL_GAMMA_DITHER_ON |
|
||||
viMode->customViMode.comRegs.ctrl = VI_CTRL_PIXEL_ADV_3 | VI_CTRL_GAMMA_ON | VI_CTRL_GAMMA_DITHER_ON |
|
||||
(!loResDeinterlaced ? VI_CTRL_SERRATE_ON : 0) |
|
||||
(antialiasOn ? VI_CTRL_DIVOT_ON : 0) |
|
||||
(fb32Bit ? VI_CTRL_TYPE_32 : VI_CTRL_TYPE_16);
|
||||
|
|
|
@ -16,15 +16,15 @@ OSViMode osViModeFpalLan1 = {
|
|||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 |
|
||||
VI_CTRL_PIXEL_ADV(3), // 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
|
||||
VI_CTRL_PIXEL_ADV_3, // 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
|
||||
{
|
||||
|
|
|
@ -16,15 +16,15 @@ OSViMode osViModeMpalLan1 = {
|
|||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 |
|
||||
VI_CTRL_PIXEL_ADV(3), // 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
|
||||
VI_CTRL_PIXEL_ADV_3, // 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
|
||||
{
|
||||
|
|
|
@ -16,15 +16,15 @@ OSViMode osViModeNtscLan1 = {
|
|||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 |
|
||||
VI_CTRL_PIXEL_ADV(3), // 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
|
||||
VI_CTRL_PIXEL_ADV_3, // 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
|
||||
{
|
||||
|
|
|
@ -16,15 +16,15 @@ OSViMode osViModePalLan1 = {
|
|||
{
|
||||
// comRegs
|
||||
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 |
|
||||
VI_CTRL_PIXEL_ADV(3), // 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
|
||||
VI_CTRL_PIXEL_ADV_3, // 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
|
||||
{
|
||||
|
|
|
@ -100,13 +100,13 @@ static ColliderCylinderInit sLightBallCylinderInit = {
|
|||
static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 };
|
||||
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
|
||||
static EnGanonMant* sCape;
|
||||
|
||||
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
|
||||
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
|
||||
static s32 sSeed1;
|
||||
static s32 sSeed2;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "cic6105.h"
|
||||
#endif
|
||||
|
||||
#pragma increment_block_number "gc-eu:157 gc-eu-mq:157 gc-jp:159 gc-jp-ce:159 gc-jp-mq:159 gc-us:159 gc-us-mq:159"
|
||||
#pragma increment_block_number "gc-eu:154 gc-eu-mq:154 gc-jp:156 gc-jp-ce:156 gc-jp-mq:156 gc-us:156 gc-us-mq:156"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
|
|
|
@ -354,19 +354,19 @@ void Player_Action_CsAction(Player* this, PlayState* play);
|
|||
|
||||
// .bss part 1
|
||||
|
||||
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
|
||||
static s32 D_80858AA0;
|
||||
|
||||
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
|
||||
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192"
|
||||
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192"
|
||||
|
||||
static s32 D_80858AA4;
|
||||
static Vec3f sInteractWallCheckResult;
|
||||
static Input* sControlInput;
|
||||
|
||||
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224"
|
||||
#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224"
|
||||
|
||||
// .data
|
||||
|
||||
|
|
Loading…
Reference in a new issue