diff options
| author | cadmic <cadmic24@gmail.com> | 2024-07-17 15:36:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-17 18:36:17 -0400 |
| commit | 4fbb48177fcf38d339cab6bc725421e13be7d6bb (patch) | |
| tree | d52c2d000f7bad2302b1e47c203d9f3796c505c4 /src/code | |
| parent | f0796afb8621e60ea56b44a443b73af6a4d763c1 (diff) | |
Create FILENAME_ macros for NTSC filename encoding (#1986)
* Create FILENAME_ macros for NTSC filename encoding
* Add defines/comments for all filename characters
* FILENAME_EXCLAMATION_POINT -> FILENAME_EXCLAMATION_MARK to match kanji file
* hirigana -> hiragana
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_message.c | 24 | ||||
| -rw-r--r-- | src/code/z_sram.c | 86 |
2 files changed, 64 insertions, 46 deletions
diff --git a/src/code/z_message.c b/src/code/z_message.c index e0a98beb5..6e3477871 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1303,7 +1303,7 @@ void Message_Decode(PlayState* play) { // Substitute the player name control character for the file's player name. for (playerNameLen = ARRAY_COUNT(gSaveContext.save.info.playerData.playerName); playerNameLen > 0; playerNameLen--) { - if (gSaveContext.save.info.playerData.playerName[playerNameLen - 1] != 0x3E) { + if (gSaveContext.save.info.playerData.playerName[playerNameLen - 1] != FILENAME_SPACE) { break; } } @@ -1311,21 +1311,21 @@ void Message_Decode(PlayState* play) { PRINTF("\n名前 = "); for (i = 0; i < playerNameLen; i++) { curChar2 = gSaveContext.save.info.playerData.playerName[i]; - if (curChar2 == 0x3E) { + if (curChar2 == FILENAME_SPACE) { curChar2 = ' '; - } else if (curChar2 == 0x40) { + } else if (curChar2 == FILENAME_PERIOD) { curChar2 = '.'; - } else if (curChar2 == 0x3F) { + } else if (curChar2 == FILENAME_DASH) { curChar2 = '-'; - } else if (curChar2 < 0xA) { - curChar2 += 0; + } else if (curChar2 <= FILENAME_DIGIT('9')) { + curChar2 -= FILENAME_DIGIT('0'); curChar2 += '0'; - } else if (curChar2 < 0x24) { - curChar2 += 0; - curChar2 += '7'; - } else if (curChar2 < 0x3E) { - curChar2 += 0; - curChar2 += '='; + } else if (curChar2 <= FILENAME_UPPERCASE('Z')) { + curChar2 -= FILENAME_UPPERCASE('A'); + curChar2 += 'A'; + } else if (curChar2 <= FILENAME_LOWERCASE('z')) { + curChar2 -= FILENAME_LOWERCASE('a'); + curChar2 += 'a'; } if (curChar2 != ' ') { Font_LoadChar(font, curChar2 - ' ', charTexIdx); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index b5da4691c..fb2a4d119 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -27,23 +27,32 @@ u16 gSramSlotOffsets[] = { static char sZeldaMagic[] = { '\0', '\0', '\0', '\x98', '\x09', '\x10', '\x21', 'Z', 'E', 'L', 'D', 'A' }; static SavePlayerData sNewSavePlayerData = { - { '\0', '\0', '\0', '\0', '\0', '\0' }, // newf - 0, // deaths - { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName - 0, // n64ddFlag - 0x30, // healthCapacity - 0x30, // defense - 0, // magicLevel - MAGIC_NORMAL_METER, // magic - 0, // rupees - 0, // swordHealth - 0, // naviTimer - false, // isMagicAcquired - 0, // unk_1F - false, // isDoubleMagicAcquired - false, // isDoubleDefenseAcquired - 0, // bgsFlag - 0, // ocarinaGameRoundNum + { '\0', '\0', '\0', '\0', '\0', '\0' }, // newf + 0, // deaths + { + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + }, // playerName + 0, // n64ddFlag + 0x30, // healthCapacity + 0x30, // defense + 0, // magicLevel + MAGIC_NORMAL_METER, // magic + 0, // rupees + 0, // swordHealth + 0, // naviTimer + false, // isMagicAcquired + 0, // unk_1F + false, // isDoubleMagicAcquired + false, // isDoubleDefenseAcquired + 0, // bgsFlag + 0, // ocarinaGameRoundNum { { ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems { SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots @@ -155,23 +164,32 @@ void Sram_InitNewSave(void) { } static SavePlayerData sDebugSavePlayerData = { - { 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf - 0, // deaths - { 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E }, // playerName ( "LINK" ) - 0, // n64ddFlag - 0xE0, // healthCapacity - 0xE0, // health - 0, // magicLevel - MAGIC_NORMAL_METER, // magic - 150, // rupees - 8, // swordHealth - 0, // naviTimer - true, // isMagicAcquired - 0, // unk_1F - false, // isDoubleMagicAcquired - false, // isDoubleDefenseAcquired - 0, // bgsFlag - 0, // ocarinaGameRoundNum + { 'Z', 'E', 'L', 'D', 'A', 'Z' }, // newf + 0, // deaths + { + FILENAME_UPPERCASE('L'), + FILENAME_UPPERCASE('I'), + FILENAME_UPPERCASE('N'), + FILENAME_UPPERCASE('K'), + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + FILENAME_SPACE, + }, // playerName + 0, // n64ddFlag + 0xE0, // healthCapacity + 0xE0, // health + 0, // magicLevel + MAGIC_NORMAL_METER, // magic + 150, // rupees + 8, // swordHealth + 0, // naviTimer + true, // isMagicAcquired + 0, // unk_1F + false, // isDoubleMagicAcquired + false, // isDoubleDefenseAcquired + 0, // bgsFlag + 0, // ocarinaGameRoundNum { { ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems { SLOT_NONE, SLOT_NONE, SLOT_NONE }, // cButtonSlots |
