mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
* Very minor cleanup of init_controllers after consulting JFG * really rough starts to some funcs * some labeling, and match thread0_Main * Some documenting, and better match for a couple of memory funcs * Add more official names for vars and funcs, as well as clean up some matches a little * Force No Shadows on Surfaces Force No Shadows on Surfaces Committer: sixtyfour On branch DKRsixtyfour Changes to be committed: modified: src/unknown_0255E0.h * identify shadows and fix mislabelling from past-me (#380) * Removed outdated comment * split some funcs out of printf that aren't related * Move funcs to particles that should belong there * Some printf documenting * Do some documenting on the debug font details * Get func_800B63F4 in a good place for now * Match func_800B63F4 * Match render_printf and do some more documenting * Move some functions around into different files. * Match func_800AA3EC * Fix some warnings in func_800AA3EC * Rename the thread 0 assert * Migrate BSS from particles to thread0 and printf * Find and split out a function in particles and do more documenting * Rename sprintf and vsprintf stuff to match JFG * Clean up the texAnimateTexture function, and document some more places. * WIP build_tex_display_list and documenting * Missing file check in * Match memset * build_tex_display_list update with macros * MAssive cleanup of build_tex_display_list that brings the score down in a big way. * Removed a massive amount of extra lines in build_tex_display_list * Match texInitTextures * Update README score * Fix comment * Rename some funcs * Commit suggestions from Fazana * Fix for last commit --------- Co-authored-by: Turok64Nukem <Duke64Nukem@gmail.com> Co-authored-by: Fazana <52551480+FazanaJ@users.noreply.github.com>
127 lines
4.2 KiB
C
127 lines
4.2 KiB
C
#ifndef _SCHED_H_
|
|
#define _SCHED_H_
|
|
|
|
#include "types.h"
|
|
#include "macros.h"
|
|
#include "f3ddkr.h"
|
|
#include "libultra_internal.h"
|
|
|
|
#define OS_SC_RETRACE_MSG 1
|
|
#define OS_SC_PRE_NMI_MSG 4
|
|
#define OS_SC_AUDIO_MSG 5
|
|
#define OS_SC_MAX_MESGS 8
|
|
|
|
#define OS_SC_ID_NONE 0
|
|
#define OS_SC_ID_AUDIO 1
|
|
#define OS_SC_ID_VIDEO 2
|
|
#define OS_SC_ID_PRENMI 3
|
|
|
|
#define OSMESG_SWAP_BUFFER 0
|
|
#define MESG_SKIP_BUFFER_SWAP 8
|
|
|
|
/*
|
|
* OSScTask state
|
|
*/
|
|
#define OS_SC_DP 0x0001 /* set if still needs dp */
|
|
#define OS_SC_SP 0x0002 /* set if still needs sp */
|
|
#define OS_SC_YIELD 0x0010 /* set if yield requested */
|
|
#define OS_SC_YIELDED 0x0020 /* set if yield completed */
|
|
|
|
/*
|
|
* OSScTask->flags type identifier
|
|
*/
|
|
#define OS_SC_XBUS (OS_SC_SP | OS_SC_DP)
|
|
#define OS_SC_DRAM (OS_SC_SP | OS_SC_DP | OS_SC_DRAM_DLIST)
|
|
#define OS_SC_DP_XBUS (OS_SC_SP)
|
|
#define OS_SC_DP_DRAM (OS_SC_SP | OS_SC_DRAM_DLIST)
|
|
#define OS_SC_SP_XBUS (OS_SC_DP)
|
|
#define OS_SC_SP_DRAM (OS_SC_DP | OS_SC_DRAM_DLIST)
|
|
/*
|
|
* OSScTask flags:
|
|
*/
|
|
#define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */
|
|
#define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */
|
|
#define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */
|
|
#define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */
|
|
#define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */
|
|
#define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */
|
|
|
|
#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */
|
|
#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */
|
|
|
|
typedef struct {
|
|
short type;
|
|
char misc[30];
|
|
} OSScMsg;
|
|
|
|
typedef struct OSScTask_s {
|
|
struct OSScTask_s *next; /* note: this must be first */
|
|
u32 state;
|
|
u32 flags;
|
|
void *framebuffer; /* used by graphics tasks */
|
|
|
|
OSTask list;
|
|
OSMesgQueue *msgQ;
|
|
OSMesg msg;
|
|
s32 unk58;
|
|
s32 unk5C;
|
|
s32 unk60;
|
|
s32 unk64;
|
|
s32 unk68; /* Added by Rare? */
|
|
s32 unk6C; /* Task ID, used in debug functions in JFG */
|
|
} OSScTask;
|
|
|
|
typedef struct SCClient_s {
|
|
u8 id; /* Client ID, added by Rareware to single out individual scheduler clients*/
|
|
struct SCClient_s *next; /* next client in the list */
|
|
OSMesgQueue *msgQ; /* where to send the frame msg */
|
|
} OSScClient;
|
|
|
|
/* 0x288 bytes */
|
|
typedef struct {
|
|
/* 0x00 */ OSScMsg retraceMsg;
|
|
/* 0x20 */ OSScMsg prenmiMsg;
|
|
/* 0x40 */ OSMesgQueue interruptQ;
|
|
/* 0x58 */ OSMesg intBuf[OS_SC_MAX_MESGS]; //0x8 per OSMesg
|
|
/* 0x78 */ OSMesgQueue cmdQ;
|
|
/* 0x90 */ OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; //0x8 per OSMesg
|
|
/* 0xB0 */ OSThread thread;
|
|
/* 0x260 */ OSScClient *clientList;
|
|
/* 0x264 */ OSScTask *audioListHead;
|
|
/* 0x268 */ OSScTask *gfxListHead;
|
|
/* 0x26C */ OSScTask *audioListTail;
|
|
/* 0x270 */ OSScTask *gfxListTail;
|
|
/* 0x274 */ OSScTask *curRSPTask;
|
|
/* 0x278 */ OSScTask *curRDPTask;
|
|
/* 0x27C */ OSScTask *unkTask; //Rare added?
|
|
/* 0x280 */ u32 frameCount;
|
|
/* 0x284 */ s32 doAudio;
|
|
} OSSched;
|
|
|
|
typedef struct{
|
|
u8 pad00[0x50];
|
|
} unk800E3900;
|
|
|
|
extern OSViMode osViModeTable[];
|
|
|
|
/*******************************/
|
|
|
|
void __scYield(OSSched *sc);
|
|
void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp);
|
|
void osCreateScheduler(OSSched *sc, void *stack, OSPri priority, u8 mode, u8 numFields);
|
|
void osScAddClient(OSSched *sc, OSScClient *c, OSMesgQueue *msgQ, u8 id);
|
|
void osScRemoveClient(OSSched *sc, OSScClient *c);
|
|
OSMesgQueue *osScGetCmdQ(OSSched *sc);
|
|
OSMesgQueue *osScGetInterruptQ(OSSched *sc);
|
|
void func_80079584(f32 *arg0, f32 *arg1, f32 *arg2);
|
|
void func_80079760(OSSched *sc);
|
|
void __scHandleRDP(OSSched *sc);
|
|
void __scHandleRSP(OSSched *sc);
|
|
OSScTask *__scTaskReady(OSScTask *t);
|
|
s32 __scTaskComplete(OSSched *sc, OSScTask *t);
|
|
void __scAppendList(OSSched *sc, OSScTask *t);
|
|
void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp);
|
|
void __scHandleRetrace(OSSched *sc);
|
|
|
|
#endif
|