finish decompiling text.c

This commit is contained in:
ProjectRevoTPP
2018-10-06 16:40:08 -04:00
parent 2cb551cf0d
commit 9236084ad8
5 changed files with 454 additions and 1134 deletions
+2 -2
View File
@@ -1322,7 +1322,7 @@ _0813C2D4:
bl GetKeypadIconTileOffset
lsls r0, 24
lsrs r0, 19
ldr r1, _0813C344 @ =gUnknown_81EA700
ldr r1, _0813C344 @ =gKeypadIconTiles
adds r0, r1
str r0, [sp, 0x14]
add r1, sp, 0x14
@@ -1365,7 +1365,7 @@ _0813C2D4:
bl GetKeypadIconWidth
b _0813C38E
.align 2, 0
_0813C344: .4byte gUnknown_81EA700
_0813C344: .4byte gKeypadIconTiles
_0813C348:
mov r0, r9
ldrb r1, [r0]
-1108
View File
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -24,65 +24,65 @@ gUnknown_81EA6A4:: @ 81EA6A4
gUnknown_81EA6B4:: @ 81EA6B4
.incbin "baserom.gba", 0x1EA6B4, 0x18
gUnknown_81EA6CC:: @ 81EA6CC
gKeypadIcons:: @ 81EA6CC
.incbin "baserom.gba", 0x1EA6CC, 0x34
gUnknown_81EA700:: @ 81EA700
gKeypadIconTiles:: @ 81EA700
.incbin "baserom.gba", 0x1EA700, 0x800
gUnknown_81EAF00:: @ 81EAF00
gFont0LatinGlyphs:: @ 81EAF00
.incbin "baserom.gba", 0x1EAF00, 0x4000
gUnknown_81EEF00:: @ 81EEF00
gFont0LatinGlyphWidths:: @ 81EEF00
.incbin "baserom.gba", 0x1EEF00, 0x200
gUnknown_81EF100:: @ 81EF100
gFont0JapaneseGlyphs:: @ 81EF100
.incbin "baserom.gba", 0x1EF100, 0x4000
gUnknown_81F3100:: @ 81F3100
gFont1LatinGlyphs:: @ 81F3100
.incbin "baserom.gba", 0x1F3100, 0x8000
gUnknown_81FB100:: @ 81FB100
gFont1LatinGlyphWidths:: @ 81FB100
.incbin "baserom.gba", 0x1FB100, 0x200
gUnknown_81FB300:: @ 81FB300
gFont1JapaneseGlyphs:: @ 81FB300
.incbin "baserom.gba", 0x1FB300, 0x4000
gUnknown_81FF300:: @ 81FF300
gFont2LatinGlyphs:: @ 81FF300
.incbin "baserom.gba", 0x1FF300, 0x8000
gUnknown_8207300:: @ 8207300
gFont2LatinGlyphWidths:: @ 8207300
.incbin "baserom.gba", 0x207300, 0x200
gUnknown_8207500:: @ 8207500
gFont2JapaneseGlyphs:: @ 8207500
.incbin "baserom.gba", 0x207500, 0x8000
gUnknown_820F500:: @ 820F500
gFont2JapaneseGlyphWidths:: @ 820F500
.incbin "baserom.gba", 0x20F500, 0x118
gUnknown_820F618:: @ 820F618
gFont4LatinGlyphs:: @ 820F618
.incbin "baserom.gba", 0x20F618, 0x8000
gUnknown_8217618:: @ 8217618
gFont4LatinGlyphWidths:: @ 8217618
.incbin "baserom.gba", 0x217618, 0x200
gUnknown_8217818:: @ 8217818
gFont4JapaneseGlyphs:: @ 8217818
.incbin "baserom.gba", 0x217818, 0x8000
gUnknown_821F818:: @ 821F818
gFont4JapaneseGlyphWidths:: @ 821F818
.incbin "baserom.gba", 0x21F818, 0x118
gUnknown_821F930:: @ 821F930
gFont5LatinGlyphs:: @ 821F930
.incbin "baserom.gba", 0x21F930, 0x8000
gUnknown_8227930:: @ 8227930
gFont5LatinGlyphWidths:: @ 8227930
.incbin "baserom.gba", 0x227930, 0x200
gUnknown_8227B30:: @ 8227B30
gFont5JapaneseGlyphs:: @ 8227B30
.incbin "baserom.gba", 0x227B30, 0x8000
gUnknown_822FB30:: @ 822FB30
gFont5JapaneseGlyphWidths:: @ 822FB30
.incbin "baserom.gba", 0x22FB30, 0x118
gUnknown_822FC48:: @ 822FC48
gFont9JapaneseGlyphs:: @ 822FC48
.incbin "baserom.gba", 0x22FC48, 0x2000
-1
View File
@@ -58,7 +58,6 @@ SECTIONS {
asm/blit.o(.text);
src/window_8bpp.o(.text);
src/text.o(.text);
asm/text.o(.text);
src/sprite.o(.text);
src/string_util.o(.text);
asm/link.o(.text);
+431 -2
View File
@@ -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;
}