mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-06 07:56:32 +00:00
[iQue] Match z_kanfont (#2428)
This commit is contained in:
parent
161c789886
commit
c76d2a8a4d
5 changed files with 56 additions and 16 deletions
|
@ -19,13 +19,21 @@ void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
|
|||
* at `codePointIndex`. The value of `character` is the ASCII codepoint subtract ' '/0x20.
|
||||
*/
|
||||
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
|
||||
u8 charTmp = character;
|
||||
s32 offset = character * FONT_CHAR_TEX_SIZE;
|
||||
|
||||
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex],
|
||||
(uintptr_t)_nes_font_staticSegmentRomStart + charTmp * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE,
|
||||
"../z_kanfont.c", 93);
|
||||
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_nes_font_staticSegmentRomStart + offset,
|
||||
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 93);
|
||||
}
|
||||
|
||||
#if PLATFORM_IQUE
|
||||
void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex) {
|
||||
s32 offset = character * FONT_CHAR_TEX_SIZE;
|
||||
|
||||
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_nes_font_staticSegmentRomStart + offset,
|
||||
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Loads a message box icon from message_static, such as the ending triangle/square or choice arrow into the
|
||||
* icon buffer.
|
||||
|
@ -48,18 +56,23 @@ void Font_LoadOrderedFont(Font* font) {
|
|||
s32 codePointIndex;
|
||||
s32 fontBufIndex;
|
||||
u32 offset;
|
||||
const char* messageDataStart;
|
||||
u16* msgBufWide;
|
||||
|
||||
font->msgOffset = FONT_MESSAGE_OFFSET;
|
||||
size = font->msgLength = FONT_MESSAGE_LENGTH;
|
||||
|
||||
#if OOT_NTSC
|
||||
#if OOT_NTSC && !PLATFORM_IQUE
|
||||
messageDataStart = (const char*)_jpn_message_data_staticSegmentStart;
|
||||
font->msgOffset = _message_0xFFFC_jpn - messageDataStart;
|
||||
size = font->msgLength = _message_0xFFFD_jpn - _message_0xFFFC_jpn;
|
||||
len = (u32)size / 2;
|
||||
DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size,
|
||||
"../z_kanfont.c", UNK_LINE);
|
||||
|
||||
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len);
|
||||
|
||||
fontBufIndex = 0;
|
||||
for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
|
||||
if (len < codePointIndex) {
|
||||
PRINTF(T("ERROR!! エラー!!! error───!!!!\n", "ERROR!! Error!!! error───!!!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,7 +83,10 @@ void Font_LoadOrderedFont(Font* font) {
|
|||
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#elif OOT_PAL
|
||||
messageDataStart = (const char*)_nes_message_data_staticSegmentStart;
|
||||
font->msgOffset = _message_0xFFFC_nes - messageDataStart;
|
||||
size = font->msgLength = _message_0xFFFD_nes - _message_0xFFFC_nes;
|
||||
len = size;
|
||||
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len,
|
||||
"../z_kanfont.c", 122);
|
||||
|
@ -93,5 +109,31 @@ void Font_LoadOrderedFont(Font* font) {
|
|||
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
|
||||
}
|
||||
}
|
||||
#elif PLATFORM_IQUE
|
||||
messageDataStart = (const char*)_jpn_message_data_staticSegmentStart;
|
||||
font->msgOffset = _message_0xFFFC_jpn - messageDataStart;
|
||||
size = font->msgLength = _message_0xFFFD_jpn - _message_0xFFFC_jpn;
|
||||
len = (u32)size / 2;
|
||||
DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size,
|
||||
"../z_kanfont.c", UNK_LINE);
|
||||
|
||||
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len);
|
||||
|
||||
// Workaround for EGCS bug
|
||||
msgBufWide = font->msgBufWide;
|
||||
fontBufIndex = 0;
|
||||
for (codePointIndex = 0; msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
|
||||
if (len < codePointIndex) {
|
||||
PRINTF(T("ERROR!! エラー!!! error───!!!!\n", "ERROR!! Error!!! error───!!!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) {
|
||||
offset = Kanji_OffsetFromShiftJIS(msgBufWide[codePointIndex]);
|
||||
DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
|
||||
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE);
|
||||
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue