From 9236084ad807cc1d2062d87217beb82a874119ec Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 6 Oct 2018 16:40:08 -0400 Subject: finish decompiling text.c --- src/text.c | 433 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 431 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/text.c b/src/text.c index 7832d86f3..bc5fd7a66 100644 --- a/src/text.c +++ b/src/text.c @@ -37,8 +37,6 @@ extern const struct FontInfo gFontInfos[]; extern const u8 gMenuCursorDimensions[][2]; -extern const u16 gFont9JapaneseGlyphs[]; - extern const u16 gFont8LatinGlyphs[]; extern const u8 gFont8LatinGlyphWidths[]; extern const u16 gFont0LatinGlyphs[]; @@ -53,6 +51,15 @@ extern const u16 gFont0JapaneseGlyphs[]; extern const u16 gFont1JapaneseGlyphs[]; extern const u16 gFont2JapaneseGlyphs[]; extern const u8 gFont2JapaneseGlyphWidths[]; +extern const u16 gFont4JapaneseGlyphs[]; +extern const u8 gFont4JapaneseGlyphWidths[]; +extern const u16 gFont4LatinGlyphs[]; +extern const u8 gFont4LatinGlyphWidths[]; +extern const u16 gFont5JapaneseGlyphs[]; +extern const u8 gFont5JapaneseGlyphWidths[]; +extern const u16 gFont5LatinGlyphs[]; +extern const u8 gFont5LatinGlyphWidths[]; +extern const u16 gFont9JapaneseGlyphs[]; u16 Font0Func(struct TextPrinter *textPrinter) { @@ -1438,3 +1445,425 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) RestoreTextColors(&colorBackup[0], &colorBackup[1], &colorBackup[2]); return 1; } + +// TODO: What is this? +struct Unk80062B0 { + u8 filler0[0x26]; + u16 unk26; + u8 filler28[0x6]; + s16 unk2E; + s16 unk30; +}; + +void sub_80062B0(struct Unk80062B0 *unkStruct) +{ + if(unkStruct->unk2E) + { + unkStruct->unk2E--; + } + else + { + unkStruct->unk2E = 8; + switch(unkStruct->unk30) + { + case 0: + unkStruct->unk26 = 0; + break; + case 1: + unkStruct->unk26 = 1; + break; + case 2: + unkStruct->unk26 = 2; + break; + case 3: + unkStruct->unk26 = 1; + unkStruct->unk30 = 0; + return; + } + unkStruct->unk30++; + } +} + +extern const struct SpriteSheet gUnknown_81EA68C[]; +extern const struct SpritePalette gUnknown_81EA6A4; +extern const struct SpriteTemplate gUnknown_81EA6B4; + +u8 sub_8006300(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) +{ + u8 spriteId; + LoadSpriteSheet(&gUnknown_81EA68C[sheetId & 1]); + LoadSpritePalette(&gUnknown_81EA6A4); + spriteId = CreateSprite(&gUnknown_81EA6B4, x + 3, y + 4, subpriority); + gSprites[spriteId].oam.priority = (priority & 3); + gSprites[spriteId].oam.matrixNum = 0; + gSprites[spriteId].data[0] = 8; + return spriteId; +} + +void sub_8006398(u8 spriteId) +{ + DestroySprite(&gSprites[spriteId]); + FreeSpriteTilesByTag(0x8000); + FreeSpritePaletteByTag(0x8000); +} + +u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) +{ + BlitBitmapRectToWindow( + windowId, + gKeypadIconTiles + (gKeypadIcons[keypadIconId].tile_offset * 0x20), + 0, + 0, + 0x80, + 0x80, + x, + y, + gKeypadIcons[keypadIconId].width, + gKeypadIcons[keypadIconId].height); + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconTileOffset(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].tile_offset; +} + +u8 GetKeypadIconWidth(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].width; +} + +u8 GetKeypadIconHeight(u8 keypadIconId) +{ + return gKeypadIcons[keypadIconId].height; +} + +void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == 1) + { + glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = 8; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + else + { + glyphs = gFont0LatinGlyphs + (0x10 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = gFont0LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 13; + } +} + +u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFont0LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + + if (isJapanese == TRUE) + { + int eff; + glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + gGlyphInfo[0x80] = 8; // gGlyphWidth + gGlyphInfo[0x81] = 16; // gGlyphHeight + } + else + { + glyphs = gFont1LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont1LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; + } +} + +u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + return 8; + else + return gFont1LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _080065F8 + { + glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else // _0800665C + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont2LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else // _0800669C + { + glyphs = gFont2LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont2LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; + } + } +} + +u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese) +{ + if (isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont2JapaneseGlyphWidths[glyphId]; + } + else + { + return gFont2LatinGlyphWidths[glyphId]; + } +} + +void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else + { + glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = 10; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + DecompressGlyphFont2(glyphId, isJapanese); +} + +u32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + return 10; + else + return gFont2LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _0800682C + { + glyphs = gFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else // _080068D0 + { + glyphs = gFont4LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 14; // gGlyphHeight + } + } +} + +u32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont4JapaneseGlyphWidths[glyphId]; + } + else + return gFont4LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) +{ + const u16* glyphs; + int i; + u8 lastColor; + + if(isJapanese == TRUE) + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // Game Freak, please. writing the same values over and over... + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; + } + } + else // _08006998 + { + glyphs = gFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 12; // gGlyphHeight + } + } + else + { + if(glyphId == 0) + { + lastColor = GetLastTextColor(2); + + for(i = 0; i < 0x80; i++) + { + gGlyphInfo[i] = lastColor | lastColor << 4; + // but why + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[0]; + gGlyphInfo[0x81] = 14; + } + } + else + { + glyphs = gFont5LatinGlyphs + (0x20 * glyphId); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; // gGlyphWidth + gGlyphInfo[0x81] = 14; // gGlyphHeight + } + } +} + +u32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese) +{ + if(isJapanese == TRUE) + { + if(glyphId == 0) + return 10; + + return gFont5JapaneseGlyphWidths[glyphId]; + } + else + return gFont5LatinGlyphWidths[glyphId]; +} + +void DecompressGlyphFont9(u16 glyphId) +{ + const u16* glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); + DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 12; +} -- cgit v1.2.3 From 4cd32e863617326cab9cb7347a55be8c6c6dc3ac Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 7 Oct 2018 00:14:45 -0400 Subject: migrate text rodata to C file --- src/text.c | 436 +++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 369 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/text.c b/src/text.c index bc5fd7a66..bb2f62f04 100644 --- a/src/text.c +++ b/src/text.c @@ -4,9 +4,12 @@ #include "string_util.h" #include "window.h" #include "text.h" +#include "sprite.h" extern u8 gGlyphInfo[0x90]; extern u8 gUnknown_203ADFA; +extern u16 gUnknown_841F408[]; +extern const struct OamData gUnknown_83AC9D0; extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); @@ -20,46 +23,358 @@ extern u8* UnkTextUtil_GetPtrI(u8 a1); TextFlags gTextFlags; -extern const u8 gDownArrowTiles[]; -extern const u8 gDarkDownArrowTiles[]; -extern const u8 gUnusedFRLGBlankedDownArrow[]; -extern const u8 gUnusedFRLGDownArrow[]; -extern const u8 gDownArrowYCoords[]; -extern const u8 gWindowVerticalScrollSpeeds[]; - -extern const struct GlyphWidthFunc gGlyphWidthFuncs[]; - -extern const struct KeypadIcon gKeypadIcons[]; - -extern const u8 gKeypadIconTiles[]; - -extern const struct FontInfo gFontInfos[]; - -extern const u8 gMenuCursorDimensions[][2]; - -extern const u16 gFont8LatinGlyphs[]; -extern const u8 gFont8LatinGlyphWidths[]; -extern const u16 gFont0LatinGlyphs[]; -extern const u8 gFont0LatinGlyphWidths[]; -extern const u16 gFont7LatinGlyphs[]; -extern const u8 gFont7LatinGlyphWidths[]; -extern const u16 gFont2LatinGlyphs[]; -extern const u8 gFont2LatinGlyphWidths[]; -extern const u16 gFont1LatinGlyphs[]; -extern const u8 gFont1LatinGlyphWidths[]; -extern const u16 gFont0JapaneseGlyphs[]; -extern const u16 gFont1JapaneseGlyphs[]; -extern const u16 gFont2JapaneseGlyphs[]; -extern const u8 gFont2JapaneseGlyphWidths[]; -extern const u16 gFont4JapaneseGlyphs[]; -extern const u8 gFont4JapaneseGlyphWidths[]; -extern const u16 gFont4LatinGlyphs[]; -extern const u8 gFont4LatinGlyphWidths[]; -extern const u16 gFont5JapaneseGlyphs[]; -extern const u8 gFont5JapaneseGlyphWidths[]; -extern const u16 gFont5LatinGlyphs[]; -extern const u8 gFont5LatinGlyphWidths[]; -extern const u16 gFont9JapaneseGlyphs[]; +const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4bpp"); +const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); +const u8 gTinyArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_2.4bpp"); +const u8 gTinyDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS_2.4bpp"); +const u8 gDoubleArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); + +const u8 gDownArrowYCoords[] = { 0x0, 0x10, 0x20, 0x10 }; +const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2 , 0x4 , 0x0 }; + +const struct GlyphWidthFunc gGlyphWidthFuncs[] = { + { 0x0, GetGlyphWidthFont0 }, + { 0x1, GetGlyphWidthFont1 }, + { 0x2, GetGlyphWidthFont2 }, + { 0x3, GetGlyphWidthFont3 }, + { 0x4, GetGlyphWidthFont4 }, + { 0x5, GetGlyphWidthFont5 }, + { 0x6, GetGlyphWidthFont6 } +}; + +const struct SpriteSheet gUnknown_81EA68C[] = +{ + {gDoubleArrowTiles, 0x0080, 0x8000}, + {gDoubleArrowTiles + 0x80, 0x0080, 0x8000}, + {NULL} +}; + +const struct SpritePalette gUnknown_81EA6A4[] = +{ + {gUnknown_841F408, 0x8000}, + {NULL} +}; + +const struct SpriteTemplate gUnknown_81EA6B4 = +{ + .tileTag = 0x8000, + .paletteTag = 0x8000, + .oam = &gUnknown_83AC9D0, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80062B0, +}; + +const struct KeypadIcon gKeypadIcons[] = { + { 0x0, 0x8, 0xC }, + { 0x1, 0x8, 0xC }, + { 0x2, 0x10, 0xC }, + { 0x4, 0x10, 0xC }, + { 0x6, 0x18, 0xC }, + { 0x9, 0x18, 0xC }, + { 0xC, 0x8, 0xC }, + { 0xD, 0x8, 0xC }, + { 0xE, 0x8, 0xC }, + { 0xF, 0x8, 0xC }, + { 0x20, 0x8, 0xC }, + { 0x21, 0x8, 0xC }, + { 0x22, 0x8, 0xC }, +}; + +const u8 gKeypadIconTiles[] = INCBIN_U8("data/graphics/fonts/keypad_icons.4bpp"); + +// Font 0 +const u16 gFont0LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font0_latin.latfont"); +const u8 gFont0LatinGlyphWidths[] = +{ + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x04, 0x04, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x04, 0x05, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x08, 0x07, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x07, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x07, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x08, 0x05, 0x08, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, 0x05, + 0x05, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x08, 0x07, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, + 0x05, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05 +}; +const u16 gFont0JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font0_jap.fwjpnfont"); + +// Font 1 +const u16 gFont1LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font1_latin.latfont"); +const u8 gFont1LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont1JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font1_jap.fwjpnfont"); + +// Font 2 +const u16 gFont2LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font2_latin.latfont"); +const u8 gFont2LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont2JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font2_jap.fwjpnfont"); +const u8 gFont2JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 4 +const u16 gFont4LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font4_latin.latfont"); +const u8 gFont4LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont4JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font4_jap.fwjpnfont"); +const u8 gFont4JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 5 +const u16 gFont5LatinGlyphs[] = INCBIN_U16("data/graphics/fonts/font5_latin.latfont"); +const u8 gFont5LatinGlyphWidths[] = +{ + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x09, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0A, 0x08, 0x05, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x06, 0x08, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x03, 0x03, 0x06, + 0x06, 0x08, 0x05, 0x09, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x04, 0x06, 0x05, + 0x05, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x08, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06 +}; +const u16 gFont5JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font5_jap.fwjpnfont"); +const u8 gFont5JapaneseGlyphWidths[] = +{ + 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x09, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x05, 0x09, 0x0A, 0x0A, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A, 0x08, + 0x08, 0x08, 0x0A, 0x0A, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x04, 0x06, + 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, + 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 +}; + +// Font 9 +const u16 gFont9JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font9_jap.fwjpnfont"); u16 Font0Func(struct TextPrinter *textPrinter) { @@ -989,7 +1304,7 @@ _08005CD0:\n\ ldrb r2, [r6, 0x1F]\n\ cmp r2, 0\n\ beq _08005D40\n\ - ldr r4, _08005D04 @ =gUnknown_81EA650\n\ + ldr r4, _08005D04 @ =gWindowVerticalScrollSpeeds\n\ ldr r5, _08005D08 @ =gSaveBlock2Ptr\n\ ldr r0, [r5]\n\ ldrb r0, [r0, 0x14]\n\ @@ -1011,7 +1326,7 @@ _08005CD0:\n\ strb r0, [r6, 0x1F]\n\ b _08005D36\n\ .align 2, 0\n\ -_08005D04: .4byte gUnknown_81EA650\n\ +_08005D04: .4byte gWindowVerticalScrollSpeeds\n\ _08005D08: .4byte gSaveBlock2Ptr\n\ _08005D0C:\n\ ldrb r0, [r6, 0x4]\n\ @@ -1446,53 +1761,40 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) return 1; } -// TODO: What is this? -struct Unk80062B0 { - u8 filler0[0x26]; - u16 unk26; - u8 filler28[0x6]; - s16 unk2E; - s16 unk30; -}; - -void sub_80062B0(struct Unk80062B0 *unkStruct) +void sub_80062B0(struct Sprite *sprite) { - if(unkStruct->unk2E) + if(sprite->data[0]) { - unkStruct->unk2E--; + sprite->data[0]--; } else { - unkStruct->unk2E = 8; - switch(unkStruct->unk30) + sprite->data[0] = 8; + switch(sprite->data[1]) { case 0: - unkStruct->unk26 = 0; + sprite->pos2.y = 0; break; case 1: - unkStruct->unk26 = 1; + sprite->pos2.y = 1; break; case 2: - unkStruct->unk26 = 2; + sprite->pos2.y = 2; break; case 3: - unkStruct->unk26 = 1; - unkStruct->unk30 = 0; + sprite->pos2.y = 1; + sprite->data[1] = 0; return; } - unkStruct->unk30++; + sprite->data[1]++; } } -extern const struct SpriteSheet gUnknown_81EA68C[]; -extern const struct SpritePalette gUnknown_81EA6A4; -extern const struct SpriteTemplate gUnknown_81EA6B4; - u8 sub_8006300(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) { u8 spriteId; LoadSpriteSheet(&gUnknown_81EA68C[sheetId & 1]); - LoadSpritePalette(&gUnknown_81EA6A4); + LoadSpritePalette(gUnknown_81EA6A4); spriteId = CreateSprite(&gUnknown_81EA6B4, x + 3, y + 4, subpriority); gSprites[spriteId].oam.priority = (priority & 3); gSprites[spriteId].oam.matrixNum = 0; -- cgit v1.2.3 From 77f8b38417393b8639912efbcc18f7ac610549c1 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 7 Oct 2018 01:01:45 -0400 Subject: address comments --- src/text.c | 91 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 46 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/text.c b/src/text.c index bb2f62f04..7fb0ab034 100644 --- a/src/text.c +++ b/src/text.c @@ -27,7 +27,8 @@ const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4 const u8 gDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS.4bpp"); const u8 gTinyArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_2.4bpp"); const u8 gTinyDarkDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_RS_2.4bpp"); -const u8 gDoubleArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); +const u8 gDoubleArrowTiles1[] = INCBIN_U8("data/graphics/fonts/down_arrow_3.4bpp"); +const u8 gDoubleArrowTiles2[] = INCBIN_U8("data/graphics/fonts/down_arrow_4.4bpp"); const u8 gDownArrowYCoords[] = { 0x0, 0x10, 0x20, 0x10 }; const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2 , 0x4 , 0x0 }; @@ -44,8 +45,8 @@ const struct GlyphWidthFunc gGlyphWidthFuncs[] = { const struct SpriteSheet gUnknown_81EA68C[] = { - {gDoubleArrowTiles, 0x0080, 0x8000}, - {gDoubleArrowTiles + 0x80, 0x0080, 0x8000}, + {gDoubleArrowTiles1, sizeof(gDoubleArrowTiles1), 0x8000}, + {gDoubleArrowTiles2, sizeof(gDoubleArrowTiles2), 0x8000}, {NULL} }; @@ -1849,8 +1850,8 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese) glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); - gGlyphInfo[0x80] = 8; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 12; } else { @@ -1879,9 +1880,9 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese) int eff; glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 - gGlyphInfo[0x80] = 8; // gGlyphWidth - gGlyphInfo[0x81] = 16; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + gGlyphInfo[0x80] = 8; + gGlyphInfo[0x81] = 16; } else { @@ -1923,18 +1924,18 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _080065F8 + else { glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont2JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } - else // _0800665C + else { if(glyphId == 0) { @@ -1948,7 +1949,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 14; } } - else // _0800669C + else { glyphs = gFont2LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); @@ -2000,11 +2001,11 @@ void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) { glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = 10; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = 10; + gGlyphInfo[0x81] = 12; } } else @@ -2039,15 +2040,15 @@ void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _0800682C + else { glyphs = gFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont4JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } else @@ -2064,15 +2065,15 @@ void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 14; } } - else // _080068D0 + else { glyphs = gFont4LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 14; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont4LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; } } } @@ -2110,15 +2111,15 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) gGlyphInfo[0x81] = 12; } } - else // _08006998 + else { glyphs = gFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 12; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont5JapaneseGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 12; } } else @@ -2139,11 +2140,11 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese) { glyphs = gFont5LatinGlyphs + (0x20 * glyphId); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); // gUnknown_03002FD0 - DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FB0 - DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); // gUnknown_03002FF0 - gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; // gGlyphWidth - gGlyphInfo[0x81] = 14; // gGlyphHeight + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); + DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); + DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); + gGlyphInfo[0x80] = gFont5LatinGlyphWidths[glyphId]; + gGlyphInfo[0x81] = 14; } } } @@ -2165,7 +2166,7 @@ void DecompressGlyphFont9(u16 glyphId) { const u16* glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); // gUnknown_03002FD0 + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); gGlyphInfo[0x80] = 8; gGlyphInfo[0x81] = 12; } -- cgit v1.2.3 From 7040e8e9568a21ef8417c7de6e47fd636dcd7865 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 12:10:33 -0400 Subject: sub_8146C30 --- src/menews_jisan.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/menews_jisan.c (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c new file mode 100644 index 000000000..afaef7cf9 --- /dev/null +++ b/src/menews_jisan.c @@ -0,0 +1,74 @@ +#include "global.h" +#include "mevent.h" +#include "random.h" + +#ifdef NONMATCHING +void sub_8146C30(u32 a0) +{ + struct MysteryEventStruct *r5 = sub_8143D94(); + + r5->unk_0_0 = a0; + asm_comment("The switch logic does not match. Specifically, the \"bhi\" is replaced with a \"bls\" and the comparisons with 1 and 3 are swapped chronologically."); + switch (a0) + { + case 0: + r5->unk_1 = (Random() % 15) + 16; + break; + case 1: + break; + case 2: + break; + case 3: + r5->unk_1 = (Random() % 15) + 1; + break; + } +} +#else +NAKED +void sub_8146C30(u32 a0) +{ + asm_unified("\tpush {r4,r5,lr}\n" + "\tadds r4, r0, 0\n" + "\tbl sub_8143D94\n" + "\tadds r5, r0, 0\n" + "\tmovs r0, 0x3\n" + "\tadds r1, r4, 0\n" + "\tands r1, r0\n" + "\tldrb r2, [r5]\n" + "\tmovs r0, 0x4\n" + "\tnegs r0, r0\n" + "\tands r0, r2\n" + "\torrs r0, r1\n" + "\tstrb r0, [r5]\n" + "\tcmp r4, 0x2\n" + "\tbhi _08146C56\n" + "\tcmp r4, 0x1\n" + "\tbcs _08146C5C\n" + "\tb _08146C80\n" + "_08146C56:\n" + "\tcmp r4, 0x3\n" + "\tbeq _08146C6E\n" + "\tb _08146C80\n" + "_08146C5C:\n" + "\tbl Random\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tmovs r1, 0xF\n" + "\tbl __umodsi3\n" + "\tadds r0, 0x10\n" + "\tb _08146C7E\n" + "_08146C6E:\n" + "\tbl Random\n" + "\tlsls r0, 16\n" + "\tlsrs r0, 16\n" + "\tmovs r1, 0xF\n" + "\tbl __umodsi3\n" + "\tadds r0, 0x1\n" + "_08146C7E:\n" + "\tstrb r0, [r5, 0x1]\n" + "_08146C80:\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif -- cgit v1.2.3 From 4dd5029fdc505636d8ac00add5425bb22fd082ba Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:24:44 -0400 Subject: sub_8146CA4 --- src/menews_jisan.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c index afaef7cf9..6e9be8318 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -1,6 +1,7 @@ #include "global.h" #include "mevent.h" #include "random.h" +#include "event_data.h" #ifdef NONMATCHING void sub_8146C30(u32 a0) @@ -72,3 +73,27 @@ void sub_8146C30(u32 a0) "\tbx r0"); } #endif + +void sub_8146C88(void) +{ + struct MysteryEventStruct *r5 = sub_8143D94(); + + r5->unk_0_0 = 0; + r5->unk_0_2 = 0; + r5->unk_0_5 = 0; + r5->unk_1 = 0; + VarSet(0x4028, 0); +} + +void sub_8146CA4(void) +{ + u16 *r4 = sub_806E454(0x4028); + struct MysteryEventStruct *r5 = sub_8143D94(); + struct MysteryEventStruct r0 = *r5; + + if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3) + { + r5->unk_0_5 = 0; + *r4 = 0; + } +} -- cgit v1.2.3 From 6b27e999f242f51a81bef70c40a378d5adbaf9e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:40:46 -0400 Subject: through sub_8146D94 --- src/menews_jisan.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 6e9be8318..93f98ab7a 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -3,6 +3,14 @@ #include "random.h" #include "event_data.h" +extern EWRAM_DATA u16 gUnknown_20370D0; + +u32 sub_8146D74(struct MysteryEventStruct *); +void sub_8146DD8(struct MysteryEventStruct *); +u16 sub_8146E0C(struct MysteryEventStruct *); +void sub_8146DA0(struct MysteryEventStruct *); +void sub_8146D94(struct MysteryEventStruct *); + #ifdef NONMATCHING void sub_8146C30(u32 a0) { @@ -88,12 +96,66 @@ void sub_8146C88(void) void sub_8146CA4(void) { u16 *r4 = sub_806E454(0x4028); - struct MysteryEventStruct *r5 = sub_8143D94(); - struct MysteryEventStruct r0 = *r5; + struct MysteryEventStruct *r2 = sub_8143D94(); + struct MysteryEventStruct r0 = *r2; if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3) { - r5->unk_0_5 = 0; + r2->unk_0_5 = 0; *r4 = 0; } } + +u16 sub_8146CE8(void) +{ + u16 *r6 = &gUnknown_20370D0; + struct MysteryEventStruct *r4 = sub_8143D94(); + u16 r5; + + if (!sub_806E2BC() || !sub_8143E1C()) + return 0; + + r5 = sub_8146E0C(r4); + + switch (r5) + { + case 0: + break; + case 1: + *r6 = sub_8146D74(r4); + break; + case 2: + *r6 = sub_8146D74(r4); + break; + case 3: + break; + case 4: + *r6 = sub_8146D74(r4); + sub_8146DA0(r4); + break; + case 5: + *r6 = sub_8146D74(r4); + sub_8146D94(r4); + break; + case 6: + break; + } + + return r5; +} + +u32 sub_8146D74(struct MysteryEventStruct *a0) +{ + u32 r4; + + a0->unk_0_0 = 0; + r4 = a0->unk_1 + 0x84; + a0->unk_1 = 0; + sub_8146DD8(a0); + return r4; +} + +void sub_8146D94(struct MysteryEventStruct *a0) +{ + a0->unk_0_2 = 0; +} -- cgit v1.2.3 From d348c44eb66a30d50a742d900760826a863c5759 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:58:51 -0400 Subject: Finish decompile of menews_jisan.s --- src/menews_jisan.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 93f98ab7a..6c3f669eb 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -7,7 +7,7 @@ extern EWRAM_DATA u16 gUnknown_20370D0; u32 sub_8146D74(struct MysteryEventStruct *); void sub_8146DD8(struct MysteryEventStruct *); -u16 sub_8146E0C(struct MysteryEventStruct *); +u32 sub_8146E0C(struct MysteryEventStruct *); void sub_8146DA0(struct MysteryEventStruct *); void sub_8146D94(struct MysteryEventStruct *); @@ -159,3 +159,42 @@ void sub_8146D94(struct MysteryEventStruct *a0) { a0->unk_0_2 = 0; } + +void sub_8146DA0(struct MysteryEventStruct *a0) +{ + a0->unk_0_2++; + if ((u8)a0->unk_0_2 > 4) + a0->unk_0_2 = 4; +} + +void sub_8146DD8(struct MysteryEventStruct *a0) +{ + a0->unk_0_5++; + if ((u8)a0->unk_0_5 > 5) + a0->unk_0_5 = 5; +} + +u32 sub_8146E0C(struct MysteryEventStruct *a0) +{ + struct MysteryEventStruct r0; + if ((u8)a0->unk_0_5 == 5) + return 6; + + r0 = *a0; + switch (r0.unk_0_0) + { + case 0: + return 3; + case 1: + return 1; + case 2: + return 2; + case 3: + if ((u8)r0.unk_0_2 < 3) + return 4; + return 5; + default: + AGBAssert("C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383, "0", 1); + return 0; + } +} -- cgit v1.2.3 From eda4a9f9406aa2ef3fe91006e134f44b07035081 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 14:59:48 -0400 Subject: Use the macro ya dummy --- src/menews_jisan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c index 6c3f669eb..dd1376c26 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -194,7 +194,7 @@ u32 sub_8146E0C(struct MysteryEventStruct *a0) return 4; return 5; default: - AGBAssert("C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383, "0", 1); + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/menews_jisan.c", 383); return 0; } } -- cgit v1.2.3 From 1d50bcb0b95e52fb43c22a3348ac033b3534f860 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 8 Oct 2018 16:02:11 -0400 Subject: Cleanup and create menews_jisan header --- src/menews_jisan.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/menews_jisan.c b/src/menews_jisan.c index dd1376c26..7dfcee939 100644 --- a/src/menews_jisan.c +++ b/src/menews_jisan.c @@ -2,14 +2,13 @@ #include "mevent.h" #include "random.h" #include "event_data.h" +#include "menews_jisan.h" -extern EWRAM_DATA u16 gUnknown_20370D0; - -u32 sub_8146D74(struct MysteryEventStruct *); -void sub_8146DD8(struct MysteryEventStruct *); -u32 sub_8146E0C(struct MysteryEventStruct *); -void sub_8146DA0(struct MysteryEventStruct *); -void sub_8146D94(struct MysteryEventStruct *); +static u32 sub_8146D74(struct MysteryEventStruct *); +static void sub_8146DD8(struct MysteryEventStruct *); +static u32 sub_8146E0C(struct MysteryEventStruct *); +static void sub_8146DA0(struct MysteryEventStruct *); +static void sub_8146D94(struct MysteryEventStruct *); #ifdef NONMATCHING void sub_8146C30(u32 a0) @@ -144,7 +143,7 @@ u16 sub_8146CE8(void) return r5; } -u32 sub_8146D74(struct MysteryEventStruct *a0) +static u32 sub_8146D74(struct MysteryEventStruct *a0) { u32 r4; @@ -155,26 +154,26 @@ u32 sub_8146D74(struct MysteryEventStruct *a0) return r4; } -void sub_8146D94(struct MysteryEventStruct *a0) +static void sub_8146D94(struct MysteryEventStruct *a0) { a0->unk_0_2 = 0; } -void sub_8146DA0(struct MysteryEventStruct *a0) +static void sub_8146DA0(struct MysteryEventStruct *a0) { a0->unk_0_2++; if ((u8)a0->unk_0_2 > 4) a0->unk_0_2 = 4; } -void sub_8146DD8(struct MysteryEventStruct *a0) +static void sub_8146DD8(struct MysteryEventStruct *a0) { a0->unk_0_5++; if ((u8)a0->unk_0_5 > 5) a0->unk_0_5 = 5; } -u32 sub_8146E0C(struct MysteryEventStruct *a0) +static u32 sub_8146E0C(struct MysteryEventStruct *a0) { struct MysteryEventStruct r0; if ((u8)a0->unk_0_5 == 5) -- cgit v1.2.3