Continue disassembling text.s

This commit is contained in:
Diegoisawesome 2017-03-08 14:44:44 -06:00
parent c47e109fbf
commit 1d95689766
4 changed files with 863 additions and 820 deletions

View File

@ -5,811 +5,6 @@
.text
thumb_func_start RunTextPrinters
@ void RunTextPrinters()
RunTextPrinters: @ 8004778
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r0, =gUnknown_03002F84
ldrb r0, [r0]
cmp r0, 0
bne _080047F6
ldr r0, =gTextPrinters
movs r6, 0
adds r5, r0, 0x4
mov r8, r0
movs r7, 0x1F
_08004790:
ldrb r0, [r5, 0x17]
cmp r0, 0
beq _080047E8
mov r0, r8
bl RenderFont
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x1
beq _080047E4
cmp r4, 0x1
bgt _080047B8
cmp r4, 0
beq _080047BE
b _080047E8
.pool
_080047B8:
cmp r4, 0x3
beq _080047C6
b _080047E8
_080047BE:
ldrb r0, [r5]
movs r1, 0x2
bl CopyWindowToVram
_080047C6:
ldr r1, =gTextPrinters
adds r0, r1, 0
adds r0, 0x10
adds r0, r6, r0
ldr r2, [r0]
cmp r2, 0
beq _080047E8
adds r0, r6, r1
adds r1, r4, 0
bl _call_via_r2
b _080047E8
.pool
_080047E4:
movs r0, 0
strb r0, [r5, 0x17]
_080047E8:
adds r6, 0x24
adds r5, 0x24
movs r0, 0x24
add r8, r0
subs r7, 0x1
cmp r7, 0
bge _08004790
_080047F6:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end RunTextPrinters
thumb_func_start IsTextPrinterActive
@ bool8 IsTextPrinterActive(u8 id)
IsTextPrinterActive: @ 8004800
lsls r0, 24
lsrs r0, 24
ldr r2, =gTextPrinters
lsls r1, r0, 3
adds r1, r0
lsls r1, 2
adds r1, r2
ldrb r0, [r1, 0x1B]
bx lr
.pool
thumb_func_end IsTextPrinterActive
thumb_func_start RenderFont
@ u16 RenderFont(struct TextPrinter *textPrinter)
RenderFont: @ 8004818
push {r4,lr}
adds r4, r0, 0
_0800481C:
ldrb r1, [r4, 0x5]
ldr r0, =gFonts
ldr r2, [r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 2
adds r0, r2
ldr r1, [r0]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 16
lsrs r0, 16
cmp r0, 0x2
beq _0800481C
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end RenderFont
thumb_func_start GenerateFontHalfRowLookupTable
@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
GenerateFontHalfRowLookupTable: @ 8004844
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x24
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
lsls r2, 24
lsrs r2, 24
ldr r3, =gUnknown_03000948
ldr r4, =gUnknown_030009EA
strh r1, [r4]
ldr r4, =gUnknown_030009EC
strh r0, [r4]
ldr r4, =gUnknown_030009EE
strh r2, [r4]
lsls r5, r1, 12
lsls r6, r0, 12
lsls r4, r2, 12
mov r8, r4
lsls r7, r1, 8
str r7, [sp]
lsls r4, r1, 4
mov r9, r4
orrs r7, r4
str r7, [sp, 0x4]
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
lsls r7, r0, 8
mov r10, r7
mov r4, r10
mov r7, r9
orrs r4, r7
str r4, [sp, 0x8]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
lsls r7, r2, 8
mov r12, r7
mov r4, r12
mov r7, r9
orrs r4, r7
str r4, [sp, 0xC]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
lsls r7, r0, 4
mov r9, r7
ldr r4, [sp]
orrs r4, r7
str r4, [sp, 0x10]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
mov r7, r10
adds r4, r7, 0
mov r7, r9
orrs r4, r7
str r4, [sp, 0x14]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
mov r7, r12
adds r4, r7, 0
mov r7, r9
orrs r4, r7
str r4, [sp, 0x18]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
lsls r7, r2, 4
mov r9, r7
mov r4, r9
ldr r7, [sp]
orrs r7, r4
str r7, [sp, 0x1C]
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
mov r7, r9
mov r4, r10
orrs r4, r7
str r4, [sp, 0x20]
adds r7, r4, 0
orrs r7, r1
adds r4, r5, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
adds r4, r6, 0
orrs r4, r7
strh r4, [r3]
adds r3, 0x2
mov r4, r8
orrs r7, r4
strh r7, [r3]
adds r3, 0x2
mov r4, r12
mov r7, r9
orrs r4, r7
adds r7, r4, 0
orrs r7, r1
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x4]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x8]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0xC]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x10]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x14]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x18]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x1C]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
ldr r7, [sp, 0x20]
orrs r7, r0
adds r1, r5, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
adds r1, r6, 0
orrs r1, r7
strh r1, [r3]
adds r3, 0x2
mov r1, r8
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
adds r7, r4, 0
orrs r7, r0
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r0, [sp, 0x4]
orrs r7, r0
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
orrs r7, r1
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x8]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0xC]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x10]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x14]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x18]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x1C]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
ldr r1, [sp, 0x20]
orrs r7, r1
adds r0, r5, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
adds r0, r6, 0
orrs r0, r7
strh r0, [r3]
adds r3, 0x2
mov r0, r8
orrs r7, r0
strh r7, [r3]
adds r3, 0x2
adds r7, r2, 0
orrs r7, r4
orrs r5, r7
strh r5, [r3]
adds r3, 0x2
orrs r6, r7
strh r6, [r3]
orrs r0, r7
strh r0, [r3, 0x2]
add sp, 0x24
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end GenerateFontHalfRowLookupTable
thumb_func_start SaveTextColors
@ void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
SaveTextColors: @ 8004BE0
ldr r3, =gUnknown_030009EA
ldrh r3, [r3]
strb r3, [r1]
ldr r1, =gUnknown_030009EC
ldrh r1, [r1]
strb r1, [r0]
ldr r0, =gUnknown_030009EE
ldrh r0, [r0]
strb r0, [r2]
bx lr
.pool
thumb_func_end SaveTextColors
thumb_func_start RestoreTextColors
@ void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
RestoreTextColors: @ 8004C00
push {lr}
ldrb r0, [r0]
ldrb r1, [r1]
ldrb r2, [r2]
bl GenerateFontHalfRowLookupTable
pop {r0}
bx r0
thumb_func_end RestoreTextColors
thumb_func_start DecompressGlyphTile
@ void DecompressGlyphTile(u16 *src, u32 *dest)
DecompressGlyphTile: @ 8004C10
push {r4-r7,lr}
mov r7, r8
push {r7}
ldrh r7, [r0]
ldr r5, =gUnknown_03000948
ldr r4, =gFontHalfRowOffsets
movs r2, 0xFF
mov r8, r2
adds r2, r7, 0
mov r3, r8
ands r2, r3
adds r2, r4
ldrb r2, [r2]
lsls r2, 1
adds r2, r5
ldrh r3, [r2]
lsls r3, 16
lsrs r2, r7, 8
adds r2, r4
ldrb r2, [r2]
lsls r2, 1
adds r2, r5
ldrh r2, [r2]
orrs r3, r2
adds r6, r1, 0
stm r6!, {r3}
ldrh r7, [r0, 0x2]
adds r0, 0x4
adds r2, r7, 0
mov r3, r8
ands r2, r3
adds r2, r4
ldrb r2, [r2]
lsls r2, 1
adds r2, r5
ldrh r3, [r2]
lsls r3, 16
lsrs r2, r7, 8
adds r2, r4
ldrb r2, [r2]
lsls r2, 1
adds r2, r5
ldrh r2, [r2]
orrs r3, r2
str r3, [r1, 0x4]
adds r6, 0x4
ldrh r7, [r0]
adds r0, 0x2
adds r1, r7, 0
mov r2, r8
ands r1, r2
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r2, [r1]
lsls r2, 16
lsrs r1, r7, 8
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r1, [r1]
orrs r2, r1
stm r6!, {r2}
ldrh r7, [r0]
adds r0, 0x2
adds r1, r7, 0
mov r3, r8
ands r1, r3
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r2, [r1]
lsls r2, 16
lsrs r1, r7, 8
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r1, [r1]
orrs r2, r1
stm r6!, {r2}
ldrh r7, [r0]
adds r0, 0x2
adds r1, r7, 0
ands r1, r3
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r2, [r1]
lsls r2, 16
lsrs r1, r7, 8
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r1, [r1]
orrs r2, r1
stm r6!, {r2}
ldrh r7, [r0]
adds r0, 0x2
adds r1, r7, 0
ands r1, r3
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r2, [r1]
lsls r2, 16
lsrs r1, r7, 8
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r1, [r1]
orrs r2, r1
stm r6!, {r2}
ldrh r7, [r0]
adds r1, r7, 0
ands r1, r3
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r2, [r1]
lsls r2, 16
lsrs r1, r7, 8
adds r1, r4
ldrb r1, [r1]
lsls r1, 1
adds r1, r5
ldrh r1, [r1]
orrs r2, r1
stm r6!, {r2}
ldrh r7, [r0, 0x2]
adds r0, r7, 0
ands r0, r3
adds r0, r4
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
ldrh r1, [r0]
lsls r1, 16
lsrs r0, r7, 8
adds r0, r4
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
ldrh r0, [r0]
orrs r1, r0
str r1, [r6]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end DecompressGlyphTile
thumb_func_start GetLastTextColor
@ u8 GetLastTextColor(u8 colorType)
GetLastTextColor: @ 8004D58
push {lr}
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
cmp r0, 0x1
beq _08004D8C
cmp r0, 0x1
bgt _08004D6E
cmp r0, 0
beq _08004D74
b _08004D98
_08004D6E:
cmp r1, 0x2
beq _08004D80
b _08004D98
_08004D74:
ldr r0, =gUnknown_030009EC
ldrb r0, [r0]
b _08004D9A
.pool
_08004D80:
ldr r0, =gUnknown_030009EA
ldrb r0, [r0]
b _08004D9A
.pool
_08004D8C:
ldr r0, =gUnknown_030009EE
ldrb r0, [r0]
b _08004D9A
.pool
_08004D98:
movs r0, 0
_08004D9A:
pop {r1}
bx r1
thumb_func_end GetLastTextColor
thumb_func_start CopyGlyphToWindow
@ int CopyGlyphToWindow(struct TextPrinter *x)
CopyGlyphToWindow: @ 8004DA0
@ -1520,7 +715,7 @@ ClearTextSpan: @ 80052C8
sub sp, 0x10
adds r4, r0, 0
adds r6, r1, 0
ldr r0, =gUnknown_030009EA
ldr r0, =gLastTextBgColor
ldrh r5, [r0]
cmp r5, 0
beq _0800531E

View File

@ -33,7 +33,7 @@ struct TextPrinter
{
struct TextWindow window;
void (*callback)(u16, struct TextWindow *); // 0x10
void (*callback)(struct TextWindow *, u16); // 0x10
union {
struct
@ -45,7 +45,7 @@ struct TextPrinter
u8 field_4; // 0x18
u8 field_5;
u8 field_6;
u8 field_7;
u8 active;
} sub;
u8 sub_fields[8];
} sub_union;

View File

@ -8,11 +8,17 @@
EWRAM_DATA struct TextPrinter gTempTextPrinter;
EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS];
extern u8 gUnknown_03002F84[];
extern u16 gFontHalfRowLookupTable[];
extern u16 gLastTextBgColor;
extern u16 gLastTextFgColor;
extern u16 gLastTextShadowColor;
extern struct FontInfo *gFonts;
extern u8 gUnknown_03002F84[];
u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(u16, struct TextWindow *));
extern u8 gFontHalfRowOffsets[];
u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(struct TextWindow *, u16));
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor);
u32 RenderFont(struct TextPrinter *textPrinter);
void CopyWindowToVram(u8 windowId, u8 mode);
@ -26,10 +32,10 @@ void DeactivateAllTextPrinters (void)
{
int printer;
for (printer = 0; printer < NUM_TEXT_PRINTERS; ++printer)
gTextPrinters[printer].sub_union.sub.field_7 = 0;
gTextPrinters[printer].sub_union.sub.active = 0;
}
u16 Print(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback)(u16, struct TextWindow *))
u16 Print(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextWindow *, u16))
{
struct TextWindow window;
@ -49,7 +55,7 @@ u16 Print(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback
return AddTextPrinter(&window, speed, callback);
}
u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(u16, struct TextWindow *))
u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(struct TextWindow *, u16))
{
int i;
u16 j;
@ -57,7 +63,7 @@ u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(u16
if (!gFonts)
return FALSE;
gTempTextPrinter.sub_union.sub.field_7 = 1;
gTempTextPrinter.sub_union.sub.active = 1;
gTempTextPrinter.state = 0;
gTempTextPrinter.text_speed = speed;
gTempTextPrinter.delayCounter = 0;
@ -84,16 +90,858 @@ u16 AddTextPrinter(struct TextWindow *textWindow, u8 speed, void (*callback)(u16
gTempTextPrinter.text_speed = 0;
for (j = 0; j < 0x400; ++j)
{
if (RenderFont(&gTempTextPrinter) == 1)
if ((u32)RenderFont(&gTempTextPrinter) == 1)
break;
}
if (speed != 0xFF)
CopyWindowToVram(gTempTextPrinter.window.windowId, 2);
gTextPrinters[textWindow->windowId].sub_union.sub.field_7 = 0;
gTextPrinters[textWindow->windowId].sub_union.sub.active = 0;
}
gUnknown_03002F84[0] = 0;
return TRUE;
}
void RunTextPrinters(void)
{
int i;
u16 temp;
if (gUnknown_03002F84[0] == 0)
{
for (i = 0; i < 0x20; ++i)
{
if (gTextPrinters[i].sub_union.sub.active != 0)
{
temp = RenderFont(&gTextPrinters[i]);
switch (temp) {
case 0:
CopyWindowToVram(gTextPrinters[i].window.windowId, 2);
case 3:
if (gTextPrinters[i].callback != 0)
gTextPrinters[i].callback(&gTextPrinters[i].window, temp);
break;
case 1:
gTextPrinters[i].sub_union.sub.active = 0;
break;
}
}
}
}
}
bool8 IsTextPrinterActive(u8 id)
{
return gTextPrinters[id].sub_union.sub.active;
}
u32 RenderFont(struct TextPrinter *textPrinter)
{
u32 ret;
while (TRUE)
{
ret = gFonts[textPrinter->window.fontId].fontFunction(textPrinter);
if (ret != 2)
return ret;
}
}
#ifdef NONMATCHING
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
u16* current = gFontHalfRowLookupTable;
gLastTextBgColor = bgColor;
gLastTextFgColor = fgColor;
gLastTextShadowColor = shadowColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
}
#else
__attribute__((naked))
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
asm(" push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, #0x24\n\
lsl r0, #24\n\
lsr r0, #24\n\
lsl r1, #24\n\
lsr r1, #24\n\
lsl r2, #24\n\
lsr r2, #24\n\
ldr r3, =gFontHalfRowLookupTable\n\
ldr r4, =gLastTextBgColor\n\
strh r1, [r4]\n\
ldr r4, =gLastTextFgColor\n\
strh r0, [r4]\n\
ldr r4, =gLastTextShadowColor\n\
strh r2, [r4]\n\
lsl r5, r1, #12\n\
lsl r6, r0, #12\n\
lsl r4, r2, #12\n\
mov r8, r4\n\
lsl r7, r1, #8\n\
str r7, [sp]\n\
lsl r4, r1, #4\n\
mov r9, r4\n\
orr r7, r4\n\
str r7, [sp, #0x4]\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
lsl r7, r0, #8\n\
mov r10, r7\n\
mov r4, r10\n\
mov r7, r9\n\
orr r4, r7\n\
str r4, [sp, #0x8]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
lsl r7, r2, #8\n\
mov r12, r7\n\
mov r4, r12\n\
mov r7, r9\n\
orr r4, r7\n\
str r4, [sp, #0xC]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
lsl r7, r0, #4\n\
mov r9, r7\n\
ldr r4, [sp]\n\
orr r4, r7\n\
str r4, [sp, #0x10]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
mov r7, r10\n\
add r4, r7, #0\n\
mov r7, r9\n\
orr r4, r7\n\
str r4, [sp, #0x14]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
mov r7, r12\n\
add r4, r7, #0\n\
mov r7, r9\n\
orr r4, r7\n\
str r4, [sp, #0x18]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
lsl r7, r2, #4\n\
mov r9, r7\n\
mov r4, r9\n\
ldr r7, [sp]\n\
orr r7, r4\n\
str r7, [sp, #0x1C]\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
mov r7, r9\n\
mov r4, r10\n\
orr r4, r7\n\
str r4, [sp, #0x20]\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r4, r5, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
add r4, r6, #0\n\
orr r4, r7\n\
strh r4, [r3]\n\
add r3, #0x2\n\
mov r4, r8\n\
orr r7, r4\n\
strh r7, [r3]\n\
add r3, #0x2\n\
mov r4, r12\n\
mov r7, r9\n\
orr r4, r7\n\
add r7, r4, #0\n\
orr r7, r1\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x4]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x8]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0xC]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x10]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x14]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x18]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x1C]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
ldr r7, [sp, #0x20]\n\
orr r7, r0\n\
add r1, r5, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
add r1, r6, #0\n\
orr r1, r7\n\
strh r1, [r3]\n\
add r3, #0x2\n\
mov r1, r8\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r4, #0\n\
orr r7, r0\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r0, [sp, #0x4]\n\
orr r7, r0\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
orr r7, r1\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x8]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0xC]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x10]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x14]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x18]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x1C]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
ldr r1, [sp, #0x20]\n\
orr r7, r1\n\
add r0, r5, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
add r0, r6, #0\n\
orr r0, r7\n\
strh r0, [r3]\n\
add r3, #0x2\n\
mov r0, r8\n\
orr r7, r0\n\
strh r7, [r3]\n\
add r3, #0x2\n\
add r7, r2, #0\n\
orr r7, r4\n\
orr r5, r7\n\
strh r5, [r3]\n\
add r3, #0x2\n\
orr r6, r7\n\
strh r6, [r3]\n\
orr r0, r7\n\
strh r0, [r3, #0x2]\n\
add sp, #0x24\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif
void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
{
*bgColor = gLastTextBgColor;
*fgColor = gLastTextFgColor;
*shadowColor = gLastTextShadowColor;
}
void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
{
GenerateFontHalfRowLookupTable(*fgColor, *bgColor, *shadowColor);
}
// struct means TextWindow, no struct means TextPrinter
//#ifdef NONMATCHING
void DecompressGlyphTile(u16 *src, u32 *dest)
{
u32 temp;
temp = src[0];
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
temp = src[1];
src += 2;
dest[1] = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
dest++;
temp = *(src++);
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
temp = *(src++);
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
temp = *(src++);
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
temp = *(src++);
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
*(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] >> 8]];
*(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
}
/*#else
__attribute__((naked))
void DecompressGlyphTile(u16 *src, u32 *dest)
{
asm("push {r4-r7,lr}\n\
mov r7, r8\n\
push {r7}\n\
ldrh r7, [r0]\n\
ldr r5, =gFontHalfRowLookupTable\n\
ldr r4, =gFontHalfRowOffsets\n\
mov r2, #0xFF\n\
mov r8, r2\n\
add r2, r7, #0\n\
mov r3, r8\n\
and r2, r3\n\
add r2, r4\n\
ldrb r2, [r2]\n\
lsl r2, #1\n\
add r2, r5\n\
ldrh r3, [r2]\n\
lsl r3, #16\n\
lsr r2, r7, #8\n\
add r2, r4\n\
ldrb r2, [r2]\n\
lsl r2, #1\n\
add r2, r5\n\
ldrh r2, [r2]\n\
orr r3, r2\n\
add r6, r1, #0\n\
stmia r6!, {r3}\n\
ldrh r7, [r0, #0x2]\n\
add r0, #0x4\n\
add r2, r7, #0\n\
mov r3, r8\n\
and r2, r3\n\
add r2, r4\n\
ldrb r2, [r2]\n\
lsl r2, #1\n\
add r2, r5\n\
ldrh r3, [r2]\n\
lsl r3, #16\n\
lsr r2, r7, #8\n\
add r2, r4\n\
ldrb r2, [r2]\n\
lsl r2, #1\n\
add r2, r5\n\
ldrh r2, [r2]\n\
orr r3, r2\n\
str r3, [r1, #0x4]\n\
add r6, #0x4\n\
ldrh r7, [r0]\n\
add r0, #0x2\n\
add r1, r7, #0\n\
mov r2, r8\n\
and r1, r2\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r2, [r1]\n\
lsl r2, #16\n\
lsr r1, r7, #8\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r1, [r1]\n\
orr r2, r1\n\
stmia r6!, {r2}\n\
ldrh r7, [r0]\n\
add r0, #0x2\n\
add r1, r7, #0\n\
mov r3, r8\n\
and r1, r3\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r2, [r1]\n\
lsl r2, #16\n\
lsr r1, r7, #8\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r1, [r1]\n\
orr r2, r1\n\
stmia r6!, {r2}\n\
ldrh r7, [r0]\n\
add r0, #0x2\n\
add r1, r7, #0\n\
and r1, r3\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r2, [r1]\n\
lsl r2, #16\n\
lsr r1, r7, #8\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r1, [r1]\n\
orr r2, r1\n\
stmia r6!, {r2}\n\
ldrh r7, [r0]\n\
add r0, #0x2\n\
add r1, r7, #0\n\
and r1, r3\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r2, [r1]\n\
lsl r2, #16\n\
lsr r1, r7, #8\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r1, [r1]\n\
orr r2, r1\n\
stmia r6!, {r2}\n\
ldrh r7, [r0]\n\
add r1, r7, #0\n\
and r1, r3\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r2, [r1]\n\
lsl r2, #16\n\
lsr r1, r7, #8\n\
add r1, r4\n\
ldrb r1, [r1]\n\
lsl r1, #1\n\
add r1, r5\n\
ldrh r1, [r1]\n\
orr r2, r1\n\
stmia r6!, {r2}\n\
ldrh r7, [r0, #0x2]\n\
add r0, r7, #0\n\
and r0, r3\n\
add r0, r4\n\
ldrb r0, [r0]\n\
lsl r0, #1\n\
add r0, r5\n\
ldrh r1, [r0]\n\
lsl r1, #16\n\
lsr r0, r7, #8\n\
add r0, r4\n\
ldrb r0, [r0]\n\
lsl r0, #1\n\
add r0, r5\n\
ldrh r0, [r0]\n\
orr r1, r0\n\
str r1, [r6]\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif*/
u8 GetLastTextColor(u8 colorType)
{
switch (colorType)
{
case 0:
return gLastTextFgColor;
case 2:
return gLastTextBgColor;
case 1:
return gLastTextShadowColor;
default:
return 0;
}
}

View File

@ -37,16 +37,16 @@ gUnknown_030008FC: @ 30008FC
gUnknown_03000938: @ 3000938
.space 0x10
gUnknown_03000948: @ 3000948
gFontHalfRowLookupTable: @ 3000948
.space 0xA2
gUnknown_030009EA: @ 30009EA
gLastTextBgColor: @ 30009EA
.space 0x2
gUnknown_030009EC: @ 30009EC
gLastTextFgColor: @ 30009EC
.space 0x2
gUnknown_030009EE: @ 30009EE
gLastTextShadowColor: @ 30009EE
.space 0x2
gUnknown_030009F0: @ 30009F0