Alchemy
Loading...
Searching...
No Matches

runtime.h

Go to the documentation of this file.
1#ifndef ALCHEMY_UNIT_RUNTIME_RUNTIME_H
2#define ALCHEMY_UNIT_RUNTIME_RUNTIME_H
3
4#include "types.h"
6#include "irq.h"
7
8struct AffineTransform;
9
10void System_Initialize(void);
11void Runtime_IdleForever(void);
18s32 RuntimeDispatch_ReturnZero(s32 unused0, const u8 *unused1);
19void System_CopyBuildStamp(void);
20void RuntimeDispatch_NoOpHook(s32 unused);
21void *Resource_GetTableEntry(s32 index);
22void Code_ResolveLongBranches(u16 *entries, s32 byteLength);
23void Resource_LoadCode(u32 index, void *destination);
26void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler);
27void WaitFrames(s32 frames);
28void Input_ResetKeyRepeat(void);
30void System_VBlankHandler(void);
32void Sound_ReservedNoOpA(void);
33void Sound_ReservedNoOpB(void);
35void Fade_ToBlack(s32 frames);
36void Fade_FromBlack(s32 frames);
37void Fade_ToWhite(s32 frames);
38void Fade_FromWhite(s32 frames);
39s32 Resource_DecodeType01(const void *source, void *destination);
40s32 Resource_DecodeType2(const void *source, void *destination);
41s32 Resource_DecodeByteLz(const void *source, void *destination);
44
46
47void Fade_Update(void);
48void Fade_Start(s8 bright, s32 layer, u32 start, s32 target, s32 frames);
49void Fade_Wait(void);
50
51void Render_ResetFrame(void);
53void Runtime_PushSlotEntry(void *slotEntry, s32 slot);
54void Render_BuildOamList(void *work);
55
61s32 VramCache_Load(u32 no, u32 size, const void *src);
62void VramCache_Reset(void);
66
68void Scheduler_CopyWords(u32 *destination, u32 *source, u32 byteCount);
69void Scheduler_SortTasks(void);
72void Scheduler_Idle(void);
80void Scheduler_RunPass(s32 key);
81
82u32 Random16(void);
83void Vector_AddPolarOffset(s32 radius, s32 angle, void *position);
84s32 ArcTan2(s32 x, s32 y);
86s32 FixedSqrt(s32 value);
87
89void NumberText_FormatHex(u32 value);
90void NumberText_FormatDecimal(s32 number);
91void DebugText_PrintBlanks(u32 count);
92void *memcpy(void *destination, const void *source, unsigned long size);
93void DebugText_Print(const u8 *src);
94void DebugText_PrintHex(u32 value, s32 digits);
95void DebugText_PrintDecimal(s32 value, s32 digits);
96void DebugText_Clear(void);
97void Ui_LoadWindowGraphics(void);
99
100void Runtime_InitializeHeap(void);
103void *Runtime_AllocateHeapBlock(s32 kind, s32 size);
104void *Runtime_AllocateBlock(s32 kind, s32 size);
105void *MemAlloc(s32 size);
108
110void Transform_Push(void);
111void Transform_Store(void *dst);
112void Transform_Load(const void *src);
113void Transform_Pop(void);
119void SceneTransform_ApplyPosition(const s32 *position);
120void SceneTransform_ApplyScale(const s32 *scale);
121void SceneTransform_ApplyRotationTranslation(s32 *angles, s32 *position);
122void SceneTransform_ApplyScaledRotation(s32 *angles, s32 *position, s32 *scale);
123void Transform_BuildLookAt(s32 *eye, s32 *target, s32 *out);
124void Transform_SetLookAt(s32 *eye, s32 *target);
125void Transform_ApplyLookAt(s32 *eye, s32 *target);
126void Projection_SetFieldOfView(u32 fieldOfView, s32 nearDepth, s32 farDepth);
127void Projection_Set(u32 focal, u32 nearDepth, u32 farDepth);
128s32 Render_ProjectPoint(const void *point, s32 *screen);
129
130void Resource_DecompressHalfwords(const void *source, void *destination);
131void ColorBuffer_BackupAndBrighten(u8 *buffer, u32 amount, u8 *backup,
132 u32 bytes);
133void ColorBuffer_BackupAndDarken(u8 *buffer, u32 amount, u8 *backup, u32 bytes);
134void ColorBuffer_BackupAndScaleThreeQuarters(u8 *buffer, u8 *backup, u32 bytes);
135void ColorBuffer_BackupAndHalve(u8 *buffer, u8 *backup, u32 bytes);
136void ColorBuffer_BackupAndBrightenPartial(u8 *buffer, u32 amount, u8 *backup,
137 u32 bytes);
138void ColorBuffer_BackupAndDarkenPartial(u8 *buffer, u32 amount, u8 *backup,
139 u32 bytes);
141 u32 bytes);
142void ColorBuffer_BackupAndHalveNonzero(u8 *buffer, u8 *backup, u32 bytes);
148s32 SaveState_WriteRecord(s32 recordId, void *source);
149u32 SaveState_ReadRecordPayload(s32 recordId, void *destination);
154s32 SaveState_CompareBytes(u8 *left, u8 *right, s32 count);
158
159void SerialRuntime_Initialize(void);
162s32 SerialRuntime_PollAndTransfer(void *send, void *receive);
164s32 SerialRuntime_ExchangePayloads(void *send, void *receive);
165void SerialRuntime_PrepareSendPacket(void *payload);
170s32 SerialRuntime_BeginSend(void *source, s32 size);
171s32 SerialRuntime_BeginReceive(void *destination);
176void SerialTest_Delay(void);
177void SerialTest_Run(void);
178
179#endif
The task scheduler: tasks, their order and the scheduler's state.
void(*) SchedulerCallback(void)
void Fade_ToBlack(s32 frames)
Fades out to black.
Definition fade.c:76
void Fade_ToWhite(s32 frames)
Fades out to white.
Definition fade.c:82
void Fade_FromWhite(s32 frames)
Fades in from white.
Definition fade.c:85
void Fade_Wait(void)
Waits a frame at a time until the running fade has finished.
Definition fade.c:108
void Fade_FromBlack(s32 frames)
Fades in from black.
Definition fade.c:79
void Fade_Update(void)
Steps the screen fade once a frame, called by System_VBlankHandler: sets BLDCNT to brighten or darken...
Definition fade.c:20
void Fade_Start(s8 bright, s32 layer, u32 start, s32 target, s32 frames)
Starts a fade of any layers by setting the gBlend globals Fade_Update steps.
Definition fade.c:94
void Input_HandleKeyInterrupt(void)
The keypad interrupt, from the handler table: A+B+Select+Start was pressed, so it sets gResetRequeste...
Definition frame.c:460
UNUSED void Sound_ReservedNoOpB(void)
Nothing calls it.
Definition frame.c:455
void Input_ResetKeyRepeat(void)
Restarts the key repeat delay, so held keys wait the full delay again.
Definition frame.c:289
void System_VBlankHandler(void)
The VBlank interrupt handler, installed by System_Initialize.
Definition frame.c:374
UNUSED void Sound_ReservedNoOpA(void)
Nothing calls it.
Definition frame.c:452
s32 Sound_LoadPresetParameters(s32 preset)
Copies the mixer code for sound preset preset (0 to 4; anything else is 0) from ROM into IwramSoundPr...
Definition frame.c:439
void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler)
Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and...
Definition frame.c:37
void Input_UpdateKeyRepeatAndDirection(void)
Runs once a frame after VBlank, called by WaitFrames.
Definition frame.c:297
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
Definition frame.c:97
s32 Runtime_GetRemainingIwram(void)
Returns the IWRAM bytes left to allocate, up to gCartridgeResetMarker (0x03007800),...
Definition heap.c:26
void Runtime_InitializeHeap(void)
Empties the heap: clears the 64 words of gWorkSlot (both pool pointers and every named slot) and sets...
Definition heap.c:15
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
Definition heap.c:140
void * MemAlloc(s32 size)
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise...
Definition heap.c:115
s32 Runtime_GetRemainingEwram(void)
Returns the EWRAM bytes left to allocate, up to the end of EWRAM.
Definition heap.c:34
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
Definition heap.c:80
UNUSED void RuntimeMemory_ReservedNoOp(void)
Reserved empty memory export; its historical purpose is not established.
Definition heap.c:164
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
Definition heap.c:47
void IoWriteQueue_FlushPending(void)
Runs the queued register writes and empties the queue, with a copy of the executor routine on the sta...
Definition io_queue.c:40
The hardware's interrupt sources and the interrupt handler table.
void(*) InterruptHandler(void)
Definition irq.h:36
s32 Math_IntegerSqrt(s32 value)
Returns the integer square root of value, a bit at a time.
Definition math.c:126
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
Definition math.c:23
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
Definition math.c:10
s32 ArcTan2(s32 x, s32 y)
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y,...
Definition math.c:36
s32 Palette_GetBasicObjColors(void)
Definition math.c:151
s32 FixedSqrt(s32 value)
Square root of a 16.16 fixed-point value, in 16.16.
Definition math.c:149
void Render_ResetFrame(void)
Starts a new frame of sprites: frees the affine matrices and empties the 256 depth slots sprites are ...
Definition render.c:12
s32 AffineMatrix_BuildForEffect(struct AffineTransform *source)
Hands out the next OAM affine matrix for a sprite drawn with source's scale and rotation and fills it...
Definition render.c:27
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
Definition render.c:79
void Render_BuildOamList(void *work)
Builds this frame's OAM list in work from the sprites linked into the depth slots,...
Definition render.c:96
void ColorBuffer_BackupAndBrightenPartial(u8 *buffer, u32 amount, u8 *backup, u32 bytes)
As ColorBuffer_BackupAndBrighten, skipping groups already all at 63.
Definition decompress.c:83
void ColorBuffer_BackupAndScaleThreeQuarters(u8 *buffer, u8 *backup, u32 bytes)
Scales every pixel to three quarters.
Definition decompress.c:65
void Resource_DecompressHalfwords(const void *source, void *destination)
Decompresses the halfword LZ stream at source to destination, with a copy of the ARM decoder on the s...
Definition decompress.c:9
s32 Resource_DecodeType01(const void *source, void *destination)
Decodes a type-01 resource and returns its unpacked byte count.
Definition decompress.c:31
void ColorBuffer_BackupAndHalve(u8 *buffer, u8 *backup, u32 bytes)
Halves every pixel. Called by the battle effect canvas's transfers.
Definition decompress.c:75
void ColorBuffer_BackupAndBrighten(u8 *buffer, u32 amount, u8 *backup, u32 bytes)
Raises every pixel by amount, stopping at 63.
Definition decompress.c:47
void ColorBuffer_BackupAndHalveNonzero(u8 *buffer, u8 *backup, u32 bytes)
Halves every pixel, skipping all-zero groups.
Definition decompress.c:114
void ColorBuffer_BackupAndDarken(u8 *buffer, u32 amount, u8 *backup, u32 bytes)
Lowers every pixel by amount, stopping at 0.
Definition decompress.c:56
s32 Resource_DecodeByteLz(const void *source, void *destination)
Decodes a byte-oriented LZ resource and returns its unpacked byte count.
Definition decompress.c:37
void ColorBuffer_BackupAndScaleNonzeroThreeQuarters(u8 *buffer, u8 *backup, u32 bytes)
Scales every pixel to three quarters, skipping all-zero groups.
Definition decompress.c:103
void ColorBuffer_BackupAndDarkenPartial(u8 *buffer, u32 amount, u8 *backup, u32 bytes)
As ColorBuffer_BackupAndDarken, skipping groups already all at 0.
Definition decompress.c:93
s32 Resource_DecodeType2(const void *source, void *destination)
Decodes a type-02 resource and returns its unpacked byte count.
Definition decompress.c:34
u32 SaveState_ReadRecordPayload(s32 recordId, void *destination)
Loads the current copy of record recordId into destination.
Definition save.c:236
u32 SaveState_FindLatestSlot(s32 recordId)
Returns the occupied sector holding the newest copy of record recordId, or 16.
Definition save.c:294
s32 SaveState_LoadSummaryRecords(void)
Reads the summary at the start of each of the three save files into summary for the file select scree...
Definition save.c:376
u32 SaveState_ReleaseWorkspace(void)
Removes the flash timer handler and frees the save workspace's heap slot.
Definition save.c:409
u32 SaveState_DeleteRecord(s32 recordId)
Invalidates the current copy of record recordId.
Definition save.c:253
u32 SaveState_GetLatestSequence(s32 recordId)
Returns the highest sequence number among the copies of record recordId.
Definition save.c:356
u32 SaveState_SelectWriteSlot(s32 mode)
Picks the free sector to write record mode to, at random.
Definition save.c:100
s32 SaveState_WriteRecord(s32 recordId, void *source)
Saves 0xff0 bytes from source as record recordId: writes the new copy with the next sequence number,...
Definition save.c:181
u32 SaveState_WriteWorkspaceSlot(s32 sector)
Programs the workspace's sector buffer into flash sector sector and verifies it, through the flash li...
Definition save.c:136
s32 SaveState_ReadSlotAndCheckChecksum(s32 index)
Reads flash sector index into the workspace's sector buffer.
Definition save.c:155
s32 SaveState_InvalidateSlot(s32 index)
Overwrites sector index with a header for no record (id 16) and clears its occupied entry.
Definition save.c:317
s32 SaveState_CompareBytes(u8 *left, u8 *right, s32 count)
Compares count bytes, as memcmp does.
Definition save.c:340
UNUSED u16 SaveState_EraseSlotSector(u16 sector)
Erases flash sector sector with the flash library's routine for this chip.
Definition save.c:172
s32 SaveState_ChecksumWorkspace(void)
Sums the first 0xfe8 payload bytes of the workspace's sector buffer; the final eight payload bytes ar...
Definition save.c:268
s32 SaveState_InitializeWorkspace(void)
Allocates the save workspace (heap slot HEAP_SLOT_SAVE), installs the flash library's timer 2 handler...
Definition save.c:31
s32 Scheduler_ResumeTasks(SchedulerCallback callback)
Resumes the task running callback, or every task when callback is null, by clearing bit 0 of its orde...
Definition scheduler.c:243
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
Definition scheduler.c:102
void Scheduler_ResetTaskTable(void)
Empties the task table: every slot gets no routine, order 0xffff (sorted last) and no flags.
Definition scheduler.c:19
void Scheduler_RunPass(s32 key)
Runs one pass of the scheduler: every task whose order's high byte matches key's (SCHEDULER_KEY_MAIN_...
Definition scheduler.c:289
UNUSED void Scheduler_CopyWords(u32 *destination, u32 *source, u32 byteCount)
Copies byteCount bytes a word at a time. Nothing in ☀️ calls it.
Definition scheduler.c:37
s32 Scheduler_SuspendTasks(SchedulerCallback callback)
Suspends the task running callback, or every task when callback is null, by setting bit 0 of its orde...
Definition scheduler.c:172
s32 Scheduler_ResumeOverlayTasks(void)
Resumes every task whose routine is in an overlay, flagged or not.
Definition scheduler.c:265
s32 Scheduler_SuspendOverlayTasks(void)
Suspends every task whose routine is in an overlay (EWRAM, 0x02xxxxxx) unless its flag bit 0 asks to ...
Definition scheduler.c:197
UNUSED void Scheduler_Idle(void)
An empty routine; nothing in ☀️ calls it.
Definition scheduler.c:138
void Scheduler_SortTasks(void)
Bubble-sorts the task table by order, highest first, so each pass runs its tasks from the highest ord...
Definition scheduler.c:47
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
Definition scheduler.c:146
UNUSED s32 Scheduler_FindCallback(SchedulerCallback callback)
Returns the table index of the task running callback, or -1.
Definition scheduler.c:77
s32 Scheduler_SetTaskFlags(SchedulerCallback callback, u32 mask)
Stores mask as the flags of the task running callback; bit 0 keeps it running while the overlay tasks...
Definition scheduler.c:220
UNUSED void Scheduler_EmptyCallback(void)
An empty routine; nothing in ☀️ calls it.
Definition scheduler.c:141
void SerialRuntime_DisableTransfer(void)
Disables the serial and timer 3 interrupts, stops the transfer timer and clears gSerialRuntime....
Definition serial.c:94
void SerialRuntime_EnableTransferTimer(void)
Lets the timer start transfers again once a link mode is set, by setting gSerialRuntime....
Definition serial.c:85
void SerialRuntime_WaitForSend(void)
Definition serial.c:504
s32 SerialRuntime_BeginReceive(void *destination)
Starts receiving the partner's blocks into destination: sets the receive destination and clears the r...
Definition serial.c:474
void SerialRuntime_WaitForTransfers(void)
Waits until both the send and the receive have finished, giving up after 600000 frames.
Definition serial.c:509
void SerialTest_Delay(void)
An empty routine the link test calls to waste time.
Definition serial.c:668
s32 SerialRuntime_BeginSend(void *source, s32 size)
Starts sending size bytes from source to the partner in 20-byte blocks: sets the send source,...
Definition serial.c:454
void SerialRuntime_RemoveIrqHandlers(void)
Clears gSerialExchangeActive, which stops the per-frame exchange, and removes the link interrupt hand...
Definition serial.c:431
void BattleLink_ResetTransferState(void)
Definition serial.c:536
u32 SerialRuntime_WaitForStatusMask(s32 mask)
Waits a frame at a time until every status bit in mask is set in gLinkStatus, then returns this conso...
Definition serial.c:440
s32 SerialRuntime_PollStatus(void)
As SerialRuntime_PollAndTransfer, without exchanging data: WaitFrames calls it once a frame while gSe...
Definition serial.c:168
void SerialRuntime_WaitForReceive(void)
Definition serial.c:505
void SerialRuntime_PrepareSendPacket(void *payload)
Builds the packet to send in sendBuffer[0]: [0] the sequence number, [1] the consoles not yet heard f...
Definition serial.c:246
s32 SerialRuntime_PollAndTransfer(void *send, void *receive)
Looks for the link partner and, once connected, does one exchange (as SerialRuntime_ExchangePayloads)...
Definition serial.c:113
void SerialTest_Run(void)
A link cable test left in the game: it shows a row of tiles, receives blocks into the map cell buffer...
Definition serial.c:673
s32 SerialRuntime_GetActiveTransfers(void)
Returns bit 0 while a send runs and bit 1 while a receive runs.
Definition serial.c:523
void SerialRuntime_Initialize(void)
Resets the serial port into multiplayer mode, installs the serial and timer 3 interrupt handlers,...
Definition serial.c:28
void SerialRuntime_StepBlockTransfer(void)
Runs each VBlank after the exchange, called by System_VBlankHandler: moves the bulk transfer on by on...
Definition serial.c:548
s32 SerialRuntime_ExchangePayloads(void *send, void *receive)
Once connected (phase 1), gathers the received payloads into receive and builds the next packet from ...
Definition serial.c:218
u8 SerialRuntime_CollectReceivedPayloads(void *payload)
Swaps in the packets the interrupt handler finished, then copies the payload of each one whose checks...
Definition serial.c:302
void SerialRuntime_HandleTransferInterrupt(void)
The serial and timer 3 interrupt, installed by SerialRuntime_Initialize: each one moves a halfword.
Definition serial.c:344
A sprite's rotation and scale: scales in 8.8 fixed point (0x100 is full size), the angle in 1/65536 t...
Definition affine.h:13
u16 angle
1/65536 turns
Definition affine.h:16
UNUSED void RuntimeDispatch_ReservedNoOpA(void)
Reserved empty export A in the runtime far-call table; no source caller.
Definition system.c:109
void Runtime_IgnoreInterrupt(void)
The handler of every interrupt nobody has claimed.
Definition system.c:240
void System_Initialize(void)
Powers the game up: stops any HBlank DMA left running, sets the cartridge wait states,...
Definition system.c:17
void System_CopyBuildStamp(void)
Copies the build stamp resource (twelve digits) into gBuildStamp in high IWRAM and writes the zero wo...
Definition system.c:135
UNUSED void RuntimeDispatch_ReservedNoOpB(void)
Reserved empty export B in the runtime far-call table; no source caller.
Definition system.c:112
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
Definition system.c:150
UNUSED void RuntimeDispatch_ReservedNoOpD(void)
Reserved empty export D in the runtime far-call table; no source caller.
Definition system.c:118
UNUSED void RuntimeDispatch_ReservedNoOpC(void)
Reserved empty export C in the runtime far-call table; no source caller.
Definition system.c:115
void RuntimeDispatch_NoOpHook(s32 unused)
An exported stub that does nothing with its argument.
Definition system.c:146
void Resource_LoadCode(u32 index, void *destination)
Decodes the compressed code resource index to destination and resolves its long branches there,...
Definition system.c:228
UNUSED void Code_ResolveLongBranches(u16 *entries, s32 byteLength)
Resolves the Thumb long branches (BL pairs) of a block of code whose branch offsets are stored from t...
Definition system.c:162
UNUSED void RuntimeDispatch_ReservedNoOpE(void)
Reserved empty export E in the runtime far-call table; no source caller.
Definition system.c:121
void Runtime_InstallIwramAndIrqs(void)
Copies the resident code to IWRAM, points the BIOS interrupt vector (gIrqVector) at its dispatcher,...
Definition system.c:247
UNUSED void Runtime_IdleForever(void)
Waits out frames forever; the frame loop still runs the scheduled tasks.
Definition system.c:64
s32 RuntimeDispatch_ReturnZero(s32 unused0, const u8 *unused1)
An exported stub that ignores its arguments and reports 0.
Definition system.c:124
void DebugText_PrintDecimal(s32 value, s32 digits)
Prints the last digits characters of value in signed decimal (1 to 10; anything else prints 10).
Definition text.c:157
void DebugText_PrintBlanks(u32 count)
Writes count blank characters at the debug text cursor and moves it on.
Definition text.c:89
void Palette_LoadBasicObjColors(void)
Loads the basic sprite palettes (palettes 0 to 13).
Definition text.c:199
void DebugText_PrintHex(u32 value, s32 digits)
Prints the last digits hexadecimal digits of value (1 to 8; anything else prints all 8).
Definition text.c:144
void NumberText_FormatHex(u32 value)
Writes value as eight hexadecimal digits to the number buffer.
Definition text.c:12
void DebugText_Print(const u8 *src)
Prints the string src (at most 32 characters) at the debug text cursor, wrapping from the end of the ...
Definition text.c:116
void Ui_LoadWindowGraphics(void)
Loads the window font and frame tiles into BG character block 0, the window palette into BG palette 1...
Definition text.c:180
void DebugText_Clear(void)
Blanks the debug text screen, homes the cursor and points BG0 at it.
Definition text.c:170
void NumberText_FormatDecimal(s32 number)
Writes number to the number buffer as eleven characters: spaces, a sign (a space or '-') and its deci...
Definition text.c:32
void SceneTransform_ApplyYaw(s32 angle)
Rotates gTransform about the Y axis by angle.
Definition transform.c:113
void Projection_Set(u32 focal, u32 nearDepth, u32 farDepth)
Sets gProjection's focal length and depth range directly.
Definition transform.c:350
void Transform_Load(const void *src)
Copies the matrix at src into gTransform. Called by BattleFx_RunAtalanta.
Definition transform.c:44
s32 Render_ProjectPoint(const void *point, s32 *screen)
Reads three word-aligned coordinates from point, transforms them by gTransform and projects them to t...
Definition transform.c:364
void SceneTransform_ApplyPitch(s32 angle)
Rotates gTransform about the X axis by angle.
Definition transform.c:97
void SceneTransform_ResetMatrix(void)
Resets gTransform to identity. Reached through the far-call table.
Definition transform.c:58
void Transform_Pop(void)
Restores gTransform from the save area, if Transform_Push saved it.
Definition transform.c:49
void Projection_SetFieldOfView(u32 fieldOfView, s32 nearDepth, s32 farDepth)
Sets gProjection from a vertical field of view: the focal length is 80 (half the screen height) over ...
Definition transform.c:335
void SceneTransform_ApplyPosition(const s32 *position)
Translates gTransform by position (x, y, z in 16.16).
Definition transform.c:145
void Transform_Push(void)
Saves gTransform into the save area (one level deep; a second save is ignored).
Definition transform.c:30
void Transform_ApplyLookAt(s32 *eye, s32 *target)
Multiplies the camera at eye looking at target into gTransform.
Definition transform.c:324
void Render_ResetTransformState(void)
Allocates the one-level save area (heap slot HEAP_SLOT_TRANSFORM_STACK), clears gTransformStackDepth ...
Definition transform.c:19
void Transform_Store(void *dst)
Copies gTransform to dst. Called by BattleFx_RunAtalanta.
Definition transform.c:39
void SceneTransform_ApplyScale(const s32 *scale)
Scales gTransform by scale (x, y, z factors in 16.16).
Definition transform.c:158
void Transform_SetLookAt(s32 *eye, s32 *target)
Makes the camera at eye looking at target the whole of gTransform.
Definition transform.c:318
void Transform_BuildLookAt(s32 *eye, s32 *target, s32 *out)
Builds in out the camera matrix of an eye at eye looking at target.
Definition transform.c:243
void SceneTransform_ApplyRotationTranslation(s32 *angles, s32 *position)
Rotates gTransform by angles and translates it by position in one matrix.
Definition transform.c:171
void SceneTransform_ApplyRoll(s32 angle)
Rotates gTransform about the Z axis by angle.
Definition transform.c:129
void SceneTransform_ApplyRotation(s32 *angles)
Rotates gTransform by angles[0], angles[1] and angles[2] about the X, Y and Z axes,...
Definition transform.c:66
void SceneTransform_ApplyScaledRotation(s32 *angles, s32 *position, s32 *scale)
Rotates by angles, scales each rotation row by scale and translates by position, in one matrix.
Definition transform.c:202
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
void * memcpy(void *destination, const void *source, unsigned long size)
s32 System_GetLanguage(void)
s32 VramCache_FreeBlocks(s32 id)
Frees every block entry id owns in gResourceBlockOwners.
Definition vram_cache.c:79
void VramCache_Reset(void)
Frees every block and every cache entry.
Definition vram_cache.c:184
s32 VramCache_AllocEntry(s32 size)
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
Definition vram_cache.c:227
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
Definition vram_cache.c:238
s32 VramCache_GetLongestFreeRun(void)
Returns the length, in blocks, of the longest run of free blocks.
Definition vram_cache.c:57
s32 VramCache_ReleaseVram(u32 no)
Gives back entry no's blocks but keeps the entry taken, with size 1, so a later VramCache_Load can re...
Definition vram_cache.c:122
s32 VramCache_AllocateBlocks(u32 id, u32 size)
Finds the first run of free blocks that holds size bytes and gives it to entry id,...
Definition vram_cache.c:16
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
Definition vram_cache.c:106
s32 Resource_FindFreeEntry(void)
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
Definition vram_cache.c:211
s32 VramCache_Load(u32 no, u32 size, const void *src)
Gives cache entry no size bytes of sprite VRAM and copies src there.
Definition vram_cache.c:143