1#ifndef COASTLINE_SYSTEM_H
2#define COASTLINE_SYSTEM_H
62#if TGR_PLATFORM == TGR_PLATFORM_N64 && defined(ENABLE_PATCHES)
64#define N64_ACTIVE_DEPTH_BUFFER \
65 ((g_dwScreenScaleShift && osMemSize > 0x400000) ? (u16 *)0x80400000 : g_aDepthBuffer)
68#define N64_ACTIVE_DEPTH_BUFFER g_aDepthBuffer
100extern u8 *g_pInflateHeapEnd;
382extern OSMesg g_aDmaMsgBuf[32];
395#if TGR_PLATFORM != TGR_PLATFORM_SDL
408extern OSMesg g_aRspEventMsgBuf[1];
430extern OSMesg g_aRspDoneMsgBuf[1];
443#if TGR_PLATFORM != TGR_PLATFORM_SDL
456extern OSMesg g_aRdpEventMsgBuf[1];
478extern OSMesg g_aRdpDoneMsgBuf[1];
492#if TGR_PLATFORM != TGR_PLATFORM_SDL
505extern OSMesg g_ViRetracePollMesgBuf[1];
527extern OSMesg g_ViRetraceMesgBuf[1];
540#if TGR_PLATFORM != TGR_PLATFORM_SDL
541extern u32 g_dwDummyOsMesg;
554#if TGR_PLATFORM != TGR_PLATFORM_SDL
555extern s32 g_dwVblankCounter;
577#if TGR_REGION == TGR_REGION_EU || TGR_REGION == TGR_REGION_JP
584extern OSThread g_PreNmiResetHandlerThreadObj;
612#define THREAD_STACK_WORDS 0x200
613#define MAIN_STACK_WORDS 0x800
614#define IDLE_STACK_WORDS 0x100
615#define FAULT_STACK_WORDS 0x100
625extern u32 g_adwRspDoneThreadStack[THREAD_STACK_WORDS];
633extern u32 g_adwRdpDoneThreadStack[THREAD_STACK_WORDS];
635#if TGR_REGION == TGR_REGION_EU || TGR_REGION == TGR_REGION_JP
640extern u32 g_adwPreNmiResetThreadStack[THREAD_STACK_WORDS];
649extern u32 g_adwMainThreadStack[MAIN_STACK_WORDS];
657extern u32 g_adwIdleThreadStack[IDLE_STACK_WORDS];
665extern u32 g_adwFaultThreadStack[FAULT_STACK_WORDS];
687#define g_aGfxDisplayListPool g_abDisplayListMemory
733extern OSMesg g_aSiEventMesgBuf[1];
779extern u32 g_dwDmaChunkSize;
799extern OSMesg g_aFaultMsgBuf[1];
848extern s32 *g_pdwMainArgc;
868extern OSMesg g_aPiMgrCmdMsgBuf[32];
955#if TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU
969extern OSMesg g_aPreNmiMesgBuf[1];
1062#define DISPLAY_LIST_COMMANDS 12000
1064#define DISPLAY_LIST_COMMANDS 6000
1068#define DISPLAY_LIST_RESERVED 64
1127#if TGR_PLATFORM == TGR_PLATFORM_N64
1145extern u64 g_aGspUcodeText[];
1235extern s32 g_dwPeakShadowVertexCount;
1247extern s32 g_dwPeakDisplayListCommands;
1290extern u32 g_dwFlushInterval;
1302extern u32 g_dwFlushStartTime;
1328extern u32 g_dwLastFlushValue;
1374#if TGR_REGION == TGR_REGION_EU
The state the renderer shares between the parts of a frame.
Gfx DisplayListCommand
A display-list command in the Nintendo 64 renderer.
Definition displaylistops.h:21
The time of the last frame.
The graphics binary interface types the gu routines fill in for the RSP microcode.
Public interface of the libultra operating system, as the game links it.
struct OSThread_s OSThread
A thread: its place in the queues, its state, and the registers saved when it last stopped.
struct OSMesgQueue_s OSMesgQueue
A message queue: a ring of messages and the threads blocked sending or receiving.
void * OSMesg
Definition os.h:73
The controllers and the Controller Pak file system.
#define MAXCONTROLLERS
The ports of the console.
Definition os_cont.h:17
The size of the frame, and the routines of the screen the main loop calls.
The bump allocator zcalloc() draws from.
Definition system.h:29
u8 * cur
Definition system.h:30
u8 * end
Definition system.h:31
What osContInit() learns of a controller.
Definition os_cont.h:98
An I/O request to a device manager: a DMA between RDRAM and a device.
Definition os.h:210
A video mode: the registers of the video interface for a resolution and television standard.
Definition os.h:310
The rectangle of the screen a view fills.
Definition render.h:134
u64 g_aRspBootUcode[]
The boot microcode of the RSP.
u16 * g_apFramebuffers[2]
The two frame buffers.
u8 g_aInflateHeapBuffer[]
The room the heap of zlib takes while the game loads, and that the sound effects of a race are loaded...
char * g_apszBootArgv[]
The arguments of a development kit and their count, which starts at 1, and the copies of the argument...
u32 g_dwFlushValueSource
A word FlushDisplayList() copies each frame, and the copy.
void UpdateFrameTiming(void)
Update the timing of the frames from the CPU timer.
s32 g_dwIoMessagePendingCount
The DMA started and not yet waited for.
void InitRenderingSubsystem(void)
Set up the display, the RSP and RDP state, and the system threads.
OSViMode g_ViModeMpalLan1
The MPAL low-resolution video mode.
s32 g_dwPrevElapsedTimeMs
The time of the frame before, in milliseconds.
s32 g_dwDisplayModeChangeCountdown
The frames until the video mode changes to the resolution BeginDisplayList() was given,...
s32 g_dwIoMessagePoolIndex
The message of g_aIoMessagePool last handed out.
s32 g_dwPreNmiResetPending
Set once the reset button has been pressed.
u16 g_aDepthBuffer[]
The depth buffer, of 16-bit depths, near the start of the memory.
OSMesgQueue g_PiMgrCmdQueue
The queue of the commands of the PI manager.
void RdpDoneThread(void *arg)
Forward each finished frame of the RDP to g_RdpDoneMsgQueue, marking the timing bars.
OSMesgQueue g_RspDoneMsgQueue
The queue the RSP event reaches, and the queue the thread forwards it to.
u64 g_qwTimestampBase
The clock of the frames, in counts of the CPU counter.
s32 UnusedVblankQueryStub(s32 unused0, s32 unused1)
Return 0.
s32 g_bRaceScreenActive
Whether the screen of a race runs, which makes UpdateFrameTiming() step a fixed 1/30 of a second a fr...
void StartHighResFrame(void)
Start the display list of a frame in the high-resolution mode.
void PreNmiResetHandlerThread(void *arg)
Wait for the reset button, then silence the sound, record the reset, and blank the screen,...
OSViMode g_ViModeNtscLan1
The video modes of the NTSC and the MPAL consoles.
s32 g_dwFirstFlushDone
Whether a frame has been sent to the RSP.
s32 g_dwFrameDeltaMs
The time the last frame took.
void ClearDepthBuffer(void)
Fill the whole depth buffer with the farthest depth, then draw to the frame buffer again.
u32 g_dwAlphaDitherMode
The alpha dither the screens draw with, as the other-mode bits gDPSetAlphaDither() takes.
void FlushDisplayList(void)
End the display list of the frame and run it.
OSMesgQueue g_DmaMessageQueue
The queue a finished DMA sends to.
void StartLowResFrame(void)
Start the display list of a frame in the low-resolution mode.
void ResetFrameClock(void)
Restart the clock of the frames from zero.
OSMesgQueue g_RdpDoneMsgQueue
The queue the RDP event reaches, and the queue the thread forwards it to.
OSMesgQueue g_ViRetraceMesgQueue
The queue of the retrace of ViRetraceThread(), which nothing starts, and the queue each retrace reach...
void FaultThread(void *arg)
Wait for faults and keep the thread that faulted.
OSTask g_aGfxTask[2]
The tasks of the RSP, one for each frame buffer.
void StubEmptyVoid(s32 unused0,...)
Do nothing.
s32 g_dwPeakShadowCommandCount
The most commands of a shadow, vertices of a shadow, and commands of a frame seen.
u64 g_aRspBootUcodeEnd[]
The end of the RSP boot microcode, at the start of the graphics microcode.
void BootIdleThread(void *arg)
Read the arguments of a development kit, start the managers, the fault thread and the main thread,...
u32 g_dwScreenUnblankDelay
The frames to wait before the display returns after inflateInit2_() blanks it to use the frame buffer...
InflateAllocator g_inflateAllocator
The state of the allocator inflateInit2_() gives zlib.
void BeginDisplayList(s32 highRes)
Start the display list of a frame in a resolution, with the render modes every frame starts with.
s32 g_dwFaultState
Cleared once by the fault thread.
u16 g_aFramebuffer1[]
The second 320-by-240 frame buffer of 16-bit pixels.
s32 g_dwDisplayListCommandCount
The commands of the display list of the last frame.
OSViMode g_ViModeNtscHaf1
The video modes of the high resolution.
s32 g_dwViGammaEnabled
Whether the video interface corrects the gamma.
u32 g_dwFrameTimestamp
The CPU counter at the last frame.
s32 g_dwAppliedScreenScaleShift
The resolution the video mode was last set to.
void RspDoneThread(void *arg)
Forward each finished task of the RSP to g_RspDoneMsgQueue, marking the timing bars.
void WaitForDmaMessages(void)
Wait for every DMA started to finish.
u16 g_aFramebuffer0[]
The first of the two frame buffers, of 320 by 240 16-bit pixels.
s32 g_dwElapsedTimeMs
The time UpdateFrameTiming() counts, in milliseconds.
u8 g_abRspDramStackBuffer[]
The memory of the matrix stack of the RSP, 16 bytes more than the stack to align it.
void ClearZBufferRect(s32 x, s32 y, s32 width, s32 height)
Fill a rectangle of the depth buffer with the farthest depth.
f32 g_fCountsPerMillisecond
The counts of the CPU counter a millisecond.
void UnusedFrameTimingStub(void)
Do nothing.
char ** g_ppszMainArgv
The boot argument vector shared with the rendering initialiser.
void StubFunction(s32 unused)
Do nothing; where a debugger would stop.
OSMesgQueue g_PreNmiMesgQueue
The queue of the reset button, and its buffer.
u8 * g_pInflateHeapBase
The heap DecompressFromRom() lends to zlib, or NULL to let inflateInit2_() borrow the frame buffers.
OSMesgQueue g_FaultMsgQueue
The queue of the fault event and the thread that faulted.
u16 g_wScreenFrameCount
The frames a screen has shown, for screens that count them.
Gfx g_aGfxDisplayListPool[]
The value the events send.
u32 g_dwFlushDuration
The counts of the CPU counter the end of a frame took, between the ends of two frames,...
u64 * g_pRdpOutputBuffer[2]
The start and end of the buffer the RDP commands go to.
DisplayListCommand * g_pDisplayListBase
The start of the display lists.
OSContStatus g_aContStatus[MAXCONTROLLERS]
What the controllers reported at the start.
OSViMode g_ViModePalLan1
The PAL low-resolution video mode.
u64 g_abRspUcodeData[]
The data of the graphics microcode.
u32 g_dwColorDitherMode
The color dither the screens draw with, as the other-mode bits gDPSetColorDither() takes.
void ViRetraceThread(void *arg)
Forward each retrace to g_ViRetraceMesgQueue and count it.
u32 g_dwKeepScreenBlanked
Whether the display stays black whatever a frame would show.
OSIoMesg g_aIoMessagePool[32]
The messages of the DMA, which AllocIoMessage() hands out in turn.
OSViMode g_ViModeMpalHaf1
The MPAL high-resolution video mode.
void WaitForVblankMessage(void)
Wait for the next retrace.
s32 g_dwOutputBuffReserve
The doublewords at the end of the output buffer the tasks do not use.
OSIoMesg * AllocIoMessage(void)
Take a message of the DMA, waiting for a DMA to finish when every one is in flight.
OSViMode g_ViModePalHaf1
The copies of the PAL video modes the game sets.
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
float f32
Definition ultratypes.h:38
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
unsigned long long u64
Definition ultratypes.h:21
unsigned char u8
Definition ultratypes.h:18
A display list command for the Fast3D microcode.
Definition gbi.h:132
A task for the RSP, aligned to 8 bytes.
Definition sptask.h:44