4#define OWN_Flash_Handler0
6#define OWN_gFlashNumRemainingBytes
40#define CREDITS_LINE_PIXELS 192
41#define CREDITS_VISIBLE_ROWS 16
42#define CREDITS_COLUMNS 6
43#define CREDITS_RING_ROWS 32
44#define CREDITS_LINE_TILES 24
45#define CREDITS_RING_TILES (CREDITS_RING_ROWS * CREDITS_LINE_TILES)
46#define CREDITS_RING_BYTES (CREDITS_RING_TILES * TILE_SIZE_4BPP)
47#define CREDITS_BUFFER_BYTES 0x900
48#define CREDITS_RASTER_STRIDE 256
49#define CREDITS_DECODER_HEAP_SLOT 49
50#define CREDITS_BORDER_SPRITES 24
51#define CREDITS_OAM_ENTRIES 128
59 void *tileDestination;
60 void *paletteDestination;
66 fillColor = 0x01010101;
68 paletteDestination = (
void *)
BG_PLTT;
70 fillColor = 0x81818181;
72 paletteDestination = (
void *)&
BG_PLTT[128];
123 const u8 *resourceData;
124 u32 paletteDestination;
126 void *tileDestination;
128 if (resourceId == 0) {
133 if (alternate == 0) {
138 paletteOffset = 0x80808080;
147 resourceData + 256, tileDestination, paletteOffset);
161 u32 blankTiles = 0x01FF01FF;
162 u32 tilePair = 0x10000;
168 *destination++ = blankTiles;
169 }
while (remaining >= 0);
173 *destination++ = tilePair;
175 }
while (remaining >= 0);
179 *destination++ = blankTiles;
180 }
while (remaining >= 0);
185 *destination++ = tilePair;
186 }
while (remaining >= 0);
193 u32 decrement = 0xffff;
245 for (alpha = 1; alpha <= 16; alpha++) {
283#define SCROLL_OBJECTS gFlashNumRemainingBytes
284#define CREDITS_LAST_LINE_POSITION gFlash
285#define CREDITS_END_OF_TEXT gFlash_Handler0
287#define SCROLL_OBJECTS \
288 (*(struct DisplayScrollObject **)&gFlashNumRemainingBytes)
289#define CREDITS_LAST_LINE_POSITION (*(s16 *)&gFlash)
290#define CREDITS_END_OF_TEXT (*(s16 *)&gFlash_Handler0)
297#if LANGUAGE == LANGUAGE_JAPANESE
298#define CREDITS_STAFF_TITLE "OUGON NO TAIYO STAFF"
299#define CREDITS_FACES_SUBTITLE "& Faces"
300#define CREDITS_SOUND_DIRECTION_LABEL "Sound Direction"
301#define CREDITS_GRAPHICS_SUPPORT_LABEL "Graphic Support"
302#define CREDITS_ARTWORK_LABEL "Artwork Design"
304#define CREDITS_STAFF_TITLE "GOLDEN SUN STAFF CREDITS"
305#define CREDITS_FACES_SUBTITLE " & Faces"
306#define CREDITS_SOUND_DIRECTION_LABEL "Sound Director"
307#define CREDITS_GRAPHICS_SUPPORT_LABEL "Graphic Supports"
308#define CREDITS_ARTWORK_LABEL "Artwork"
325 "Hiroyuki Takahashi",
334 "Hiroyuki Takahashi",
348 "Assistant Director",
442 "Battle Backgrounds",
451 "Masayuki Hashimoto",
452 "Mitsumasa Muraishi",
456 "Shinichiro Sugimoto",
469 "Graphics Direction",
477 "Staff Coordination",
530 "Yoshitaka Nishikawa",
538#if (LANGUAGE != LANGUAGE_JAPANESE)
550#if (LANGUAGE == LANGUAGE_JAPANESE)
553 "Mitsuaki Hagishima",
571 "Super Mario Club Staff",
579 "Keiichiro Nishimoto",
580 "Toshimasa Minegishi",
590 "Katsunori Masutani",
593 "Tomohiro Nishigaki",
600 "Yoshihiro Muramatsu",
608 "Youichiro Ushijima",
628 "Hiroyuki Takahashi",
636 "Executive Producer",
648 "Copyrights of Game, Scenario",
649 "and Program reserved by",
655 "Copyrights of All Characters",
656 "and Music reserved by",
663#elif (LANGUAGE == LANGUAGE_ENGLISH)
711 "NOA Product Testing",
737 "Hiroyuki Takahashi",
745 "Executive Producer",
757 "Copyrights of Game, Scenario,",
758 "and Program reserved by",
760 "NINTENDO and CAMELOT.",
762 "Copyrights of all characters",
763 "and music reserved by",
817#if (LANGUAGE == LANGUAGE_GERMAN)
818 "German Translation",
822#elif (LANGUAGE == LANGUAGE_SPANISH)
823 "Spanish Translation",
827#elif (LANGUAGE == LANGUAGE_FRENCH)
828 "French Translation",
832#elif (LANGUAGE == LANGUAGE_ITALIAN)
833 "Italian Translation",
841#if (LANGUAGE == LANGUAGE_GERMAN)
850#elif (LANGUAGE == LANGUAGE_SPANISH)
859#elif (LANGUAGE == LANGUAGE_FRENCH)
865 "Pascal Di Pasquale",
869#elif (LANGUAGE == LANGUAGE_ITALIAN)
877 "Andrea De Benedetto",
893 "Hiroyuki Takahashi",
898 "Executive Producer",
909 "Copyrights of Game, Scenario,",
910 "and Program reserved by",
912 "NINTENDO and CAMELOT.",
914 "Copyrights of all characters",
915 "and music reserved by",
917#if (LANGUAGE != LANGUAGE_FRENCH)
935 u32 scrollWithinTile = frame & 7;
945 *oamWords++ = (row * 8 + 16 - scrollWithinTile) |
946 ((column * 32 + 24) << 16) | 0x40004000;
947 *oamWords++ = tileIndex;
986 volatile u32 dmaFill;
1001 for (row = 0; row < 8; row++) {
1002 *oamWords++ = (row << 21) | 0x80004000;
1005 for (row = 0; row < 8; row++) {
1006 *oamWords++ = (row << 21) | 0x80004088;
1009 for (row = 0; row < 8; row++) {
1010 *oamWords++ = (row << 21) | 0x40004098;
1015 u32 tileIndex = (row * 3) * 8 + column * 4;
1016 *oamWords++ = (row * 8 + 16) | ((column * 32 + 24) << 16) | 0x40004000;
1017 *oamWords++ = tileIndex;
1020 for (row = 0; row < 8; row++) {
1021 *oamWords++ = 0x00c000c0;
1048 const u8 *sourceBytes;
1067 if (linePixels !=
NULL)
1087 while ((sourceValue = *sourceBytes++) != 0) {
1088 if (sourceValue > 31)
1092 startX = lineWidth - textAdvance;
1093 else if (alignment == 1)
1094 startX = (lineWidth - textAdvance) / 2;
1099 while ((sourceValue = *text++) != 0) {
1100 if (sourceValue > 31) {
1101 glyphIndex = sourceValue - 32;
1102 sourceBytes = font + glyphIndex * 8;
1103 destination = linePixels + startX + textAdvance;
1104 for (row = 0; row < 8; row++) {
1105 glyphBits = *sourceBytes++;
1107 for (columnIndex = 7; columnIndex >= 0; columnIndex--) {
1108 if (glyphBits & glyphMask) {
1109 destination[0x101] = 1;
1110 destination[0] = 15;
1118 if (sourceValue > 31)
1120 textAdvance += glyphWidth;
1125 tileCount = lineWidth / 8;
1126 sourceBytes = linePixels;
1127 destination = linePixels;
1128 for (row = 0; row < 8; row++) {
1129 for (columnIndex = 0; columnIndex < tileCount * 4; columnIndex++) {
1130 sourceValue = *sourceBytes++;
1131 sourceValue |= *sourceBytes++ << 4;
1132 *destination++ = sourceValue;
1139 for (row = 0; row < tileCount; row++) {
1140 s32 tileIndex = firstTile + row;
1141 u32 *words = (
u32 *)linePixels + row;
1144 *(
u32 *)(0x06010004 + tileIndex * 32) = words[0x040];
1145 *(
u32 *)(0x06010008 + tileIndex * 32) = words[0x080];
1146 *(
u32 *)(0x0601000c + tileIndex * 32) = words[0x0c0];
1147 *(
u32 *)(0x06010010 + tileIndex * 32) = words[0x100];
1148 *(
u32 *)(0x06010014 + tileIndex * 32) = words[0x140];
1149 *(
u32 *)(0x06010018 + tileIndex * 32) = words[0x180];
1150 *(
u32 *)(0x0601001c + tileIndex * 32) = words[0x1c0];
u16 gFlashNumRemainingBytes
Which units are in a battle, and the Djinn recovery list.
BattleUnit_Recalculate, which recalculates a unit's stats.
The task scheduler: tasks, their order and the scheduler's state.
#define SCHEDULER_KEY_VBLANK
A task's order: the high byte picks the pass that runs it, the low byte ranks it within the pass (hig...
#define SCHEDULER_KEY_MAIN_LOOP
#define CREDITS_STAFF_TITLE
#define CREDITS_ARTWORK_LABEL
const u32 gDisplayScroll_SlideResources[]
Battle backgrounds shown in the credits; 0 clears the display.
#define CREDITS_RING_TILES
void Graphics_LoadCharacterBlockAndPalette(u32 resourceId, s32 alternate)
Loads a credits backdrop into one of the two tile/palette halves.
#define CREDITS_SOUND_DIRECTION_LABEL
void DisplayScroll_RenderEnteringLine(void)
A main-loop task scheduled by DisplayScroll_InitObjectTable: renders each entering line sixteen rows ...
s32(*) PackedDecoder(const u8 *source, void *destination, u32 fill)
#define CREDITS_RING_BYTES
#define CREDITS_BORDER_SPRITES
void DisplayScroll_BuildHblankWordTable(u32 *destination)
Builds the 512 tilemap words surrounding a sliding credits backdrop: blank margins,...
#define CREDITS_LAST_LINE_POSITION
#define CREDITS_OAM_ENTRIES
void DisplayScroll_InitObjectTable(void)
Allocates the credits sprites, builds the blank border and text rows, clears the tile ring and schedu...
u16 gFlash_Handler3
Credits scroll position in pixels, in the low half of a flash work cell.
#define CREDITS_FACES_SUBTITLE
void Graphics_ClearCharacterBlockAndPalette(s32 alternate)
Fills 30 KB of 256-color tiles with color 1 and clears 128 palette colors.
const void * gDisplayScroll_LineTable[]
Credits text, one row per line, terminated by 0.
#define CREDITS_LINE_TILES
#define CREDITS_RING_ROWS
#define CREDITS_VISIBLE_ROWS
#define CREDITS_BUFFER_BYTES
static const u8 sBlankCreditLine[]
Blank credits line.
#define CREDITS_RASTER_STRIDE
#define CREDITS_LINE_PIXELS
#define CREDITS_GRAPHICS_SUPPORT_LABEL
s32 DisplayScroll_RunSlideshow(void)
Crossfades the credits backdrop sequence through alternating tile banks while the staff names scroll ...
#define CREDITS_END_OF_TEXT
void DisplayScroll_StepPositionEveryFourFrames(void)
A VBlank task of the credits slideshow: drifts both backdrops together, keeping their horizontal offs...
s32 DisplayScroll_DrawLine(const u8 *text, s32 firstTile, s32 alignment)
Centers, right-aligns or left-aligns one credits line in a 192-pixel row.
void DisplayScroll_UpdateObjects(void)
A VBlank task scheduled by DisplayScroll_InitObjectTable: maps the visible sixteen rows onto the tile...
#define CREDITS_DECODER_HEAP_SLOT
The engine calls the debug menus import, and their palette swatch tiles.
DMA channel registers, and the DMA and CPU fills.
#define Dma_Fill32Cell(cell, value, destination, size)
Dma_Fill32 through the caller's own volatile word cell, so a function that fills several blocks keeps...
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
s32 GameFlag_TestFar(s32 flag)
s32 GameFlag_SetBitFar(s32 flag)
Game flags, named where their meaning is shown.
#define FLAG_SCENE_TEMP_00
const struct FlashType * gFlash
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
volatile u8 gCpuLoadDisplayEnabled
Debug: WaitFrames measures the CPU load into gCpuLoadPeak when set.
u32 gFrameTick
Counted up by every VBlank.
u8 gOamCopyEnabled
The VBlank handler copies the OAM list only while it is set; scenes clear it to keep their own sprite...
volatile u8 gIdleSleepEnabled
Sleep after three idle minutes.
The staff credits font's advance widths in pixels, characters 0x20 to 0x7f, beside the font (credits....
const u8 gDisplayScroll_GlyphWidths[96]
The screen blend's globals and the graphics routines.
const u8 gDisplayScroll_Font[]
u8 BattleEffect_ExpandCodeSize[]
const u8 BattleEffect_Expand[]
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
The heap's work slots and HeapState.
The hardware's I/O registers and their bits, as pret names them.
#define BGCNT_CHAR_BASE(block)
#define BGCNT_PRIORITY(n)
#define BG_SCREEN_BLOCK(n)
#define OAM_SIZE
OAM's size in bytes: 128 sprites of 8 bytes.
#define OBJ_VRAM0
Sprite tile memory, as pret names it: the 32 KB from 0x06010000.
#define BLDCNT_EFFECT_BLEND
weighted by REG_BLDALPHA
#define BGCNT_SCREEN_BASE(block)
#define DMA_COPY_WORDS(n)
The register write queue that VBlank carries out after each finished frame.
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped...
Io_Write16, a 16-bit write to a register or memory.
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
static s32 Iwram_FillWords(void *destination, s32 size, u32 value)
The heaps: allocating and freeing blocks.
void Runtime_ReleaseHeapBlock(s32 slot)
void MemFree(void *buffer)
The reel game's title lettering.
Copying ARM routines to RAM to run them there.
#define RamCode_LoadSlot(slot, code, bytes)
Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.
Resource numbers, named where their contents are known.
char ResourceId_SuhallaGateBackdrop
char ResourceId_TolbiShipInteriorsBackdrop
char ResourceId_TunnelRuinsBackdrop
char ResourceId_ImilFuchinFallsBackdrop
char ResourceId_LamakanDesertBackdrop
char ResourceId_VenusLighthouseBackdrop
char ResourceId_ValeStormBackdrop
char ResourceId_TretTreeBranchBackdrop
char ResourceId_ForestBackdrop
char ResourceId_VioletSkyBackdrop
char ResourceId_TolbiShipDeckBackdrop
char ResourceId_ColossoBackdrop
char ResourceId_MercuryLighthouseBackdrop
char ResourceId_AltinPeakBackdrop
char ResourceId_VenusLighthouseAerieBackdrop
char ResourceId_SolSanctumBackdrop
char ResourceId_MogallForestBackdrop
char ResourceId_SnowfieldBackdrop
char ResourceId_BeachBackdrop
char ResourceId_CrossboneIsleCaveBackdrop
char ResourceId_DuskCloudsBackdrop
char ResourceId_VenusLighthouseAerieStormBackdrop
char ResourceId_PirateShipBackdrop
char ResourceId_TretTreeInteriorsBackdrop
char ResourceId_GomaCaveBackdrop
char ResourceId_GrasslandBackdrop
char ResourceId_AltmillerCaveBackdrop
char ResourceId_MercuryLighthouseAerieBackdrop
char ResourceId_InteriorBackdrop
char ResourceId_BabiLighthouseBackdrop
char ResourceId_SuhallaDesertBackdrop
char ResourceId_KolimaForestBackdrop
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
void Scheduler_ResetTaskTable(void)
Empties the task table: every slot gets no routine, order 0xffff (sorted last) and no flags.
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
void * Resource_GetTableEntry(s32 index)
Returns the ROM address of resource index from the resource directory.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
void Ui_LoadWindowGraphics(void)
Loads the window font and frame tiles into BG character block 0, the window palette into BG palette 1...
void DebugText_Clear(void)
Blanks the debug text screen, homes the cursor and points BG0 at it.
The integer types, TRUE, UNUSED and the fixed-address macros.