Files
mm/src/code/z_kanfont.c
T
Zelllll 6db3fc7b32 Document most of global context (#198)
* doesn't build for some reason..?

* some formatting fixes

* windows calculator is trash

* fix!

* fix2

* most of global context documented

* interfacectx

* hopefully fix interface

* document restrictions

* envCtx done

* revert accidental change

* fix

* pause ctx done

* fixxxxxxxxxxxxxxx

* remove unintended zapd change

* fix..?

* format files

* Update include/z64.h

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

* ocarinstaff

* Update include/z64.h

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

* Update include/z64.h

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>

* suggestions

* fix mistake in pausectx

* typo

* door context

* renames

* all nb removed

* Update include/z64.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update include/functions.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* fix kanfont, new docs

* format files, merge master

* fix typo in linker script

* extract asm properly

* door context rename

* fixes in door context

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
2021-07-05 21:14:27 -04:00

47 lines
1.7 KiB
C

#include <ultra64.h>
#include <global.h>
// stubbed in NTSC-U
void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset) {
}
void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) {
MessageContext* msgCtx = &globalCtx->msgCtx;
Font* font = &msgCtx->font;
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
&_nes_font_staticSegmentRomStart[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE],
FONT_CHAR_TEX_SIZE);
}
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
DmaMgr_SendRequest0(&font->iconBuf, &_message_staticSegmentRomStart[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
FONT_CHAR_TEX_SIZE);
}
static char sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
"!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"\x00\x0D\x0E\x1A"
"afjmosvwxyz{|}~"
"\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C";
void Font_LoadOrderedFont(Font* font) {
u32 loadOffset;
s32 codePointIndex = 0;
u8* writeLocation;
while (1) {
writeLocation = &font->fontBuf[codePointIndex * FONT_CHAR_TEX_SIZE];
loadOffset = sFontOrdering[codePointIndex] * FONT_CHAR_TEX_SIZE;
if (sFontOrdering[codePointIndex] == 0) {
loadOffset = 0;
}
// UB to convert pointer to u32
DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, FONT_CHAR_TEX_SIZE);
if (sFontOrdering[codePointIndex] == 0x8C) {
break;
}
codePointIndex++;
}
}