Go to the source code of this file.
Functions | |
| void | System_Initialize (void) |
| Powers the game up: stops any HBlank DMA left running, sets the cartridge wait states, clears IWRAM, installs the interrupt handlers and the resident IWRAM code, loads the window graphics and the sound driver, then starts a new game. | |
| void | Runtime_IdleForever (void) |
| Waits out frames forever; the frame loop still runs the scheduled tasks. | |
| s32 | System_GetLanguage (void) |
| void | RuntimeDispatch_ReservedNoOpA (void) |
| Reserved empty export A in the runtime far-call table; no source caller. | |
| void | RuntimeDispatch_ReservedNoOpB (void) |
| Reserved empty export B in the runtime far-call table; no source caller. | |
| void | RuntimeDispatch_ReservedNoOpC (void) |
| Reserved empty export C in the runtime far-call table; no source caller. | |
| void | RuntimeDispatch_ReservedNoOpD (void) |
| Reserved empty export D in the runtime far-call table; no source caller. | |
| void | RuntimeDispatch_ReservedNoOpE (void) |
| Reserved empty export E in the runtime far-call table; no source caller. | |
| s32 | RuntimeDispatch_ReturnZero (s32 unused0, const u8 *unused1) |
| An exported stub that ignores its arguments and reports 0. | |
| void | System_CopyBuildStamp (void) |
| Copies the build stamp resource (twelve digits) into gBuildStamp in high IWRAM and writes the zero word that ends it. | |
| void | RuntimeDispatch_NoOpHook (s32 unused) |
| An exported stub that does nothing with its argument. | |
| void * | Resource_GetTableEntry (s32 index) |
| Returns the ROM address of resource index from the resource directory. | |
| 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 the start of the block. | |
| void | Resource_LoadCode (u32 index, void *destination) |
| Decodes the compressed code resource index to destination and resolves its long branches there, with a RAM copy of the ARM routine that does what Code_ResolveLongBranches does; the copy is allocated and freed again. | |
| void | Runtime_IgnoreInterrupt (void) |
| The handler of every interrupt nobody has claimed. | |
| void | Runtime_InstallIwramAndIrqs (void) |
| Copies the resident code to IWRAM, points the BIOS interrupt vector (gIrqVector) at its dispatcher, installs the default handler table and enables the VBlank and keypad interrupts (and, outside Japan and England, the cartridge-removed interrupt, which halts the game). | |
| 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 installs the do-nothing handler. | |
| void | WaitFrames (s32 frames) |
| The game's frame loop: runs frames frames and returns. | |
| void | Input_ResetKeyRepeat (void) |
| Restarts the key repeat delay, so held keys wait the full delay again. | |
| void | Input_UpdateKeyRepeatAndDirection (void) |
| Runs once a frame after VBlank, called by WaitFrames. | |
| void | System_VBlankHandler (void) |
| The VBlank interrupt handler, installed by System_Initialize. | |
| s32 | Sound_LoadPresetParameters (s32 preset) |
| Copies the mixer code for sound preset preset (0 to 4; anything else is 0) from ROM into IwramSoundPresetCode. | |
| void | Sound_ReservedNoOpA (void) |
| Nothing calls it. | |
| void | Sound_ReservedNoOpB (void) |
| Nothing calls it. | |
| void | Input_HandleKeyInterrupt (void) |
| The keypad interrupt, from the handler table: A+B+Select+Start was pressed, so it sets gResetRequested for the frame loop and disarms the interrupt. | |
| void | Fade_ToBlack (s32 frames) |
| Fades out to black. | |
| void | Fade_FromBlack (s32 frames) |
| Fades in from black. | |
| void | Fade_ToWhite (s32 frames) |
| Fades out to white. | |
| void | Fade_FromWhite (s32 frames) |
| Fades in from white. | |
| s32 | Resource_DecodeType01 (const void *source, void *destination) |
| Decodes a type-01 resource and returns its unpacked byte count. | |
| s32 | Resource_DecodeType2 (const void *source, void *destination) |
| Decodes a type-02 resource and returns its unpacked byte count. | |
| s32 | Resource_DecodeByteLz (const void *source, void *destination) |
| Decodes a byte-oriented LZ resource and returns its unpacked byte count. | |
| void | SerialRuntime_WaitForSend (void) |
| void | SerialRuntime_WaitForReceive (void) |
| void | IoWriteQueue_FlushPending (void) |
| Runs the queued register writes and empties the queue, with a copy of the executor routine on the stack. | |
| void | Fade_Update (void) |
| Steps the screen fade once a frame, called by System_VBlankHandler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts gBlendFramesLeft down; at the end it clears gBlendDuration. | |
| 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. | |
| void | Fade_Wait (void) |
| Waits a frame at a time until the running fade has finished. | |
| void | Render_ResetFrame (void) |
| Starts a new frame of sprites: frees the affine matrices and empties the 256 depth slots sprites are linked into. | |
| 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 in. | |
| void | Runtime_PushSlotEntry (void *slotEntry, s32 slot) |
| Links a sprite entry into depth slot slot (clamped to 0..255) for this frame. | |
| void | Render_BuildOamList (void *work) |
| Builds this frame's OAM list in work from the sprites linked into the depth slots, with a RAM copy of the ARM builder. | |
| s32 | VramCache_AllocateBlocks (u32 id, u32 size) |
| Finds the first run of free blocks that holds size bytes and gives it to entry id, writing id into gResourceBlockOwners for each block. | |
| s32 | VramCache_GetLongestFreeRun (void) |
| Returns the length, in blocks, of the longest run of free blocks. | |
| s32 | VramCache_FreeBlocks (s32 id) |
| Frees every block entry id owns in gResourceBlockOwners. | |
| s32 | Resource_ResetEntry (u32 no) |
| Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff). | |
| 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 refill it. | |
| s32 | VramCache_Load (u32 no, u32 size, const void *src) |
| Gives cache entry no size bytes of sprite VRAM and copies src there. | |
| void | VramCache_Reset (void) |
| Frees every block and every cache entry. | |
| s32 | Resource_FindFreeEntry (void) |
| Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken. | |
| s32 | VramCache_AllocEntry (s32 size) |
| Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number. | |
| s32 | VramCache_Reload (s32 no, s32 src) |
| Copies src again into entry no's VRAM, keeping its size. | |
| void | Scheduler_ResetTaskTable (void) |
| Empties the task table: every slot gets no routine, order 0xffff (sorted last) and no flags. | |
| void | Scheduler_CopyWords (u32 *destination, u32 *source, u32 byteCount) |
| Copies byteCount bytes a word at a time. Nothing in ☀️ calls it. | |
| void | Scheduler_SortTasks (void) |
| Bubble-sorts the task table by order, highest first, so each pass runs its tasks from the highest order down; removed tasks (order 0x7fff) rise to the front. | |
| s32 | Scheduler_FindCallback (SchedulerCallback callback) |
| Returns the table index of the task running callback, or -1. | |
| 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 table. | |
| void | Scheduler_Idle (void) |
| An empty routine; nothing in ☀️ calls it. | |
| void | Scheduler_EmptyCallback (void) |
| An empty routine; nothing in ☀️ calls it. | |
| s32 | Scheduler_RemoveCallback (SchedulerCallback callback) |
| Unschedules the task running callback: clears its routine and gives it order 0x7fff, which no pass matches. | |
| s32 | Scheduler_SuspendTasks (SchedulerCallback callback) |
| Suspends the task running callback, or every task when callback is null, by setting bit 0 of its order's high byte, which then matches neither pass key. | |
| s32 | Scheduler_SuspendOverlayTasks (void) |
| Suspends every task whose routine is in an overlay (EWRAM, 0x02xxxxxx) unless its flag bit 0 asks to keep it running, as Scheduler_SuspendTasks does. | |
| 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 are suspended. | |
| s32 | Scheduler_ResumeTasks (SchedulerCallback callback) |
| Resumes the task running callback, or every task when callback is null, by clearing bit 0 of its order's high byte. | |
| s32 | Scheduler_ResumeOverlayTasks (void) |
| Resumes every task whose routine is in an overlay, flagged or not. | |
| void | Scheduler_RunPass (s32 key) |
| Runs one pass of the scheduler: every task whose order's high byte matches key's (SCHEDULER_KEY_MAIN_LOOP or SCHEDULER_KEY_VBLANK), in table order. | |
| u32 | Random16 (void) |
| Advances the game's random number generator (the C library's classic linear congruential one), stores the new seed and returns 16 bits of it. | |
| 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, z by the sine. | |
| 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, 0x4000 along +x. | |
| s32 | Math_IntegerSqrt (s32 value) |
| Returns the integer square root of value, a bit at a time. | |
| s32 | FixedSqrt (s32 value) |
| Square root of a 16.16 fixed-point value, in 16.16. | |
| s32 | Palette_GetBasicObjColors (void) |
| void | NumberText_FormatHex (u32 value) |
| Writes value as eight hexadecimal digits to the number buffer. | |
| void | NumberText_FormatDecimal (s32 number) |
| Writes number to the number buffer as eleven characters: spaces, a sign (a space or '-') and its decimal digits, right-aligned. | |
| void | DebugText_PrintBlanks (u32 count) |
| Writes count blank characters at the debug text cursor and moves it on. | |
| void * | memcpy (void *destination, const void *source, unsigned long size) |
| 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 screen to its start, when debug text is on; the cursor moves past it. | |
| void | DebugText_PrintHex (u32 value, s32 digits) |
| Prints the last digits hexadecimal digits of value (1 to 8; anything else prints all 8). | |
| void | DebugText_PrintDecimal (s32 value, s32 digits) |
| Prints the last digits characters of value in signed decimal (1 to 10; anything else prints 10). | |
| void | DebugText_Clear (void) |
| Blanks the debug text screen, homes the cursor and points BG0 at it. | |
| void | Ui_LoadWindowGraphics (void) |
| Loads the window font and frame tiles into BG character block 0, the window palette into BG palette 15 with its gradient colours, and the basic sprite palettes. | |
| void | Palette_LoadBasicObjColors (void) |
| Loads the basic sprite palettes (palettes 0 to 13). | |
| void | Runtime_InitializeHeap (void) |
| Empties the heap: clears the 64 words of gWorkSlot (both pool pointers and every named slot) and sets the pools' next addresses to gIwramHeap and gEwramHeap. | |
| s32 | Runtime_GetRemainingIwram (void) |
| Returns the IWRAM bytes left to allocate, up to gCartridgeResetMarker (0x03007800), the same end the allocators test. | |
| s32 | Runtime_GetRemainingEwram (void) |
| Returns the EWRAM bytes left to allocate, up to the end of EWRAM. | |
| void * | Runtime_AllocateHeapBlock (s32 kind, s32 size) |
| Returns heap slot kind's block, first allocating size bytes for it (rounded up to words), from IWRAM when they fit and EWRAM otherwise. | |
| void * | Runtime_AllocateBlock (s32 kind, s32 size) |
| As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the battle, shop and save work, among others. | |
| void * | MemAlloc (s32 size) |
| Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise, and advances that pool's next address. | |
| void * | Runtime_BumpAllocateAlternatePool (s32 size) |
| As MemAlloc, but tries EWRAM first. | |
| void | RuntimeMemory_ReservedNoOp (void) |
| Reserved empty memory export; its historical purpose is not established. | |
| void | Render_ResetTransformState (void) |
| Allocates the one-level save area (heap slot HEAP_SLOT_TRANSFORM_STACK), clears gTransformStackDepth and resets gTransform to identity. | |
| void | Transform_Push (void) |
| Saves gTransform into the save area (one level deep; a second save is ignored). | |
| void | Transform_Store (void *dst) |
| Copies gTransform to dst. Called by BattleFx_RunAtalanta. | |
| void | Transform_Load (const void *src) |
| Copies the matrix at src into gTransform. Called by BattleFx_RunAtalanta. | |
| void | Transform_Pop (void) |
| Restores gTransform from the save area, if Transform_Push saved it. | |
| void | SceneTransform_ResetMatrix (void) |
| Resets gTransform to identity. Reached through the far-call table. | |
| void | SceneTransform_ApplyRotation (s32 *angles) |
| Rotates gTransform by angles[0], angles[1] and angles[2] about the X, Y and Z axes, in that order, with one combined matrix. | |
| void | SceneTransform_ApplyPitch (s32 angle) |
| Rotates gTransform about the X axis by angle. | |
| void | SceneTransform_ApplyYaw (s32 angle) |
| Rotates gTransform about the Y axis by angle. | |
| void | SceneTransform_ApplyRoll (s32 angle) |
| Rotates gTransform about the Z axis by angle. | |
| void | SceneTransform_ApplyPosition (const s32 *position) |
| Translates gTransform by position (x, y, z in 16.16). | |
| void | SceneTransform_ApplyScale (const s32 *scale) |
| Scales gTransform by scale (x, y, z factors in 16.16). | |
| void | SceneTransform_ApplyRotationTranslation (s32 *angles, s32 *position) |
| Rotates gTransform by angles and translates it by position in one matrix. | |
| 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. | |
| void | Transform_BuildLookAt (s32 *eye, s32 *target, s32 *out) |
| Builds in out the camera matrix of an eye at eye looking at target. | |
| void | Transform_SetLookAt (s32 *eye, s32 *target) |
| Makes the camera at eye looking at target the whole of gTransform. | |
| void | Transform_ApplyLookAt (s32 *eye, s32 *target) |
| Multiplies the camera at eye looking at target into gTransform. | |
| 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 the tangent of half the angle. | |
| void | Projection_Set (u32 focal, u32 nearDepth, u32 farDepth) |
| Sets gProjection's focal length and depth range directly. | |
| s32 | Render_ProjectPoint (const void *point, s32 *screen) |
| Reads three word-aligned coordinates from point, transforms them by gTransform and projects them to the screen: screen[0] and screen[1] are its pixel position and screen[2] its whole-unit depth. | |
| 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 stack. | |
| void | ColorBuffer_BackupAndBrighten (u8 *buffer, u32 amount, u8 *backup, u32 bytes) |
| Raises every pixel by amount, stopping at 63. | |
| void | ColorBuffer_BackupAndDarken (u8 *buffer, u32 amount, u8 *backup, u32 bytes) |
| Lowers every pixel by amount, stopping at 0. | |
| void | ColorBuffer_BackupAndScaleThreeQuarters (u8 *buffer, u8 *backup, u32 bytes) |
| Scales every pixel to three quarters. | |
| void | ColorBuffer_BackupAndHalve (u8 *buffer, u8 *backup, u32 bytes) |
| Halves every pixel. Called by the battle effect canvas's transfers. | |
| void | ColorBuffer_BackupAndBrightenPartial (u8 *buffer, u32 amount, u8 *backup, u32 bytes) |
| As ColorBuffer_BackupAndBrighten, skipping groups already all at 63. | |
| void | ColorBuffer_BackupAndDarkenPartial (u8 *buffer, u32 amount, u8 *backup, u32 bytes) |
| As ColorBuffer_BackupAndDarken, skipping groups already all at 0. | |
| void | ColorBuffer_BackupAndScaleNonzeroThreeQuarters (u8 *buffer, u8 *backup, u32 bytes) |
| Scales every pixel to three quarters, skipping all-zero groups. | |
| void | ColorBuffer_BackupAndHalveNonzero (u8 *buffer, u8 *backup, u32 bytes) |
| Halves every pixel, skipping all-zero groups. | |
| s32 | SaveState_InitializeWorkspace (void) |
| Allocates the save workspace (heap slot HEAP_SLOT_SAVE), installs the flash library's timer 2 handler, identifies the flash chip (up to eight tries, a frame apart) and scans all 16 sectors into the workspace's occupied, recordId and sequence tables: a sector counts as taken when its signature and checksum are good, and of two copies of a record only the newer stays taken. | |
| u32 | SaveState_SelectWriteSlot (s32 mode) |
| Picks the free sector to write record mode to, at random. | |
| u32 | SaveState_WriteWorkspaceSlot (s32 sector) |
| Programs the workspace's sector buffer into flash sector sector and verifies it, through the flash library's routine for this chip. | |
| s32 | SaveState_ReadSlotAndCheckChecksum (s32 index) |
| Reads flash sector index into the workspace's sector buffer. | |
| u16 | SaveState_EraseSlotSector (u16 sector) |
| Erases flash sector sector with the flash library's routine for this chip. | |
| s32 | SaveState_WriteRecord (s32 recordId, void *source) |
| Saves 0xff0 bytes from source as record recordId: writes the new copy with the next sequence number, then invalidates the old one, updating the workspace's sector tables. | |
| u32 | SaveState_ReadRecordPayload (s32 recordId, void *destination) |
| Loads the current copy of record recordId into destination. | |
| u32 | SaveState_DeleteRecord (s32 recordId) |
| Invalidates the current copy of record recordId. | |
| s32 | SaveState_ChecksumWorkspace (void) |
| Sums the first 0xfe8 payload bytes of the workspace's sector buffer; the final eight payload bytes are excluded. | |
| u32 | SaveState_FindLatestSlot (s32 recordId) |
| Returns the occupied sector holding the newest copy of record recordId, or 16. | |
| s32 | SaveState_InvalidateSlot (s32 index) |
| Overwrites sector index with a header for no record (id 16) and clears its occupied entry. | |
| s32 | SaveState_CompareBytes (u8 *left, u8 *right, s32 count) |
| Compares count bytes, as memcmp does. | |
| u32 | SaveState_GetLatestSequence (s32 recordId) |
| Returns the highest sequence number among the copies of record recordId. | |
| s32 | SaveState_LoadSummaryRecords (void) |
| Reads the summary at the start of each of the three save files into summary for the file select screen, and four bytes from offset 0x110 of each file's second record (zero when it has none). | |
| u32 | SaveState_ReleaseWorkspace (void) |
| Removes the flash timer handler and frees the save workspace's heap slot. | |
| void | SerialRuntime_Initialize (void) |
| Resets the serial port into multiplayer mode, installs the serial and timer 3 interrupt handlers, clears gSerialRuntime and points its packet buffers into its storage, clears the bulk transfer state and sets gSerialExchangeActive, which starts the per-frame exchange. | |
| void | SerialRuntime_EnableTransferTimer (void) |
| Lets the timer start transfers again once a link mode is set, by setting gSerialRuntime.transferEnabled. | |
| void | SerialRuntime_DisableTransfer (void) |
| Disables the serial and timer 3 interrupts, stops the transfer timer and clears gSerialRuntime.transferEnabled. | |
| s32 | SerialRuntime_PollAndTransfer (void *send, void *receive) |
| Looks for the link partner and, once connected, does one exchange (as SerialRuntime_ExchangePayloads). | |
| s32 | SerialRuntime_PollStatus (void) |
| As SerialRuntime_PollAndTransfer, without exchanging data: WaitFrames calls it once a frame while gSerialExchangeActive is set, and the VBlank handler does the exchange. | |
| s32 | SerialRuntime_ExchangePayloads (void *send, void *receive) |
| Once connected (phase 1), gathers the received payloads into receive and builds the next packet from send. | |
| void | SerialRuntime_PrepareSendPacket (void *payload) |
| Builds the packet to send in sendBuffer[0]: [0] the sequence number, [1] the consoles not yet heard from, [2] the checksum and [4] the 24-byte payload. | |
| u8 | SerialRuntime_CollectReceivedPayloads (void *payload) |
| Swaps in the packets the interrupt handler finished, then copies the payload of each one whose checksum is good to payload (24 bytes per console), and records the consoles heard from in currentMask and receivedMask. | |
| void | SerialRuntime_HandleTransferInterrupt (void) |
| The serial and timer 3 interrupt, installed by SerialRuntime_Initialize: each one moves a halfword. | |
| void | SerialRuntime_RemoveIrqHandlers (void) |
| Clears gSerialExchangeActive, which stops the per-frame exchange, and removes the link interrupt handlers. | |
| u32 | SerialRuntime_WaitForStatusMask (s32 mask) |
| Waits a frame at a time until every status bit in mask is set in gLinkStatus, then returns this console's multiplayer id. | |
| s32 | SerialRuntime_BeginSend (void *source, s32 size) |
| Starts sending size bytes from source to the partner in 20-byte blocks: sets the send source, size and block sequence that SerialRuntime_StepBlockTransfer works from. | |
| s32 | SerialRuntime_BeginReceive (void *destination) |
| Starts receiving the partner's blocks into destination: sets the receive destination and clears the received size. | |
| void | SerialRuntime_WaitForTransfers (void) |
| Waits until both the send and the receive have finished, giving up after 600000 frames. | |
| s32 | SerialRuntime_GetActiveTransfers (void) |
| Returns bit 0 while a send runs and bit 1 while a receive runs. | |
| void | BattleLink_ResetTransferState (void) |
| void | SerialRuntime_StepBlockTransfer (void) |
| Runs each VBlank after the exchange, called by System_VBlankHandler: moves the bulk transfer on by one 20-byte block each way. | |
| void | SerialTest_Delay (void) |
| An empty routine the link test calls to waste time. | |
| 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 and shows them as tiles, and sends a part of the ROM when A or B is held. | |
| void System_Initialize | ( | void | ) |
Powers the game up: stops any HBlank DMA left running, sets the cartridge wait states, clears IWRAM, installs the interrupt handlers and the resident IWRAM code, loads the window graphics and the sound driver, then starts a new game.
It never returns. Called once by System_Entry after it has set the stacks; it clears the debug switches, enables the OAM copy and sleep, and clears gCartridgeResetMarker, which a soft reset leaves set.
Definition at line 17 of file system.c.
Referenced by System_Initialize().
| void Runtime_IdleForever | ( | void | ) |
Waits out frames forever; the frame loop still runs the scheduled tasks.
Nothing in ☀️ calls it.
Definition at line 64 of file system.c.
Referenced by Runtime_IdleForever().
| s32 System_GetLanguage | ( | void | ) |
Referenced by BattleTarget_RunSelection(), System_GetLanguage(), and Ui_RunOwnerStatusScreen().
| void RuntimeDispatch_ReservedNoOpA | ( | void | ) |
Reserved empty export A in the runtime far-call table; no source caller.
Definition at line 109 of file system.c.
Referenced by RuntimeDispatch_ReservedNoOpA(), and System_GetLanguage().
| void RuntimeDispatch_ReservedNoOpB | ( | void | ) |
Reserved empty export B in the runtime far-call table; no source caller.
Definition at line 112 of file system.c.
Referenced by RuntimeDispatch_ReservedNoOpB(), and System_GetLanguage().
| void RuntimeDispatch_ReservedNoOpC | ( | void | ) |
Reserved empty export C in the runtime far-call table; no source caller.
Definition at line 115 of file system.c.
Referenced by RuntimeDispatch_ReservedNoOpC(), and System_GetLanguage().
| void RuntimeDispatch_ReservedNoOpD | ( | void | ) |
Reserved empty export D in the runtime far-call table; no source caller.
Definition at line 118 of file system.c.
Referenced by RuntimeDispatch_ReservedNoOpD(), and System_GetLanguage().
| void RuntimeDispatch_ReservedNoOpE | ( | void | ) |
Reserved empty export E in the runtime far-call table; no source caller.
Definition at line 121 of file system.c.
Referenced by RuntimeDispatch_ReservedNoOpE(), and System_GetLanguage().
An exported stub that ignores its arguments and reports 0.
Definition at line 124 of file system.c.
Referenced by RuntimeDispatch_ReturnZero(), System_GetLanguage(), and Ui_RunIconMonitor().
| void System_CopyBuildStamp | ( | void | ) |
Copies the build stamp resource (twelve digits) into gBuildStamp in high IWRAM and writes the zero word that ends it.
Called by System_Initialize.
Definition at line 135 of file system.c.
Referenced by System_CopyBuildStamp(), System_GetLanguage(), and System_Initialize().
| void RuntimeDispatch_NoOpHook | ( | s32 | unused | ) |
An exported stub that does nothing with its argument.
Definition at line 146 of file system.c.
Referenced by LuckyDice_Run(), ReelGame_Run(), RuntimeDispatch_NoOpHook(), System_GetLanguage(), and Title_Run().
| void * Resource_GetTableEntry | ( | s32 | index | ) |
Returns the ROM address of resource index from the resource directory.
Called throughout the game before decoding a resource.
Definition at line 150 of file system.c.
Referenced by BattleBackground_Load(), BattleFx_InitializeStarField(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunBurstShower(), BattleFx_RunCondemn(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinniEntrance(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNereid(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShiningStar(), BattleFx_RunSparkGroups(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), BattleFx_RunVolcano(), BattleFx_RunWhirlwind(), BattleFx_StartElementStreaks(), BattleFx_StepPaletteToResource(), Colosso_LoadLettering(), Colosso_StartRival(), ColossoWall_StartRivalPath(), Graphics_LoadCharacterBlockAndPalette(), LuckyDice_Run(), Map_InitializePerspectiveScene(), Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), Map_LoadLayeredScene(), Map_ShowWorldMap(), Menu_LoadResourceSlot(), OptionMenu_AnimateCursors(), Palette_StepTowardResource(), ReelGame_Run(), RenderResource_LoadFrame(), Resource_GetTableEntry(), Resource_LoadAndDecompress(), Resource_LoadCode(), Resource_LoadIndexedIntoBuffer(), ResourceSlot_Load(), Runtime_GetBuildStampTime(), SelectionScreen_LoadLargeIcon(), System_CopyBuildStamp(), System_GetLanguage(), Title_LoadBackground(), Title_LoadIntroBackgrounds(), Title_LoadSprites(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), Ui_LoadWindowGraphics(), UiGlyph_LoadEntryWithPalette(), UiText_DrawGlyph(), UiText_LoadRemappedGlyph(), UiText_RenderStringTiles(), UiWindow_OverlayTilePattern(), and WorldMap_LoadGraphics().
Resolves the Thumb long branches (BL pairs) of a block of code whose branch offsets are stored from the start of the block.
A BL is two halfwords: the first carries the marker bits 0xf000 and the high eleven bits of the offset, the second the marker 0xf800 and the low eleven bits of the halfword offset. Each pair's offset is reduced by the pair's own position in the block, which turns it into the pc-relative offset the CPU expects; the pairs are rewritten in place. byteLength is the code size. Nothing calls it: Resource_LoadCode uses the ARM routine that does the same.
Definition at line 162 of file system.c.
Referenced by Code_ResolveLongBranches(), and System_GetLanguage().
| void Resource_LoadCode | ( | u32 | index, |
| void * | destination ) |
Decodes the compressed code resource index to destination and resolves its long branches there, with a RAM copy of the ARM routine that does what Code_ResolveLongBranches does; the copy is allocated and freed again.
Called by Scene_LoadOverlay for each scene's overlay, and through the far-call table.
Definition at line 228 of file system.c.
Referenced by Resource_LoadCode(), Scene_LoadOverlay(), and System_GetLanguage().
| void Runtime_IgnoreInterrupt | ( | void | ) |
The handler of every interrupt nobody has claimed.
Definition at line 240 of file system.c.
Referenced by Runtime_IgnoreInterrupt(), Runtime_SetIrqHandler(), and System_GetLanguage().
| void Runtime_InstallIwramAndIrqs | ( | void | ) |
Copies the resident code to IWRAM, points the BIOS interrupt vector (gIrqVector) at its dispatcher, installs the default handler table and enables the VBlank and keypad interrupts (and, outside Japan and England, the cartridge-removed interrupt, which halts the game).
Called by System_Initialize with IME cleared; it sets IME again at the end.
Definition at line 247 of file system.c.
Referenced by Runtime_InstallIwramAndIrqs(), System_GetLanguage(), and System_Initialize().
| 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 installs the do-nothing handler.
The three display interrupts are also switched in DISPSTAT; for VCount, vcount is the line it fires on. Writes REG_IE, REG_DISPSTAT and gIrqHandlers with interrupts disabled. Called by System_Initialize, the link cable and save code for their timer and serial interrupts, and the battle transitions for their HBlank and VCount effects.
Definition at line 37 of file frame.c.
Referenced by AltinPeak_DrainFirstWater(), AltinPeak_DrainSecondWater(), AltinPeak_DrainThirdWater(), BattleFx_RunNeptune(), BattlePres_RunEntryTransition(), CrossboneIslePillarRooms_AnimateWaterLevel(), DisplayTransition_Finish(), DisplayTransition_Start(), DisplayTransition_Update(), DisplayTransition_UpdateFromCentre(), Game_ResetForNewGame(), Graphics_InstallBg1VCountHandler(), KolimaForestBend_FlipFloodgateSwitch(), Menu_RunCommandRow(), Runtime_RemoveIrqHandlerSlot2(), Runtime_SetIrqHandler(), SaveState_ReleaseWorkspace(), SerialRuntime_Initialize(), SerialRuntime_RemoveIrqHandlers(), System_GetLanguage(), System_Initialize(), and TretTreeBranch_StartBg3Split().
| void WaitFrames | ( | s32 | frames | ) |
The game's frame loop: runs frames frames and returns.
Each frame runs the scheduled main-loop tasks, builds the OAM list, measures CPU load for the debug display, counts idle time for sleep, steps the debug pause, waits for VBlank and then reads the keys. Holding L and R for three seconds, or three idle minutes with idle sleep on, puts the system into Stop until L and R are pressed again. A soft reset requested by the keypad interrupt happens here. Called everywhere the game waits: every scene, menu and battle step that lets time pass goes through it.
Code may call WaitFrames deep inside its own call chains, so a caller whose stack has grown below the frame-wait stack top has its stack copied aside into gSavedStack first, and the loop runs at that top; the copy is put back on return. Each frame it allocates and releases the frame scratch heap slot, sets gFrameRenderPending, and counts up gFrameCount and gPlayTimeFrames.
Definition at line 97 of file frame.c.
Referenced by Actor_JumpDownLedge(), Actor_WaitForAnimationEnd(), AudioCommand_WaitForCompletion(), AudioCommand_WaitForStateByteClear(), AudioTest_RunParameterController(), Battle_CollectPartyCommands(), Battle_RunEncounter(), Battle_SelectAbility(), Battle_ShowPairedUnitWorkAndWait(), BattleActor_SpawnObjectsForList(), BattleCommand_BuildPlan(), BattleEffect_CleanupSceneObjects(), BattleEffect_RunFallbackObjectTransition(), BattleEffect_SpawnBurstParticleField(), BattleEscape_PlayRun(), BattleEventRuntime_WaitForReady(), BattleFx_BeginCanvasLayer(), BattleFx_ClearActiveSlotsAndScheduleUpdates(), BattleFx_ConfigureEffectDisplay(), BattleFx_EndCanvasLayer(), BattleFx_HideBg1AndRestoreBackdrop(), BattleFx_OpenCanvasLayer(), BattleFx_PlayCueAndStartEmitterOnTarget(), BattleFx_PlayUnitElementEffect(), BattleFx_RunAnnihilation(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBoreas(), BattleFx_RunBurstScene(), BattleFx_RunDeathPlunge(), BattleFx_RunFlashingStrike(), BattleFx_RunJudgment(), BattleFx_RunKirin(), BattleFx_RunMercuryDjinnCapture(), BattleFx_RunNeptune(), BattleFx_RunNereid(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunRamses(), BattleFx_RunRingAndSparkScene(), BattleFx_RunShatteringOpening(), BattleFx_RunSparkApproachVariant3(), BattleFx_RunSpiderWeb(), BattleFx_RunThrash(), BattleFx_RunTorch(), BattleFx_RunVenusDjinnCapture(), BattleFx_RunVisibilityTransition(), BattleFx_RunWhirlwind(), BattleFx_SetupBlendedDisplay(), BattleFx_SetupCanvasTileMap(), BattleFx_SpawnItemBreakMode1(), BattleFx_SpawnItemBreakMode3(), BattleFx_StartEffectObject22(), BattleFx_StartRandomParticleEmitter(), BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), BattleMenu_RunActionSelection(), BattleMotion_FlashHit(), BattleMotion_SetMode5AndActivateSlot(), BattleMotion_ShowDowned(), BattleMotion_SpawnSlotEffectAndWait(), BattlePres_RunAction(), BattlePres_RunActorEntries(), BattlePres_RunApproachAction(), BattlePres_RunAttack(), BattlePres_RunEntryTransition(), BattlePres_RunEscape(), BattlePres_RunItem(), BattlePres_RunMosaicFadeOut(), BattlePres_RunPlainAttack(), BattlePres_RunUnitAction(), BattlePres_SetActorModes(), BattlePres_SyncTurn(), BattlePres_WaitSync(), BattlePresentation_AppendLinkedActions(), BattlePresentation_DispatchAction(), BattlePresentation_RunPairedUnitTransition(), BattlePresentation_RunUnitTransition(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), Camera_FollowActor(), Camera_MoveWithinMapBounds(), CharacterMenu_DrawStatusAilments(), CharacterMenu_SelectCommand(), CharacterMenu_SelectOwner(), CharacterSelector_RunRearrange(), Debug_RunPaletteEditor(), Debug_SelectAbilityPair(), DebugBattle_RunMenu(), DebugBattle_ViewMessages(), DebugMenu_BrowseEntryGlyphs(), DebugMenu_BrowseIcons(), DisplayScroll_RunSlideshow(), DisplayTransition_Finish(), DisplayTransition_InitializeState(), DisplayTransition_Start(), Djinn_ResolvePendingEvent(), Djinn_RunBattleStartHop(), Djinn_RunJupiterJoinEffect(), Djinn_RunMarsJoinEffect(), Djinn_ShowJoinedMessage(), DjinnMenu_Run(), DjinnMenu_RunScreen(), DjinnMenu_SelectDjinn(), DjinnMenu_ShowCurrentList(), DjinnMenu_ShowHelp(), DjinnMenu_ShowOwnerStatus(), EffectRuntime_RunRisingObjectSequence(), EffectRuntime_StopCurrentObject(), Event_AskYesNoWithActorAnimation(), Event_RunObjectHookAndWait(), Event_ShowMessageAtPosition(), Event_ShowSpeakerMessage(), Event_WaitForZoomTransition(), Event_WaitTransitionFrames(), FacingObject_TurnPairToFaceEachOther(), Fade_Wait(), Field_ClimbUp(), Field_RunScene(), Field_SearchTile(), Field_StartEncounterTransition(), Field_TryJumpForward(), FieldEvent_ShowMessageAndWait(), FieldEvent_WaitFrames(), FieldFx_EndCloak(), FieldFx_RunAvoid(), FieldFx_RunCatch(), FieldFx_RunDouse(), FieldFx_RunForce(), FieldFx_RunFrost(), FieldFx_RunGrowth(), FieldFx_RunGrowthOnTarget(), FieldFx_RunLiftOnTarget(), FieldFx_RunMove(), FieldFx_RunPly(), FieldFx_RunRetreat(), FieldFx_RunReveal(), FieldFx_RunWhirlwind(), FieldFx_StartCloak(), FieldObject_WaitForMove(), Graphics_ConvertBackgroundToBlueRamp(), Graphics_FadeAlphaIn(), Graphics_FadeAlphaOut(), Inn_PlaySleep(), InventoryMenu_ShowModalMessage(), ItemDisplay_RaiseAboveLeader(), ItemList_SelectEntry(), ItemMenu_ChooseCommand(), ItemMenu_Close(), ItemMenu_ConfirmDrop(), ItemMenu_ConfirmEquip(), ItemMenu_DrawCategory(), ItemMenu_DrawEquipPage(), ItemMenu_DrawItemDetailPage(), ItemMenu_DrawOwnerStatus(), ItemMenu_Run(), ItemMenu_RunCommands(), ItemMenu_RunList(), ItemMenu_RunOwnerSelection(), ItemMenu_SelectGiveQuantity(), ItemMenu_SelectItem(), ItemMenu_SelectMember(), ItemMenu_SelectTarget(), LinkBattle_ReceiveParty(), LinkBattle_SendParty(), LuckyDice_Run(), Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), Map_PlayMetatileCopySequence(), Map_RenderAllAnimatedTileFrames(), Map_RenderAnimatedTileFramesForObject(), Map_ShowWorldMap(), Map_WaitForShakeToSettle(), Marker_LaunchMimic(), Menu_ConfirmSelection(), Menu_DrawOwnerStatusPanel(), Menu_EndResourceSelection(), Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_OpenBackdropScreen(), Menu_OpenCharacterSelector(), Menu_ReleaseSelectionWorkspace(), Menu_ResolveSelectedAction(), Menu_RunCommandRow(), Menu_RunResourceSelectionLoop(), Menu_RunSelection(), Menu_RunSelectionWithCursorObject(), Menu_RunTopSelection(), Menu_RunWorkspaceOptions(), Menu_RunWorkspaceSelectionLoop(), Menu_ScrollSelectionList(), Menu_SelectionLoop(), Menu_SelectQuantity(), Menu_SelectResource(), Menu_SelectResourceLayout(), Menu_StepLeft(), Menu_StepRight(), Menu_WaitForSelectionInput(), NameEntry_EditOwnerName(), ObjectDispatch_WaitForValue16(), ObjectEffect_EndContextEffect(), ObjectEffect_PrepareContextEffect(), ObjectEffect_RunPendingFlagEvent(), ObjectMotion_WaitForAnimationChange(), ObjectSystem_SuspendProjectionAndShowSprites(), OwnerAction_RunCompareLoop(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), PartyTalkMenu_Choose(), PsynergyMenu_DrawDetailPage(), PsynergyMenu_DrawRangePage(), PsynergyMenu_Run(), PsynergyMenu_RunList(), PsynergyMenu_SelectAction(), PsynergyMenu_SelectMember(), PsynergyMenu_SelectOwner(), PsynergyMenu_SelectPartySlot(), PsynergyMenu_SelectTarget(), ReelGame_Run(), ResetSceneTransitionEffect(), Resource_ResetOwnerEntries(), Runtime_AdjustDebugValueWithButtons(), Runtime_IdleForever(), Sanctum_RunPartyService(), Save_WriteSelectedSlot(), SaveMenu_SelectSlot(), SaveState_ConfirmAndProcessSelectedSlot(), SaveState_DeleteSelectedSlot(), SaveState_InitializeWorkspace(), SelectionScreen_CreateEmpty(), SerialRuntime_WaitForStatusMask(), SerialRuntime_WaitForTransfers(), SerialTest_Run(), SetMarkerAnimationAndPlaySound(), Shop_BuySpecialItem(), Shop_ConfirmEquip(), Shop_DrawMsg(), Shop_PickUnit(), Shop_PickUnitItem(), Shop_RepairItem(), Shop_Run(), Shop_RunPartyMemberIconBurst(), Shop_SelectBuy(), Shop_SelectQuantity(), Shop_SelectRepair(), Shop_SelectSell(), Shop_SelectSellNum(), Shop_SelectUse(), StatusMenu_Run(), SummonMenu_SelectSummon(), System_GetLanguage(), System_Initialize(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), Ui_RunIconMonitor(), Ui_RunOwnerStatusScreen(), UiMenu_SlideCursor(), UiMessage_ShowAndRestoreState(), UiMessage_ShowAndWait(), UiMessage_ShowResolvedAndRestoreState(), UiMessage_ShowResolvedAndWait(), UiText_OpenMessageAtObject(), UiText_ShowCenteredMessage(), UiText_ShowLocalizedMessageAndWait(), UiText_ShowMessageAndWaitComplete(), UiText_ShowMessageAndWaitCore(), UiText_ShowPositionedMessageAndWait(), UiWindow_Create(), UiWindow_OpenMode1AndWaitFrame(), UiWindow_WaitZoom(), UiWork_DrainPending(), UiWork_FinalizePendingCore(), UpdateRisingParticleBurst(), WaitFrames(), and WorldMap_BeginStillView().
| void Input_ResetKeyRepeat | ( | void | ) |
Restarts the key repeat delay, so held keys wait the full delay again.
Definition at line 289 of file frame.c.
Referenced by Battle_SelectAbility(), BattleMenu_RunActionSelection(), DjinnMenu_ShowOwnerStatus(), Input_ResetKeyRepeat(), ItemList_SelectEntry(), Menu_HandlePageInput(), OwnerAction_RunCompareLoop(), SummonMenu_SelectSummon(), and System_GetLanguage().
| void Input_UpdateKeyRepeatAndDirection | ( | void | ) |
Runs once a frame after VBlank, called by WaitFrames.
When the repeat timer has run out, the held keys repeat into gKeysRepeat. gKeysRepeatDirected is the same keys with at most one D-pad direction: of several held directions it keeps the one added last (gKeysDirection remembers it), and with all four it keeps none. Last, the keys newly held since the previous frame go to gKeysPressed, and gKeysHeldLast takes gKeysHeld.
Definition at line 297 of file frame.c.
Referenced by Input_UpdateKeyRepeatAndDirection(), System_GetLanguage(), and WaitFrames().
| void System_VBlankHandler | ( | void | ) |
The VBlank interrupt handler, installed by System_Initialize.
It trades the link cable payloads, steps the music fades and the screen fade, and when the frame loop has finished a frame copies its OAM list and BG scroll registers, flushes the queued register writes and clears gFrameRenderPending. Then it runs and clears the one-shot gVBlankHook, runs the VBlank tasks, reads the keypad into gKeysHeld and gKeysPressed, sets gVBlankDone and finally mixes the next sound buffer.
Definition at line 374 of file frame.c.
Referenced by System_GetLanguage(), System_Initialize(), and System_VBlankHandler().
Copies the mixer code for sound preset preset (0 to 4; anything else is 0) from ROM into IwramSoundPresetCode.
Called by the battle and the link lobby for their music, and by the audio test. Always returns 0.
Definition at line 439 of file frame.c.
Referenced by AudioCommand_Play(), AudioTest_RunParameterController(), Battle_RunEncounter(), LinkLobby_LeaveArena(), LinkLobby_RunRoundResult(), Sound_LoadPresetParameters(), and System_GetLanguage().
| void Sound_ReservedNoOpA | ( | void | ) |
Nothing calls it.
Definition at line 452 of file frame.c.
Referenced by Sound_ReservedNoOpA(), and System_GetLanguage().
| void Sound_ReservedNoOpB | ( | void | ) |
Nothing calls it.
Definition at line 455 of file frame.c.
Referenced by Sound_ReservedNoOpB(), and System_GetLanguage().
| void Input_HandleKeyInterrupt | ( | void | ) |
The keypad interrupt, from the handler table: A+B+Select+Start was pressed, so it sets gResetRequested for the frame loop and disarms the interrupt.
During sleep the same interrupt only wakes the CPU.
Definition at line 460 of file frame.c.
Referenced by Input_HandleKeyInterrupt(), and System_GetLanguage().
| void Fade_ToBlack | ( | s32 | frames | ) |
Fades out to black.
Definition at line 76 of file fade.c.
Referenced by Battle_RunEncounter(), BattlePres_RunMosaicFadeOut(), DisplayTransition_Finish(), DisplayTransition_Start(), Fade_ToBlack(), System_GetLanguage(), Title_LoadBackground(), Title_Run(), Title_ShowAnimatedSplash(), and Title_ShowSplashScreen().
| void Fade_FromBlack | ( | s32 | frames | ) |
Fades in from black.
Definition at line 79 of file fade.c.
Referenced by DisplayTransition_Finish(), DisplayTransition_Start(), Fade_FromBlack(), Map_InitializePerspectiveScene(), Map_LoadLayeredScene(), System_GetLanguage(), Title_ShowSplashScreen(), and Ui_RunIconMonitor().
| void Fade_ToWhite | ( | s32 | frames | ) |
Fades out to white.
Definition at line 82 of file fade.c.
Referenced by Fade_ToWhite(), System_GetLanguage(), and Title_ShowIntro().
| void Fade_FromWhite | ( | s32 | frames | ) |
Fades in from white.
Definition at line 85 of file fade.c.
Referenced by Fade_FromWhite(), System_GetLanguage(), Title_ShowAnimatedSplash(), and Title_ShowIntro().
| s32 Resource_DecodeType01 | ( | const void * | source, |
| void * | destination ) |
Decodes a type-01 resource and returns its unpacked byte count.
Definition at line 31 of file decompress.c.
Referenced by BattleFx_InitializeStarField(), BattleFx_RunAstralBlast(), BattleFx_RunBind(), BattleFx_RunCondemn(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinniEntrance(), BattleFx_RunFroth(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunLobbedShells(), BattleFx_RunMirroredWall(), BattleFx_RunNereid(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunPlanetDiver(), BattleFx_RunProcne(), BattleFx_RunShiningStar(), BattleFx_RunTriangleStrike(), BattleFx_RunWhirlwind(), FieldResource_DecodeType01(), LuckyDice_Run(), Map_InitializePerspectiveScene(), Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), Map_LoadLayeredScene(), Map_ShowWorldMap(), ReelGame_Run(), Resource_LoadAndDecompress(), Resource_LoadCode(), ResourceSlot_Load(), Sprite_ComposeAnimationFrame(), System_GetLanguage(), Title_ShowAnimatedSplash(), Title_ShowSplashScreen(), UiWindow_CopyTilemapRegion(), and WorldMap_LoadGraphics().
| s32 Resource_DecodeType2 | ( | const void * | source, |
| void * | destination ) |
Decodes a type-02 resource and returns its unpacked byte count.
Definition at line 34 of file decompress.c.
Referenced by Map_LoadLayeredScene(), Resource_DecodeType01(), and System_GetLanguage().
| s32 Resource_DecodeByteLz | ( | const void * | source, |
| void * | destination ) |
Decodes a byte-oriented LZ resource and returns its unpacked byte count.
Definition at line 37 of file decompress.c.
Referenced by FieldEffect_InitSparkles(), FieldFx_StartGroundParticles(), FieldMotes_Start(), Map_LoadAreaGraphics(), Map_WriteLayerCellTile(), Menu_LoadResourceSlot(), RenderResource_LoadFrame(), RenderResource_LoadPair(), Resource_DecodeType2(), Resource_LoadIndexedIntoBuffer(), SelectionScreen_LoadLargeIcon(), SolSanctumStatue_InitializeScrollingSprites(), System_GetLanguage(), Title_LoadIntroBackgrounds(), Title_ShowIntro(), UiText_LoadRemappedGlyph(), and WorldMap_LoadGraphics().
| void SerialRuntime_WaitForSend | ( | void | ) |
Definition at line 504 of file serial.c.
Referenced by LinkBattle_SendParty(), SerialRuntime_WaitForSend(), and System_GetLanguage().
| void SerialRuntime_WaitForReceive | ( | void | ) |
Definition at line 505 of file serial.c.
Referenced by LinkBattle_ReceiveParty(), SerialRuntime_WaitForReceive(), and System_GetLanguage().
| void IoWriteQueue_FlushPending | ( | void | ) |
Runs the queued register writes and empties the queue, with a copy of the executor routine on the stack.
Called by System_VBlankHandler once the frame loop has finished a frame.
Definition at line 40 of file io_queue.c.
Referenced by IoWriteQueue_FlushPending(), System_GetLanguage(), and System_VBlankHandler().
| void Fade_Update | ( | void | ) |
Steps the screen fade once a frame, called by System_VBlankHandler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts gBlendFramesLeft down; at the end it clears gBlendDuration.
Definition at line 20 of file fade.c.
Referenced by Fade_Update(), System_GetLanguage(), and System_VBlankHandler().
Starts a fade of any layers by setting the gBlend globals Fade_Update steps.
Reached through the far-call table. bright : 0 toward black, 1 toward white layer : the BLDCNT layers to fade (low six bits) start : the starting brightness; above 16, the current target target : the brightness to end at frames : how long the fade takes
Definition at line 94 of file fade.c.
Referenced by Fade_Start(), and System_GetLanguage().
| void Fade_Wait | ( | void | ) |
Waits a frame at a time until the running fade has finished.
Called by the title screen and the battle, and through the far-call table.
Definition at line 108 of file fade.c.
Referenced by Battle_RunEncounter(), Fade_Wait(), System_GetLanguage(), Title_Run(), Title_ShowAnimatedSplash(), Title_ShowIntro(), and Title_ShowSplashScreen().
| void Render_ResetFrame | ( | void | ) |
Starts a new frame of sprites: frees the affine matrices and empties the 256 depth slots sprites are linked into.
Called by WaitFrames after each VBlank.
Definition at line 12 of file render.c.
Referenced by Render_ResetFrame(), System_GetLanguage(), and WaitFrames().
| 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 in.
Called by the field sprites and the windows' scaled sprites. Returns the matrix number, 0 to 31. When all 32 are taken it fills nothing and still returns 0, which a caller cannot tell from matrix 0: the sprite is drawn with whatever matrix 0 holds.
Definition at line 27 of file render.c.
Referenced by AffineEffect_UpdateFrame(), AffineMatrix_BuildForEffect(), BattleTarget_RunSelection(), Colosso_UpdateLettering(), Menu_RunCommandRow(), Render_ApplyProjectedPlacement(), Render_PlaceProjectedSprite(), RenderOutput_UpdateScaleAnimation(), SelectionScreen_Draw(), System_GetLanguage(), Ui_ApplyTableScaleToObject(), and UiWork_AnimateSpriteSlots().
| void Runtime_PushSlotEntry | ( | void * | slotEntry, |
| s32 | slot ) |
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
The entry's first word becomes its link to the next entry. Called by everything that draws a sprite, before WaitFrames builds the OAM list.
Definition at line 79 of file render.c.
Referenced by AffineEffect_UpdateFrame(), Battle_SelectAbility(), BattleEvent_Playback(), BattleMenu_RunActionSelection(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), Colosso_DrawGauge(), Colosso_UpdateLettering(), Colosso_UpdateMarker(), Curtain_Close(), Djinn_ShowJoinedMessage(), FadeOverlay_DrawMarks(), FieldEffect_UpdateSparkles(), FieldFx_UpdateGroundParticles(), FieldMotes_Update(), HeatGauge_Draw(), ItemList_SelectEntry(), Map_UpdateWorldMapMarkers(), Menu_RunCommandRow(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), Render_ApplyProjectedPlacement(), Render_PlaceProjectedSprite(), Runtime_PushSlotEntry(), SelectionScreen_Draw(), SelectionScreen_DrawArrow(), SolSanctumStatue_UpdateScrollingSprites(), SummonMenu_SelectSummon(), System_GetLanguage(), Title_ShowIntro(), Title_UpdateSpriteReveal(), Ui_RunOwnerStatusScreen(), UiTextResource_SetPosition(), UiWork_AnimateSpriteSlots(), and UpdateLinkSessionCountdown().
| void Render_BuildOamList | ( | void * | work | ) |
Builds this frame's OAM list in work from the sprites linked into the depth slots, with a RAM copy of the ARM builder.
Called by WaitFrames into the frame scratch heap slot.
Definition at line 96 of file render.c.
Referenced by Render_BuildOamList(), System_GetLanguage(), and WaitFrames().
Finds the first run of free blocks that holds size bytes and gives it to entry id, writing id into gResourceBlockOwners for each block.
Called by VramCache_Load. Returns its byte offset in sprite VRAM, or -1 when no run is long enough.
Definition at line 16 of file vram_cache.c.
Referenced by System_GetLanguage(), VramCache_AllocateBlocks(), and VramCache_Load().
| s32 VramCache_GetLongestFreeRun | ( | void | ) |
Returns the length, in blocks, of the longest run of free blocks.
Nothing in ☀️ calls it.
Definition at line 57 of file vram_cache.c.
Referenced by System_GetLanguage(), and VramCache_GetLongestFreeRun().
Frees every block entry id owns in gResourceBlockOwners.
Called by Resource_ResetEntry and VramCache_ReleaseVram. Returns -1 when it freed any (or id is out of range) and 0 when the entry owned none.
Definition at line 79 of file vram_cache.c.
Referenced by Resource_ResetEntry(), System_GetLanguage(), VramCache_FreeBlocks(), and VramCache_ReleaseVram().
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
Called throughout the game when a sprite's picture is no longer shown.
Definition at line 106 of file vram_cache.c.
Referenced by Battle_CollectPartyCommands(), Battle_RunEncounter(), Battle_SelectAbility(), BattleEffect_CleanupSceneObjects(), BattleFx_CleanupResourcesAndWindow(), BattleFx_RunMercuryDjinnCapture(), BattleFx_SpawnDescendingArcParticles(), BattleFx_SpawnScaledArcObjects(), BattleMenu_RunActionSelection(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), Colosso_HidePointer(), Colosso_UpdateLettering(), Djinn_ShowJoinedMessage(), DjinnMenu_ShowHelp(), Event_SpawnObjectTable(), FieldFx_RunAvoid(), FieldFx_RunForce(), FieldFx_RunPly(), ItemList_SelectEntry(), KolimaForestTree_UpdateOrbitSpark(), Menu_ConfirmSelection(), Menu_EndResourceSelection(), Menu_ReleaseSelectionWorkspace(), Menu_ResetTwoResourceEntries(), Menu_RunCommandRow(), Menu_ScrollSelectionList(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), PartyTalkMenu_Choose(), RenderOutput_Create(), RenderOutput_Release(), Resource_ResetEntry(), Resource_ResetOwnerEntries(), Resource_ResetPendingTransfer(), ResourceObject_Release(), Shop_ReleaseCursorWork(), SolSanctumEruption_SpawnEffectPair(), Sprite_ShareVramCache(), SummonMenu_SelectSummon(), System_GetLanguage(), TretTreeInteriors_UpdateSwirlSpark(), Ui_RunOwnerStatusScreen(), UiTextResource_Release(), UiWork_StepChannelScript(), ValeBabi_SpawnEffectPair(), ValeHome_SpawnEffectPair(), ValeStorm_SpawnEffectPair(), VenusLighthouseAerie_SpawnLinkedPairEffects(), VramCache_Load(), and WorldMap_CreateLinkedEffects().
Gives back entry no's blocks but keeps the entry taken, with size 1, so a later VramCache_Load can refill it.
Called by the field sprites and cameras.
Definition at line 122 of file vram_cache.c.
Referenced by Colosso_DrawGauge(), HeatGauge_Draw(), ObjectSystem_UpdateCamera(), Render_PlaceProjectedSprite(), System_GetLanguage(), and VramCache_ReleaseVram().
Gives cache entry no size bytes of sprite VRAM and copies src there.
An entry that already holds VRAM of the same size keeps it. A null src copies nothing and (void *)-1 clears the memory. Writes the entry's offset and size into gVramBlockCache. Called throughout the game to load sprite pictures. Returns the first sprite tile number (32-byte units), or 0 when there was no room.
Definition at line 143 of file vram_cache.c.
Referenced by BattleFx_LoadActionEffectResources(), BattleFx_SetupResourcesAndWindow(), BattleFx_StartEffectObject22(), BattleFx_StartFadeOverlay(), BattleFx_StartRandomParticleEmitter(), Debug_SelectAbilityPair(), FieldEffect_InitSparkles(), FieldFx_RunAvoid(), FieldFx_StartGroundParticles(), FieldMotes_Start(), ItemMenu_SelectGiveQuantity(), Menu_LoadResourceSlot(), NameEntry_EditOwnerName(), ObjectSystem_Configure(), OptionMenu_AnimateCursors(), OptionMenu_Open(), PartyTalkMenu_Choose(), RenderResource_LoadFrame(), RenderResource_LoadPair(), RenderResource_LoadTableEntry(), Resource_CopyFixedBlockA(), Resource_CopyFixedBlockB(), Resource_LoadFixedBlockBIntoFreeSlot(), Resource_LoadPairedBlocks(), Resource_LoadPairedBlocksIfAvailable(), ResourceObject_Create(), SaveMenu_SelectSlot(), SelectionScreen_Draw(), SelectionScreen_DrawArrow(), SelectionScreen_LoadLargeIcon(), SelectionScreen_SetupArrow(), Shop_CreatePriceSprite(), Shop_InitializeCursorWork(), Shop_SelectQuantity(), System_GetLanguage(), SystemMenu_Open(), Title_ShowIntro(), Ui_BuildPairedPatternsToSlot(), Ui_BuildPatternToSlot(), UiGlyph_LoadEntryWithPalette(), UiGlyph_ResetWorkState(), UiIcon_BuildAbilityIconTiles(), UiIcon_BuildItemIconTiles(), UiIcon_CopyResourceToSlot(), UiIcon_CreateWithResource(), UiIcon_CreateWithResourceVariant(), UiTextResource_Initialize(), UiWork_AnimateSpriteSlots(), UiWork_InitCountersAndScheduleRefresh(), UiWork_InitCountersWithResourceAndScheduleRefresh(), VramCache_AllocEntry(), VramCache_Load(), and VramCache_Reload().
| void VramCache_Reset | ( | void | ) |
Frees every block and every cache entry.
Called by System_Initialize, Game_ResetForNewGame and the debug modes that start over.
Definition at line 184 of file vram_cache.c.
Referenced by DebugBattle_RunMenu(), Game_ResetForNewGame(), System_GetLanguage(), System_Initialize(), Title_ShowIntro(), Ui_RunIconMonitor(), and VramCache_Reset().
| s32 Resource_FindFreeEntry | ( | void | ) |
Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken.
Called before VramCache_Load by code that keeps the entry number.
Definition at line 211 of file vram_cache.c.
Referenced by BattleFx_LoadActionEffectResources(), BattleFx_SetupResourcesAndWindow(), Colosso_LoadLettering(), Colosso_StartRaceGauge(), Curtain_Start(), Debug_SelectAbilityPair(), DebugMenu_BrowseIcons(), FieldEffect_InitSparkles(), FieldFx_RunAvoid(), FieldFx_StartGroundParticles(), FieldMotes_Start(), FieldScene_BuildDescriptorAndInstallTask(), HeatGauge_Start(), ItemMenu_SelectGiveQuantity(), Menu_AppendResourceEntry(), NameEntry_EditOwnerName(), OptionMenu_Open(), PartyTalkMenu_Choose(), RenderOutput_CreateFromTable(), RenderOutput_CreateLoaded(), RenderOutput_CreateWithTransform(), RenderResource_CreateFrame(), RenderResource_CreatePair(), Resource_FindFreeEntry(), Resource_LoadByMode(), Resource_LoadByModeIntoSlot(), Resource_LoadFixedBlockBIntoFreeSlot(), Resource_LoadPairedBlocks(), Resource_LoadPairedBlocksIfAvailable(), ResourceObject_Create(), SaveMenu_SelectSlot(), SelectionScreen_LoadLargeIcon(), SelectionScreen_SetupArrow(), Shop_CreatePriceSprite(), Shop_InitializeCursorWork(), Shop_SelectQuantity(), SolSanctumStatue_InitializeScrollingSprites(), System_GetLanguage(), SystemMenu_Open(), Title_LoadSprites(), Title_ShowIntro(), Ui_BuildPairedPatternsToSlot(), Ui_CreateOutputFromResourceSlot(), UiGlyph_LoadEntryWithPalette(), UiGlyph_ResetWorkState(), UiIcon_BuildAbilityIconTiles(), UiIcon_BuildItemIconTiles(), UiIcon_CreateWithLoadedResource(), UiIcon_CreateWithResource(), UiIcon_CreateWithResourceVariant(), UiText_DrawGlyph(), UiTextResource_Initialize(), UiWindow_PutGlyph(), and VramCache_AllocEntry().
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
Called by the battle prompts and the menus' command rows.
Definition at line 227 of file vram_cache.c.
Referenced by Battle_CollectPartyCommands(), Battle_RunEncounter(), Battle_SelectAbility(), BattleMenu_RunActionSelection(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), DjinnMenu_ShowChangePreview(), ItemList_SelectEntry(), Menu_RunCommandRow(), SummonMenu_SelectSummon(), System_GetLanguage(), Ui_RunOwnerStatusScreen(), and VramCache_AllocEntry().
Copies src again into entry no's VRAM, keeping its size.
Called by code that redraws a sprite picture in place, such as the battle prompts. Returns the first sprite tile number.
Definition at line 238 of file vram_cache.c.
Referenced by Battle_SelectAbility(), BattleEvent_Playback(), BattleMenu_RunActionSelection(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), DjinnMenu_ShowChangePreview(), ItemIcon_LoadIntoSlot(), ItemList_SelectEntry(), Resource_LoadIndexedEntryToBuffer(), Resource_LoadIndexedIntoBuffer(), Resource_LoadTableEntryToBuffer(), SummonMenu_SelectSummon(), System_GetLanguage(), Ui_RunOwnerStatusScreen(), UiIcon_LoadResourceIntoSlot(), and VramCache_Reload().
| void Scheduler_ResetTaskTable | ( | void | ) |
Empties the task table: every slot gets no routine, order 0xffff (sorted last) and no flags.
Clears gSchedulerReady while it works and sets it at the end, so neither pass runs a half-cleared table. Called by System_Initialize and by the battle, Lucky Dice and other modes that start from a clean table.
Definition at line 19 of file scheduler.c.
Referenced by Battle_RunEncounter(), DebugBattle_RunMenu(), DisplayScroll_RunSlideshow(), Field_RunScene(), Game_ResetForNewGame(), LuckyDice_Run(), ReelGame_Run(), Scheduler_ResetTaskTable(), System_GetLanguage(), System_Initialize(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), and Ui_RunIconMonitor().
Copies byteCount bytes a word at a time. Nothing in ☀️ calls it.
Definition at line 37 of file scheduler.c.
Referenced by Scheduler_CopyWords(), and System_GetLanguage().
| void Scheduler_SortTasks | ( | void | ) |
Bubble-sorts the task table by order, highest first, so each pass runs its tasks from the highest order down; removed tasks (order 0x7fff) rise to the front.
Called by Scheduler_AddOrUpdateCallback with interrupts disabled.
Definition at line 47 of file scheduler.c.
Referenced by Scheduler_AddOrUpdateCallback(), Scheduler_SortTasks(), and System_GetLanguage().
| s32 Scheduler_FindCallback | ( | SchedulerCallback | callback | ) |
Returns the table index of the task running callback, or -1.
Nothing in ☀️ calls it.
Definition at line 77 of file scheduler.c.
Referenced by Scheduler_FindCallback(), and System_GetLanguage().
| 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 table.
Writes the task's routine, order and flags (cleared for a new task) with interrupts disabled. Returns the task's index, or -1 when all 20 slots are taken. Called throughout the game to start per-frame and VBlank work; order is SCHEDULER_KEY_MAIN_LOOP or SCHEDULER_KEY_VBLANK's high byte with a priority in the low byte.
Definition at line 102 of file scheduler.c.
Referenced by AffineEffect_InitializeWork(), Battle_CollectPartyCommands(), Battle_RunEncounter(), BattleBackground_Load(), BattleEffect_InitializeBuffers(), BattleEventRuntime_SchedulePhase(), BattleFx_BeginCanvasLayer(), BattleFx_InitializeSlots(), BattleFx_InitializeStarField(), BattleFx_LoadActionEffectResources(), BattleFx_OpenCanvasLayer(), BattleFx_RunAnnihilation(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBoreas(), BattleFx_RunBurstShower(), BattleFx_RunCastingImpact(), BattleFx_RunCondemn(), BattleFx_RunCurse(), BattleFx_RunDeathPlunge(), BattleFx_RunDouse(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFroth(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunIce(), BattleFx_RunJudgment(), BattleFx_RunKirin(), BattleFx_RunNeptune(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunParticleStreams(), BattleFx_RunProjectileVolley(), BattleFx_RunRamses(), BattleFx_RunRingAndSparkScene(), BattleFx_RunShiningStar(), BattleFx_RunStatBoost(), BattleFx_RunTargetMotes(), BattleFx_RunThor(), BattleFx_RunThorn(), BattleFx_RunTorch(), BattleFx_ScheduleRatioTransition(), BattleFx_StartBufferBlend(), BattleFx_StartElementStreaks(), BattleFx_StartFadeOverlay(), BattleFx_SteerLiftedTarget(), BattlePres_RunAttack(), BattlePres_RunEntryTransition(), BattlePres_RunItem(), BattlePres_RunPsynergyCast(), BattlePres_SetActorModes(), BattlePresentation_ConfigurePaletteFade(), BattlePresentation_RunUnitTransition(), CharacterMenu_SelectCommand(), DebugMenu_ScheduleSceneSelector(), DisplayBlend_StartScript(), DisplayScroll_InitObjectTable(), DisplayScroll_RunSlideshow(), DisplayTransition_Finish(), DisplayTransition_InitializeBattleEffectState(), DisplayTransition_InitializeState(), DisplayTransition_Start(), DjinnMenu_ShowHelp(), DjinnMenu_ShowOwnerStatus(), FieldEffect_InitSparkles(), FieldEvent_Begin(), FieldFx_ResumeCloakCheck(), FieldFx_RunAvoid(), FieldFx_RunReveal(), FieldFx_StartCloak(), FieldFx_StartGroundParticles(), FieldFx_StartLightning(), FieldMotes_Start(), FieldScheduler_AddCallback(), FourObjectMotion_InitializeBottomRow(), FourObjectMotion_InitializeTopRow(), ItemMenu_ChooseCommand(), ItemMenu_SelectItem(), ItemMenu_SelectTarget(), Map_InitializePerspectiveScene(), Map_LoadLayeredScene(), Map_ShowWorldMap(), MapAnimation_StartChannels(), Menu_CancelSoundReset(), Menu_RunCommandRow(), Menu_SelectQuantity(), Menu_SelectResourceLayout(), ObjectSystem_Initialize(), OptionMenu_InitializeWork(), OwnerAction_RunCompareLoop(), PaletteFade_Init(), PaletteGlow_Start(), PaletteQueue_Start(), PsynergyMenu_InitializeEntryObjects(), PsynergyMenu_SelectAction(), ReelGame_Run(), Resource_ScheduleOwnerResetDelayed(), RunSceneTransitionEffect(), SaveMenu_ShowDjinnSprites(), SaveMenu_ShowPartySprites(), Scheduler_AddOrUpdateCallback(), Shop_InitializeCursorWork(), Shop_RunPartyMemberIconBurst(), System_GetLanguage(), SystemMenu_Initialize(), Title_ShowIntro(), Ui_FillBank15PaletteGrey(), Ui_RunIconMonitor(), UiTimedNotice_Create(), UiWork_InitCountersAndScheduleRefresh(), UiWork_InitCountersWithResourceAndScheduleRefresh(), UiWork_Initialize(), and UiWork_InitializeWithResourceCounters().
| void Scheduler_Idle | ( | void | ) |
An empty routine; nothing in ☀️ calls it.
Definition at line 138 of file scheduler.c.
Referenced by Scheduler_Idle(), and System_GetLanguage().
| void Scheduler_EmptyCallback | ( | void | ) |
An empty routine; nothing in ☀️ calls it.
Definition at line 141 of file scheduler.c.
Referenced by Scheduler_EmptyCallback(), and System_GetLanguage().
| s32 Scheduler_RemoveCallback | ( | SchedulerCallback | callback | ) |
Unschedules the task running callback: clears its routine and gives it order 0x7fff, which no pass matches.
Returns its old index, or -1. Called throughout the game when the work a task did is finished.
Definition at line 146 of file scheduler.c.
Referenced by Battle_CollectPartyCommands(), Battle_RunEncounter(), BattleEffect_CleanupSceneObjects(), BattleEventRuntime_WaitForReady(), BattleFx_ClearActiveSlotsAndScheduleUpdates(), BattleFx_EndCanvasLayer(), BattleFx_EndElementStreaks(), BattleFx_FinishSceneAndReleaseHeapBlock(), BattleFx_RunAnnihilation(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBoreas(), BattleFx_RunBurstScene(), BattleFx_RunCastingImpact(), BattleFx_RunCondemn(), BattleFx_RunCybele(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinniEntrance(), BattleFx_RunDouse(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunFire(), BattleFx_RunFlare(), BattleFx_RunFlashingStrike(), BattleFx_RunFrost(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunIce(), BattleFx_RunImpactBurst(), BattleFx_RunNeptune(), BattleFx_RunNereid(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunRingAndSparkScene(), BattleFx_RunShatteringOpening(), BattleFx_RunSpiderWeb(), BattleFx_RunStatBoost(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunTorch(), BattleFx_RunTriangleStrike(), BattleFx_RunUndeadSword(), BattleFx_RunVolcano(), BattleFx_RunWhirlwind(), BattleFx_SteerLiftedTarget(), BattlePalette_StopBlendAndReleaseBuffer(), BattlePres_RunEntryTransition(), BattlePres_SetActorModes(), CastingImpact_EndPrelude(), CharacterMenu_SelectCommand(), CrossboneIslePlatformRooms_ReleaseSecondBlockPlatform(), DisplayScroll_DisarmHBlankDma(), DisplayTransition_Update(), DisplayTransition_UpdateFrame(), DisplayTransition_UpdateFromCentre(), DisplayTransition_UpdateScanlineTable(), EquipmentMenu_StartCompatibilityIndicators(), Event_ConfrontSaturosAndMenardi(), Event_DemonstrateLevitation(), Event_DemonstratePsynergy(), Event_DiscussSuspiciousGuests(), Event_EnterWaterfallGrotto(), Event_MendingTheRoof(), Event_ReadCorneredSuspectsMinds(), Event_RoofMended(), Event_WatchBoulderFall(), FieldEvent_End(), FieldFx_EndCloak(), FieldFx_RunAvoid(), FieldFx_StepRatioTransition(), Graphics_ResetVramBlockAndReleaseHeapBlocks(), ItemMenu_SelectItem(), Kalay_CatchTownNut(), Kalay_WatchTourGroupDeparture(), Map_ShowWorldMap(), Menu_CancelSoundTick(), Menu_EndResourceSelection(), Menu_EnsureCancelSound(), Menu_ReleaseEntryObjects(), Menu_RunCommandRow(), Menu_SelectQuantity(), Menu_SelectResourceLayout(), OptionMenu_Release(), PaletteFade_Release(), PaletteGlow_Stop(), PaletteQueue_Stop(), PsynergyMenu_SelectAction(), ReelGame_Run(), ResetSceneTransitionEffect(), Resource_ScheduleOwnerReset(), SaveMenu_HideDjinnSprites(), SaveMenu_HidePartySprites(), Scheduler_RemoveCallback(), Shop_ReleaseCursorWork(), Shop_RunPartyMemberIconBurst(), System_GetLanguage(), SystemMenu_Release(), Title_ShowIntro(), Ui_SetBank15PaletteAndClearRenderMode(), UiTimedNotice_CloseIfActive(), UiTimedNotice_Tick(), ValeStorm_GaretLeavesIsaac(), ValeStorm_ShowBoulderSweepingDownriver(), and VenusLighthouseAerie_EruptBeacon().
| s32 Scheduler_SuspendTasks | ( | SchedulerCallback | callback | ) |
Suspends the task running callback, or every task when callback is null, by setting bit 0 of its order's high byte, which then matches neither pass key.
Returns the last index changed, or -1. Called by the map animation and battle code, through the far-call table, to pause tasks Scheduler_ResumeTasks restarts later.
Definition at line 172 of file scheduler.c.
Referenced by Battle_RunEncounter(), DisplayBlend_SuspendScript(), DisplayTransition_SuspendCallbacks(), FadeOverlay_Suspend(), MapAnimation_Suspend(), ObjectSystem_SuspendProjectionAndShowSprites(), Scheduler_SuspendTasks(), System_GetLanguage(), and WorldMap_BeginStillView().
| s32 Scheduler_SuspendOverlayTasks | ( | void | ) |
Suspends every task whose routine is in an overlay (EWRAM, 0x02xxxxxx) unless its flag bit 0 asks to keep it running, as Scheduler_SuspendTasks does.
Called by the menus' common code while a menu is open, and by the world map's visibility transition. Returns the last index changed, or -1.
Definition at line 197 of file scheduler.c.
Referenced by BattleFx_RunVisibilityTransition(), Menu_SuspendFieldTasks(), Scheduler_SuspendOverlayTasks(), and System_GetLanguage().
| 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 are suspended.
Called by the link lobby and Colosso scenes for the tasks that must keep running under a menu. Returns its index, or -1.
Definition at line 220 of file scheduler.c.
Referenced by ColossoWall_Initialize(), LinkLobby_EnterBattle(), LinkLobby_RunRoundResult(), Scheduler_SetTaskFlags(), and System_GetLanguage().
| s32 Scheduler_ResumeTasks | ( | SchedulerCallback | callback | ) |
Resumes the task running callback, or every task when callback is null, by clearing bit 0 of its order's high byte.
Called by the map animation and field object code. Returns the last index changed, or -1.
Definition at line 243 of file scheduler.c.
Referenced by DisplayBlend_ResumeScript(), FadeOverlay_Resume(), Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), MapAnimation_Resume(), ObjectSystem_ResumeProjectionAndHideLayers(), Scheduler_ResumeTasks(), and System_GetLanguage().
| s32 Scheduler_ResumeOverlayTasks | ( | void | ) |
Resumes every task whose routine is in an overlay, flagged or not.
Called by the menus' common code when a menu closes, and by the world map's visibility transition. Returns the last index changed, or -1.
Definition at line 265 of file scheduler.c.
Referenced by BattleFx_RunVisibilityTransition(), Menu_ResumeFieldTasks(), Scheduler_ResumeOverlayTasks(), and System_GetLanguage().
| void Scheduler_RunPass | ( | s32 | key | ) |
Runs one pass of the scheduler: every task whose order's high byte matches key's (SCHEDULER_KEY_MAIN_LOOP or SCHEDULER_KEY_VBLANK), in table order.
Called once a frame by WaitFrames and once a VBlank by System_VBlankHandler. Nothing runs until Scheduler_ResetTaskTable has set gSchedulerReady.
Definition at line 289 of file scheduler.c.
Referenced by Scheduler_RunPass(), System_GetLanguage(), System_VBlankHandler(), and WaitFrames().
| u32 Random16 | ( | void | ) |
Advances the game's random number generator (the C library's classic linear congruential one), stores the new seed and returns 16 bits of it.
Called throughout the game.
Definition at line 10 of file math.c.
Referenced by Battle_CollectPartyCommands(), BattleEffect_ApplyToTargets(), BattleEffect_RunFallbackObjectTransition(), BattleEffect_SetRandomTableValueOnObject(), BattleEffect_SpawnBurstParticleField(), BattleEffect_UpdatePhasedRadialParticle(), BattleEnemy_CalculateCoinReward(), BattleEnemy_CalculateExperienceReward(), BattleEscape_CheckSuccess(), BattleEscape_PlayRun(), BattleFormation_BuildEnemyList(), BattleFormation_SelectLevelMatchedCandidate(), BattleFx_CircleAnchor(), BattleFx_DrawStreaks(), BattleFx_InitializeStarField(), BattleFx_RunAnnihilation(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBladeRain(), BattleFx_RunBolt(), BattleFx_RunBoreas(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunBurstShower(), BattleFx_RunCastingImpact(), BattleFx_RunCurse(), BattleFx_RunCybele(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunDouse(), BattleFx_RunDragonCloud(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFire(), BattleFx_RunFrost(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunGround(), BattleFx_RunGrowingColumns(), BattleFx_RunHail(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunHelmSplitter(), BattleFx_RunIce(), BattleFx_RunImpactBurst(), BattleFx_RunJudgment(), BattleFx_RunJupiter(), BattleFx_RunKirin(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMercury(), BattleFx_RunMoteFountain(), BattleFx_RunNeptune(), BattleFx_RunNereid(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunPrism(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunRagnarok(), BattleFx_RunRamses(), BattleFx_RunRay(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShatteringOpening(), BattleFx_RunShiningStar(), BattleFx_RunSleep(), BattleFx_RunSparkEmitter(), BattleFx_RunSparkGroups(), BattleFx_RunSpire(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunThorn(), BattleFx_RunTitanBlade(), BattleFx_RunUndeadSword(), BattleFx_RunVenus(), BattleFx_RunVenusDjinnCapture(), BattleFx_RunVolcano(), BattleFx_RunWhirlwind(), BattleFx_SpawnFallingParticles(), BattleFx_StartItemBreak(), BattleFx_SteerLiftedTarget(), BattleFx_UpdateDriftingFallObject(), BattleFx_UpdateItemBreakFragment(), BattleFx_UpdateOrbitAndReturn(), BattleFx_UpdateRadialBurst(), BattleFx_UpdateRadialCamera(), BattleFx_UpdateRadialLaunch(), BattleFx_UpdateRadialMotion(), BattleFx_UpdateRadialSpread(), BattleFx_UpdateRandomTargetParticle(), BattleFx_UpdateStarField(), BattleFx_WanderAroundAnchor(), BattleFx_WipeCanvas(), BattleGroupRandom(), BattlePres_BuildOpponentEntries(), BattlePres_RunApproachAction(), BattlePres_RunEscape(), BattlePres_RunMosaicFadeOut(), BattlePresentation_BuildSortedUnitEntries(), BattlePresentation_RunPairedUnitTransition(), BattleTarget_ReplaceDefeated(), BattleTarget_SelectForAction(), BattleTarget_SelectRandomPosition(), Camera_ApplyShake(), DisplayTransition_UpdateScanlineTable(), Djinn_RunJupiterJoinEffect(), Djinn_RunMarsJoinEffect(), EffectSlot_Initialize(), Encounter_SelectEnemyGroup(), Event_SpawnObjectTable(), FieldEffect_UpdateSparkles(), FieldFx_RunDouse(), FieldFx_RunFrost(), FieldFx_RunGrowth(), FieldFx_RunRetreat(), FieldFx_RunWhirlwind(), FieldFx_SpawnBurstParticle(), FieldFx_SpawnRandomAngleTriplet(), FieldFx_UpdateGroundParticles(), FieldFx_UpdateLightning(), FieldMotes_Update(), Graphics_ConvertBackgroundToBlueRamp(), ItemDisplay_EmitSparkles(), ItemMenu_TryBreak(), LuckyDice_Run(), Map_UpdateLayerScroll(), Object_Wander(), Owner_LevelUp(), Random16(), ReelGame_Run(), ReelGame_RunFrame(), RevealMarker_EmitSparkles(), SaveState_SelectWriteSlot(), Scene_TalkToActor(), ScriptObject_WanderNearHome(), Shop_ResetEffects(), Shop_RunPartyMemberIconBurst(), SpawnHeavyImpactEffect(), System_GetLanguage(), UiWork_AnimateSpriteSlots(), UpdateRisingParticleBurst(), and WorldMap_UpdateView().
Moves the point position by radius in direction angle on the ground plane: x by the cosine, z by the sine.
The point is any three s32 coordinates x, y, z in a row (struct FieldPosition, struct EffectVector and others), so it takes a plain pointer. Byte offsets reach each coordinate without treating separate struct members as an array.
Definition at line 23 of file math.c.
Referenced by AltmillerCave_HopSelectedActor(), AltmillerCave_PlaceLight(), AltmillerCave_UpdateWallFragment(), BattleEffect_RunFallbackObjectTransition(), BattleEffect_SpawnBurstParticleField(), BattleEffect_UpdatePhasedRadialParticle(), BattleFx_RunAngledApproachPhases(), BattleFx_RunSparkEmitter(), BattleFx_SetupObjectPair(), BattleFx_SpawnFallingParticles(), BattleFx_StartRandomParticleEmitter(), BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), BattleFx_UpdateDescendingOrbitObject(), BattleFx_UpdateItemBreakFragment(), BattleFx_UpdateOrbitAndReturn(), BattleFx_UpdateRadialBurst(), BattleFx_UpdateRadialCamera(), BattleFx_UpdateRadialLaunch(), BattleFx_UpdateRadialMotion(), BattleFx_UpdateRadialSpread(), BattleFx_UpdateRandomTargetParticle(), BattleFx_UpdateShrinkingOrbitObject(), Colosso_FindActorAhead(), ColossoLogRollingStage_SpawnRandomSceneEffect(), ColossoRiver_SpawnRandomEffect(), ColossoWall_SpawnRandomSceneEffect(), CrossboneIsle_TryHop(), CrossboneIslePillarRooms_TryJumpAcrossPillar(), Effect_ConfigureSpawnedParticle(), Effect_UpdateParticlePosition(), Event_JumpAcrossGap(), Event_JumpToNextPillar(), Event_RollLongLog(), Field_GetCollisionAheadOfLeader(), Field_TryJumpForward(), FieldFx_RunCatch(), FieldFx_RunDouse(), FieldFx_RunForce(), FieldFx_RunFrost(), FieldFx_RunGrowth(), FieldFx_RunWhirlwind(), FieldFx_UpdateSpiralParticle(), FieldObject_UpdatePlayerControl(), FieldVector_AddPolarOffset(), Imil_RunIceSlide(), Imil_SwayAndSpark(), Imil_UpdateCountdownArc(), ItemDisplay_EmitSparkles(), KolimaForestBend_RollLog(), KolimaForestTree_UpdateOrbitSpark(), Map_BuildProbeRing(), Map_UpdateWorldMapMarkers(), Marker_MoveLeaderAway(), MercuryLighthouse_HopAcrossPool(), MercuryLighthouseAerie_JumpToPlatform(), Motion_SetTargetPositionFromMagnitudeAngle(), Object_GetTriggerTileAheadOfCurrent(), Object_MoveByKeys(), Object_MoveOnWorldMap(), Object_Wander(), RevealMarker_EmitSparkles(), SceneEffect_SpawnRandomizedBurst(), ScriptObject_WanderNearHome(), System_GetLanguage(), TretTreeInteriors_UpdateSwirlSpark(), VaultCave_OffsetActorRadially(), Vector_AddPolarOffset(), and WorldMap_UpdateBobbingMarker().
Returns the angle of the vector (x, y), in 1/65536 turns, measured from the y axis: 0 along +y, 0x4000 along +x.
It binary-searches the tangent table to 1/256 of a quarter turn.
Definition at line 36 of file math.c.
Referenced by ArcTan2(), BattleFx_RunProcne(), BattleFx_UpdateItemBreakFragment(), BattleObjMake(), BattlePres_RunAttack(), BattlePres_RunPlainAttack(), BattlePres_RunPsynergyCast(), CrossboneIslePlatformRooms_FaceBaneTowardLeader(), EffectSlot_UpdateMotion(), FacingObject_TurnPairToFaceEachOther(), Field_FindNearbyPsynergyTarget(), Field_FindNearbyTalkTarget(), FieldFx_UpdateMindReadWave(), FieldObject_UpdatePlayerControl(), FuchinTemple_FaceLeader(), Leader_FaceFeizhi(), Map_UpdateWorldMapMarkers(), Marker_MoveLeaderAway(), MercuryLighthouseEntrance_MiaWatchesLeader(), Object_FindNearestFacingTarget(), Object_UpdateAllMotion(), Object_UpdateAllThumb(), ObjectMotion_SetAngleToward(), ObjectMotion_TurnTowardLinkedTarget(), ObjectSystem_UpdateCameraFixed(), ObjMotRst(), Scene_TurnTowardTarget(), Script_StoreAngleToLinkedObject(), ScriptObject_WanderNearHome(), System_GetLanguage(), Tolbi_KidStopForTarget(), Vale_TestFacing(), ValeCave_FaceActorTowardLeader(), Vault_StopIfFacingNear(), VaultInteriors_FaceSuspectsTowardLeader(), VaultInteriors_UpdateActorStops(), and Xian_UpdateCarrierTracking().
Returns the integer square root of value, a bit at a time.
Reached through the far-call table.
Definition at line 126 of file math.c.
Referenced by Math_IntegerSqrt(), and System_GetLanguage().
Square root of a 16.16 fixed-point value, in 16.16.
Definition at line 149 of file math.c.
Referenced by BattleFx_UpdateStarField(), Camera_FollowLeaderInBounds(), EffectSlot_UpdateMotion(), FieldObject_UpdatePlayerControl(), FixedSqrt(), MercuryLighthouse_FollowLeader(), Object_MoveOnWorldMap(), Object_SetMoveTarget(), Object_UpdateAllThumb(), System_GetLanguage(), and Transform_BuildLookAt().
| s32 Palette_GetBasicObjColors | ( | void | ) |
Definition at line 151 of file math.c.
Referenced by Menu_OpenBackdropScreen(), Palette_GetBasicObjColors(), System_GetLanguage(), and UiWindow_DrawStatusBarTiles().
| void NumberText_FormatHex | ( | u32 | value | ) |
Writes value as eight hexadecimal digits to the number buffer.
Called by DebugText_PrintHex.
Definition at line 12 of file text.c.
Referenced by DebugText_PrintHex(), NumberText_FormatHex(), and System_GetLanguage().
| void NumberText_FormatDecimal | ( | s32 | number | ) |
Writes number to the number buffer as eleven characters: spaces, a sign (a space or '-') and its decimal digits, right-aligned.
Called by DebugText_PrintDecimal and the Djinn preview's number text.
Definition at line 32 of file text.c.
Referenced by DebugText_PrintDecimal(), NumberText_FormatDecimal(), System_GetLanguage(), and UiText_FormatNumberToHalfwords().
| void DebugText_PrintBlanks | ( | u32 | count | ) |
Writes count blank characters at the debug text cursor and moves it on.
Reached through the far-call table.
Definition at line 89 of file text.c.
Referenced by DebugText_PrintBlanks(), and System_GetLanguage().
| void * memcpy | ( | void * | destination, |
| const void * | source, | ||
| unsigned long | size ) |
| 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 screen to its start, when debug text is on; the cursor moves past it.
Called by the hex and decimal printers and through the far-call table.
Definition at line 116 of file text.c.
Referenced by DebugText_Print(), DebugText_PrintDecimal(), DebugText_PrintHex(), and memcpy().
Prints the last digits hexadecimal digits of value (1 to 8; anything else prints all 8).
Reached through the far-call table.
Definition at line 144 of file text.c.
Referenced by DebugText_PrintHex(), and memcpy().
Prints the last digits characters of value in signed decimal (1 to 10; anything else prints 10).
Reached through the far-call table.
Definition at line 157 of file text.c.
Referenced by DebugText_PrintDecimal(), and memcpy().
| void DebugText_Clear | ( | void | ) |
Blanks the debug text screen, homes the cursor and points BG0 at it.
Called by System_Initialize, Game_ResetForNewGame and the debug modes.
Definition at line 170 of file text.c.
Referenced by Debug_RunPaletteEditor(), DebugBattle_RunMenu(), DebugText_Clear(), DisplayScroll_RunSlideshow(), Game_ResetForNewGame(), memcpy(), System_Initialize(), Title_ShowAnimatedSplash(), Title_ShowIntro(), and Title_ShowSplashScreen().
| void Ui_LoadWindowGraphics | ( | void | ) |
Loads the window font and frame tiles into BG character block 0, the window palette into BG palette 15 with its gradient colours, and the basic sprite palettes.
Called by System_Initialize and by the modes that replace those graphics and must put them back (the debug battle, the palette editor).
Definition at line 180 of file text.c.
Referenced by Debug_RunPaletteEditor(), DebugBattle_RunMenu(), DisplayScroll_RunSlideshow(), memcpy(), NameEntry_EditOwnerName(), SaveMenu_Run(), System_Initialize(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), and Ui_LoadWindowGraphics().
| void Palette_LoadBasicObjColors | ( | void | ) |
Loads the basic sprite palettes (palettes 0 to 13).
Called by Ui_LoadWindowGraphics and the field object setup.
Definition at line 199 of file text.c.
Referenced by memcpy(), ObjectSystem_Configure(), and Palette_LoadBasicObjColors().
| void Runtime_InitializeHeap | ( | void | ) |
Empties the heap: clears the 64 words of gWorkSlot (both pool pointers and every named slot) and sets the pools' next addresses to gIwramHeap and gEwramHeap.
Called by System_Initialize, by Game_ResetForNewGame and by the debug modes that start over, so every earlier block is forgotten.
Definition at line 15 of file heap.c.
Referenced by DebugBattle_RunMenu(), Game_ResetForNewGame(), memcpy(), Runtime_InitializeHeap(), System_Initialize(), and Ui_RunIconMonitor().
| s32 Runtime_GetRemainingIwram | ( | void | ) |
Returns the IWRAM bytes left to allocate, up to gCartridgeResetMarker (0x03007800), the same end the allocators test.
Battle_RunEncounter calls it around each action and ignores the result.
Definition at line 26 of file heap.c.
Referenced by Battle_RunEncounter(), memcpy(), and Runtime_GetRemainingIwram().
| s32 Runtime_GetRemainingEwram | ( | void | ) |
Returns the EWRAM bytes left to allocate, up to the end of EWRAM.
Battle_RunEncounter calls it around each action and ignores the result.
Definition at line 34 of file heap.c.
Referenced by Battle_RunEncounter(), memcpy(), and Runtime_GetRemainingEwram().
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words), from IWRAM when they fit and EWRAM otherwise.
A new block advances that pool's next address and is stored in the slot, so later calls with the same kind return it until Runtime_ReleaseHeapBlock frees it. Returns NULL when neither pool has room. Called throughout the game for long-lived work blocks, and by WaitFrames for each frame's OAM list.
Definition at line 47 of file heap.c.
Referenced by BattleFx_BuildBlitter(), BattleFx_DispatchByIdRange(), BattleFx_InitializeSlots(), BattleFx_InitializeStarField(), BattleFx_LoadActionEffectResources(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunSceneEffect(), BattleFx_RunShatteringOpening(), BattleFx_RunTableEffect(), BattleFx_StartEffectObject22(), BattleFx_StartElementStreaks(), BattleFx_StartFadeOverlay(), BattleFx_StartRandomParticleEmitter(), BattlePres_RunEntryTransition(), Colosso_ShowItemIcon(), DjinnMenu_Run(), ItemMenu_Run(), LuckyDice_Run(), Map_InitializePerspectiveScene(), Map_WriteLayerCellTile(), memcpy(), Menu_OpenCharacterSelector(), ObjectSystem_Configure(), PsynergyMenu_Run(), ReelGame_Run(), Resource_LoadIndexedIntoBuffer(), Runtime_AllocateHeapBlock(), Sanctum_RaiseItemIcon(), SaveMenu_SelectSlot(), SelectionScreen_LoadLargeIcon(), Shop_InitializeCursorWork(), Sprite_ComposeAnimationFrame(), StatusMenu_Run(), Title_ShowIntro(), Ui_BuildPairedPatternsToSlot(), Ui_BuildPatternToSlot(), UiGlyph_LoadEntryWithPalette(), UiIcon_BuildAbilityIconTiles(), UiIcon_BuildItemIconTiles(), UiIcon_CopyResourceToSlot(), UiText_BuildRenderEntries(), UiText_LoadRemappedGlyph(), and WaitFrames().
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the battle, shop and save work, among others.
Definition at line 80 of file heap.c.
Referenced by AffineEffect_InitializeWork(), Battle_CollectPartyCommands(), Battle_RunEncounter(), BattleEffect_InitializeBuffers(), BattleFx_DispatchByIdRange(), BattleFx_InitializeStarField(), BattleFx_RunVisibilityTransition(), BattleFx_ScheduleRatioTransition(), BattleFx_StartBufferBlend(), BattleFx_StartFadeOverlay(), BattlePresentation_InitializeWorkAndResetState(), Camera_FollowActor(), Camera_FollowObject(), Camera_GetEventObject(), Camera_MoveWithinMapBounds(), Camera_SetSpeedParameters(), Camera_WaitForArrival(), Colosso_StartRaceGauge(), ColossoWall_RollLogToCell(), DisplayScroll_InitializeHBlankDma(), DisplayTransition_AllocateAndClearState(), DisplayTransition_InitializeBattleEffectState(), DisplayTransition_InitializeState(), Event_PushPipeworksBlock(), Event_RollLongLog(), Event_WaitForZoomTransition(), Field_RunScene(), FieldEffect_InitSparkles(), FieldFx_LastLightning(), FieldFx_ResumeLightning(), FieldFx_StartGroundParticles(), FieldFx_StartLightning(), FieldFx_StepRatioTransition(), FieldFx_StopLightning(), FieldMotes_Start(), FieldScene_BuildDescriptorAndInstallTask(), ItemIcon_LoadIntoSlot(), ItemMenu_SelectGiveQuantity(), KolimaForestBend_RollLog(), LinkLobby_EnterBattle(), LuckyDice_Run(), Map_InitializePerspectiveScene(), Map_LoadLayeredScene(), Map_ShowWorldMap(), memcpy(), Menu_AllocateSelectionWorkspace(), MercuryLighthouse_RemoveColumnOnRetreat(), MercuryLighthouse_RestoreLights(), Object_PlaceCurrentWithinCameraBounds(), ObjectSystem_Configure(), ObjectSystem_Initialize(), OptionMenu_InitializeWork(), PaletteFade_Init(), PaletteQueue_Initialize(), ReelGame_Run(), Render_ResetTransformState(), RenderResource_LoadFrame(), RenderResource_LoadPair(), Resource_LoadIndexedEntryToBuffer(), Resource_LoadTableEntryToBuffer(), RunSceneTransitionEffect(), Runtime_AllocateBlock(), SaveState_InitializeWorkspace(), Shop_CreatePriceSprite(), Shop_SelectQuantity(), SolSanctum_StartFloatingLights(), SolSanctum_UpdateRing(), SolSanctumStatue_InitializeScrollingSprites(), SystemMenu_Initialize(), Title_ShowIntro(), Ui_RunIconMonitor(), UiGlyph_ResetWorkState(), UiIcon_LoadResourceIntoSlot(), UiWindow_CreateWithLayoutBounds(), UiWork_Initialize(), UiWork_InitializeWithResourceCounters(), WorldMap_BeginEvent(), and WorldMap_EndEvent().
| void * MemAlloc | ( | s32 | size | ) |
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise, and advances that pool's next address.
Returns NULL when neither has room. Called for short-lived buffers (decode buffers, RAM copies of code), which MemFree rewinds the pool over.
Definition at line 115 of file heap.c.
Referenced by Battle_CollectPartyCommands(), BattleTargetExec(), Debug_SelectAbilityPair(), DjinnMenu_DrawStatPreview(), DjinnMenu_ShowChangePreview(), HeatGauge_Draw(), ItemMenu_ConfirmEquip(), ItemMenu_DrawEquipPreview(), ItemMenu_RunCommands(), Map_LoadLayeredScene(), MemAlloc(), memcpy(), Menu_DrawOwnerStatusPanel(), Menu_LoadResourceSlot(), PsynergyMenu_SelectMember(), RunLuckyDice(), RunReelGame(), Sprite_ComposeAnimationFrame(), StatusMenu_ShowOwnerProgressMessage(), Ui_RunOwnerStatusScreen(), UiText_LoadRemappedGlyph(), UiText_RenderStringTiles(), and WorldMap_LoadGraphics().
| void * Runtime_BumpAllocateAlternatePool | ( | s32 | size | ) |
As MemAlloc, but tries EWRAM first.
Called mostly by the battle code and the credits for buffers too large to want IWRAM.
Definition at line 140 of file heap.c.
Referenced by Battle_AwardSpoils(), Battle_SelectAbility(), BattleEnemy_AdjustLevel(), BattleFormation_SelectLevelMatchedCandidate(), BattleFx_SetupResourcesAndWindow(), BattlePres_BuildUnitEntries(), BattlePresentation_AppendLinkedActions(), BattleUnit_ProcessTurnEnd(), Colosso_DrawGauge(), Colosso_LoadLettering(), Colosso_StartRaceGauge(), Curtain_Start(), DisplayScroll_DrawLine(), DisplayScroll_InitObjectTable(), DjinnMenu_Run(), DjinnMenu_ShowChangePreview(), DjinnMenu_ShowOwnerStatus(), FieldScene_BuildDescriptorAndInstallTask(), ItemMenu_Run(), LinkBattle_ReceiveParty(), LinkBattle_SendParty(), LinkLobby_ReceivePartyRecords(), LinkLobby_SendPartyRecords(), memcpy(), Menu_RunCommandRow(), Owner_LevelUp(), OwnerAction_RunCompareLoop(), PsynergyMenu_Run(), Runtime_BumpAllocateAlternatePool(), SaveMenu_FillTileBlock(), SaveMenu_FillTileGrid(), SaveState_ProcessSelectedSlot(), StatusMenu_Run(), Tilemap_ConvertBuffer(), Title_LoadSprites(), UiText_DrawString(), UiText_DrawStringAtOffset(), UiText_DrawStringInWindow(), UiWindow_CopyTilemapRegion(), UnitCalc(), and WorldMap_PlayLighthouseTransition().
| void RuntimeMemory_ReservedNoOp | ( | void | ) |
Reserved empty memory export; its historical purpose is not established.
Definition at line 164 of file heap.c.
Referenced by memcpy(), and RuntimeMemory_ReservedNoOp().
| void Render_ResetTransformState | ( | void | ) |
Allocates the one-level save area (heap slot HEAP_SLOT_TRANSFORM_STACK), clears gTransformStackDepth and resets gTransform to identity.
Called by the battle scene setup and the field camera before a scene's first transform.
Definition at line 19 of file transform.c.
Referenced by Battle_RunEncounter(), BattleFx_DrawStreaks(), BattleFx_RunAtalanta(), BattleFx_RunBind(), BattleFx_RunBoreas(), BattleFx_RunCastingImpact(), BattleFx_RunFrost(), BattleFx_RunJudgment(), BattleFx_RunParticleStreams(), BattleFx_RunProcne(), BattleFx_RunRingAndSparkScene(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_DispatchAction(), BattlePresentation_UpdateCamera(), Camera_ApplyTransformByFlag(), Camera_ConfigureScene(), Camera_InitDefaultTransform(), Camera_ResetSceneDefaults(), LuckyDice_Run(), Map_InitializePerspectiveScene(), memcpy(), ObjectSystem_UpdateCameraFixed(), Render_ResetTransformState(), and WorldMap_UpdateView().
| void Transform_Push | ( | void | ) |
Saves gTransform into the save area (one level deep; a second save is ignored).
Called by the battle effects that draw a part with its own transform, with Transform_Pop after.
Definition at line 30 of file transform.c.
Referenced by BattleFx_RunAstralBlast(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunSwirlingStars(), memcpy(), and Transform_Push().
| void Transform_Store | ( | void * | dst | ) |
Copies gTransform to dst. Called by BattleFx_RunAtalanta.
Definition at line 39 of file transform.c.
Referenced by BattleFx_RunAtalanta(), memcpy(), and Transform_Store().
| void Transform_Load | ( | const void * | src | ) |
Copies the matrix at src into gTransform. Called by BattleFx_RunAtalanta.
Definition at line 44 of file transform.c.
Referenced by BattleFx_RunAtalanta(), memcpy(), and Transform_Load().
| void Transform_Pop | ( | void | ) |
Restores gTransform from the save area, if Transform_Push saved it.
Definition at line 49 of file transform.c.
Referenced by BattleFx_RunAstralBlast(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunSwirlingStars(), memcpy(), and Transform_Pop().
| void SceneTransform_ResetMatrix | ( | void | ) |
Resets gTransform to identity. Reached through the far-call table.
Definition at line 58 of file transform.c.
Referenced by memcpy(), and SceneTransform_ResetMatrix().
| void SceneTransform_ApplyRotation | ( | s32 * | angles | ) |
Rotates gTransform by angles[0], angles[1] and angles[2] about the X, Y and Z axes, in that order, with one combined matrix.
Reached through the far-call table.
Definition at line 66 of file transform.c.
Referenced by memcpy(), and SceneTransform_ApplyRotation().
| void SceneTransform_ApplyPitch | ( | s32 | angle | ) |
Rotates gTransform about the X axis by angle.
Called by the battle and field cameras.
Definition at line 97 of file transform.c.
Referenced by BattleFx_DrawStreaks(), BattleFx_RunAtalanta(), BattleFx_RunCastingImpact(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunRingAndSparkScene(), BattleFx_RunStatBoost(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetMotes(), BattleFx_RunThor(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_UpdateCamera(), Camera_ConfigureScene(), Camera_InitDefaultTransform(), Camera_ResetSceneDefaults(), Map_InitializePerspectiveScene(), memcpy(), SceneTransform_ApplyPitch(), and WorldMap_UpdateView().
| void SceneTransform_ApplyYaw | ( | s32 | angle | ) |
Rotates gTransform about the Y axis by angle.
Called by the battle and field cameras.
Definition at line 113 of file transform.c.
Referenced by BattleFx_DrawStreaks(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBind(), BattleFx_RunCastingImpact(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunParticleStreams(), BattleFx_RunProcne(), BattleFx_RunRingAndSparkScene(), BattleFx_RunStatBoost(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetMotes(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_UpdateCamera(), Camera_ConfigureScene(), Camera_InitDefaultTransform(), Camera_ResetSceneDefaults(), Map_InitializePerspectiveScene(), memcpy(), SceneTransform_ApplyYaw(), and WorldMap_UpdateView().
| void SceneTransform_ApplyRoll | ( | s32 | angle | ) |
Rotates gTransform about the Z axis by angle.
Called by battle effects that spin their picture.
Definition at line 129 of file transform.c.
Referenced by BattleFx_DrawStreaks(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBind(), BattleFx_RunCastingImpact(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunParticleStreams(), BattleFx_RunProcne(), BattleFx_RunRingAndSparkScene(), BattleFx_RunStatBoost(), BattleFx_RunSwirlingStars(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), memcpy(), and SceneTransform_ApplyRoll().
| void SceneTransform_ApplyPosition | ( | const s32 * | position | ) |
Translates gTransform by position (x, y, z in 16.16).
Called by the battle and field cameras and effects.
Definition at line 145 of file transform.c.
Referenced by BattleFx_RunAstralBlast(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinnHeal(), BattleFx_RunDjinniEntrance(), BattleFx_RunFrost(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunParticleStreams(), BattleFx_RunProcne(), BattleFx_RunSleep(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunSwirlingStars(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunThor(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_UpdateCamera(), Camera_ConfigureScene(), Camera_InitDefaultTransform(), Camera_ResetSceneDefaults(), Map_InitializePerspectiveScene(), memcpy(), SceneTransform_ApplyPosition(), and WorldMap_UpdateView().
| void SceneTransform_ApplyScale | ( | const s32 * | scale | ) |
Scales gTransform by scale (x, y, z factors in 16.16).
Called by a few battle effects (Bind, Astral Blast, Thor).
Definition at line 158 of file transform.c.
Referenced by BattleFx_RunAstralBlast(), BattleFx_RunBind(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), memcpy(), and SceneTransform_ApplyScale().
Rotates gTransform by angles and translates it by position in one matrix.
Reached through the far-call table.
Definition at line 171 of file transform.c.
Referenced by memcpy(), and SceneTransform_ApplyRotationTranslation().
Rotates by angles, scales each rotation row by scale and translates by position, in one matrix.
Definition at line 202 of file transform.c.
Referenced by memcpy(), and SceneTransform_ApplyScaledRotation().
Builds in out the camera matrix of an eye at eye looking at target.
The camera's sideways axis is kept level (no Y component). Called by Transform_SetLookAt and Transform_ApplyLookAt.
Definition at line 243 of file transform.c.
Referenced by memcpy(), Transform_ApplyLookAt(), Transform_BuildLookAt(), and Transform_SetLookAt().
Makes the camera at eye looking at target the whole of gTransform.
Called by the battle cameras.
Definition at line 318 of file transform.c.
Referenced by BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_DispatchAction(), Camera_ApplyTransformByFlag(), LuckyDice_Run(), Map_InitializePerspectiveScene(), memcpy(), ObjectSystem_UpdateCameraFixed(), Transform_SetLookAt(), and WorldMap_UpdateView().
Multiplies the camera at eye looking at target into gTransform.
Called by the battle and field object cameras.
Definition at line 324 of file transform.c.
Referenced by Camera_ApplyTransformByFlag(), memcpy(), ObjectSystem_UpdateCameraFixed(), and Transform_ApplyLookAt().
Sets gProjection from a vertical field of view: the focal length is 80 (half the screen height) over the tangent of half the angle.
Points nearer than nearDepth or farther than farDepth are not drawn. Reached through the far-call table.
Definition at line 335 of file transform.c.
Referenced by memcpy(), and Projection_SetFieldOfView().
Sets gProjection's focal length and depth range directly.
Called by the battle cameras and effects.
Definition at line 350 of file transform.c.
Referenced by BattleFx_RunThor(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattlePresentation_DispatchAction(), Camera_ConfigureScene(), Camera_ResetSceneDefaults(), Map_InitializePerspectiveScene(), memcpy(), Projection_Set(), and WorldMap_UpdateView().
Reads three word-aligned coordinates from point, transforms them by gTransform and projects them to the screen: screen[0] and screen[1] are its pixel position and screen[2] its whole-unit depth.
Returns the projection scale (16.16), or 0 when the point is outside the depth range, when only the transformed point is written. Called by the battle and field code that places sprites in 3D.
Definition at line 364 of file transform.c.
Referenced by BattleFx_RunBeamSequence(), BattleMotion_ProjectConditionalPosition(), BattleMotion_ProjectPosition(), BattleMotion_ProjectScaledPosition(), BattlePres_SetupTransitionScene(), BattlePres_SetupTransitionSceneAtDepth(), BattleUnit_ProjectToScreen(), Camera_WorldToScreen(), EffectPosition_ProjectPoint(), Event_ShowSpeakerMessage(), LuckyDice_Run(), memcpy(), Render_PlaceProjectedSprite(), Render_ProjectPoint(), and UiText_OpenMessageAtObject().
| 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 stack.
Called by the palette editor.
Definition at line 9 of file decompress.c.
Referenced by Debug_RunPaletteEditor(), memcpy(), and Resource_DecompressHalfwords().
Raises every pixel by amount, stopping at 63.
Definition at line 47 of file decompress.c.
Referenced by BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndBrighten(), and memcpy().
Lowers every pixel by amount, stopping at 0.
Definition at line 56 of file decompress.c.
Referenced by BattleFx_FlushPendingGraphicsTransfer(), BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndDarken(), and memcpy().
Scales every pixel to three quarters.
Definition at line 65 of file decompress.c.
Referenced by BattleFx_FlushPendingGraphicsTransfer(), BattleFx_ProcessPendingGraphicsTransfer(), BattleFx_UploadStarField(), ColorBuffer_BackupAndScaleThreeQuarters(), and memcpy().
Halves every pixel. Called by the battle effect canvas's transfers.
Definition at line 75 of file decompress.c.
Referenced by BattleFx_FlushPendingGraphicsTransfer(), BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndHalve(), and memcpy().
As ColorBuffer_BackupAndBrighten, skipping groups already all at 63.
Definition at line 83 of file decompress.c.
Referenced by ColorBuffer_BackupAndBrightenPartial(), and memcpy().
As ColorBuffer_BackupAndDarken, skipping groups already all at 0.
Definition at line 93 of file decompress.c.
Referenced by ColorBuffer_BackupAndDarkenPartial(), and memcpy().
Scales every pixel to three quarters, skipping all-zero groups.
Definition at line 103 of file decompress.c.
Referenced by ColorBuffer_BackupAndScaleNonzeroThreeQuarters(), memcpy(), and ReelGame_TransferCanvas().
Halves every pixel, skipping all-zero groups.
Called by the slot reels' canvas transfer.
Definition at line 114 of file decompress.c.
Referenced by ColorBuffer_BackupAndHalveNonzero(), memcpy(), and ReelGame_TransferCanvas().
| s32 SaveState_InitializeWorkspace | ( | void | ) |
Allocates the save workspace (heap slot HEAP_SLOT_SAVE), installs the flash library's timer 2 handler, identifies the flash chip (up to eight tries, a frame apart) and scans all 16 sectors into the workspace's occupied, recordId and sequence tables: a sector counts as taken when its signature and checksum are good, and of two copies of a record only the newer stays taken.
Returns 1 when no flash chip answers, 0 otherwise; either way the caller ends with SaveState_ReleaseWorkspace. Called by the save screens (window/battle_command/save.c) before every save, load, copy or delete.
Definition at line 31 of file save.c.
Referenced by memcpy(), Save_WriteSelectedSlot(), SaveState_CopySlotPair(), SaveState_CountRecordsExcludingFlagged(), SaveState_DeleteSelectedSlot(), SaveState_InitializeWorkspace(), SaveState_LoadRecordIntoWork(), SaveState_ProcessSelectedSlot(), SaveState_ScanRecordFlags(), SaveState_WriteCurrentSlotPair(), and SaveState_WriteSlotPair().
Picks the free sector to write record mode to, at random.
The last free sector only goes to a record that already has a copy, so replacing a save always has room. Called by SaveState_WriteRecord. Returns 16 when there is no sector to use.
Definition at line 100 of file save.c.
Referenced by memcpy(), SaveState_SelectWriteSlot(), and SaveState_WriteRecord().
Programs the workspace's sector buffer into flash sector sector and verifies it, through the flash library's routine for this chip.
Called by SaveState_WriteRecord and SaveState_InvalidateSlot. Returns 0 on success and 1 on failure.
Definition at line 136 of file save.c.
Referenced by memcpy(), SaveState_InvalidateSlot(), SaveState_WriteRecord(), and SaveState_WriteWorkspaceSlot().
Reads flash sector index into the workspace's sector buffer.
Called by SaveState_InitializeWorkspace and SaveState_ReadRecordPayload. Returns 0 when the payload matches the header's checksum.
Definition at line 155 of file save.c.
Referenced by memcpy(), SaveState_InitializeWorkspace(), SaveState_ReadRecordPayload(), and SaveState_ReadSlotAndCheckChecksum().
Erases flash sector sector with the flash library's routine for this chip.
Nothing calls it.
Definition at line 172 of file save.c.
Referenced by memcpy(), and SaveState_EraseSlotSector().
Saves 0xff0 bytes from source as record recordId: writes the new copy with the next sequence number, then invalidates the old one, updating the workspace's sector tables.
When the sequence passes 65000 it restarts at 1, written back over the old sector. Called by the save screens. Returns 0 on success and 1 on failure.
Definition at line 181 of file save.c.
Referenced by memcpy(), Save_WriteSelectedSlot(), SaveState_CopySlotPair(), SaveState_ProcessSelectedSlot(), SaveState_WriteCurrentSlotPair(), SaveState_WriteRecord(), and SaveState_WriteSlotPair().
Loads the current copy of record recordId into destination.
Called by the save screens to load or copy a file. Returns 1 when there is none and 0 otherwise.
Definition at line 236 of file save.c.
Referenced by memcpy(), SaveState_CopySlotPair(), SaveState_LoadRecordIntoWork(), SaveState_ProcessSelectedSlot(), and SaveState_ReadRecordPayload().
Invalidates the current copy of record recordId.
Called by the save screen's delete. Returns 0 on success and 1 when there is none or the write failed.
Definition at line 253 of file save.c.
Referenced by memcpy(), SaveState_DeleteRecord(), and SaveState_DeleteSelectedSlot().
| s32 SaveState_ChecksumWorkspace | ( | void | ) |
Sums the first 0xfe8 payload bytes of the workspace's sector buffer; the final eight payload bytes are excluded.
Called when a sector is read and before one is written.
Definition at line 268 of file save.c.
Referenced by memcpy(), SaveState_ChecksumWorkspace(), SaveState_ReadSlotAndCheckChecksum(), and SaveState_WriteRecord().
Returns the occupied sector holding the newest copy of record recordId, or 16.
Called by every record operation in this file.
Definition at line 294 of file save.c.
Referenced by memcpy(), SaveState_DeleteRecord(), SaveState_FindLatestSlot(), SaveState_LoadSummaryRecords(), SaveState_ReadRecordPayload(), SaveState_SelectWriteSlot(), and SaveState_WriteRecord().
Overwrites sector index with a header for no record (id 16) and clears its occupied entry.
Called by SaveState_WriteRecord and SaveState_DeleteRecord. Returns 0 on success and 1 on failure.
Definition at line 317 of file save.c.
Referenced by memcpy(), SaveState_DeleteRecord(), SaveState_InvalidateSlot(), and SaveState_WriteRecord().
Compares count bytes, as memcmp does.
Called by SaveState_InitializeWorkspace to check each sector's signature.
Definition at line 340 of file save.c.
Referenced by memcpy(), SaveState_CompareBytes(), and SaveState_InitializeWorkspace().
Returns the highest sequence number among the copies of record recordId.
Called by SaveState_WriteRecord to number the new copy.
Definition at line 356 of file save.c.
Referenced by memcpy(), SaveState_GetLatestSequence(), and SaveState_WriteRecord().
| s32 SaveState_LoadSummaryRecords | ( | void | ) |
Reads the summary at the start of each of the three save files into summary for the file select screen, and four bytes from offset 0x110 of each file's second record (zero when it has none).
Called by the save screens. Returns how many save files exist.
Definition at line 376 of file save.c.
Referenced by memcpy(), Save_WriteSelectedSlot(), SaveState_CopySlotPair(), SaveState_CountRecordsExcludingFlagged(), SaveState_DeleteSelectedSlot(), SaveState_LoadRecordIntoWork(), SaveState_LoadSummaryRecords(), and SaveState_ScanRecordFlags().
| u32 SaveState_ReleaseWorkspace | ( | void | ) |
Removes the flash timer handler and frees the save workspace's heap slot.
Called by the save screens after every save operation. Declared as returning a value, it returns none (pop {r1}; bx r1).
Definition at line 409 of file save.c.
Referenced by memcpy(), Save_WriteSelectedSlot(), SaveState_CopySlotPair(), SaveState_CountRecordsExcludingFlagged(), SaveState_DeleteSelectedSlot(), SaveState_LoadRecordIntoWork(), SaveState_ProcessSelectedSlot(), SaveState_ReleaseWorkspace(), SaveState_ScanRecordFlags(), SaveState_WriteCurrentSlotPair(), and SaveState_WriteSlotPair().
| void SerialRuntime_Initialize | ( | void | ) |
Resets the serial port into multiplayer mode, installs the serial and timer 3 interrupt handlers, clears gSerialRuntime and points its packet buffers into its storage, clears the bulk transfer state and sets gSerialExchangeActive, which starts the per-frame exchange.
Called by the link lobby, the save menu's link transfer and the link test, and through the far-call table.
Definition at line 28 of file serial.c.
Referenced by LinkLobby_InitializeSerial(), LinkLobby_RunRoundResult(), memcpy(), SaveMenu_Run(), SerialRuntime_Initialize(), and SerialTest_Run().
| void SerialRuntime_EnableTransferTimer | ( | void | ) |
Lets the timer start transfers again once a link mode is set, by setting gSerialRuntime.transferEnabled.
Nothing in ☀️ calls it; WaitFrames does the same inline.
Definition at line 85 of file serial.c.
Referenced by memcpy(), and SerialRuntime_EnableTransferTimer().
| void SerialRuntime_DisableTransfer | ( | void | ) |
Disables the serial and timer 3 interrupts, stops the transfer timer and clears gSerialRuntime.transferEnabled.
Nothing in ☀️ calls it.
Definition at line 94 of file serial.c.
Referenced by memcpy(), and SerialRuntime_DisableTransfer().
| s32 SerialRuntime_PollAndTransfer | ( | void * | send, |
| void * | receive ) |
Looks for the link partner and, once connected, does one exchange (as SerialRuntime_ExchangePayloads).
When this console is the parent (SIOCNT reports multiplayer mode with no error) it arms timer 3 to clock the transfers. Called by the Tret tree branch scene for its own exchange. Returns the link status (see SerialRuntime_ExchangePayloads).
Definition at line 113 of file serial.c.
Referenced by memcpy(), SerialRuntime_PollAndTransfer(), and TretTreeBranch_ExchangeInputPacket().
| s32 SerialRuntime_PollStatus | ( | void | ) |
As SerialRuntime_PollAndTransfer, without exchanging data: WaitFrames calls it once a frame while gSerialExchangeActive is set, and the VBlank handler does the exchange.
Definition at line 168 of file serial.c.
Referenced by memcpy(), SerialRuntime_PollStatus(), and WaitFrames().
| s32 SerialRuntime_ExchangePayloads | ( | void * | send, |
| void * | receive ) |
Once connected (phase 1), gathers the received payloads into receive and builds the next packet from send.
Called by the VBlank handler while gSerialExchangeActive is set, which stores the result in gLinkStatus. Returns the link status: bits 0 to 7 : the consoles heard from this frame (bit 7 also when parent) bits 8 to 15 : the consoles heard from since the link began 0x1000 : this console is the parent 0x2000 : SIOCNT's multiplayer id is 2 or more
Definition at line 218 of file serial.c.
Referenced by memcpy(), SerialRuntime_ExchangePayloads(), and System_VBlankHandler().
| void SerialRuntime_PrepareSendPacket | ( | void * | payload | ) |
Builds the packet to send in sendBuffer[0]: [0] the sequence number, [1] the consoles not yet heard from, [2] the checksum and [4] the 24-byte payload.
The checksum is the complement of the sum of the first 28 bytes as halfwords. Then restarts the send position and the timer. Called by both exchanges.
Definition at line 246 of file serial.c.
Referenced by memcpy(), SerialRuntime_ExchangePayloads(), SerialRuntime_PollAndTransfer(), and SerialRuntime_PrepareSendPacket().
| u8 SerialRuntime_CollectReceivedPayloads | ( | void * | payload | ) |
Swaps in the packets the interrupt handler finished, then copies the payload of each one whose checksum is good to payload (24 bytes per console), and records the consoles heard from in currentMask and receivedMask.
Called by both exchanges. Returns the mask of consoles heard from this frame.
Definition at line 302 of file serial.c.
Referenced by memcpy(), SerialRuntime_CollectReceivedPayloads(), SerialRuntime_ExchangePayloads(), and SerialRuntime_PollAndTransfer().
| void SerialRuntime_HandleTransferInterrupt | ( | void | ) |
The serial and timer 3 interrupt, installed by SerialRuntime_Initialize: each one moves a halfword.
It sends the next halfword of the outgoing packet (0xfefe between packets) and stores the halfword received from each console; a console's fourteenth halfword completes its packet.
Definition at line 344 of file serial.c.
Referenced by memcpy(), SerialRuntime_HandleTransferInterrupt(), and SerialRuntime_Initialize().
| void SerialRuntime_RemoveIrqHandlers | ( | void | ) |
Clears gSerialExchangeActive, which stops the per-frame exchange, and removes the link interrupt handlers.
Called when the link lobby, the save menu's transfer or a link battle ends.
Definition at line 431 of file serial.c.
Referenced by BattlePresentation_AppendLinkedActions(), LinkLobby_InitializeSerial(), LinkLobby_LeaveArena(), memcpy(), SaveMenu_Run(), and SerialRuntime_RemoveIrqHandlers().
Waits a frame at a time until every status bit in mask is set in gLinkStatus, then returns this console's multiplayer id.
Called by the link test and through the far-call table.
Definition at line 440 of file serial.c.
Referenced by memcpy(), SerialRuntime_WaitForStatusMask(), and SerialTest_Run().
Starts sending size bytes from source to the partner in 20-byte blocks: sets the send source, size and block sequence that SerialRuntime_StepBlockTransfer works from.
Called by the link battle, the link lobby and the save menu's transfer. Returns -1 when a send is already running, 0 otherwise.
Definition at line 454 of file serial.c.
Referenced by BattlePresentation_AppendLinkedActions(), LinkBattle_SendParty(), LinkLobby_SendPartyRecords(), memcpy(), SaveMenu_Run(), SerialRuntime_BeginSend(), and SerialTest_Run().
| s32 SerialRuntime_BeginReceive | ( | void * | destination | ) |
Starts receiving the partner's blocks into destination: sets the receive destination and clears the received size.
Called by the same code as SerialRuntime_BeginSend. Returns -1 when a receive is already running, 0 otherwise.
Definition at line 474 of file serial.c.
Referenced by BattlePresentation_AppendLinkedActions(), LinkBattle_ReceiveParty(), LinkLobby_ReceivePartyRecords(), memcpy(), SerialRuntime_BeginReceive(), and SerialTest_Run().
| void SerialRuntime_WaitForTransfers | ( | void | ) |
Waits until both the send and the receive have finished, giving up after 600000 frames.
Reached through the far-call table.
Definition at line 509 of file serial.c.
Referenced by memcpy(), and SerialRuntime_WaitForTransfers().
| s32 SerialRuntime_GetActiveTransfers | ( | void | ) |
Returns bit 0 while a send runs and bit 1 while a receive runs.
The link battle and lobby poll it between frames.
Definition at line 523 of file serial.c.
Referenced by BattlePresentation_AppendLinkedActions(), LinkLobby_ReceivePartyRecords(), LinkLobby_SendPartyRecords(), memcpy(), and SerialRuntime_GetActiveTransfers().
| void BattleLink_ResetTransferState | ( | void | ) |
Definition at line 536 of file serial.c.
Referenced by BattleLink_ResetTransferState(), BattlePresentation_AppendLinkedActions(), memcpy(), and SerialRuntime_Initialize().
| void SerialRuntime_StepBlockTransfer | ( | void | ) |
Runs each VBlank after the exchange, called by System_VBlankHandler: moves the bulk transfer on by one 20-byte block each way.
The receiver acknowledges each block's sequence number; when the sender sees an acknowledgement behind its own count it rewinds and sends the missed blocks again. A finished send or receive clears gSerialSendSource or gSerialReceiveDest.
Definition at line 548 of file serial.c.
Referenced by memcpy(), SerialRuntime_StepBlockTransfer(), and System_VBlankHandler().
| void SerialTest_Delay | ( | void | ) |
An empty routine the link test calls to waste time.
Definition at line 668 of file serial.c.
Referenced by memcpy(), SerialTest_Delay(), and SerialTest_Run().
| 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 and shows them as tiles, and sends a part of the ROM when A or B is held.
It never returns. Nothing in ☀️ reaches it.
Definition at line 673 of file serial.c.
Referenced by memcpy(), and SerialTest_Run().