Fix messages crashing when no ntsc game is loaded (#5259)

* Fix messages crashing when no ntsc game is loaded

* rename func
This commit is contained in:
Archez
2025-03-30 18:16:44 -04:00
committed by GitHub
parent 0dc5ff4984
commit bcd8842bde
3 changed files with 37 additions and 23 deletions

View File

@@ -7,6 +7,9 @@
#include "textures/kanji/kanji.h"
#include "textures/message_static/message_static.h"
// SOH [NTSC]
extern MessageTableEntry* sJpnMessageEntryTablePtr;
// #region SOH [Port] Asset tables we can pull from instead of from ROM
const char* fontTbl[140] =
{
@@ -4141,9 +4144,20 @@ const char* msgStaticTbl[] =
};
// #endregion
void func_8006EE50(Font* font, u16 character, u16 codePointIndex) {
// #region SOH [NTSC]
/**
* 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) {
// DmaMgr_RequestSync(&font->charTexBuf[codePointIndex], _kanjiSegmentStart + Kanji_OffsetFromShiftJIS(character), 0x80);
// #region SOH [NTSC]
// This function is called even for non-nstc, but this function would be empty for non-ntsc.
// To simulate that, we check if the jpn message table is loaded and if not immediately return.
if (sJpnMessageEntryTablePtr == NULL) {
return;
}
s32 charIndex = Kanji_OffsetFromShiftJIS(character);
charIndex /= FONT_CHAR_TEX_SIZE;
if (charIndex < ARRAY_COUNT(kanjiFontTbl))
@@ -4213,8 +4227,6 @@ void Font_LoadOrderedFont(Font* font) {
}
// #region SOH [NTSC]
extern MessageTableEntry* sJpnMessageEntryTablePtr;
void Font_LoadOrderedFontNTSC(Font* font) {
s32 len;
s32 size;