From e5157023eb0bf427bbec067d39a73d96bf554983 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Tue, 17 Jun 2025 10:26:16 -0400 Subject: [PATCH] Match savemenu_render_element for JP Region (#631) * Last function that had no compilable code is now there. * Hack up the score script to filter out functions that are matched in US 1.0 but not in JPN. This will finally show us the true functions remaining to be matched to finish US 1.0 * Update score * Run formatter * Match savemenu_render_element for JP Region * Update the score --- README.md | 18 +++++++++--------- libultra/src/libc/ldiv.c | 2 +- src/menu.c | 31 +++++++++++++------------------ tools/python/score.py | 2 +- 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 8fede0ee..96a4a473 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fd As of June 17, 2025, this is our current score: -    Decomp progress: 92.00% +    Decomp progress: 92.22% -    Documentation progress: 59.08% +    Documentation progress: 59.33% --- @@ -121,8 +121,8 @@ As of June 17, 2025, this is our current score: ``` ===================================================================== ADVENTURE ONE (ASM -> C Decompilation) - --------------- 92.00% Complete (92.78% NON_MATCHING) --------------- - # Decompiled functions: 1922 + --------------- 92.22% Complete (93.00% NON_MATCHING) --------------- + # Decompiled functions: 1923 # GLOBAL_ASM remaining: 25 # NON_MATCHING functions: 4 # NON_EQUIVALENT WIP functions: 21 @@ -130,17 +130,17 @@ As of June 17, 2025, this is our current score: Balloons: 43/47, Keys: 4/4, Trophies: 4/5 T.T. Amulets: 4/4, Wizpig Amulets: 4/4 --------------------------------------------------------------------- - We are collecting silver coins in Spacedust Alley. (6/8 silver coins) + We are collecting silver coins in Spacedust Alley. (7/8 silver coins) ===================================================================== ADVENTURE TWO (Cleanup & Documentation) - -------------------------- 59.08% Complete -------------------------- - # Documented functions: 1207 + -------------------------- 59.33% Complete -------------------------- + # Documented functions: 1208 # Undocumented remaining: 440 ---------------------------- Game Status ---------------------------- - Balloons: 28/47, Keys: 3/4, Trophies: 2/5 + Balloons: 29/47, Keys: 3/4, Trophies: 2/5 T.T. Amulets: 3/4, Wizpig Amulets: 2/4 --------------------------------------------------------------------- - We are collecting silver coins in Pirate Lagoon. (8/8 silver coins) + We are collecting silver coins in Treasure Caves. (1/8 silver coins) ===================================================================== ``` diff --git a/libultra/src/libc/ldiv.c b/libultra/src/libc/ldiv.c index 7e7fa016..1e4d65c4 100644 --- a/libultra/src/libc/ldiv.c +++ b/libultra/src/libc/ldiv.c @@ -47,4 +47,4 @@ u64 __ashldi3(u64 u, unsigned int b) { s64 __ashrdi3(s64 u, unsigned int b) { return u >> b; } -#endif \ No newline at end of file +#endif diff --git a/src/menu.c b/src/menu.c index 54ba6326..d2500cde 100644 --- a/src/menu.c +++ b/src/menu.c @@ -4130,7 +4130,6 @@ void menu_save_options_init(void) { * This has the file name, and then a background and icon based on kind of file it is. * DKR save files will display the balloon count and adventure type. */ -#if REGION != REGION_JP void savemenu_render_element(SaveFileData *file, s32 x, s32 y) { s32 i; s32 firstDigit; @@ -4185,7 +4184,7 @@ void savemenu_render_element(SaveFileData *file, s32 x, s32 y) { buffer[i + 3] = file->saveFileExt[0]; buffer[i + 4] = ')'; buffer[i + 5] = '\0'; - text = gMenuText[86 + file->controllerIndex]; + text = gMenuText[ASSET_MENU_TEXT_CONTPAK1 + file->controllerIndex]; firstDigit = file->balloonCount / 10; secondDigit = file->balloonCount % 10; if (file->adventureTwo) { @@ -4195,24 +4194,24 @@ void savemenu_render_element(SaveFileData *file, s32 x, s32 y) { case SAVE_FILE_TYPE_CPAK_TIMES: #if REGION == REGION_JP drawTexture = gDrawTexTTIcon; - text2 = gMenuText[ASSET_MENU_TEXT_TIMES]; texture = gMenuAssets[TEXTURE_UNK_44]; colour = gContPakSaveBgColours[file->controllerIndex]; - for (i = 0; (text2[i] & 0xFF) != 0; i++) { - firstDigit = text2[ASSET_MENU_TEXT_TIMES + i]; - buffer[i] = firstDigit; + for (i = 0; gMenuText[ASSET_MENU_TEXT_TIMES][i] != '\0'; i++) { + buffer[i] = gMenuText[ASSET_MENU_TEXT_TIMES][i]; } - for (i = 0; file->saveFileExt[i] != 0 && file->saveFileExt[i] != 0x2E; i++) {} - buffer[i] = '.'; - if (file->saveFileExt[i] != '\n') { - buffer[i - 1] = file->saveFileExt[i + 1]; + firstDigit = 0; + while (file->saveFileExt[firstDigit] != '\0' && file->saveFileExt[firstDigit] != '.') { + firstDigit++; + } + buffer[i++] = '.'; + if (file->saveFileExt[firstDigit] != '\0') { + buffer[i++] = file->saveFileExt[firstDigit + 1]; } else { - buffer[i] = 'A'; + buffer[i++] = 'A'; } - buffer[i + 1] = '\n'; + buffer[i++] = '\0'; text2 = buffer; text = gMenuText[ASSET_MENU_TEXT_CONTPAK1 + file->controllerIndex]; - firstDigit = i; #else drawTexture = gDrawTexTTIcon; texture = gMenuAssets[TEXTURE_UNK_44]; @@ -4264,7 +4263,7 @@ void savemenu_render_element(SaveFileData *file, s32 x, s32 y) { text = NULL; break; } -#if VERSION == VERSION_79 +#if REGION == REGION_JP #define SAVE_MENU_TEXT_FONT ASSET_FONTS_SUBTITLEFONT #define SAVE_MENU_TEXT_WIDTH 208 #define SAVE_MENU_SPRITE_OFFSET 8 @@ -4328,10 +4327,6 @@ void savemenu_render_element(SaveFileData *file, s32 x, s32 y) { draw_text(&sMenuCurrDisplayList, x + (79 + SAVE_MENU_TEXT_OFFSET_2), y + 47, text2, ALIGN_TOP_CENTER); } } -// No match JPN savemenu_render_element -#else -#pragma GLOBAL_ASM("asm/nonmatchings/menu/savemenu_render_element.s") -#endif /** * Render all of the save option elements onscreen. diff --git a/tools/python/score.py b/tools/python/score.py index 395b302e..3be511c0 100644 --- a/tools/python/score.py +++ b/tools/python/score.py @@ -117,7 +117,7 @@ MAP_FILE = DkrMapFile() NOT_FUNCTION_NAMES = ['if', 'else', 'switch', 'while', 'for', 'dmacopy_internal', 'func_80082BC8_837C8', 'rumble_enable', 'func_800C6464_C7064', 'func_800C663C_C723C', 'func_800C67F4_C73F4', 'func_800C6870_C7470', 'func_800C68CC_C74CC', 'fontCreateDisplayList', 'func_800C7744_C8344', 'func_800C7804_C8404', - 'fontConvertString', 'func_800C78E0_C84E0', 'menu_credits_loop', 'savemenu_render_element', 'results_render'] + 'fontConvertString', 'func_800C78E0_C84E0', 'menu_credits_loop', 'results_render'] class ScoreFileMatch: def __init__(self, comment, functionName):