mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-04 06:54:33 +00:00
Match NTSC z_kanfont.c and z_message.c (#1997)
* Match NTSC z_kanfont.c and z_message.c Co-authored-by: inspectredc <inspectredc@gmail.com> * Apply suggestions from code review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Remove now-unnecessary padding * Remove msgBufDecoded comment * Use == NULL for fake match * Rename Message_DrawText{JPN,NES} -> Message_DrawText[Wide] * Font_LoadKanji -> Font_LoadCharWide * Restore FONT_MESSAGE_OFFSET/FONT_MESSAGE_LENGTH --------- Co-authored-by: inspectredc <inspectredc@gmail.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
This commit is contained in:
parent
ab2ca85227
commit
47fd023238
7 changed files with 1259 additions and 402 deletions
|
@ -1,7 +1,15 @@
|
|||
#include "global.h"
|
||||
#include "message_data_static.h"
|
||||
|
||||
void func_8006EE50(Font* font, u16 arg1, u16 arg2) {
|
||||
/**
|
||||
* Loads a texture from kanji for the requested `character` into the character texture buffer
|
||||
* at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character.
|
||||
*/
|
||||
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
|
||||
#if OOT_NTSC
|
||||
DmaMgr_RequestSync(&font->charTexBuf[codePointIndex],
|
||||
(uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,14 +41,34 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
|
|||
* the font buffer.
|
||||
*/
|
||||
void Font_LoadOrderedFont(Font* font) {
|
||||
s32 size;
|
||||
s32 len;
|
||||
s32 codePointIndex;
|
||||
s32 fontBufIndex;
|
||||
u32 offset;
|
||||
|
||||
font->msgOffset = FONT_MESSAGE_OFFSET;
|
||||
len = font->msgLength = FONT_MESSAGE_LENGTH;
|
||||
size = font->msgLength = FONT_MESSAGE_LENGTH;
|
||||
|
||||
#if OOT_NTSC
|
||||
len = (u32)size / 2;
|
||||
DmaMgr_RequestSync(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size);
|
||||
|
||||
fontBufIndex = 0;
|
||||
for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
|
||||
if (len < codePointIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) {
|
||||
offset = Kanji_OffsetFromShiftJIS(font->msgBufWide[codePointIndex]);
|
||||
DmaMgr_RequestSync(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
|
||||
FONT_CHAR_TEX_SIZE);
|
||||
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
|
||||
}
|
||||
}
|
||||
#else
|
||||
len = size;
|
||||
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len,
|
||||
"../z_kanfont.c", 122);
|
||||
|
||||
|
@ -62,4 +90,5 @@ void Font_LoadOrderedFont(Font* font) {
|
|||
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
1579
src/code/z_message.c
1579
src/code/z_message.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue