Files
Diddy-Kong-Racing/include/sched.h
T
028cfd01bb Match a batch (#252)
* Squashed commit of the following:

commit 3ab4716110
Author: Fazana <52551480+FazanaJ@users.noreply.github.com>
Date:   Mon May 23 23:11:46 2022 +0100

    Mostly misc labelling, but also weather too (#232)

    * bit more labelling

    * identify some weather stuff

    * Update sound_ids.h

    * yum

    * more random identification

    * last weather stuff for now

    * Update README.md

    * Update README.md

    * Fix non equivalent

* I found the 60fps button

* match func_80052B64

* match racer_attack_handler

* match func_80048C7C

* buncha function declaring

* e

* tweak

* match func_8004DE38

oh man oh man

* Small bit of labelling

* Merge remote-tracking branch 'upstream/master' into the-many-against-the-few

* Update README.md

* Fix monumentally poor bout of misinformation in the readme

we wouldn't want to mislead the readers, would we?

* github please

* Update README.md

* requested changes

kinda funny because I knew this struct existed, and knew it was used for this, but never made the connection lol

* Update objects.c

* match racer_enter_door

A nice easy one after the pure hellscape of the last few days :)

* names

* renames

* match func_8005250C

* heehee

* Update racer.c

* identify some misc asset calls

* identify some surface types

* match func_8005492C

* Delete func_8005492C.s

* match func_80052D7C

* move some enums

* label all existing misc asset calls

granted I know what almost none of them are lmao, buut will make things slightly easier in the long run

* Update README.md

* requested changes

pain

* Update README.md

* just a bit of labelling

* labbel

* more

* Update structs.h

* file select

* file struct

* Update menu.c

* multiplayer box

* texture naming

* realised why there's 3 indices lol

* rounding

* Update menu.c

* identify textures

* pain

* fix non equiv

* Update src/menu.c

Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>

* Update src/unknown_078050.c

Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>

* Update src/menu.c

Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>

* more texture identification

* character select bytes

actually hate this so much

* Update menu.c

* I aged about 50 years doing this

* character select data

* fix conflicts

* match func_8007A98C

* fix video.c warnings

* rename func

* more video.c labels

* Update video.c

* blacklist windows script files

Mostly a me thing, so I can have some scripts in the root directory without them getting in the way. Since the repo operates exclusively on Linux, this shouldn't have any consequense

* fix build warnings in unknown_078050.c

* More.

* Update sched.c

* object name enum

* match gParticlePtrList_flush

* Update objects.c

* match func_8000E2B4

* Update .gitignore

* object ID enum

* match func_8000B290

* main game loop (and friends)

* Update racer.c

* match render_textured_rectangle

* match various funcs

* fix non equiv

* requested changes

Co-authored-by: Ryan Myers <ryan.p.myers@gmail.com>
2022-10-16 19:55:59 +01:00

128 lines
4.4 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;
#ifndef _FINALROM /* all #ifdef items should */
OSTime startTime; /* remain at the end!!, or */
OSTime totalTime; /* possible conflict if */
#endif /* FINALROM library used with */
/* non FINALROM code */
s32 unk68; /* Added by Rare? */
} 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