Match menu_ghost_data_init (#480)

* Match menu_ghost_data_init

* 75% matching!

* Fix readme
This commit is contained in:
Ryan Myers
2025-03-13 14:17:05 -04:00
committed by GitHub
parent d7e3aa069a
commit 019b2fa9d0
4 changed files with 36 additions and 58 deletions
+9 -9
View File
@@ -5,9 +5,9 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the
Currently, only the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is supported. US 1.1, EU 1.0, EU 1.1, and JP are not supported at this time.
<!-- README_SCORE_SUMMARY_BEGIN -->
As of March 12, 2025, this is our current score:
As of March 13, 2025, this is our current score:
&emsp;&emsp;&emsp;&emsp;Decomp progress: 74.91%
&emsp;&emsp;&emsp;&emsp;Decomp progress: 75.04%
&emsp;&emsp;&emsp;&emsp;Documentation progress: 49.99%
<!-- README_SCORE_SUMMARY_END -->
@@ -126,20 +126,20 @@ s32 is_drumstick_unlocked(void) {
```
<!-- README_SCORE_BEGIN -->
As of March 12, 2025, this is our current score:
As of March 13, 2025, this is our current score:
```
=====================================================================
ADVENTURE ONE (ASM -> C Decompilation)
--------------- 74.91% Complete (77.14% NON_MATCHING) ---------------
# Decompiled functions: 1826
# GLOBAL_ASM remaining: 115
--------------- 75.04% Complete (77.26% NON_MATCHING) ---------------
# Decompiled functions: 1827
# GLOBAL_ASM remaining: 114
# NON_MATCHING functions: 13
# NON_EQUIVALENT WIP functions: 40
# NON_EQUIVALENT WIP functions: 39
---------------------------- Game Status ----------------------------
Balloons: 35/47, Keys: 4/4, Trophies: 3/5
T.T. Amulets: 4/4, Wizpig Amulets: 3/4
---------------------------------------------------------------------
We are collecting silver coins in Windmill Plains. (3/8 silver coins)
We are collecting silver coins in Windmill Plains. (4/8 silver coins)
=====================================================================
ADVENTURE TWO (Cleanup & Documentation)
-------------------------- 49.99% Complete --------------------------
@@ -151,7 +151,7 @@ As of March 12, 2025, this is our current score:
---------------------------------------------------------------------
We are racing in Pirate Lagoon. (Lap 3/3)
=====================================================================
```
```
<!-- README_SCORE_END -->
---
+25 -47
View File
@@ -4958,7 +4958,7 @@ void bootscreen_init_cpak(void) {
// Fills in the table.
for (i = 1; i < ARRAY_COUNT(gBootPakData); i++) {
gBootPakData[i] = (char *) (((u32) gBootPakData[0]) + (i * 0x20));
gBootPakData[i] = (char *) (((u32) gBootPakData[0]) + (i * (SAVE_SIZE_MENU / ARRAY_COUNT(gBootPakData))));
}
// Only check cpak 0
@@ -8028,11 +8028,11 @@ void trackmenu_render_2D(s32 x, s32 y, char *hubName, char *trackName, s32 rectO
// trackmenu_render_names
void func_8008FF1C(UNUSED s32 updateRate) {
s32 i; // sp7C
UNUSED s16 **temp2;
UNUSED s32 pad1;
char *hubName;
UNUSED s32 temp4;
s16 temp4;
s32 trackSelectX;
UNUSED s32 pad4;
UNUSED s32 pad2;
s32 temp;
s32 maxTrackY;
s8 *trackMenuIds;
@@ -8063,9 +8063,9 @@ void func_8008FF1C(UNUSED s32 updateRate) {
} else {
cur->visible = 1;
hubName = get_level_name(get_hub_area_id(trackY + 1));
temp4 = gTrackSelectIDs[trackY][trackX];
cur->hubName = hubName;
// Problem is here.
if (gTrackSelectIDs[trackY][trackX] != -1) {
if ((temp4) != -1) {
cur->trackName = get_level_name(trackMenuIds[(trackY * 6) + trackX]);
if (trackX == 4) {
if (((settings->trophies >> (trackY * 2)) & 3) == 3) {
@@ -11569,53 +11569,34 @@ s32 ghostmenu_erase(s32 id) {
return result;
}
#ifdef NON_EQUIVALENT
// Should be functionally equivalent
void menu_ghost_data_init(void) {
s32 i;
SIDeviceStatus pakStatus;
pakStatus = func_800756D4(gCpakGhostData, &gGhostLevelIDsPak, &gGhostVehicleIDsPak, &gGhostCharacterIDsPak,
&gGhostChecksumIDsPak);
pakStatus = func_800756D4(gCpakGhostData, gGhostLevelIDsPak, gGhostVehicleIDsPak, gGhostCharacterIDsPak,
gGhostChecksumIDsPak);
if (pakStatus == CONTROLLER_PAK_GOOD) {
ghostmenu_generate();
}
menu_assetgroup_load(&gGhostDataObjectIndices);
menu_imagegroup_load(&gGhostDataImageIndices);
menu_assetgroup_load(gGhostDataObjectIndices);
menu_imagegroup_load(gGhostDataImageIndices);
load_font(ASSET_FONTS_BIGFONT);
gDrawTexDinoDomainGhostBg[0].texture = gMenuAssets[TEXTURE_BACKGROUND_DINO_DOMAIN_TOP];
gDrawTexDinoDomainGhostBg[5].texture = gMenuAssets[TEXTURE_BACKGROUND_DINO_DOMAIN_BOTTOM];
gDrawTexSherbetIslandGhostBg[0].texture = gMenuAssets[TEXTURE_BACKGROUND_SHERBERT_ISLAND_TOP];
gDrawTexSherbetIslandGhostBg[5].texture = gMenuAssets[TEXTURE_BACKGROUND_SHERBERT_ISLAND_BOTTOM];
gDrawTexSnowflakeMountainGhostBg[0].texture = gMenuAssets[TEXTURE_BACKGROUND_SNOWFLAKE_MOUNTAIN_TOP];
gDrawTexSnowflakeMountainGhostBg[5].texture = gMenuAssets[TEXTURE_BACKGROUND_SNOWFLAKE_MOUNTAIN_BOTTOM];
gDrawTexDragonForestGhostBg[0].texture = gMenuAssets[TEXTURE_BACKGROUND_DRAGON_FOREST_TOP];
gDrawTexDragonForestGhostBg[5].texture = gMenuAssets[TEXTURE_BACKGROUND_DRAGON_FOREST_BOTTOM];
gDrawTexFutureFunLandGhostBg[0].texture = gMenuAssets[TEXTURE_BACKGROUND_FUTURE_FUN_LAND_TOP];
gDrawTexFutureFunLandGhostBg[5].texture = gMenuAssets[TEXTURE_BACKGROUND_FUTURE_FUN_LAND_BOTTOM];
for (i = 0; i < 4; i++) {
gDrawTexDinoDomainGhostBg[i + 1].texture = gDrawTexDinoDomainGhostBg[0].texture;
gDrawTexDinoDomainGhostBg[i + 6].texture = gDrawTexDinoDomainGhostBg[5].texture;
if (i & 1 == 1) {
gDrawTexSherbetIslandGhostBg[i + 1].texture = gDrawTexSherbetIslandGhostBg[0].texture;
gDrawTexSherbetIslandGhostBg[i + 6].texture = gDrawTexSherbetIslandGhostBg[5].texture;
} else {
gDrawTexSherbetIslandGhostBg[i + 1].texture = gDrawTexSherbetIslandGhostBg[5].texture;
gDrawTexSherbetIslandGhostBg[i + 6].texture = gDrawTexSherbetIslandGhostBg[0].texture;
}
gDrawTexSnowflakeMountainGhostBg[i + 1].texture = gDrawTexSnowflakeMountainGhostBg[0].texture;
gDrawTexSnowflakeMountainGhostBg[i + 6].texture = gDrawTexSnowflakeMountainGhostBg[5].texture;
gDrawTexDragonForestGhostBg[i + 1].texture = gDrawTexDragonForestGhostBg[0].texture;
gDrawTexDragonForestGhostBg[i + 6].texture = gDrawTexDragonForestGhostBg[5].texture;
if (i & 1 == 1) {
gDrawTexFutureFunLandGhostBg[i + 1].texture = gDrawTexFutureFunLandGhostBg[0].texture;
gDrawTexFutureFunLandGhostBg[i + 6].texture = gDrawTexFutureFunLandGhostBg[5].texture;
} else {
gDrawTexFutureFunLandGhostBg[i + 1].texture = gDrawTexFutureFunLandGhostBg[5].texture;
gDrawTexFutureFunLandGhostBg[i + 6].texture = gDrawTexFutureFunLandGhostBg[0].texture;
}
for (i = 0; i < 5; i++) {
gDrawTexDinoDomainGhostBg[i].texture = gMenuAssets[TEXTURE_BACKGROUND_DINO_DOMAIN_TOP];
gDrawTexDinoDomainGhostBg[i + 5].texture = gMenuAssets[TEXTURE_BACKGROUND_DINO_DOMAIN_BOTTOM];
gDrawTexSherbetIslandGhostBg[i + ((i & 1) * 5)].texture = gMenuAssets[TEXTURE_BACKGROUND_SHERBERT_ISLAND_TOP];
gDrawTexSherbetIslandGhostBg[i + (((i & 1) ^ 1) * 5)].texture =
gMenuAssets[TEXTURE_BACKGROUND_SHERBERT_ISLAND_BOTTOM];
gDrawTexSnowflakeMountainGhostBg[i].texture = gMenuAssets[TEXTURE_BACKGROUND_SNOWFLAKE_MOUNTAIN_TOP];
gDrawTexSnowflakeMountainGhostBg[i + 5].texture = gMenuAssets[TEXTURE_BACKGROUND_SNOWFLAKE_MOUNTAIN_BOTTOM];
gDrawTexDragonForestGhostBg[i].texture = gMenuAssets[TEXTURE_BACKGROUND_DRAGON_FOREST_TOP];
gDrawTexDragonForestGhostBg[i + 5].texture = gMenuAssets[TEXTURE_BACKGROUND_DRAGON_FOREST_BOTTOM];
gDrawTexFutureFunLandGhostBg[i + ((i & 1) * 5)].texture = gMenuAssets[TEXTURE_BACKGROUND_FUTURE_FUN_LAND_TOP];
gDrawTexFutureFunLandGhostBg[i + (((i & 1) ^ 1) * 5)].texture =
gMenuAssets[TEXTURE_BACKGROUND_FUTURE_FUN_LAND_BOTTOM];
}
menu_init_vehicle_textures();
menu_racer_portraits();
menu_init_arrow_textures();
@@ -11630,9 +11611,6 @@ void menu_ghost_data_init(void) {
}
gMenuDelay = 30;
}
#else
GLOBAL_ASM("asm/non_matchings/menu/menu_ghost_data_init.s")
#endif
/**
* Render the list of existing ghost data.
+1 -1
View File
@@ -1455,7 +1455,7 @@ s32 func_800753D8(s32 controllerIndex, s32 worldId) {
return pakStatus;
}
SIDeviceStatus func_800756D4(s32 controllerIndex, u8 *levelIDs, u8 *vehicleIDs, u8 *characterIDs, s16 *checksumIDs) {
SIDeviceStatus func_800756D4(s32 controllerIndex, u8 *levelIDs, u8 *vehicleIDs, u8 *characterIDs, u16 *checksumIDs) {
s32 i;
u8 *fileData;
s32 ret; // sp64
+1 -1
View File
@@ -177,7 +177,7 @@ s32 func_80072C54(s32 arg0);
void populate_settings_from_save_data(Settings *settings, u8 *saveData);
s32 read_save_file(s32 saveFileNum, Settings *settings);
void erase_save_file(s32 saveFileNum, Settings *settings);
SIDeviceStatus func_800756D4(s32 controllerIndex, u8 *levelIDs, u8 *vehicleIDs, u8 *characterIDs, s16 *checksumIDs);
SIDeviceStatus func_800756D4(s32 controllerIndex, u8 *levelIDs, u8 *vehicleIDs, u8 *characterIDs, u16 *checksumIDs);
SIDeviceStatus get_file_extension(s32 controllerIndex, s32 fileType, char *fileExt);
void func_80073588(Settings *settings, u8 *saveData, u8 arg2);
void func_800732E8(Settings *settings, u8 *saveData);