diff --git a/Makefile b/Makefile index 8f2cfbb0ef..aacbfdf25d 100644 --- a/Makefile +++ b/Makefile @@ -118,14 +118,15 @@ else CC_CHECK := @: endif -CPP := cpp -MKLDSCRIPT := tools/buildtools/mkldscript -MKDMADATA := tools/buildtools/mkdmadata -ZAPD := tools/ZAPD/ZAPD.out -FADO := tools/fado/fado.elf -MAKEYAR := $(PYTHON) tools/buildtools/makeyar.py -CHECKSUMMER := $(PYTHON) tools/buildtools/checksummer.py -SCHC := tools/buildtools/schc.py +CPP := cpp +MKLDSCRIPT := tools/buildtools/mkldscript +MKDMADATA := tools/buildtools/mkdmadata +ZAPD := tools/ZAPD/ZAPD.out +FADO := tools/fado/fado.elf +MAKEYAR := $(PYTHON) tools/buildtools/makeyar.py +CHECKSUMMER := $(PYTHON) tools/buildtools/checksummer.py +SHIFTJIS_CONV := $(PYTHON) tools/shiftjis_conv.py +SCHC := $(PYTHON) tools/buildtools/schc.py SCHC_FLAGS := @@ -200,6 +201,9 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \ $(foreach f,$(BASEROM_FILES),build/$f.o) \ $(ARCHIVES_O) +SHIFTJIS_C_FILES := src/libultra/voice/voicecheckword.c src/audio/voice_external.c src/code/z_message.c src/code/z_message_nes.c +SHIFTJIS_O_FILES := $(foreach f,$(SHIFTJIS_C_FILES:.c=.o),build/$f) + OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | grep -o '[^"]*_reloc.o' ) SCHEDULE_INC_FILES := $(foreach f,$(SCHEDULE_FILES:.schl=.schl.inc),build/$f) @@ -253,8 +257,6 @@ build/src/boot/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS build/src/boot/O2/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- build/src/libultra/%.o: CC := $(CC_OLD) -# Needed at least until voice is decompiled -build/src/libultra/voice/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC_OLD) -- $(AS) $(ASFLAGS) -- build/src/code/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- build/src/audio/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- @@ -263,6 +265,8 @@ build/src/overlays/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASF build/assets/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +$(SHIFTJIS_O_FILES): CC_CHECK += -Wno-multichar -Wno-type-limits -Wno-overflow + #### Main Targets ### uncompressed: $(ROM) @@ -412,6 +416,13 @@ build/src/%.o: src/%.c $(OBJDUMP_CMD) $(RM_MDEBUG) +$(SHIFTJIS_O_FILES): build/src/%.o: src/%.c + $(SHIFTJIS_CONV) -o $(@:.o=.enc.c) $< + $(CC_CHECK) $(@:.o=.enc.c) + $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(@:.o=.enc.c) + $(OBJDUMP_CMD) + $(RM_MDEBUG) + build/src/libultra/libc/ll.o: src/libultra/libc/ll.c $(CC_CHECK) $< $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< diff --git a/src/audio/voice_external.c b/src/audio/voice_external.c index e483144e60..5e4005c07c 100644 --- a/src/audio/voice_external.c +++ b/src/audio/voice_external.c @@ -3,23 +3,23 @@ OSVoiceDictionary sVoiceDictionary = { { - // "アトナンジカン" - "atonanjikan" - "How many hours" - { 0x8341, 0x8367, 0x8369, 0x8393, 0x8357, 0x834A, 0x8393 }, + // "atonanjikan" - "How many hours" + { 'ア', 'ト', 'ナ', 'ン', 'ジ', 'カ', 'ン' }, - // "ハイチーズ" - "haichīzu" - "say cheese" - { 0x836E, 0x8343, 0x8360, 0x815B, 0x8359 }, + // "haichīzu" - "say cheese" + { 'ハ', 'イ', 'チ', 'ー', 'ズ' }, - // "オキロー" - "okirō" - "wake up" - { 0x8349, 0x834C, 0x838D, 0x815B }, + // "okirō" - "wake up" + { 'オ', 'キ', 'ロ', 'ー' }, - // "オスワリ" - "osuwari" - "sit" - { 0x8349, 0x8358, 0x838F, 0x838A }, + // "osuwari" - "sit" + { 'オ', 'ス', 'ワ', 'リ' }, - // "ミルク" - "miruku" - "milk" - { 0x837E, 0x838B, 0x834E }, + // "miruku" - "milk" + { 'ミ', 'ル', 'ク' }, - // "ハイヤー" - "haiyā" - "hiya!" - { 0x836E, 0x8343, 0x8384, 0x815B }, + // "haiyā" - "hiya!" + { 'ハ', 'イ', 'ヤ', 'ー' }, }, VOICE_WORD_ID_MAX, // number of words diff --git a/src/code/z_message.c b/src/code/z_message.c index 92059146ff..1b59642737 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -697,7 +697,7 @@ void func_801496C8(PlayState* play) { if (msgCtx->unk12054[msgCtx->unk120C2] < 0) { msgCtx->unk12054[msgCtx->unk120C2] = 3; } - msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + 0x824F; + msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadChar(play, msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); @@ -706,7 +706,7 @@ void func_801496C8(PlayState* play) { if (msgCtx->unk12054[msgCtx->unk120C2] >= 4) { msgCtx->unk12054[msgCtx->unk120C2] = 0; } - msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + 0x824F; + msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2] = msgCtx->unk12054[msgCtx->unk120C2] + '0'; Font_LoadChar(play, msgCtx->decodedBuffer.wchar[msgCtx->unk120C0 + msgCtx->unk120C2], msgCtx->unk120C4 + (msgCtx->unk120C2 << 7)); Audio_PlaySfx(NA_SE_SY_RUPY_COUNT); @@ -1178,7 +1178,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { } break; - case 0x20: // ` ` + case ' ': msgCtx->textPosX += 6; break; @@ -1476,17 +1476,17 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { default: switch (character) { - case 0x8169: - case 0x8175: + case '(': + case '「': msgCtx->textPosX -= TRUNCF_BINANG(6.0f * msgCtx->textCharScale); break; - case 0x8145: + case '・': msgCtx->textPosX -= TRUNCF_BINANG(3.0f * msgCtx->textCharScale); break; - case 0x8148: - case 0x8149: + case '?': + case '!': msgCtx->textPosX -= TRUNCF_BINANG(2.0f * msgCtx->textCharScale); break; @@ -1514,26 +1514,26 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) { } charTexIndex += FONT_CHAR_TEX_SIZE; switch (character) { - case 0x8144: + case '.': msgCtx->textPosX += TRUNCF_BINANG(8.0f * msgCtx->textCharScale); break; - case 0x816A: - case 0x8176: + case ')': + case '」': msgCtx->textPosX += TRUNCF_BINANG(10.0f * msgCtx->textCharScale); break; - case 0x8141: - case 0x8142: - case 0x8168: + case '、': + case '。': + case '”': msgCtx->textPosX += TRUNCF_BINANG(12.0f * msgCtx->textCharScale); break; - case 0x8194: + case '#': msgCtx->textPosX += TRUNCF_BINANG(14.0f * msgCtx->textCharScale); break; - case 0x8145: + case '・': msgCtx->textPosX += TRUNCF_BINANG(15.0f * msgCtx->textCharScale); break; @@ -1911,25 +1911,23 @@ void Message_LoadChar(PlayState* play, u16 codePointIndex, s32* offset, f32* arg *arg3 = temp2; } -// TODO: SJIS support -// Message_LoadRupees JPN ? -void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) { +void Message_LoadRupeesJPN(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) { MessageContext* msgCtx = &play->msgCtx; s16 t = *decodedBufPos; s32 k = *offset; f32 f = *arg3; - Font_LoadChar(play, 0x838B, k); // 0x838B = ル in JISX0213 + Font_LoadChar(play, 'ル', k); k += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[t] = 0x838B; + msgCtx->decodedBuffer.wchar[t] = 'ル'; t++; - Font_LoadChar(play, 0x8373, k); // 0x8373 = ピ in JISX0213 + Font_LoadChar(play, 'ピ', k); k += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[t] = 0x8373; + msgCtx->decodedBuffer.wchar[t] = 'ピ'; t++; - Font_LoadChar(play, 0x815C, k); // 0x815C = ― in JISX0213 + Font_LoadChar(play, '―', k); k += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[t] = 0x815C; + msgCtx->decodedBuffer.wchar[t] = '―'; f += 16.0f * msgCtx->textCharScale * 3.0f; *decodedBufPos = t; @@ -1939,7 +1937,7 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) /* * offsetting to actual codepoints is done outside this function - * every digit will be added 0x824F to get an actual S-JIS + * every digit will be added 0x824F ('0') to get an actual S-JIS * printable character. */ void Message_GetTimerDigits(OSTime time, s16 digits[8]) { @@ -1953,7 +1951,7 @@ void Message_GetTimerDigits(OSTime time, s16 digits[8]) { digits[1] = t / SECONDS_TO_TIMER(60); t -= digits[1] * SECONDS_TO_TIMER(60); - digits[2] = 0x135B; // 0x135B + 0x824F = 分 (minutes) in S-JIS + digits[2] = '分' - '0'; // 10 seconds digits[3] = t / SECONDS_TO_TIMER(10); @@ -1963,7 +1961,7 @@ void Message_GetTimerDigits(OSTime time, s16 digits[8]) { digits[4] = t / SECONDS_TO_TIMER(1); t -= digits[4] * SECONDS_TO_TIMER(1); - digits[5] = 0x1313; // 0x1313 + 0x824F = 秒 (seconds) in S-JIS + digits[5] = '秒' - '0'; // 100 milliseconds digits[6] = t / SECONDS_TO_TIMER_PRECISE(0, 10); @@ -2048,25 +2046,25 @@ void Message_LoadTime(PlayState* play, u16 curChar, s32* offset, f32* arg3, s16* } for (i = 0; i < 4; i++) { - Font_LoadChar(play, digits[i] + 0x824F, o); // 0x824F = '0' in S-JIS + Font_LoadChar(play, digits[i] + '0', o); o += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[p] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[p] = digits[i] + '0'; p++; if (i == 1) { // Hours (時間) - Font_LoadChar(play, 0x8E9E, o); + Font_LoadChar(play, '時', o); o += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[p] = 0x8E9E; + msgCtx->decodedBuffer.wchar[p] = '時'; p++; - Font_LoadChar(play, 0x8AD4, o); + Font_LoadChar(play, '間', o); o += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[p] = 0x8E9E; + msgCtx->decodedBuffer.wchar[p] = '時'; p++; } else if (i == 3) { // Minutes (分) - Font_LoadChar(play, 0x95AA, o); + Font_LoadChar(play, '分', o); o += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[p] = 0x95AA; + msgCtx->decodedBuffer.wchar[p] = '分'; } } @@ -2077,29 +2075,28 @@ void Message_LoadTime(PlayState* play, u16 curChar, s32* offset, f32* arg3, s16* } #define GREAT_BAY_COAST_STR \ - { 0x834F, 0x838C, 0x815B, 0x8367, 0x8378, 0x8343, 0x82CC, 0x8A43, 0x8ADD } + { 'グ', 'レ', 'ー', 'ト', 'ベ', 'イ', 'の', '海', '岸' } #define ZORA_CAPE_STR \ - { 0x835D, 0x815B, 0x8389, 0x82CC, 0x82DD, 0x82B3, 0x82AB } + { 'ゾ', 'ー', 'ラ', 'の', 'み', 'さ', 'き' } #define SNOWHEAD_STR \ - { 0x8358, 0x836D, 0x815B, 0x8377, 0x8362, 0x8368 } + { 'ス', 'ノ', 'ー', 'ヘ', 'ッ', 'ド' } #define MOUNTAIN_VILLAGE_STR \ - { 0x8E52, 0x97A2 } + { '山', '里' } #define CLOCK_TOWN_STR \ - { 0x834E, 0x838D, 0x8362, 0x834E, 0x835E, 0x8345, 0x8393 } + { 'ク', 'ロ', 'ッ', 'ク', 'タ', 'ウ', 'ン' } #define MILK_ROAD_STR \ - { 0x837E, 0x838B, 0x834E, 0x838D, 0x815B, 0x8368 } + { 'ミ', 'ル', 'ク', 'ロ', 'ー', 'ド' } #define WOODFALL_STR \ - { 0x8345, 0x8362, 0x8368, 0x8374, 0x8348, 0x815B, 0x838B } + { 'ウ', 'ッ', 'ド', 'フ', 'ォ', 'ー', 'ル' } #define SOUTHERN_SWAMP_STR \ - { 0x8FC0, 0x926E } + { '沼', '地' } #define IKANA_CANYON_STR \ - { 0x8343, 0x834A, 0x815B, 0x8369, 0x8C6B, 0x924A } + { 'イ', 'カ', 'ー', 'ナ', '渓', '谷' } #define STONE_TOWER_STR \ - { 0x838D, 0x8362, 0x834E, 0x8372, 0x838B } + { 'ロ', 'ッ', 'ク', 'ビ', 'ル' } #define ENTRANCE_STR \ - { 0x93FC, 0x82E8, 0x8CFB } + { '入', 'り', '口' } -// Shift JIS u16 sOwlWarpTextJPN[OWL_WARP_MAX][9] = { GREAT_BAY_COAST_STR, // OWL_WARP_GREAT_BAY_COAST ZORA_CAPE_STR, // OWL_WARP_ZORA_CAPE @@ -2114,7 +2111,6 @@ u16 sOwlWarpTextJPN[OWL_WARP_MAX][9] = { ENTRANCE_STR, // OWL_WARP_ENTRANCE }; -//! TODO: use sizeof when we have strings s16 sOwlWarpTextLengthJPN[OWL_WARP_MAX] = { 9, // OWL_WARP_GREAT_BAY_COAST 7, // OWL_WARP_ZORA_CAPE @@ -2160,15 +2156,15 @@ void Message_LoadOwlWarpText(PlayState* play, s32* offset, f32* arg2, s16* decod } u16 sTimeSpeedTextJPN[][3] = { - { 0x82CD, 0x82E2, 0x82A2 }, - { 0x82D3, 0x82C2, 0x82A4 }, - { 0x82A8, 0x82BB, 0x82A2 }, + { 'は', 'や', 'い' }, + { 'ふ', 'つ', 'う' }, + { 'お', 'そ', 'い' }, }; u16 sMaskCodeColorCmdJPN[] = { 0x2001, 0x2003, 0x2004, 0x2002 }; // Counterpart to NES sMaskCodeTextENG -u16 D_801D0284[] = { 0x90D4, 0x90C2, 0x89A9, 0x97CE }; +u16 sMaskCodeTextJPN[] = { '赤', '青', '黄', '緑' }; void Message_Decode(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; @@ -2313,7 +2309,7 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, spAC[i + 3] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, spAC[i + 3] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } @@ -2328,7 +2324,7 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, spAC[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, spAC[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } @@ -2350,19 +2346,19 @@ void Message_Decode(PlayState* play) { } for (i = 0; i < 4; i++) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { - Font_LoadChar(play, 0x8E9E, charTexIndex); + Font_LoadChar(play, '時', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x8E9E; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '時'; decodedBufPos++; } else if (i == 3) { - Font_LoadChar(play, 0x95AA, charTexIndex); + Font_LoadChar(play, '分', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x95AA; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '分'; } } spC0 += 6 * (16.0f * msgCtx->textCharScale); @@ -2389,9 +2385,9 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } @@ -2407,10 +2403,10 @@ void Message_Decode(PlayState* play) { digits[0] = digits[1] = digits[2] = 0; for (i = 0; i < 3; i++) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } - func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); + Message_LoadRupeesJPN(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x20D) { digits[0] = digits[1] = 0; digits[2] = msgCtx->rupeesSelected; @@ -2431,11 +2427,11 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } - func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); + Message_LoadRupeesJPN(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x20E) { digits[0] = digits[1] = digits[2] = 0; digits[3] = msgCtx->rupeesTotal; @@ -2459,11 +2455,11 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } - func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); + Message_LoadRupeesJPN(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x20F) { Message_LoadTime(play, curChar, &charTexIndex, &spC0, &decodedBufPos); } else if (curChar == 0x21C) { @@ -2485,13 +2481,13 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } - Message_LoadChar(play, 0x906C, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '人', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; - Message_LoadChar(play, 0x96DA, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '目', &charTexIndex, &spC0, decodedBufPos); } else if (curChar == 0x21D) { digits[0] = digits[1] = 0; digits[2] = Inventory_GetSkullTokenCount(play->sceneId); @@ -2511,11 +2507,11 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } - Message_LoadChar(play, 0x9543, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '匹', &charTexIndex, &spC0, decodedBufPos); } else if (curChar == 0x21E) { digits[0] = 0; digits[1] = gSaveContext.minigameScore; @@ -2527,7 +2523,7 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 2; i++) { if ((i == 1) || (digits[i] != 0)) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } @@ -2555,7 +2551,7 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } @@ -2569,10 +2565,10 @@ void Message_Decode(PlayState* play) { msgCtx->unk120C4 = charTexIndex; digits[0] = digits[1] = digits[2] = 0; for (i = 0; i < 2; i++) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } - func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); + Message_LoadRupeesJPN(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x221) { decodedBufPos++; msgCtx->unk120BE = spD2; @@ -2583,7 +2579,7 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 5; i++) { msgCtx->unk12054[i] = 1; - Message_LoadChar(play, 0x8250, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '1', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } decodedBufPos--; @@ -2616,9 +2612,9 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 3; i++) { msgCtx->unk12054[i] = 1; - Font_LoadChar(play, 0x8250, charTexIndex); + Font_LoadChar(play, '1', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x8250; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '1'; spC0 += 16.0f * msgCtx->textCharScale; decodedBufPos++; } @@ -2628,7 +2624,7 @@ void Message_Decode(PlayState* play) { msgCtx->decodedBuffer.wchar[decodedBufPos] = sMaskCodeColorCmdJPN[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[i])]; decodedBufPos++; - Message_LoadChar(play, i + 0x8250, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, i + '1', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x2000; @@ -2652,14 +2648,14 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } } - Message_LoadChar(play, 0x906C, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '人', &charTexIndex, &spC0, decodedBufPos); } else if (curChar == 0x22B) { digits[0] = digits[1] = digits[2] = 0; digits[3] = gSaveContext.minigameScore; @@ -2683,14 +2679,14 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } } - Message_LoadChar(play, 0x94AD, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '発', &charTexIndex, &spC0, decodedBufPos); } else if ((curChar == 0x22C) || (curChar == 0x22D)) { if (curChar == 0x22C) { digits[0] = gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0]; @@ -2702,9 +2698,9 @@ void Message_Decode(PlayState* play) { digits[2] = HS_GET_LOTTERY_CODE_GUESS() & 0xF; } for (i = 0; i < 3; i++) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } @@ -2732,20 +2728,20 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } } - func_8014CCB4(play, &decodedBufPos, &charTexIndex, &spC0); + Message_LoadRupeesJPN(play, &decodedBufPos, &charTexIndex, &spC0); } else if (curChar == 0x22F) { for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.bomberCode); i++) { digits[i] = gSaveContext.save.saveInfo.bomberCode[i]; - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } @@ -2754,10 +2750,10 @@ void Message_Decode(PlayState* play) { msgCtx->decodedBuffer.wchar[decodedBufPos] = sMaskCodeColorCmdJPN[( (void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0x231)])]; decodedBufPos++; - Message_LoadChar( - play, - D_801D0284[((void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0x231)])], - &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, + sMaskCodeTextJPN[( + (void)0, gSaveContext.save.saveInfo.spiderHouseMaskOrder[(s16)(curChar - 0x231)])], + &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x2000; } else if (curChar == 0x237) { @@ -2776,17 +2772,17 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Message_LoadChar(play, digits[i] + 0x824F, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, digits[i] + '0', &charTexIndex, &spC0, decodedBufPos); decodedBufPos++; } } - Font_LoadChar(play, 0x8E9E, charTexIndex); + Font_LoadChar(play, '時', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x8E9E; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '時'; decodedBufPos++; - Font_LoadChar(play, 0x8AD4, charTexIndex); + Font_LoadChar(play, '間', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x8E9E; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '時'; spC0 += 2.0f * (16.0f * msgCtx->textCharScale); } else if (curChar == 0x238) { Message_LoadTime(play, curChar, &charTexIndex, &spC0, &decodedBufPos); @@ -2825,9 +2821,9 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } @@ -2851,9 +2847,9 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, spAC[i] + 0x824F, charTexIndex); + Font_LoadChar(play, spAC[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = spAC[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = spAC[i] + '0'; decodedBufPos++; } else { var_fs0 -= 1.0f; @@ -2880,19 +2876,19 @@ void Message_Decode(PlayState* play) { } for (i = 0; i < 4; i++) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; if (i == 1) { - Font_LoadChar(play, 0x95AA, charTexIndex); + Font_LoadChar(play, '分', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x95AA; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '分'; decodedBufPos++; } else if (i == 3) { - Font_LoadChar(play, 0x9562, charTexIndex); + Font_LoadChar(play, '秒', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = 0x9562; + msgCtx->decodedBuffer.wchar[decodedBufPos] = '秒'; } } spC0 += 4.0f * (16.0f * msgCtx->textCharScale); @@ -2919,14 +2915,14 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } } - Message_LoadChar(play, 0x9543, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '匹', &charTexIndex, &spC0, decodedBufPos); } else if ((curChar == 0x30D) || (curChar == 0x30E) || (curChar == 0x30F)) { index = curChar - 0x30D; @@ -2976,14 +2972,14 @@ void Message_Decode(PlayState* play) { loadChar = true; } if (loadChar) { - Font_LoadChar(play, digits[i] + 0x824F, charTexIndex); + Font_LoadChar(play, digits[i] + '0', charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + 0x824F; + msgCtx->decodedBuffer.wchar[decodedBufPos] = digits[i] + '0'; decodedBufPos++; spC0 += 16.0f * msgCtx->textCharScale; } } - Message_LoadChar(play, 0x94AD, &charTexIndex, &spC0, decodedBufPos); + Message_LoadChar(play, '発', &charTexIndex, &spC0, decodedBufPos); } else if (curChar == 0x1F) { decodedBufPos--; for (i = 0; i < font->msgBuf.wchar[msgCtx->msgBufPos + 1]; i++) { @@ -3020,19 +3016,19 @@ void Message_Decode(PlayState* play) { } else if ((curChar != 0x20) && ((curChar < 0x2000) || (curChar >= 0x2009))) { Font_LoadChar(play, curChar, charTexIndex); charTexIndex += FONT_CHAR_TEX_SIZE; - if ((curChar == 0x8169) || (curChar == 0x8175)) { + if ((curChar == '(') || (curChar == '「')) { spC0 += 10.0f * msgCtx->textCharScale; - } else if (curChar == 0x8145) { + } else if (curChar == '・') { spC0 += (12.0f * msgCtx->textCharScale); - } else if ((curChar == 0x8148) || (curChar == 0x8149)) { + } else if ((curChar == '?') || (curChar == '!')) { spC0 += 14.0f * msgCtx->textCharScale; - } else if (curChar == 0x8144) { + } else if (curChar == '.') { spC0 += 8.0f * msgCtx->textCharScale; - } else if ((curChar == 0x816A) || (curChar == 0x8176)) { + } else if ((curChar == ')') || (curChar == '」')) { spC0 += 10.0f * msgCtx->textCharScale; - } else if ((curChar == 0x8141) || (curChar == 0x8142) || (curChar == 0x8168)) { + } else if ((curChar == '、') || (curChar == '。') || (curChar == '”')) { spC0 += 12.0f * msgCtx->textCharScale; - } else if (curChar == 0x8194) { + } else if (curChar == '#') { spC0 += 14.0f * msgCtx->textCharScale; } else { spC0 += 16.0f * msgCtx->textCharScale; @@ -3603,7 +3599,7 @@ void Message_DisplayOcarinaStaffImpl(PlayState* play, u16 ocarinaAction) { } for (j = 0, k = 0; j < 48; j++, k += FONT_CHAR_TEX_SIZE) { - Font_LoadChar(play, 0x8140, k); + Font_LoadChar(play, ' ', k); }; msgCtx->stateTimer = 3; @@ -4218,7 +4214,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) { case MSGMODE_TEXT_CONTINUING: if (msgCtx->stateTimer == 1) { for (i = 0, j = 0; i < 48; i++, j += FONT_CHAR_TEX_SIZE) { - Font_LoadChar(play, 0x8140, j); + Font_LoadChar(play, ' ', j); } Message_DrawText(play, &gfx); } else { diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index de3213fd12..286548216d 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -867,23 +867,24 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { default: switch (character) { - case 0x8169: - case 0x8175: + case '(': + case '「': msgCtx->textPosX -= TRUNCF_BINANG(6.0f * msgCtx->textCharScale); break; - case 0x8145: + case '・': msgCtx->textPosX -= TRUNCF_BINANG(3.0f * msgCtx->textCharScale); break; - case 0x8148: - case 0x8149: + case '?': + case '!': msgCtx->textPosX -= TRUNCF_BINANG(2.0f * msgCtx->textCharScale); break; default: break; } + if ((msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) && ((i + 1) == msgCtx->textDrawPos)) { Audio_PlaySfx(NA_SE_NONE); } @@ -907,28 +908,27 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) { } charTexIndex += FONT_CHAR_TEX_SIZE; - //! @TODO: u8 character but > 0x255 cases switch (character) { - case 0x8144: + case '.': msgCtx->textPosX += TRUNCF_BINANG(8.0f * msgCtx->textCharScale); break; - case 0x816A: - case 0x8176: + case ')': + case '」': msgCtx->textPosX += TRUNCF_BINANG(10.0f * msgCtx->textCharScale); break; - case 0x8141: - case 0x8142: - case 0x8168: + case '、': + case '。': + case '”': msgCtx->textPosX += TRUNCF_BINANG(12.0f * msgCtx->textCharScale); break; - case 0x8194: + case '#': msgCtx->textPosX += TRUNCF_BINANG(14.0f * msgCtx->textCharScale); break; - case 0x8145: + case '・': msgCtx->textPosX += TRUNCF_BINANG(15.0f * msgCtx->textCharScale); break; diff --git a/src/libultra/voice/voicecheckword.c b/src/libultra/voice/voicecheckword.c index b4c05d90cb..d0aa8331a1 100644 --- a/src/libultra/voice/voicecheckword.c +++ b/src/libultra/voice/voicecheckword.c @@ -5,90 +5,83 @@ */ #include "PR/controller.h" -// TODO: SJIS support s32 osVoiceCheckWord(u8* word) { s32 i; s32 errorCode = 0; u16 curSyllable; - u16 prevSyllable = 0; + u16 prevSyllable = '\0'; for (i = 0; word[i] != 0; i += 2) { curSyllable = (word[i] << 8) + word[i + 1]; - if (((curSyllable != 0x815B) && (curSyllable < 0x829F)) || - ((curSyllable >= 0x82F2) && (curSyllable < 0x8340)) || (curSyllable == 0x837F) || (curSyllable >= 0x8397)) { + if (((curSyllable != 'ー') && (curSyllable < 'ぁ')) || ((curSyllable > 'ん') && (curSyllable < 'ァ')) || + (curSyllable == 0x837F) || (curSyllable > 'ヶ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if ((i == 0) && ((curSyllable == 0x815B) || (curSyllable == 0x82F1) || (curSyllable == 0x82C1) || - (curSyllable == 0x82EC) || (curSyllable == 0x8393) || (curSyllable == 0x8362) || - (curSyllable == 0x838E) || (curSyllable == 0x8395) || (curSyllable == 0x8396))) { + } else if ((i == 0) && ((curSyllable == 'ー') || (curSyllable == 'ん') || (curSyllable == 'っ') || + (curSyllable == 'ゎ') || (curSyllable == 'ン') || (curSyllable == 'ッ') || + (curSyllable == 'ヮ') || (curSyllable == 'ヵ') || (curSyllable == 'ヶ'))) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x829F) || (curSyllable == 0x8340)) && (prevSyllable != 0x82D3) && - (prevSyllable != 0x8374) && (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ぁ') || (curSyllable == 'ァ')) && (prevSyllable != 'ふ') && + (prevSyllable != 'フ') && (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82A1) || (curSyllable == 0x8342)) && (prevSyllable != 0x82A4) && - (prevSyllable != 0x82C4) && (prevSyllable != 0x82C5) && (prevSyllable != 0x82D3) && - (prevSyllable != 0x8345) && (prevSyllable != 0x8365) && (prevSyllable != 0x8366) && - (prevSyllable != 0x8374) && (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ぃ') || (curSyllable == 'ィ')) && (prevSyllable != 'う') && + (prevSyllable != 'て') && (prevSyllable != 'で') && (prevSyllable != 'ふ') && + (prevSyllable != 'ウ') && (prevSyllable != 'テ') && (prevSyllable != 'デ') && + (prevSyllable != 'フ') && (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82A3) || (curSyllable == 0x8344)) && (prevSyllable != 0x82C6) && - (prevSyllable != 0x82C7) && (prevSyllable != 0x82D3) && (prevSyllable != 0x8367) && - (prevSyllable != 0x8368) && (prevSyllable != 0x8374) && (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ぅ') || (curSyllable == 'ゥ')) && (prevSyllable != 'と') && + (prevSyllable != 'ど') && (prevSyllable != 'ふ') && (prevSyllable != 'ト') && + (prevSyllable != 'ド') && (prevSyllable != 'フ') && (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82A5) || (curSyllable == 0x8346)) && (prevSyllable != 0x82A4) && - (prevSyllable != 0x82B5) && (prevSyllable != 0x82B6) && (prevSyllable != 0x82BF) && - (prevSyllable != 0x82C0) && (prevSyllable != 0x82C2) && (prevSyllable != 0x82D3) && - (prevSyllable != 0x8345) && (prevSyllable != 0x8356) && (prevSyllable != 0x8357) && - (prevSyllable != 0x8360) && (prevSyllable != 0x8361) && (prevSyllable != 0x8363) && - (prevSyllable != 0x8374) && (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ぇ') || (curSyllable == 'ェ')) && (prevSyllable != 'う') && + (prevSyllable != 'し') && (prevSyllable != 'じ') && (prevSyllable != 'ち') && + (prevSyllable != 'ぢ') && (prevSyllable != 'つ') && (prevSyllable != 'ふ') && + (prevSyllable != 'ウ') && (prevSyllable != 'シ') && (prevSyllable != 'ジ') && + (prevSyllable != 'チ') && (prevSyllable != 'ヂ') && (prevSyllable != 'ツ') && + (prevSyllable != 'フ') && (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82A7) || (curSyllable == 0x8348)) && (prevSyllable != 0x82A4) && - (prevSyllable != 0x82D3) && (prevSyllable != 0x8345) && (prevSyllable != 0x8374) && - (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ぉ') || (curSyllable == 'ォ')) && (prevSyllable != 'う') && + (prevSyllable != 'ふ') && (prevSyllable != 'ウ') && (prevSyllable != 'フ') && + (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82E1) || (curSyllable == 0x82E3) || (curSyllable == 0x82E5) || - (curSyllable == 0x8383) || (curSyllable == 0x8385) || (curSyllable == 0x8387)) && - (prevSyllable != 0x82AB) && (prevSyllable != 0x82B5) && (prevSyllable != 0x82BF) && - (prevSyllable != 0x82C9) && (prevSyllable != 0x82D0) && (prevSyllable != 0x82DD) && - (prevSyllable != 0x82E8) && (prevSyllable != 0x82AC) && (prevSyllable != 0x82B6) && - (prevSyllable != 0x82C0) && (prevSyllable != 0x82D1) && (prevSyllable != 0x82D2) && - (prevSyllable != 0x834C) && (prevSyllable != 0x8356) && (prevSyllable != 0x8360) && - (prevSyllable != 0x836A) && (prevSyllable != 0x8371) && (prevSyllable != 0x837E) && - (prevSyllable != 0x838A) && (prevSyllable != 0x834D) && (prevSyllable != 0x8357) && - (prevSyllable != 0x8361) && (prevSyllable != 0x8372) && (prevSyllable != 0x8373) && - (prevSyllable != 0x8394)) { + } else if (((curSyllable == 'ゃ') || (curSyllable == 'ゅ') || (curSyllable == 'ょ') || (curSyllable == 'ャ') || + (curSyllable == 'ュ') || (curSyllable == 'ョ')) && + (prevSyllable != 'き') && (prevSyllable != 'し') && (prevSyllable != 'ち') && + (prevSyllable != 'に') && (prevSyllable != 'ひ') && (prevSyllable != 'み') && + (prevSyllable != 'り') && (prevSyllable != 'ぎ') && (prevSyllable != 'じ') && + (prevSyllable != 'ぢ') && (prevSyllable != 'び') && (prevSyllable != 'ぴ') && + (prevSyllable != 'キ') && (prevSyllable != 'シ') && (prevSyllable != 'チ') && + (prevSyllable != 'ニ') && (prevSyllable != 'ヒ') && (prevSyllable != 'ミ') && + (prevSyllable != 'リ') && (prevSyllable != 'ギ') && (prevSyllable != 'ジ') && + (prevSyllable != 'ヂ') && (prevSyllable != 'ビ') && (prevSyllable != 'ピ') && + (prevSyllable != 'ヴ')) { errorCode = CONT_ERR_VOICE_WORD; - } else if ((curSyllable == 0x815B) && ((prevSyllable == 0x82F1) || (prevSyllable == 0x82C1) || - (prevSyllable == 0x8393) || (prevSyllable == 0x8362))) { + } else if ((curSyllable == 'ー') && ((prevSyllable == 'ん') || (prevSyllable == 'っ') || + (prevSyllable == 'ン') || (prevSyllable == 'ッ'))) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((curSyllable == 0x82F1) || (curSyllable == 0x8393)) && - ((prevSyllable == 0x82F1) || (prevSyllable == 0x8393))) { + } else if (((curSyllable == 'ん') || (curSyllable == 'ン')) && + ((prevSyllable == 'ん') || (prevSyllable == 'ン'))) { errorCode = CONT_ERR_VOICE_WORD; - } else if (((prevSyllable == 0x82C1) || (prevSyllable == 0x8362)) && - ((curSyllable == 0x815B) || (curSyllable == 0x82A0) || (curSyllable == 0x82A2) || - (curSyllable == 0x82A4) || (curSyllable == 0x82A6) || (curSyllable == 0x82A8) || - (curSyllable == 0x82C8) || (curSyllable == 0x82C9) || (curSyllable == 0x82CA) || - (curSyllable == 0x82CB) || (curSyllable == 0x82CC) || (curSyllable == 0x82DC) || - (curSyllable == 0x82DD) || (curSyllable == 0x82DE) || (curSyllable == 0x82DF) || - (curSyllable == 0x82E0) || (curSyllable == 0x82E2) || (curSyllable == 0x82E4) || - (curSyllable == 0x82E6) || (curSyllable == 0x82E7) || (curSyllable == 0x82E8) || - (curSyllable == 0x82E9) || (curSyllable == 0x82EA) || (curSyllable == 0x82EB) || - (curSyllable == 0x82ED) || (curSyllable == 0x82EE) || (curSyllable == 0x82EF) || - (curSyllable == 0x82F0) || (curSyllable == 0x82F1) || (curSyllable == 0x829F) || - (curSyllable == 0x82A1) || (curSyllable == 0x82A3) || (curSyllable == 0x82A5) || - (curSyllable == 0x82A7) || (curSyllable == 0x82E1) || (curSyllable == 0x82E3) || - (curSyllable == 0x82E5) || (curSyllable == 0x82C1) || (curSyllable == 0x82EC) || - (curSyllable == 0x8341) || (curSyllable == 0x8343) || (curSyllable == 0x8345) || - (curSyllable == 0x8347) || (curSyllable == 0x8349) || (curSyllable == 0x8369) || - (curSyllable == 0x836A) || (curSyllable == 0x836B) || (curSyllable == 0x836C) || - (curSyllable == 0x836D) || (curSyllable == 0x837D) || (curSyllable == 0x837E) || - (curSyllable == 0x8380) || (curSyllable == 0x8381) || (curSyllable == 0x8382) || - (curSyllable == 0x8384) || (curSyllable == 0x8386) || (curSyllable == 0x8388) || - (curSyllable == 0x8389) || (curSyllable == 0x838A) || (curSyllable == 0x838B) || - (curSyllable == 0x838C) || (curSyllable == 0x838D) || (curSyllable == 0x838F) || - (curSyllable == 0x8390) || (curSyllable == 0x8391) || (curSyllable == 0x8392) || - (curSyllable == 0x8393) || (curSyllable == 0x8340) || (curSyllable == 0x8342) || - (curSyllable == 0x8344) || (curSyllable == 0x8346) || (curSyllable == 0x8348) || - (curSyllable == 0x8383) || (curSyllable == 0x8385) || (curSyllable == 0x8387) || - (curSyllable == 0x8362) || (curSyllable == 0x838E))) { + } else if (((prevSyllable == 'っ') || (prevSyllable == 'ッ')) && + ((curSyllable == 'ー') || (curSyllable == 'あ') || (curSyllable == 'い') || (curSyllable == 'う') || + (curSyllable == 'え') || (curSyllable == 'お') || (curSyllable == 'な') || (curSyllable == 'に') || + (curSyllable == 'ぬ') || (curSyllable == 'ね') || (curSyllable == 'の') || (curSyllable == 'ま') || + (curSyllable == 'み') || (curSyllable == 'む') || (curSyllable == 'め') || (curSyllable == 'も') || + (curSyllable == 'や') || (curSyllable == 'ゆ') || (curSyllable == 'よ') || (curSyllable == 'ら') || + (curSyllable == 'り') || (curSyllable == 'る') || (curSyllable == 'れ') || (curSyllable == 'ろ') || + (curSyllable == 'わ') || (curSyllable == 'ゐ') || (curSyllable == 'ゑ') || (curSyllable == 'を') || + (curSyllable == 'ん') || (curSyllable == 'ぁ') || (curSyllable == 'ぃ') || (curSyllable == 'ぅ') || + (curSyllable == 'ぇ') || (curSyllable == 'ぉ') || (curSyllable == 'ゃ') || (curSyllable == 'ゅ') || + (curSyllable == 'ょ') || (curSyllable == 'っ') || (curSyllable == 'ゎ') || (curSyllable == 'ア') || + (curSyllable == 'イ') || (curSyllable == 'ウ') || (curSyllable == 'エ') || (curSyllable == 'オ') || + (curSyllable == 'ナ') || (curSyllable == 'ニ') || (curSyllable == 'ヌ') || (curSyllable == 'ネ') || + (curSyllable == 'ノ') || (curSyllable == 'マ') || (curSyllable == 'ミ') || (curSyllable == 'ム') || + (curSyllable == 'メ') || (curSyllable == 'モ') || (curSyllable == 'ヤ') || (curSyllable == 'ユ') || + (curSyllable == 'ヨ') || (curSyllable == 'ラ') || (curSyllable == 'リ') || (curSyllable == 'ル') || + (curSyllable == 'レ') || (curSyllable == 'ロ') || (curSyllable == 'ワ') || (curSyllable == 'ヰ') || + (curSyllable == 'ヱ') || (curSyllable == 'ヲ') || (curSyllable == 'ン') || (curSyllable == 'ァ') || + (curSyllable == 'ィ') || (curSyllable == 'ゥ') || (curSyllable == 'ェ') || (curSyllable == 'ォ') || + (curSyllable == 'ャ') || (curSyllable == 'ュ') || (curSyllable == 'ョ') || (curSyllable == 'ッ') || + (curSyllable == 'ヮ'))) { errorCode = CONT_ERR_VOICE_WORD; } @@ -99,7 +92,7 @@ s32 osVoiceCheckWord(u8* word) { prevSyllable = curSyllable; } - if ((curSyllable == 0x82C1) || (curSyllable == 0x8362)) { + if ((curSyllable == 'っ') || (curSyllable == 'ッ')) { errorCode = CONT_ERR_VOICE_WORD; } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 5362e5e49a..20cb19b6a9 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2843,7 +2843,7 @@ 0x8014ADBC:("Message_DrawTextDefault",), 0x8014C70C:("Message_LoadItemIcon",), 0x8014CC14:("Message_LoadChar",), - 0x8014CCB4:("func_8014CCB4",), + 0x8014CCB4:("Message_LoadRupeesJPN",), 0x8014CDF0:("Message_GetTimerDigits",), 0x8014CFDC:("Message_DecodeHeader",), 0x8014D304:("Message_LoadTime",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 188ff2c1d8..7651b939ee 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2011,7 +2011,7 @@ 0x801D0250:("sOwlWarpTextLengthJPN","UNK_TYPE1","",0x1), 0x801D0268:("sTimeSpeedTextJPN","UNK_TYPE2","",0x2), 0x801D027C:("sMaskCodeColorCmdJPN","UNK_TYPE1","",0x1), - 0x801D0284:("D_801D0284","UNK_TYPE1","",0x1), + 0x801D0284:("sMaskCodeTextJPN","UNK_TYPE1","",0x1), 0x801D028C:("D_801D028C","UNK_TYPE1","",0x1), 0x801D02C0:("sOcarinaSongFlagsMap","UNK_TYPE1","",0x1), 0x801D02D8:("sOcarinaEffectActorIds","UNK_TYPE1","",0x1), diff --git a/tools/shiftjis_conv.py b/tools/shiftjis_conv.py new file mode 100755 index 0000000000..a865e1e77a --- /dev/null +++ b/tools/shiftjis_conv.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import argparse +import sys + +def sjis_process(buf, outfile): + skipTimer = 0 + + for i in range(len(buf)): + if skipTimer > 0: + skipTimer -= 1 + continue + + if buf[i] == "'" and buf[i+2] == "'" and ord(buf[i + 1]) > 0xFF: + echar = buf[i+1].encode("shift-jis") + hchar = int(echar.hex(), 16) + outfile.write(f"0x{hchar:04X}") + skipTimer = 2 + else: + outfile.write(buf[i]) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Takes a file and converts shift-jis character literals to their hex value') + parser.add_argument('infile', type=str, help='input file to process') + parser.add_argument('-o', '--outfile', help='output file to write to. None for stdout') + args = parser.parse_args() + + with open(args.infile) as f: + fb = f.read() + + if args.outfile is None: + sjis_process(fb, sys.stdout) + else: + with open(args.outfile, "w+") as outf: + sjis_process(fb, outf) diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 343e2ee4c6..a65e3dcd1f 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2357,7 +2357,7 @@ asm/non_matchings/code/z_message/Message_HandleOcarina.s,Message_HandleOcarina,0 asm/non_matchings/code/z_message/Message_DrawTextDefault.s,Message_DrawTextDefault,0x8014ADBC,0x654 asm/non_matchings/code/z_message/Message_LoadItemIcon.s,Message_LoadItemIcon,0x8014C70C,0x142 asm/non_matchings/code/z_message/Message_LoadChar.s,Message_LoadChar,0x8014CC14,0x28 -asm/non_matchings/code/z_message/func_8014CCB4.s,func_8014CCB4,0x8014CCB4,0x4F +asm/non_matchings/code/z_message/Message_LoadRupeesJPN.s,Message_LoadRupeesJPN,0x8014CCB4,0x4F asm/non_matchings/code/z_message/Message_GetTimerDigits.s,Message_GetTimerDigits,0x8014CDF0,0x7B asm/non_matchings/code/z_message/Message_DecodeHeader.s,Message_DecodeHeader,0x8014CFDC,0xCA asm/non_matchings/code/z_message/Message_LoadTime.s,Message_LoadTime,0x8014D304,0xCA