mirror of
https://github.com/zeldaret/oot.git
synced 2025-02-11 16:09:09 +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
|
@ -776,7 +776,8 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize);
|
|||
void KaleidoSetup_Update(PlayState* play);
|
||||
void KaleidoSetup_Init(PlayState* play);
|
||||
void KaleidoSetup_Destroy(PlayState* play);
|
||||
void func_8006EE50(Font* font, u16 arg1, u16 arg2);
|
||||
s32 Kanji_OffsetFromShiftJIS(s32 character);
|
||||
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex);
|
||||
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex);
|
||||
void Font_LoadMessageBoxIcon(Font* font, u16 icon);
|
||||
void Font_LoadOrderedFont(Font* font);
|
||||
|
|
|
@ -75,6 +75,38 @@
|
|||
#define MESSAGE_WIDE_HIGHSCORE 0x869F
|
||||
#define MESSAGE_WIDE_TIME 0x81A1
|
||||
|
||||
/*
|
||||
* Message character constants
|
||||
*/
|
||||
|
||||
// Non-Wide (nes/ger/fra)
|
||||
|
||||
#define MESSAGE_CHAR_SPACE 0x20 // ' '
|
||||
|
||||
// Wide (jpn)
|
||||
|
||||
#define MESSAGE_WIDE_CHAR_SPACE 0x8140 // ' '
|
||||
#define MESSAGE_WIDE_CHAR_TOUTEN 0x8141 // '、'
|
||||
#define MESSAGE_WIDE_CHAR_KUTEN 0x8142 // '。'
|
||||
#define MESSAGE_WIDE_CHAR_PERIOD 0x8144 // '.'
|
||||
#define MESSAGE_WIDE_CHAR_NAKATEN 0x8145 // '・'
|
||||
#define MESSAGE_WIDE_CHAR_QUESTION_MARK 0x8148 // '?'
|
||||
#define MESSAGE_WIDE_CHAR_EXCLAMATION_MARK 0x8149 // '!'
|
||||
#define MESSAGE_WIDE_CHAR_CIRCUMFLEX_ACCENT 0x814F // '^'
|
||||
#define MESSAGE_WIDE_CHAR_DOUBLE_QUOTATION_MARK_LEFT 0x8167 // '“'
|
||||
#define MESSAGE_WIDE_CHAR_DOUBLE_QUOTATION_MARK_RIGHT 0x8168 // '”'
|
||||
#define MESSAGE_WIDE_CHAR_PARENTHESES_LEFT 0x8169 // '('
|
||||
#define MESSAGE_WIDE_CHAR_PARENTHESES_RIGHT 0x816A // ')'
|
||||
#define MESSAGE_WIDE_CHAR_KAGIKAKKO_LEFT 0x8175 // '「'
|
||||
#define MESSAGE_WIDE_CHAR_KAGIKAKKO_RIGHT 0x8176 // '」'
|
||||
#define MESSAGE_WIDE_CHAR_NUMBER_SIGN 0x8194 // '#'
|
||||
#define MESSAGE_WIDE_CHAR_ASTERISK 0x8196 // '*'
|
||||
#define MESSAGE_WIDE_CHAR_ZERO 0x824F // '0'
|
||||
#define MESSAGE_WIDE_CHAR_ONE 0x8250 // '1'
|
||||
#define MESSAGE_WIDE_CHAR_HOURS 0x8E9E // '時'
|
||||
#define MESSAGE_WIDE_CHAR_SECONDS 0x9562 // '秒'
|
||||
#define MESSAGE_WIDE_CHAR_MINUTES 0x95AA // '分'
|
||||
|
||||
/*
|
||||
* Colors
|
||||
*/
|
||||
|
|
|
@ -235,8 +235,10 @@ typedef struct {
|
|||
/* 0xE2FE */ u8 textBoxPos; // text box position
|
||||
/* 0xE300 */ s32 msgLength; // original name : "msg_data"
|
||||
/* 0xE304 */ u8 msgMode; // original name: "msg_mode"
|
||||
/* 0xE305 */ char unk_E305[0x1];
|
||||
/* 0xE306 */ u8 msgBufDecoded[200]; // decoded message buffer, may be smaller than this
|
||||
/* 0xE306 */ union {
|
||||
u8 msgBufDecoded[200];
|
||||
u16 msgBufDecodedWide[100];
|
||||
};
|
||||
/* 0xE3CE */ u16 msgBufPos; // original name : "rdp"
|
||||
/* 0xE3D0 */ u16 unk_E3D0; // unused, only ever set to 0
|
||||
/* 0xE3D2 */ u16 textDrawPos; // draw all decoded characters up to this buffer position
|
||||
|
|
|
@ -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
|
@ -12,7 +12,7 @@
|
|||
#include "terminal.h"
|
||||
|
||||
// For retail BSS ordering, the block number of sStreamSfxProjectedPos must be 0.
|
||||
#pragma increment_block_number 208
|
||||
#pragma increment_block_number 206
|
||||
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
|
|
|
@ -1169,7 +1169,7 @@ Jpeg_Decode = 0x8005B1AC; // type:func
|
|||
KaleidoSetup_Update = 0x8005B4E0; // type:func
|
||||
KaleidoSetup_Init = 0x8005B74C; // type:func
|
||||
KaleidoSetup_Destroy = 0x8005B8A0; // type:func
|
||||
func_8006EE50 = 0x8005B8B0; // type:func
|
||||
Font_LoadCharWide = 0x8005B8B0; // type:func
|
||||
Font_LoadChar = 0x8005B904; // type:func
|
||||
Font_LoadMessageBoxIcon = 0x8005B954; // type:func
|
||||
Font_LoadOrderedFont = 0x8005B998; // type:func
|
||||
|
@ -3072,8 +3072,8 @@ Message_SetTextColor = 0x800D7514; // type:func
|
|||
Message_DrawTextboxIcon = 0x800D77C8; // type:func
|
||||
Message_DrawItemIcon = 0x800D7F0C; // type:func
|
||||
Message_HandleOcarina = 0x800D8258; // type:func
|
||||
Message_DrawTextJPN = 0x800D8468; // type:func
|
||||
Message_DrawTextNES = 0x800D985C; // type:func
|
||||
Message_DrawTextWide = 0x800D8468; // type:func
|
||||
Message_DrawText = 0x800D985C; // type:func
|
||||
Message_LoadItemIcon = 0x800DAAD4; // type:func
|
||||
Message_Decode = 0x800DAC74; // type:func
|
||||
Message_OpenText = 0x800DD19C; // type:func
|
||||
|
|
Loading…
Add table
Reference in a new issue