mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Rematch render_epc_lock_up_display to remove local static! (#561)
* Fix name of verify all versions job * Create a script to run m2c on all remaining unmatched functions. * Update some functions with updated versions from scratches. * Minor func_800135B8 documenting * formatting * remove yaml patch file * Add better bug comments to more standardize them * Fix and document various small issues * Add objStatusString to the symbols list * Some work trying to see if I can fix thread0 code some. * test * near match for render_epc_lock_up_display * Rematch render_epc_lock_up_display without the static bs * Remove the stacks.c file * Do some cleanup for thread0_epc. * format * update score
This commit is contained in:
@@ -7,7 +7,7 @@ on:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
verify-build:
|
||||
verify-all-versions:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
@@ -5,7 +5,7 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the
|
||||
All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified.
|
||||
|
||||
<!-- README_SCORE_SUMMARY_BEGIN -->
|
||||
As of May 7, 2025, this is our current score:
|
||||
As of May 9, 2025, this is our current score:
|
||||
|
||||
    Decomp progress: 85.73%
|
||||
|
||||
@@ -117,7 +117,7 @@ s32 is_drumstick_unlocked(void) {
|
||||
```
|
||||
|
||||
<!-- README_SCORE_BEGIN -->
|
||||
As of May 7, 2025, this is our current score:
|
||||
As of May 9, 2025, this is our current score:
|
||||
```
|
||||
=====================================================================
|
||||
ADVENTURE ONE (ASM -> C Decompilation)
|
||||
@@ -125,7 +125,7 @@ As of May 7, 2025, this is our current score:
|
||||
# Decompiled functions: 1883
|
||||
# GLOBAL_ASM remaining: 68
|
||||
# NON_MATCHING functions: 7
|
||||
# NON_EQUIVALENT WIP functions: 25
|
||||
# NON_EQUIVALENT WIP functions: 26
|
||||
---------------------------- Game Status ----------------------------
|
||||
Balloons: 39/47, Keys: 4/4, Trophies: 4/5
|
||||
T.T. Amulets: 4/4, Wizpig Amulets: 4/4
|
||||
|
||||
+3
-5
@@ -4,11 +4,9 @@
|
||||
/* Note: Structs are not complete, take them with a grain of salt. */
|
||||
|
||||
#include "types.h"
|
||||
#include "enums.h"
|
||||
#include "level_object_entries.h"
|
||||
#include "object_properties.h"
|
||||
#include "gbi.h"
|
||||
#include "PR/libaudio.h"
|
||||
#include "audio.h"
|
||||
|
||||
typedef struct Vec4f {
|
||||
@@ -491,7 +489,8 @@ typedef struct LevelHeader {
|
||||
/* 0x9D */ u8 bgColorRed;
|
||||
/* 0x9E */ u8 bgColorGreen;
|
||||
/* 0x9F */ u8 bgColorBlue;
|
||||
/* 0xA0 */ s16 unkA0;
|
||||
/* 0xA0 */ u8 unkA0;
|
||||
/* 0xA1 */ u8 unkA1;
|
||||
/* 0xA2 */ s8 unkA2;
|
||||
/* 0xA3 */ s8 unkA3;
|
||||
/* 0xA4 */ TextureHeader *unkA4;
|
||||
@@ -1701,8 +1700,7 @@ typedef struct Object_68 {
|
||||
ObjectModel *objModel;
|
||||
TextureHeader *texHeader;
|
||||
};
|
||||
/* 0x04 */ Vertex *vertices[2];
|
||||
/* 0x0C */ s32 *unkC;
|
||||
/* 0x04 */ Vertex *vertices[3];
|
||||
/* 0x10 */ s16 animationID;
|
||||
/* 0x12 */ s16 animationFrame;
|
||||
/* 0x14 */ s16 animationFrameCount;
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Make the m2cfiles dir if it doesn't already exist
|
||||
mkdir -p m2cfiles
|
||||
|
||||
# Find all .s files in the asm directory and its subdirectories
|
||||
find asm/nonmatchings -type f -name "*.s" | while read ASMFILE; do
|
||||
# Extract the filename without extension and path
|
||||
FILENAME=$(basename "$ASMFILE" .s)
|
||||
|
||||
echo "Processing $FILENAME from $ASMFILE"
|
||||
|
||||
# Create the output file with the required header
|
||||
echo '#include "../ctx.c"\n' > "m2cfiles/$FILENAME.c"
|
||||
|
||||
# Run the m2c command with the extracted filename
|
||||
.venv/bin/python3 tools/m2c/m2c.py --target mips-ido-c --pointer-style right --context ctx.c -f "$FILENAME" "$ASMFILE" >> "m2cfiles/$FILENAME.c"
|
||||
|
||||
echo "Created m2cfiles/$FILENAME.c"
|
||||
done
|
||||
+12
-14
@@ -2,7 +2,6 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "asset_enums.h"
|
||||
#include "asset_loading.h"
|
||||
#include "audiomgr.h"
|
||||
@@ -73,7 +72,7 @@ SoundHandle gRacerSoundMask;
|
||||
/******************************/
|
||||
|
||||
/**
|
||||
* Allocate memory for all of the audio systems, including sequence data, sound data and heaps.
|
||||
* Allocate memory for all the audio systems, including sequence data, sound data and heaps.
|
||||
* Afterwards, set up the audio thread and start it.
|
||||
*/
|
||||
void audio_init(OSSched *sc) {
|
||||
@@ -498,27 +497,26 @@ void music_channel_reset_all(void) {
|
||||
}
|
||||
}
|
||||
|
||||
UNUSED u8 func_80001358(u8 arg0, u8 arg1, s32 arg2) {
|
||||
UNUSED u8 func_80001358(u8 chan1, u8 chan2, s32 arg2) {
|
||||
u8 val_1f;
|
||||
u8 val_1e;
|
||||
u8 vol;
|
||||
s32 updatedVol;
|
||||
|
||||
// u8 fadeIn_chan = arg0;
|
||||
if (!(arg0 == 100)) {
|
||||
val_1f = arg2 + alCSPGetChlVol(gMusicPlayer, arg0);
|
||||
if (chan1 != 100) {
|
||||
val_1f = arg2 + alCSPGetChlVol(gMusicPlayer, chan1);
|
||||
if (val_1f > 127) {
|
||||
val_1f = 127;
|
||||
}
|
||||
alCSPSetChlVol(gMusicPlayer, arg0, val_1f);
|
||||
alCSPSetChlVol(gMusicPlayer, chan1, val_1f);
|
||||
}
|
||||
|
||||
if (arg1 != 100) {
|
||||
updatedVol = alCSPGetChlVol(gMusicPlayer, arg1);
|
||||
val_1e = (updatedVol > arg2) ? updatedVol - arg2 : 0;
|
||||
alCSPSetChlVol(gMusicPlayer, arg1, val_1e);
|
||||
return val_1e;
|
||||
if (chan2 != 100) {
|
||||
updatedVol = alCSPGetChlVol(gMusicPlayer, chan2);
|
||||
vol = (updatedVol > arg2) ? updatedVol - arg2 : 0;
|
||||
alCSPSetChlVol(gMusicPlayer, chan2, vol);
|
||||
return vol;
|
||||
} else {
|
||||
return 127 - val_1f;
|
||||
return 127 - val_1f; //!@bug: This could be uninitialized!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -219,6 +219,7 @@ void audspat_update_all(Object **objList, s32 numObjects, s32 updateRate) {
|
||||
sndp_set_param(audioPoint->soundHandle, AL_SNDP_VOL_EVT, audioPoint->volume * 256);
|
||||
sndp_set_param(audioPoint->soundHandle, AL_SNDP_PITCH_EVT, *(s32 *) &pitch1);
|
||||
pan2 = audspat_calculate_spatial_pan(dx, dz, cameras[0].trans.rotation.y_rotation);
|
||||
// This can never be true
|
||||
if (numCameras != 1) {
|
||||
pan2 = 64;
|
||||
}
|
||||
@@ -660,7 +661,7 @@ s32 audspat_line_validate(u8 lineID) {
|
||||
}
|
||||
|
||||
for (i = 0; i < line->numSegments; i++) {
|
||||
//@bug should be *(coords + 0), *(coords + 1), *(coords + 2)
|
||||
//!@bug: should be *(coords + 0), *(coords + 1), *(coords + 2)
|
||||
if (*coords + 0 == -100000.0 || *coords + 1 == -100000.0 || *coords + 2 == -100000.0) {
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -688,7 +689,7 @@ s32 audspat_reverb_validate(u8 reverbLineID) {
|
||||
}
|
||||
|
||||
for (i = 0; i < line->numSegments; i++) {
|
||||
//@bug should be *(coords + 0), *(coords + 1), *(coords + 2)
|
||||
//!@bug: should be *(coords + 0), *(coords + 1), *(coords + 2)
|
||||
if (*coords == -100000.0 || *coords + 1 == -100000.0 || *coords + 2 == -100000.0) {
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
+3
-3
@@ -377,7 +377,7 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
AMDMABuffer *dmaPtr, *lastDmaPtr;
|
||||
UNUSED s32 pad;
|
||||
|
||||
lastDmaPtr = 0;
|
||||
lastDmaPtr = NULL;
|
||||
delta = addr & 1;
|
||||
dmaPtr = dmaState.firstUsed;
|
||||
addrEnd = addr + len;
|
||||
@@ -408,7 +408,7 @@ static s32 __amDMA(s32 addr, s32 len, UNUSED void *state) {
|
||||
}
|
||||
|
||||
/*
|
||||
* if you get here and dmaPtr is null, send back the a bogus
|
||||
* if you get here and dmaPtr is null, send back a bogus
|
||||
* pointer, it's better than nothing
|
||||
*/
|
||||
if (!dmaPtr) {
|
||||
@@ -486,7 +486,7 @@ static void __clearAudioDMA(void) {
|
||||
|
||||
/*
|
||||
* Don't block here. If dma's aren't complete, you've had an audio
|
||||
* overrun. (Bad news, but go for it anyway, and try and recover.
|
||||
* overrun. (Bad news, but go for it anyway, and try and recover.)
|
||||
*/
|
||||
for (i = 0; i < nextDMA; i++) {
|
||||
if (osRecvMesg(&audDMAMessageQ, (OSMesg *) &iomsg, OS_MESG_NOBLOCK) == -1) {
|
||||
|
||||
+1
-1
@@ -427,7 +427,7 @@ void sndp_handle_event(SoundPlayer *sndp, ALSndpEvent *event) {
|
||||
sndp_play(event->retrigger.bank, event->retrigger.soundIndex, soundState->userHandle);
|
||||
if (newSound != NULL) {
|
||||
sndp_set_param(newSound, AL_SNDP_VOL_EVT, soundState->volume);
|
||||
if ((!event) && (!event)) {} // Fake
|
||||
if (!event && !event) {} // Fake
|
||||
sndp_set_param(newSound, AL_SNDP_PAN_EVT, soundState->pan);
|
||||
sndp_set_param(newSound, AL_SNDP_FX_EVT, soundState->fxmix);
|
||||
sndp_set_param(newSound, AL_SNDP_PITCH_EVT, *(s32 *) &soundState->pitch);
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ typedef struct SoundPlayer {
|
||||
ALEventQueue evtq;
|
||||
ALEvent nextEvent;
|
||||
ALSynth *drvr;
|
||||
u32 lastSoundState;
|
||||
ALSoundState *lastSoundState;
|
||||
ALSoundState *soundStatesArray;
|
||||
s32 maxSystemSoundChannels;
|
||||
s32 maxActiveSounds;
|
||||
|
||||
@@ -229,7 +229,7 @@ s32 transition_begin(FadeTransition *transition) {
|
||||
gCurFadeTransition = transition->type & 0x3F;
|
||||
gTransitionInvert = transition->type & FADE_FLAG_INVERT;
|
||||
sLevelTransitionDelayTimer = 0;
|
||||
if (!gTransitionFadeIn && !sLevelTransitionDelayTimer) {
|
||||
if (!gTransitionFadeIn && sLevelTransitionDelayTimer == 0) {
|
||||
sLevelTransitionDelayTimer = 2;
|
||||
}
|
||||
if (sTransitionFadeTimer > 0) {
|
||||
@@ -837,9 +837,9 @@ void transition_init_blank(UNUSED FadeTransition *transition) {
|
||||
* Shifts the colours of the transition over time while the timer ticks down.
|
||||
*/
|
||||
void transition_update_blank(s32 updateRate) {
|
||||
s32 var_v0 = FALSE;
|
||||
do {
|
||||
var_v0 = TRUE;
|
||||
s32 breakout = FALSE;
|
||||
while (!breakout) {
|
||||
breakout = TRUE;
|
||||
if (sTransitionFadeTimer > 0) {
|
||||
gLastFadeRed += gLastFadeRedStep * updateRate;
|
||||
gLastFadeGreen += gLastFadeGreenStep * updateRate;
|
||||
@@ -861,7 +861,7 @@ void transition_update_blank(s32 updateRate) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (var_v0 == FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-19
@@ -1,22 +1,14 @@
|
||||
#include "game.h"
|
||||
|
||||
#include <PR/os_cont.h>
|
||||
#include <PR/gu.h>
|
||||
#include <PR/os_time.h>
|
||||
#include "memory.h"
|
||||
#include "types.h"
|
||||
#include "macros.h"
|
||||
#include "structs.h"
|
||||
#include "f3ddkr.h"
|
||||
#include "asset_enums.h"
|
||||
#include "asset_loading.h"
|
||||
#include "menu.h"
|
||||
#include "video.h"
|
||||
#include "set_rsp_segment.h"
|
||||
#include "gzip.h"
|
||||
#include "printf.h"
|
||||
#include "thread0_epc.h"
|
||||
#include "thread30_bgload.h"
|
||||
#include "weather.h"
|
||||
#include "audio.h"
|
||||
#include "objects.h"
|
||||
@@ -24,22 +16,11 @@
|
||||
#include "save_data.h"
|
||||
#include "rcp_dkr.h"
|
||||
#include "audiosfx.h"
|
||||
#include "audiomgr.h"
|
||||
#include "lights.h"
|
||||
#include "textures_sprites.h"
|
||||
#include "PR/os_internal.h"
|
||||
#include "printf.h"
|
||||
#include "fade_transition.h"
|
||||
#include "borders.h"
|
||||
#include "audio_spatial.h"
|
||||
#include "tracks.h"
|
||||
#include "game_text.h"
|
||||
#include "game_ui.h"
|
||||
#include "main.h"
|
||||
#include "object_models.h"
|
||||
#include "racer.h"
|
||||
#include "particles.h"
|
||||
#include "math_util.h"
|
||||
#include "joypad.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
+2
-2
@@ -186,10 +186,10 @@ void find_next_subtitle(void) {
|
||||
done = TRUE;
|
||||
}
|
||||
gCurrentTextProperties++;
|
||||
new_var3 = (new_var2 = gCurrentTextProperties[0]);
|
||||
new_var2 = gCurrentTextProperties[0];
|
||||
if (gCurrentTextProperties[0] == 10) {
|
||||
gCurrentTextProperties++;
|
||||
} else if (new_var3 == 12) {
|
||||
} else if (new_var2 == 12) {
|
||||
gCurrentTextProperties++;
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1834,7 +1834,7 @@ void hud_speedometre(Object *obj, UNUSED s32 updateRate) {
|
||||
sRecordVel = vel;
|
||||
}
|
||||
vel *= 4.0f;
|
||||
//!@Bug: Planes and hovercraft use drift_direction for something else, applying this unintentionally.
|
||||
//!@bug: Planes and hovercraft use drift_direction for something else, applying this unintentionally.
|
||||
if (racer->drift_direction != 0) {
|
||||
vel += 7.0f;
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ s32 byteswap32(u8 *arg0) {
|
||||
value = *arg0++;
|
||||
value |= (*arg0++ << 8);
|
||||
value |= (*arg0++ << 16);
|
||||
value |= (*arg0++ << 24);
|
||||
value |= (*arg0 << 24);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ s32 input_update(s32 saveDataFlags, s32 updateRate) {
|
||||
if (saveDataFlags & SAVE_DATA_FLAG_ERASE_SAVE_DATA) {
|
||||
erase_save_file(SAVE_DATA_FLAG_WRITE_SAVE_FILE_NUMBER(saveDataFlags), settings);
|
||||
}
|
||||
// @bug These next two if statements check the same bits
|
||||
//!@bug: These next two if statements check the same bits
|
||||
// as the ones used to set the save file number to read from.
|
||||
if (saveDataFlags & SAVE_DATA_FLAG_READ_EEPROM_SETTINGS) {
|
||||
read_eeprom_settings(get_eeprom_settings_pointer());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "main.h"
|
||||
#include "thread0_epc.h"
|
||||
#include "game.h"
|
||||
#include "libultra/src/libc/rmonPrintf.h"
|
||||
#include "stacks.h"
|
||||
|
||||
/************ .bss ************/
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
#include "memory.h"
|
||||
#include "printf.h"
|
||||
#include "thread0_epc.h"
|
||||
#include "joypad.h"
|
||||
#include "math_util.h"
|
||||
|
||||
/************ .bss ************/
|
||||
@@ -135,7 +134,7 @@ MemoryPoolSlot *mempool_slot_find(MemoryPools poolIndex, s32 size, u32 colourTag
|
||||
stubbed_printf("*** mmAlloc: size = 0 ***\n");
|
||||
}
|
||||
pool = &gMemoryPools[poolIndex];
|
||||
if ((pool->curNumSlots + 1) == (*pool).maxNumSlots) {
|
||||
if (pool->maxNumSlots == pool->curNumSlots + 1) {
|
||||
interrupts_enable(intFlags);
|
||||
stubbed_printf("*** mm Error *** ---> No more slots available.\n");
|
||||
return NULL;
|
||||
|
||||
@@ -7352,7 +7352,6 @@ void gameselect_render(UNUSED s32 updateRate) {
|
||||
|
||||
if (gMenuDelay > -22 && gMenuDelay < 22) {
|
||||
fade = gOptionBlinkTimer * 8;
|
||||
fade = fade;
|
||||
if (fade > 255) {
|
||||
fade = 511 - fade;
|
||||
}
|
||||
@@ -7441,7 +7440,6 @@ s32 menu_game_select_loop(s32 updateRate) {
|
||||
if ((gMenuDelay == 0) && (gOpacityDecayTimer == 0)) {
|
||||
playerInputs = input_pressed(PLAYER_ONE);
|
||||
playerYDir = gControllersYAxisDirection[0];
|
||||
playerInputs = playerInputs;
|
||||
if (gNumberOfActivePlayers == 2) {
|
||||
playerInputs |= input_pressed(1);
|
||||
playerYDir += gControllersYAxisDirection[1];
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "fade_transition.h"
|
||||
#include "audio_vehicle.h"
|
||||
#include "object_models.h"
|
||||
#include "libultra/src/libc/rmonPrintf.h"
|
||||
#include "collision.h"
|
||||
#include "joypad.h"
|
||||
#include "printf.h"
|
||||
@@ -197,7 +196,7 @@ void obj_loop_fireball_octoweapon(Object *obj, s32 updateRate) {
|
||||
Object_Racer *racer;
|
||||
UNUSED s32 pad2[6];
|
||||
ObjectInteraction *interactObj;
|
||||
s32 soundMask;
|
||||
SoundHandle soundMask;
|
||||
f32 waveHeight;
|
||||
|
||||
someObj = obj->properties.fireball.obj;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "asset_loading.h"
|
||||
#include "textures_sprites.h"
|
||||
#include "racer.h"
|
||||
#include "save_data.h"
|
||||
#include "objects.h"
|
||||
|
||||
#define MODEL_LOADED_MAX 70
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user