177 if (interlace != 0) {
178 SetDefDispEnv(&
GFX.
disp[0], 0, 0, 320, 480);
181 SetDefDispEnv(&
GFX.
disp[1], 480, 0, 320, 480);
185 SetDefDispEnv(&
GFX.
disp[0], 0, 0, w, h);
186 SetDefDispEnv(&
GFX.
disp[1], w, 0, w, h);
189 SetDefDispEnv(&
GFX.
disp[0], 0, 0, w, h);
190 SetDefDispEnv(&
GFX.
disp[1], 0, 256, w, h);
204 SetDefDispEnv(&
GFX.
disp[0], x, y, w, h);
205 SetDefDispEnv(&
GFX.
disp[1], x, y, w, h);
static s32 GFX_STARTED
Small variables, addressed through $gp (see the Makefile)
void * getPrim(void)
The next free byte of the packet buffer being drawn.
void allocPrimBuffers(s32 size)
Allocates the two GPU packet buffers, size bytes each, at the end of the heap.
void freePrimBuffers(void)
Frees the two packet buffers.
void setDisplayArea(s32 x, s32 y, s32 w, s32 h)
Shows the same VRAM area from both display buffers.
GfxState GFX
GFX: the graphics state and its methods.
void vsyncCallback(void)
Every vsync: advances the time counters and the play time, runs GFX.vsyncFunc, shows the finished buf...
void drawFrame(s32 draw)
Ends a frame: lets the layers run their draw callbacks, waits for the GPU and for the vsync that show...
void resetGraphics(void)
Destroys every layer and clears the packet buffers' state; the first call just picks the buffers.
s32 getTime(void)
The vsyncs since boot (in 60 Hz frames)
void setPrim(void *next)
Moves the packet buffer's free pointer past the primitives just written.
void setDisplayMode(s32 w, s32 h, s32 hires, s32 interlace)
Sets up the two display buffers: side by side in hi-res (interlaced 320x480 24-bit),...
s32 getFrameCount(void)
The frames drawn since boot.
s32 getFrameTime(void)
The vsyncs the last frame took (in 60 Hz frames)
void startVSyncCallback(void)
Installs vsyncCallback.
GameState GAME
The save data, the game mode and the methods.
s32 NTSC_MODE
The European version runs at 50 Hz (PAL) unless NTSC_MODE is set; its clocks then advance 0x133,...
s32 SHIFT_PAL_SCREEN
moves both display areas 0x18 lines down
#define LAYER_COUNT
The drawing layers GFX holds at most.
#define VSYNC_STEP_NTSC
What a vsync adds to the 8.8 time counters: a frame of the 60 Hz game, or 1.2 of them at 50 Hz so tha...
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
#define MEM_MODE
the current mode's: freed by main whenever the mode task ends
Layer * getLayer(s32 id)
The layer with id id, or NULL.
s32 destroyLayer(s32 id)
Frees the layer with id id; 0 if there is none.
Layer * createLayer(RECT *rect, s32 otShift, s32 id)
A new layer drawing to rect, with an OT of OT_LENGTHS[otShift - 1] entries; NULL when all are in use.
void moveLayer(s32 id, s32 targetId, s32 delta)
Moves a layer to the position of another one (plus delta) in the draw order.
s32(* destroyLayer)(s32 id)
The graphics state: double-buffered display, the GPU packet buffers that primitives are written to (g...
void * prim
next free byte of the packet buffer
void(* vsyncFunc)(s32 arg)
s32 buffer
the one being drawn
struct Layer * layers[30]
s32 time
vsyncs since boot
s32 frameTime
vsyncs that the last frame took
void(* zero)(void *ptr, s32 size)
void *(* allocHigh)(s32 size, s32 tag)
from the end of the heap
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* loadLightMatrix)(struct Layer *)
void(* runCallbacks)(struct Layer *)
void(* draw)(struct Layer *)
void(* loadView)(struct Layer *)
void(* clearOt)(struct Layer *)
s32 frames
8.8, counted by the vsync callback