|
coastline 0.0.4
|
The display, DMA and decompression state of the system file of the N64 releases. More...
#include <PR/gbi.h>#include <PR/os.h>#include <PR/os_cont.h>#include <PR/sptask.h>#include <PR/ultratypes.h>#include "common/assetdma.h"#include "common/cameraprojection.h"#include "common/debugmessage.h"#include "common/displaylistops.h"#include "common/frametime.h"#include "common/render.h"#include "common/screen.h"#include "common/screendraw.h"

Go to the source code of this file.
Classes | |
| struct | InflateAllocator |
| The bump allocator zcalloc() draws from. More... | |
Macros | |
| #define | N64_ACTIVE_DEPTH_BUFFER g_aDepthBuffer |
| Use the regular depth buffer when Expansion Pak rendering is unavailable. | |
| #define | DISPLAY_LIST_COMMANDS 6000 |
| The commands of the display list of each frame. | |
| #define | DISPLAY_LIST_RESERVED 64 |
| The commands at the start of the display list of each frame that the frame does not use. | |
Functions | |
| void | InitRenderingSubsystem (void) |
| Set up the display, the RSP and RDP state, and the system threads. | |
| void | StartLowResFrame (void) |
| Start the display list of a frame in the low-resolution mode. | |
| void | StartHighResFrame (void) |
| Start the display list of a frame in the high-resolution mode. | |
| void | FlushDisplayList (void) |
| End the display list of the frame and run it. | |
| void | ClearDepthBuffer (void) |
| Fill the whole depth buffer with the farthest depth, then draw to the frame buffer again. | |
| void | UpdateFrameTiming (void) |
| Update the timing of the frames from the CPU timer. | |
| void | ClearZBufferRect (s32 x, s32 y, s32 width, s32 height) |
| Fill a rectangle of the depth buffer with the farthest depth. | |
| void | ResetFrameClock (void) |
| Restart the clock of the frames from zero. | |
| OSIoMesg * | AllocIoMessage (void) |
| Take a message of the DMA, waiting for a DMA to finish when every one is in flight. | |
| void | WaitForDmaMessages (void) |
| Wait for every DMA started to finish. | |
| s32 | UnusedVblankQueryStub (s32 unused0, s32 unused1) |
| Return 0. | |
| void | RspDoneThread (void *arg) |
| Forward each finished task of the RSP to g_RspDoneMsgQueue, marking the timing bars. | |
| void | RdpDoneThread (void *arg) |
| Forward each finished frame of the RDP to g_RdpDoneMsgQueue, marking the timing bars. | |
| void | PreNmiResetHandlerThread (void *arg) |
| Wait for the reset button, then silence the sound, record the reset, and blank the screen, for each press. | |
| void | ViRetraceThread (void *arg) |
| Forward each retrace to g_ViRetraceMesgQueue and count it. | |
| void | UnusedFrameTimingStub (void) |
| Do nothing. | |
| void | WaitForVblankMessage (void) |
| Wait for the next retrace. | |
| void | StubFunction (s32 unused) |
| Do nothing; where a debugger would stop. | |
| void | FaultThread (void *arg) |
| Wait for faults and keep the thread that faulted. | |
| void | BootIdleThread (void *arg) |
| Read the arguments of a development kit, start the managers, the fault thread and the main thread, and become the idle thread. | |
| void | BeginDisplayList (s32 highRes) |
| Start the display list of a frame in a resolution, with the render modes every frame starts with. | |
| void | StubEmptyVoid (s32 unused0,...) |
| Do nothing. | |
Variables | |
| u16 | g_aFramebuffer0 [] |
| The first of the two frame buffers, of 320 by 240 16-bit pixels. | |
| u16 | g_aFramebuffer1 [] |
| The second 320-by-240 frame buffer of 16-bit pixels. | |
| u16 | g_aDepthBuffer [] |
| The depth buffer, of 16-bit depths, near the start of the memory. | |
| u8 | g_aInflateHeapBuffer [] |
| The room the heap of zlib takes while the game loads, and that the sound effects of a race are loaded into. | |
| u8 * | g_pInflateHeapBase |
| The heap DecompressFromRom() lends to zlib, or NULL to let inflateInit2_() borrow the frame buffers. | |
| InflateAllocator | g_inflateAllocator |
| The state of the allocator inflateInit2_() gives zlib. | |
| u32 | g_dwScreenUnblankDelay |
| The frames to wait before the display returns after inflateInit2_() blanks it to use the frame buffers as a heap. | |
| u32 | g_dwKeepScreenBlanked |
| Whether the display stays black whatever a frame would show. | |
| u16 | g_wScreenFrameCount |
| The frames a screen has shown, for screens that count them. | |
| u32 | g_dwColorDitherMode |
| The color dither the screens draw with, as the other-mode bits gDPSetColorDither() takes. | |
| u32 | g_dwAlphaDitherMode |
| The alpha dither the screens draw with, as the other-mode bits gDPSetAlphaDither() takes. | |
| u16 * | g_apFramebuffers [2] |
| The two frame buffers. | |
| s32 | g_dwFrameDeltaMs |
| The time the last frame took. | |
| s32 | g_dwElapsedTimeMs |
| The time UpdateFrameTiming() counts, in milliseconds. | |
| s32 | g_bRaceScreenActive |
| Whether the screen of a race runs, which makes UpdateFrameTiming() step a fixed 1/30 of a second a frame rather than count the timer of the CPU. | |
| OSIoMesg | g_aIoMessagePool [32] |
| The messages of the DMA, which AllocIoMessage() hands out in turn. | |
| s32 | g_dwIoMessagePendingCount |
| The DMA started and not yet waited for. | |
| s32 | g_dwIoMessagePoolIndex |
| The message of g_aIoMessagePool last handed out. | |
| OSMesgQueue | g_DmaMessageQueue |
| The queue a finished DMA sends to. | |
| OSMesgQueue | g_RspDoneMsgQueue |
| The queue the RSP event reaches, and the queue the thread forwards it to. | |
| 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 reaches. | |
| Gfx | g_aGfxDisplayListPool [] |
| The value the events send. | |
| DisplayListCommand * | g_pDisplayListBase |
| The start of the display lists. | |
| f32 | g_fCountsPerMillisecond |
| The counts of the CPU counter a millisecond. | |
| OSContStatus | g_aContStatus [MAXCONTROLLERS] |
| What the controllers reported at the start. | |
| u64 | g_qwTimestampBase |
| The clock of the frames, in counts of the CPU counter. | |
| u32 | g_dwFrameTimestamp |
| The CPU counter at the last frame. | |
| s32 | g_dwPrevElapsedTimeMs |
| The time of the frame before, in milliseconds. | |
| OSMesgQueue | g_FaultMsgQueue |
| The queue of the fault event and the thread that faulted. | |
| s32 | g_dwFaultState |
| Cleared once by the fault thread. | |
| char * | g_apszBootArgv [] |
| The arguments of a development kit and their count, which starts at 1, and the copies of the argument vector and of the address of the count given to the threads. | |
| char ** | g_ppszMainArgv |
| The boot argument vector shared with the rendering initialiser. | |
| OSMesgQueue | g_PiMgrCmdQueue |
| The queue of the commands of the PI manager. | |
| OSViMode | g_ViModeNtscLan1 |
| The video modes of the NTSC and the MPAL consoles. | |
| OSViMode | g_ViModeMpalLan1 |
| The MPAL low-resolution video mode. | |
| OSMesgQueue | g_PreNmiMesgQueue |
| The queue of the reset button, and its buffer. | |
| s32 | g_dwPreNmiResetPending |
| Set once the reset button has been pressed. | |
| OSTask | g_aGfxTask [2] |
| The tasks of the RSP, one for each frame buffer. | |
| u64 | g_aRspBootUcode [] |
| The boot microcode of the RSP. | |
| u64 | g_aRspBootUcodeEnd [] |
| The end of the RSP boot microcode, at the start of the graphics microcode. | |
| u64 | g_abRspUcodeData [] |
| The data of the graphics microcode. | |
| u8 | g_abRspDramStackBuffer [] |
| The memory of the matrix stack of the RSP, 16 bytes more than the stack to align it. | |
| u64 * | g_pRdpOutputBuffer [2] |
| The start and end of the buffer the RDP commands go to. | |
| s32 | g_dwOutputBuffReserve |
| The doublewords at the end of the output buffer the tasks do not use. | |
| s32 | g_dwDisplayListCommandCount |
| The commands of the display list of the last frame. | |
| s32 | g_dwPeakShadowCommandCount |
| The most commands of a shadow, vertices of a shadow, and commands of a frame seen. | |
| s32 | g_dwFirstFlushDone |
| Whether a frame has been sent to the RSP. | |
| u32 | g_dwFlushDuration |
| The counts of the CPU counter the end of a frame took, between the ends of two frames, and at the end of the last frame. | |
| u32 | g_dwFlushValueSource |
| A word FlushDisplayList() copies each frame, and the copy. | |
| s32 | g_dwDisplayModeChangeCountdown |
| The frames until the video mode changes to the resolution BeginDisplayList() was given, or 0. | |
| s32 | g_dwAppliedScreenScaleShift |
| The resolution the video mode was last set to. | |
| OSViMode | g_ViModeNtscHaf1 |
| The video modes of the high resolution. | |
| OSViMode | g_ViModeMpalHaf1 |
| The MPAL high-resolution video mode. | |
| OSViMode | g_ViModePalHaf1 |
| The copies of the PAL video modes the game sets. | |
| OSViMode | g_ViModePalLan1 |
| The PAL low-resolution video mode. | |
| s32 | g_dwViGammaEnabled |
| Whether the video interface corrects the gamma. | |
The display, DMA and decompression state of the system file of the N64 releases.
| #define N64_ACTIVE_DEPTH_BUFFER g_aDepthBuffer |
Use the regular depth buffer when Expansion Pak rendering is unavailable.
| #define DISPLAY_LIST_COMMANDS 6000 |
The commands of the display list of each frame.
| #define DISPLAY_LIST_RESERVED 64 |
The commands at the start of the display list of each frame that the frame does not use.
| void InitRenderingSubsystem | ( | void | ) |
Set up the display, the RSP and RDP state, and the system threads.
| void StartLowResFrame | ( | void | ) |
Start the display list of a frame in the low-resolution mode.
| void StartHighResFrame | ( | void | ) |
Start the display list of a frame in the high-resolution mode.
| void FlushDisplayList | ( | void | ) |
End the display list of the frame and run it.
| void ClearDepthBuffer | ( | void | ) |
Fill the whole depth buffer with the farthest depth, then draw to the frame buffer again.
| void UpdateFrameTiming | ( | void | ) |
Update the timing of the frames from the CPU timer.
Fill a rectangle of the depth buffer with the farthest depth.
| x | The left edge. |
| y | The upper edge. |
| width | The width. |
| height | The height, which the bottom edge adds to x rather than y. |
| void ResetFrameClock | ( | void | ) |
Restart the clock of the frames from zero.
| OSIoMesg * AllocIoMessage | ( | void | ) |
Take a message of the DMA, waiting for a DMA to finish when every one is in flight.
| void WaitForDmaMessages | ( | void | ) |
Wait for every DMA started to finish.
Return 0.
The routine has no callers.
| unused0 | Not read. |
| unused1 | Not read. |
| void RspDoneThread | ( | void * | arg | ) |
Forward each finished task of the RSP to g_RspDoneMsgQueue, marking the timing bars.
| arg | Not read. |
| void RdpDoneThread | ( | void * | arg | ) |
Forward each finished frame of the RDP to g_RdpDoneMsgQueue, marking the timing bars.
| arg | Not read. |
| void PreNmiResetHandlerThread | ( | void * | arg | ) |
Wait for the reset button, then silence the sound, record the reset, and blank the screen, for each press.
| arg | Not read. |
| void ViRetraceThread | ( | void * | arg | ) |
Forward each retrace to g_ViRetraceMesgQueue and count it.
Nothing starts it.
| arg | Not read. |
| void UnusedFrameTimingStub | ( | void | ) |
Do nothing.
| void WaitForVblankMessage | ( | void | ) |
Wait for the next retrace.
| void StubFunction | ( | s32 | unused | ) |
Do nothing; where a debugger would stop.
| unused | Not read. |
| void FaultThread | ( | void * | arg | ) |
Wait for faults and keep the thread that faulted.
| arg | Not read. |
| void BootIdleThread | ( | void * | arg | ) |
Read the arguments of a development kit, start the managers, the fault thread and the main thread, and become the idle thread.
| arg | The argument of the main thread. |
| void BeginDisplayList | ( | s32 | highRes | ) |
Start the display list of a frame in a resolution, with the render modes every frame starts with.
A change of resolution takes effect at the next FlushDisplayList().
| highRes | 1 for the high resolution, 0 for the low. |
| void StubEmptyVoid | ( | s32 | unused0, |
| ... ) |
Do nothing.
The arguments are variable, as of a print compiled out.
| unused0 | Not read. |
|
extern |
The first of the two frame buffers, of 320 by 240 16-bit pixels.
The link script places it.
|
extern |
The second 320-by-240 frame buffer of 16-bit pixels.
The link script places it.
|
extern |
The depth buffer, of 16-bit depths, near the start of the memory.
The link script places it.
|
extern |
The room the heap of zlib takes while the game loads, and that the sound effects of a race are loaded into.
|
extern |
The heap DecompressFromRom() lends to zlib, or NULL to let inflateInit2_() borrow the frame buffers.
|
extern |
The state of the allocator inflateInit2_() gives zlib.
|
extern |
The frames to wait before the display returns after inflateInit2_() blanks it to use the frame buffers as a heap.
|
extern |
Whether the display stays black whatever a frame would show.
|
extern |
The frames a screen has shown, for screens that count them.
|
extern |
The color dither the screens draw with, as the other-mode bits gDPSetColorDither() takes.
|
extern |
The alpha dither the screens draw with, as the other-mode bits gDPSetAlphaDither() takes.
|
extern |
The two frame buffers.
|
extern |
The time the last frame took.
|
extern |
The time UpdateFrameTiming() counts, in milliseconds.
|
extern |
Whether the screen of a race runs, which makes UpdateFrameTiming() step a fixed 1/30 of a second a frame rather than count the timer of the CPU.
|
extern |
The messages of the DMA, which AllocIoMessage() hands out in turn.
|
extern |
The DMA started and not yet waited for.
|
extern |
The message of g_aIoMessagePool last handed out.
|
extern |
The queue a finished DMA sends to.
|
extern |
The queue the RSP event reaches, and the queue the thread forwards it to.
|
extern |
The queue the RDP event reaches, and the queue the thread forwards it to.
|
extern |
The queue of the retrace of ViRetraceThread(), which nothing starts, and the queue each retrace reaches.
|
extern |
The value the events send.
|
extern |
The start of the display lists.
|
extern |
The counts of the CPU counter a millisecond.
|
extern |
What the controllers reported at the start.
|
extern |
The clock of the frames, in counts of the CPU counter.
|
extern |
The CPU counter at the last frame.
|
extern |
The time of the frame before, in milliseconds.
|
extern |
The queue of the fault event and the thread that faulted.
|
extern |
Cleared once by the fault thread.
|
extern |
The arguments of a development kit and their count, which starts at 1, and the copies of the argument vector and of the address of the count given to the threads.
|
extern |
The boot argument vector shared with the rendering initialiser.
|
extern |
The queue of the commands of the PI manager.
|
extern |
The video modes of the NTSC and the MPAL consoles.
|
extern |
The MPAL low-resolution video mode.
|
extern |
The queue of the reset button, and its buffer.
|
extern |
Set once the reset button has been pressed.
|
extern |
The tasks of the RSP, one for each frame buffer.
|
extern |
The boot microcode of the RSP.
The text of the graphics microcode follows it.
|
extern |
The end of the RSP boot microcode, at the start of the graphics microcode.
|
extern |
The data of the graphics microcode.
|
extern |
The memory of the matrix stack of the RSP, 16 bytes more than the stack to align it.
|
extern |
The start and end of the buffer the RDP commands go to.
|
extern |
The doublewords at the end of the output buffer the tasks do not use.
|
extern |
The commands of the display list of the last frame.
|
extern |
The most commands of a shadow, vertices of a shadow, and commands of a frame seen.
|
extern |
Whether a frame has been sent to the RSP.
|
extern |
The counts of the CPU counter the end of a frame took, between the ends of two frames, and at the end of the last frame.
|
extern |
A word FlushDisplayList() copies each frame, and the copy.
No other routine reads either.
|
extern |
The frames until the video mode changes to the resolution BeginDisplayList() was given, or 0.
|
extern |
The resolution the video mode was last set to.
|
extern |
The video modes of the high resolution.
|
extern |
The MPAL high-resolution video mode.
|
extern |
The copies of the PAL video modes the game sets.
|
extern |
The PAL low-resolution video mode.
|
extern |
Whether the video interface corrects the gamma.