This commit is contained in:
MegaMech
2024-05-02 12:21:35 -06:00
parent c76d7d4b9b
commit e3774dc377
44 changed files with 143 additions and 670 deletions
+1
View File
@@ -1,4 +1,5 @@
#include <libultraship.h>
#include <common_structs.h>
#include <macros.h>
#include <mk64.h>
#include <defines.h>
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef AUDIO_EXTERNAL_H
#define AUDIO_EXTERNAL_H
#include "common_structs.h"
#include <libultraship.h>
#include <common_structs.h>
#include "camera.h"
#define ADSR_STATE_DISABLED 0
+20 -11
View File
@@ -1,4 +1,5 @@
#include <libultraship.h>
#include <libultra/message.h>
#include <macros.h>
#include "audio/synthesis.h"
@@ -61,7 +62,11 @@ struct SPTask *create_next_audio_frame_task(void) {
if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) != 0) {
return NULL;
}
osSendMesg(D_800EA3A8, (OSMesg) gAudioFrameCount, 0);
OSMesg audioMesg; // <-- new
audioMesg.ptr = (void*)gAudioFrameCount; // <-- new
//osSendMesg(D_800EA3A8, (OSMesg) gAudioFrameCount, 0); <-- original
osSendMesg(D_800EA3A8, audioMesg, OS_MESG_NOBLOCK); // <-- new
gAudioTaskIndex ^= 1;
gCurrAiBufferIndex++;
@@ -92,13 +97,13 @@ struct SPTask *create_next_audio_frame_task(void) {
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(D_800EA3B0, &sp58, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (u32) sp58;
//gAudioResetPresetIdToLoad = (u8) (u32) sp58;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (audio_shut_down_and_reset_step() == 0) {
if (gAudioResetStatus == 0) {
osSendMesg(D_800EA3B4, (OSMesg) (u32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
osSendMesg(D_800EA3B4, sp58, OS_MESG_NOBLOCK);
}
return NULL;
}
@@ -116,7 +121,7 @@ struct SPTask *create_next_audio_frame_task(void) {
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(D_800EA3AC, &sp54, 0) != -1) {
func_800CBCB0((u32) sp54);
func_800CBCB0((u32) sp54.data16);
}
gAudioCmd = synthesis_execute((Acmd *) gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
gAudioRandom = osGetCount() * (gAudioRandom + gAudioFrameCount);
@@ -126,17 +131,17 @@ struct SPTask *create_next_audio_frame_task(void) {
gAudioTask->msgqueue = NULL;
// wtf?
writtenCmdsCopy += 0;
gAudioTask->msg = NULL;
gAudioTask->msg.ptr = NULL;
task = &gAudioTask->task.t;
task->type = M_AUDTASK;
task->flags = 0;
task->ucode_boot = rspF3DBootStart;
task->ucode_boot_size = (u8*) rspF3DBootEnd - (u8*) rspF3DBootStart;
task->ucode = rspAspMainStart;
task->ucode_data = rspAspMainDataStart;
//task->ucode_boot = rspF3DBootStart;
//task->ucode_boot_size = (u8*) rspF3DBootEnd - (u8*) rspF3DBootStart;
//task->ucode = rspAspMainStart;
//task->ucode_data = rspAspMainDataStart;
task->ucode_size = 0x00001000;
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
//task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
task->dram_stack = NULL;
task->dram_stack_size = 0;
task->output_buff = NULL;
@@ -266,7 +271,11 @@ void func_800CBC24(void){
if (D_800EA4A4 < test) {
D_800EA4A4 = test;
}
thing = (OSMesg) ((D_800EA3A0[0] & 0xFF) | ((D_800EA3A4[0] & 0xFF) << 8));
OSMesg audioMesg;
audioMesg.ptr = ((D_800EA3A0[0] & 0xFF) | ((D_800EA3A4[0] & 0xFF) << 8));
thing = audioMesg;
osSendMesg(D_800EA3AC, thing, 0);
D_800EA3A4[0] = D_800EA3A0[0];
}
+1 -1
View File
@@ -7,7 +7,7 @@
#include "camera.h"
#include "code_800029B0.h"
#include "math_util.h"
#include "racing/math_util.h"
#include "racing/memory.h"
#include "waypoints.h"
#include "render_player.h"
+1
View File
@@ -1,6 +1,7 @@
#ifndef CAMERA_H
#define CAMERA_H
#include <libultraship.h>
#include "common_structs.h"
/**
+1
View File
@@ -1,6 +1,7 @@
#include <libultraship.h>
#include <macros.h>
#include <mk64.h>
#include <stubs.h>
#include "code_800029B0.h"
#include "memory.h"
+6 -6
View File
@@ -10,7 +10,7 @@ void func_80086EAC(s32, s32, s16);
void func_80086EF0(s32);
void func_80086F10(s32, s32, SplineData*);
void func_80086F60(s32);
s32 func_80086FA4(s32);
bool func_80086FA4(s32);
void func_80086FD4(s32);
void func_8008701C(s32, s32);
s32 func_80087060(s32, s32);
@@ -40,11 +40,11 @@ void func_80087844(s32);
f32 func_8008786C(f32, f32, f32, f32, f32);
s32 func_8008789C(s32, s32);
s32 func_80087954(s32, s32);
s32 func_80087A0C(s32, s16, s16, s16, s16);
bool func_80087A0C(s32, s16, s16, s16, s16);
s32 func_80087B84(s32, f32, f32);
s32 func_80087C48(s32, f32, f32, s32);
s32 func_80087D24(s32, f32, f32, f32);
s32 func_80087E08(s32, f32, f32, f32, s16, s32);
bool func_80087E08(s32, f32, f32, f32, s16, s32);
s32 func_80087F14(s32, f32, f32, f32, s16, s32);
void func_80088038(s32, f32, u16);
void func_800880DC(void);
@@ -68,14 +68,14 @@ bool is_within_horizontal_distance_of_player(s32, Player*, f32);
s32 are_between_distance_2d(s32, Player*, f32, f32);
bool is_within_distance_to_player(s32, Player*, f32);
bool is_within_horizontal_distance_to_camera(s32, Camera*, f32);
s32 is_within_bounds_to_camera(s32, Camera*, f32, f32);
UNUSED bool is_within_bounds_to_camera(s32, Camera*, f32, f32);
bool is_within_distance_to_camera(s32, Camera*, f32);
bool has_collided_horizontally_with_player(s32, Player*);
bool has_collided_with_player(s32, Player*);
bool has_collided_with_player_1d(s32, Player*, f32);
bool has_collided_with_player_and_within_height(s32, Player*, f32);
f32 func_80088F54(s32, Player*);
s32 func_80088F94(s32, Player*, f32);
UNUSED bool func_80088F94(s32, Player*, f32);
void func_80088FF0(Player*);
void func_8008900C(Player*);
void func_80089020(s32, f32*);
@@ -93,7 +93,7 @@ s32 func_80089E18(s32);
s32 func_80089F24(s32);
s32 func_8008A060(s32, Camera*, u16);
s32 func_8008A0B4(s32, Player*, Camera*, u16);
s32 is_object_visible_on_camera(s32, Camera*, u16);
bool is_object_visible_on_camera(s32, Camera*, u16);
void func_8008A1D0(s32, s32, s32, s32);
void func_8008A2CC(s32, s32, u16);
s32 func_8008A364(s32, s32, u16, s32);
+5 -3
View File
@@ -198,9 +198,11 @@ void thread9_crash_screen(UNUSED void *arg0)
{
static OSThread *thread;
OSMesg mesg;
OSMesg newMesg;
newMesg.data16 = 16;
osSetEventMesg(12, &D_80162D40, (OSMesg) 16);
osSetEventMesg(10, &D_80162D40, (OSMesg) 16);
osSetEventMesg(12, &D_80162D40, newMesg);
osSetEventMesg(10, &D_80162D40, newMesg);
sButtonSequenceIndex = 0;
while (true) {
@@ -231,7 +233,7 @@ void thread9_crash_screen(UNUSED void *arg0)
}
#endif
#if DEBUG
crash_screen_draw(thread);
//crash_screen_draw(thread);
#else
crash_screen_draw_info(pFramebuffer, thread);
#endif
+1
View File
@@ -3,6 +3,7 @@
#include <mk64.h>
#include <debug.h>
#include <common_structs.h>
#include "../camera.h"
#include "main.h"
#include "memory.h"
#include <assets/common_data.h>
+2 -1
View File
@@ -1,7 +1,8 @@
#ifndef podium_ceremony_actors_H
#define podium_ceremony_actors_H
#include "common_structs.h"
#include <libultraship.h>
#include <common_structs.h>
enum CeremonyActorType {
Initial,
-1
View File
@@ -1,6 +1,5 @@
#include <libultraship.h>
#include <macros.h>
#include "PR/gu.h"
#include "main.h"
#include <mk64.h>
+18 -18
View File
@@ -2,11 +2,11 @@
#define D_800DC510_AS_U16
#endif
#include <libultraship.h>
#include <PR/os.h>
#include <PR/ucode.h>
#include <libultra/vi.h>
#include <macros.h>
#include <decode.h>
#include <mk64.h>
#include <stubs.h>
#include "profiler.h"
#include "main.h"
@@ -206,7 +206,7 @@ void create_thread(OSThread *thread, OSId id, void (*entry)(void *), void *arg,
void isPrintfInit(void);
void main_func(void) {
#ifdef VERSION_EU
osTvType = TV_TYPE_PAL;
osTvType = OS_TV_PAL;
#endif
osInitialize();
#ifdef DEBUG
@@ -215,7 +215,7 @@ void main_func(void) {
create_thread(&gIdleThread, 1, &thread1_idle, NULL, gIdleThreadStack + ARRAY_COUNT(gIdleThreadStack), 100);
osStartThread(&gIdleThread);
}
extern OSViMode osViModeTable[];
/**
* Initialize hardware, start main thread, then idle.
*/
@@ -224,7 +224,7 @@ void thread1_idle(void *arg) {
#ifdef VERSION_EU
osViSetMode(&osViModeTable[OS_VI_PAL_LAN1]);
#else // VERSION_US
if (osTvType == TV_TYPE_NTSC) {
if (osTvType == OS_TV_NTSC) {
osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]);
} else {
osViSetMode(&osViModeTable[OS_VI_MPAL_LAN1]);
@@ -248,7 +248,7 @@ void setup_mesg_queues(void) {
osCreateMesgQueue(&gDmaMesgQueue, gDmaMesgBuf, ARRAY_COUNT(gDmaMesgBuf));
osCreateMesgQueue(&gSPTaskMesgQueue, gSPTaskMesgBuf, ARRAY_COUNT(gSPTaskMesgBuf));
osCreateMesgQueue(&gIntrMesgQueue, gIntrMesgBuf, ARRAY_COUNT(gIntrMesgBuf));
osViSetEvent(&gIntrMesgQueue, (OSMesg) MESG_VI_VBLANK, 1);
osViSetEvent(&gIntrMesgQueue, MESG_VI_VBLANK, 1);
osSetEventMesg(OS_EVENT_SP, &gIntrMesgQueue, (OSMesg) MESG_SP_COMPLETE);
osSetEventMesg(OS_EVENT_DP, &gIntrMesgQueue, (OSMesg) MESG_DP_COMPLETE);
}
@@ -273,24 +273,24 @@ void create_gfx_task_structure(void) {
gGfxSPTask->msg = (OSMesg) 2;
gGfxSPTask->task.t.type = M_GFXTASK;
gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
gGfxSPTask->task.t.ucode_boot = rspF3DBootStart;
gGfxSPTask->task.t.ucode_boot_size = ((u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart);
// gGfxSPTask->task.t.ucode_boot = rspF3DBootStart;
// gGfxSPTask->task.t.ucode_boot_size = ((u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart);
// The split-screen multiplayer racing state uses F3DLX which has a simple subpixel calculation.
// Singleplayer race mode and all other game states use F3DEX.
// http://n64devkit.square7.ch/n64man/ucode/gspF3DEX.htm
if (gGamestate != RACING || gPlayerCountSelection1 == 1) {
gGfxSPTask->task.t.ucode = gspF3DEXTextStart;
gGfxSPTask->task.t.ucode_data = gspF3DEXDataStart;
} else {
gGfxSPTask->task.t.ucode = gspF3DLXTextStart;
gGfxSPTask->task.t.ucode_data = gspF3DLXDataStart;
}
// if (gGamestate != RACING || gPlayerCountSelection1 == 1) {
// gGfxSPTask->task.t.ucode = gspF3DEXTextStart;
// gGfxSPTask->task.t.ucode_data = gspF3DEXDataStart;
// } else {
// gGfxSPTask->task.t.ucode = gspF3DLXTextStart;
// gGfxSPTask->task.t.ucode_data = gspF3DLXDataStart;
// }
gGfxSPTask->task.t.flags = 0;
gGfxSPTask->task.t.flags = OS_TASK_DP_WAIT;
gGfxSPTask->task.t.ucode_size = SP_UCODE_SIZE;
gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
// gGfxSPTask->task.t.ucode_size = SP_UCODE_SIZE;
// gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
gGfxSPTask->task.t.dram_stack = (u64 *) &gGfxSPTaskStack;
gGfxSPTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
// gGfxSPTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
gGfxSPTask->task.t.output_buff = (u64 *) &gGfxSPTaskOutputBuffer;
gGfxSPTask->task.t.output_buff_size = (u64 *) ((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
gGfxSPTask->task.t.data_ptr = (u64 *) gGfxPool->gfxPool;
+5 -4
View File
@@ -1,7 +1,8 @@
#ifndef MATH_UTIL_2_H
#define MATH_UTIL_2_H
#include "common_structs.h"
#include <libultraship.h>
#include <common_structs.h>
#include "camera.h"
/* Function Prototypes */
@@ -10,7 +11,7 @@
void operator_or(s32*, s32);
void operator_and_not(s32*,s32);
void operator_xor(s32*, s32);
s32 func_80040E84(s32*, s32);
UNUSED bool func_80040E84(s32*, s32);
s32 func_80040EA4(s32*, s32);
s32 f32_step_up_towards_alternate(f32*, f32, f32*);
s32 f32_step_down_towards_alternate(f32*, f32, f32*);
@@ -52,14 +53,14 @@ Vec3f *vec3f_set_xyz(Vec3f, f32, f32, f32);
Vec3f *vec3f_normalize(Vec3f dest);
Vec3f *vec3f_cross_product(Vec3f, Vec3f, Vec3f);
s32 func_80041658(f32, f32);
f32 func_800416D8(f32, f32, u16);
f32 func_800416D8(f32 x, f32 z, u16 angle);
f32 func_80041724(f32, f32, u16);
s32 get_angle_between_xy(f32, f32, f32, f32);
u16 func_800417B4(u16, u16);
s32 func_800418AC(f32, f32, Vec3f);
s32 func_800418E8(f32, f32, Vec3f);
s32 func_80041924(Collision*, Vec3f);
s32 is_particle_on_screen(Vec3f, Camera*, u16);
bool is_particle_on_screen(Vec3f, Camera*, u16);
void func_800419F8(void);
void mtfx_translation_x_y(Mat4, s32, s32);
void mtxf_u16_rotate_z(Mat4, u16);
+2 -2
View File
@@ -29,13 +29,13 @@ void controller_pak_menu_act(struct Controller *, u16);
void splash_menu_act(struct Controller *, u16);
void func_800B28C8(void);
void main_menu_act(struct Controller *, u16);
s32 is_character_spot_free(s32);
bool is_character_spot_free(s32);
void player_select_menu_act(struct Controller *, u16);
void course_select_menu_act(struct Controller *, u16);
void func_800B3F74(s32);
void func_800B44AC(void);
void func_800B44BC(void);
s32 func_800B4520(void);
bool func_800B4520(void);
/* data */
extern s32 D_8018EDC0;
+6 -6
View File
@@ -23,7 +23,7 @@ void __osDevMgrMain(void *args) {
ret = 0;
sp34 = (OSMgrArgs *) args;
while (true) {
osRecvMesg(sp34->cmdQueue, (OSMesg) &mb, OS_MESG_BLOCK);
osRecvMesg(sp34->cmdQueue, (OSMesg *) &mb, OS_MESG_BLOCK);
if (mb->piHandle != NULL && mb->piHandle->type == 2
&& (mb->piHandle->transferInfo.cmdType == 0
|| mb->piHandle->transferInfo.cmdType == 1)) {
@@ -43,7 +43,7 @@ void __osDevMgrMain(void *args) {
__osEPiRawWriteIo(mb->piHandle, 0x05000510, (sp24->bmCtlShadow | 0x80000000));
while (true) {
osRecvMesg(sp34->eventQueue, &em, OS_MESG_BLOCK);
sp30 = osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
sp30 = osSendMesg(mb->hdr.retQueue, (OSMesg)mb, OS_MESG_NOBLOCK);
if (sp2c != 1 || mb->piHandle->transferInfo.errStatus != 0) {
break;
}
@@ -57,20 +57,20 @@ void __osDevMgrMain(void *args) {
switch (mb->hdr.type) {
case 11:
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->dma_func(OS_READ, mb->devAddr, mb->dramAddr, mb->size);
ret = sp34->piDmaCallback(OS_READ, mb->devAddr, mb->dramAddr, mb->size);
break;
case 12:
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->dma_func(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size);
ret = sp34->piDmaCallback(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size);
break;
case 15:
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->edma_func(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr,
ret = sp34->epiDmaCallback(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr,
mb->size);
break;
case 16:
osRecvMesg(sp34->accessQueue, &dummy, OS_MESG_BLOCK);
ret = sp34->edma_func(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr,
ret = sp34->epiDmaCallback(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr,
mb->size);
break;
case 10:
+1 -1
View File
@@ -3,7 +3,7 @@
s32 __osSpDeviceBusy() {
register u32 status = HW_REG(SP_STATUS_REG, u32);
if (status & (SPSTATUS_IO_FULL | SPSTATUS_DMA_FULL | SPSTATUS_DMA_BUSY)) {
if (status & (SP_STATUS_IO_FULL | SP_STATUS_DMA_FULL | SP_STATUS_DMA_BUSY)) {
return 1;
}
return 0;
+1 -1
View File
@@ -3,7 +3,7 @@
s32 __osSpSetPc(void *pc) {
register u32 status = HW_REG(SP_STATUS_REG, u32);
if (!(status & SPSTATUS_HALT)) {
if (!(status & SP_CLR_HALT)) {
return -1;
} else {
HW_REG(SP_PC_REG, void *) = pc;
+6 -5
View File
@@ -1,7 +1,8 @@
#include <libultraship.h>
#include <libultra/vi.h>
#include "libultra_internal.h"
#include "hardware.h"
extern u32 osTvType;
#include <stubs.h>
OSViContext sViContexts[2] = { 0 };
OSViContext *__osViCurr = &sViContexts[0];
@@ -20,10 +21,10 @@ void __osViInit(void) {
__osViNext->retraceCount = 1;
__osViCurr->retraceCount = 1;
if (osTvType == TV_TYPE_PAL) {
if (osTvType == OS_TV_PAL) {
__osViNext->modep = &osViModePalLan1;
osViClock = 0x02F5B2D2;
} else if (osTvType == TV_TYPE_MPAL) {
} else if (osTvType == OS_TV_MPAL) {
__osViNext->modep = &osViModeMpalLan1;
osViClock = 0x02E6025C;
} else {
@@ -31,7 +32,7 @@ void __osViInit(void) {
osViClock = 0x02E6D354;
}
__osViNext->unk00 = 0x20;
__osViNext->state = 0x20;
__osViNext->features = __osViNext->modep->comRegs.ctrl;
while (HW_REG(VI_CURRENT_REG, u32) > 0xa) {
;
+14 -14
View File
@@ -18,28 +18,28 @@ void __osViSwapContext() {
field = HW_REG(VI_V_CURRENT_LINE_REG, u32) & 1;
s2 = osVirtualToPhysical(s1->buffer);
origin = (s0->fldRegs[field].origin) + s2;
if (s1->unk00 & 2) {
s1->unk20 |= s0->comRegs.xScale & ~0xfff;
if (s1->state & 2) {
s1->x.scale |= s0->comRegs.xScale & ~0xfff;
} else {
s1->unk20 = s0->comRegs.xScale;
s1->x.scale = s0->comRegs.xScale;
}
if (s1->unk00 & 4) {
if (s1->state & 4) {
sp34 = (u32)(s0->fldRegs[field].yScale & 0xfff);
s1->unk2c = s1->unk24 * sp34;
s1->unk2c |= s0->fldRegs[field].yScale & ~0xfff;
s1->y.scale = s1->y.factor * sp34;
s1->y.scale |= s0->fldRegs[field].yScale & ~0xfff;
} else {
s1->unk2c = s0->fldRegs[field].yScale;
s1->y.scale = s0->fldRegs[field].yScale;
}
hStart = s0->comRegs.hStart;
if (s1->unk00 & 0x20) {
if (s1->state & 0x20) {
hStart = 0;
}
if (s1->unk00 & 0x40) {
s1->unk2c = 0;
if (s1->state & 0x40) {
s1->y.scale = 0;
origin = osVirtualToPhysical(s1->buffer);
}
if (s1->unk00 & 0x80) {
s1->unk2c = (s1->unk28 << 0x10) & 0x3ff0000;
if (s1->state & 0x80) {
s1->y.scale = (s1->y.offset << 0x10) & 0x3ff0000;
origin = osVirtualToPhysical(s1->buffer);
}
HW_REG(VI_ORIGIN_REG, u32) = origin;
@@ -52,8 +52,8 @@ void __osViSwapContext() {
HW_REG(VI_V_START_REG, u32) = s0->fldRegs[field].vStart;
HW_REG(VI_V_BURST_REG, u32) = s0->fldRegs[field].vBurst;
HW_REG(VI_INTR_REG, u32) = s0->fldRegs[field].vIntr;
HW_REG(VI_X_SCALE_REG, u32) = s1->unk20;
HW_REG(VI_Y_SCALE_REG, u32) = s1->unk2c;
HW_REG(VI_X_SCALE_REG, u32) = s1->x.scale;
HW_REG(VI_Y_SCALE_REG, u32) = s1->y.scale;
HW_REG(VI_CONTROL_REG, u32) = s1->features;
__osViNext = __osViCurr;
__osViCurr = s1;
+1 -1
View File
@@ -1,5 +1,5 @@
#include <libultraship.h>
#include "libultra_internal.h"
#include "PR/rcp.h"
#include "controller.h"
extern s32 __osPfsGetStatus(OSMesgQueue *, s32);
+1 -1
View File
@@ -1,5 +1,5 @@
#include <libultraship.h>
#include "libultra_internal.h"
#include "PR/rcp.h"
#include "controller.h"
extern s32 __osPfsGetStatus(OSMesgQueue *, s32);
-2
View File
@@ -1,8 +1,6 @@
#ifndef _CONTROLLER_H
#define _CONTROLLER_H
#include "PR/os_internal.h"
#include <libultraship.h>
#include "PR/rcp.h"
//should go somewhere else but
#define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0])))
+9 -16
View File
@@ -1,15 +1,8 @@
#ifndef _LIBULTRA_INTERNAL_H_
#define _LIBULTRA_INTERNAL_H_
#include <libultraship.h>
#include <PR/os_thread.h>
#include "macros.h"
typedef struct __OSEventState
{
OSMesgQueue *messageQueue;
OSMesg message;
} __OSEventState;
typedef struct __osThreadTail
{
OSThread *next;
@@ -53,15 +46,15 @@ extern OSThread *__osRunningThread;
extern u32 D_80365E00[15];
extern u32 D_80365E3C;
typedef struct {
u32 initialized; // probably something like initialized?
OSThread *mgrThread;
OSMesgQueue *cmdQueue;
OSMesgQueue *eventQueue;
OSMesgQueue *accessQueue;
s32 (*dma_func)(s32, u32, void *, size_t);
s32 (*edma_func)(OSPiHandle*, s32, u32, void *, size_t);
} OSMgrArgs;
// typedef struct {
// u32 initialized; // probably something like initialized?
// OSThread *mgrThread;
// OSMesgQueue *cmdQueue;
// OSMesgQueue *eventQueue;
// OSMesgQueue *accessQueue;
// s32 (*dma_func)(s32, u32, void *, size_t);
// s32 (*edma_func)(OSPiHandle*, s32, u32, void *, size_t);
// } OSMgrArgs;
s32 __osDisableInt(void);
void __osRestoreInt(s32);
-53
View File
@@ -1,53 +0,0 @@
unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1)
{
return a0 >> a1;
}
unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1)
{
return a0 % a1;
}
unsigned long long __ull_div(unsigned long long a0, unsigned long long a1)
{
return a0 / a1;
}
unsigned long long __ll_lshift(unsigned long long a0, unsigned long long a1)
{
return a0 << a1;
}
long long __ll_rem(unsigned long long a0, long long a1)
{
return a0 % a1;
}
long long __ll_div(long long a0, long long a1)
{
return a0 / a1;
}
unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1)
{
return a0 * a1;
}
void __ull_divremi(unsigned long long *div, unsigned long long *rem, unsigned long long a2, unsigned short a3)
{
*div = a2 / a3;
*rem = a2 % a3;
}
long long __ll_mod(long long a0, long long a1)
{
long long tmp = a0 % a1;
if ((tmp < 0 && a1 > 0) || (tmp > 0 && a1 < 0))
{
tmp += a1;
}
return tmp;
}
long long __ll_rshift(long long a0, long long a1)
{
return a0 >> a1;
}
+2 -2
View File
@@ -44,8 +44,8 @@ void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgC
__osPiDevMgr.cmdQueue = cmdQ;
__osPiDevMgr.eventQueue = &__osPiMesgQueue;
__osPiDevMgr.accessQueue = &gOsPiMessageQueue;
__osPiDevMgr.dma_func = osPiRawStartDma;
__osPiDevMgr.edma_func = osEPiRawStartDma;
__osPiDevMgr.piDmaCallback = osPiRawStartDma;
__osPiDevMgr.epiDmaCallback = osEPiRawStartDma;
osCreateThread(&piMgrThread, 0, __osDevMgrMain, (void *) &__osPiDevMgr, &piMgrStack[0x400], pri);
osStartThread(&piMgrThread);
__osRestoreInt(int_disabled);
+2 -2
View File
@@ -46,8 +46,8 @@ void osCreateViManager(OSPri pri) {
viMgrMainArgs.cmdQueue = &__osViMesgQueue;
viMgrMainArgs.eventQueue = &__osViMesgQueue;
viMgrMainArgs.accessQueue = NULL;
viMgrMainArgs.dma_func = NULL;
viMgrMainArgs.edma_func = NULL;
viMgrMainArgs.piDmaCallback = NULL;
viMgrMainArgs.epiDmaCallback = NULL;
osCreateThread(&viMgrThread, 0, viMgrMain, (void *) &viMgrMainArgs, &viMgrStack[0x400], pri);
__osViInit();
+2 -1
View File
@@ -1,4 +1,5 @@
#include "libultra_internal.h"
#include <stubs.h>
#include "hardware.h"
#include <macros.h>
@@ -58,7 +59,7 @@ void osInitialize(void) {
}
osClockRate = osClockRate * 3 / 4;
if (osResetType == RESET_TYPE_COLD_RESET) {
bzero(osAppNmiBuffer, sizeof(osAppNmiBuffer));
//bzero(osAppNmiBuffer, sizeof(osAppNmiBuffer));
}
eu_sp30 = HW_REG(PI_STATUS_REG, u32);
+3 -2
View File
@@ -1,3 +1,4 @@
#include <libultraship.h>
#include "libultra_internal.h"
extern OSViContext *__osViNext;
@@ -6,9 +7,9 @@ extern OSViContext *__osViNext;
void osViBlack(u8 active) {
register u32 int_disabled = __osDisableInt();
if (active) {
__osViNext->unk00 |= 0x20;
__osViNext->state |= 0x20;
} else {
__osViNext->unk00 &= ~0x20;
__osViNext->state &= ~0x20;
}
__osRestoreInt(int_disabled);
}
+1 -1
View File
@@ -5,7 +5,7 @@ extern OSViContext *__osViNext;
void osViSetMode(OSViMode *mode) {
register u32 int_disabled = __osDisableInt();
__osViNext->modep = mode;
__osViNext->unk00 = 1;
__osViNext->state = 1;
__osViNext->features = __osViNext->modep->comRegs.ctrl;
__osRestoreInt(int_disabled);
}
+1 -1
View File
@@ -30,6 +30,6 @@ void osViSetSpecialFeatures(u32 func) {
__osViNext->features &= ~OS_VI_DITHER_FILTER;
__osViNext->features |= __osViNext->modep->comRegs.ctrl & (OS_VI_UNK200 | OS_VI_UNK100);
}
__osViNext->unk00 |= 8;
__osViNext->state |= 8;
__osRestoreInt(int_disabled);
}
+1 -1
View File
@@ -6,6 +6,6 @@ void osViSwapBuffer(void *vaddr) {
u32 int_disabled = __osDisableInt();
__osViNext->buffer = vaddr;
//! @todo figure out what this flag means
__osViNext->unk00 |= 0x10;
__osViNext->state |= 0x10;
__osRestoreInt(int_disabled);
}
-3
View File
@@ -1,8 +1,5 @@
#ifndef _PIINT_H
#define _PIINT_H
#include "PR/os_internal.h"
#include "PR/rcp.h"
#include "PR/os_pi.h"
#include <libultraship.h>
//https://github.com/LuigiBlood/64dd/wiki/Memory-Map
+1
View File
@@ -2,6 +2,7 @@
#define MATH_UTIL_H
#include <libultraship.h>
#include <common_structs.h>
//#define sins(x) gSineTable[(u16) (x) >> 4]
//#define coss(x) gCosineTable[(u16) (x) >> 4]
+1
View File
@@ -5,6 +5,7 @@
#include <common_structs.h>
#include <defines.h>
#include <course.h>
#include "../camera.h"
#include "render_courses.h"
#include "code_800029B0.h"
+1
View File
@@ -2,6 +2,7 @@
#define RENDER_COURSES_H
#include "code_800029B0.h"
#include "../camera.h"
void func_8029122C(struct UnkStruct_800DC5EC*, s32);
s32 func_80290C20(Camera*);
+1 -1
View File
@@ -7,7 +7,7 @@
#include "code_800029B0.h"
#include <common_structs.h>
#include "memory.h"
#include "camera.h"
#include "../camera.h"
#include <assets/common_data.h>
#include "render_player.h"
#include "code_80057C60.h"
+1
View File
@@ -1,6 +1,7 @@
#ifndef SKYBOX_AND_SPLITSCREEN_H
#define SKYBOX_AND_SPLITSCREEN_H
#include <libultraship.h>
#include <libultra/gbi.h>
#include "code_800029B0.h"
+1 -1
View File
@@ -32,7 +32,7 @@ void func_80021F50(Mat4, Vec3f);
void mtxf_scale2(Mat4, f32);
void failed_fixed_point_matrix_conversion(Mtx*, Mat4);
void convert_to_fixed_point_matrix(Mtx*, Mat4);
s32 adjust_angle(s16*, s16, s16);
bool adjust_angle(s16*, s16, s16);
void move_s32_towards(s32*, s32, f32);
void move_f32_towards(f32*, f32, f32);
void move_s16_towards(s16*, s16, f32);
+9
View File
@@ -0,0 +1,9 @@
#include <libultraship.h>
#include <libultraship/libultra.h>
#include <stubs.h>
u32 osTvType = OS_TV_NTSC;
u32 osResetType;
u8 osAppNmiBuffer[64];