Add a couple header files, add some mips_to_c of some previously un-decomped functions (#132)

* Add a couple header files

These files contain function prototypes for matches functions, NON_MATCHING functions,
 and functions used by matched functions.

At this point in time those headers may contain prototypes for functions defined in
 unrelated files, but fixing that will have take time

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran 2022-01-04 21:57:16 -05:00 committed by GitHub
parent c3def3e91f
commit d6cbf56537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 952 additions and 229 deletions

View File

@ -8,46 +8,63 @@
extern s32 gCCSelection;
extern s8 gCharacterIdByGPOverallRank[8]; // D_8018D9D0
extern s8 gCharacterGridSelections[4]; // D_8018EDE4
extern s8 gCharacterSelections[4]; // D_800E86A8
extern s8 gControllerPakMenuSelection; // D_8018EDF0
extern s32 gControllerPakNumPagesFree; // D_8018EB80
extern s8 gControllerPakSelectedTableRow; // D_800E86C0
extern f32 gCourseCompletionPercentByPlayerId[8]; // D_801644D0
extern f32 gCourseCompletionPercentByRank[8]; // D_80162FD8
extern s8 gCourseRecordsMenuSelection; // D_8018EDF8
extern s16 gCupCourseOrder[NUM_CUPS][NUM_COURSES_PER_CUP]; // D_800F2BB4
extern s8 gCupCourseSelection; // D_8018EE0B
extern char *gCupNames[]; // D_800E7500
extern s8 gCupSelection; // D_8018EE09
// Maps course IDs (as defined in the COURSES enum) to the cup they belong to
extern u8 gCupSelectionByCourseId[NUM_COURSES]; // D_800E7664
extern s16 gCurrentCourseId;
extern s16 gCurrentCourseId; // D_800DC5A0
extern s32 gD_8018E118TotalSize; // D_8018E110
extern char *gDebugSoundModeNames[NUM_SOUND_MODES]; // D_800E7700
extern Gfx *gDisplayListHead; // D_80150298
extern u16 gEnableDebugMode; // D_800DC520
extern s32 gGlobalTimer; // D_800DC54C
extern s8 gGPPointsByCharacterId[8]; // D_8018D9C8
extern s16 gGPCurrentRacePlayerIdByRank[8]; // D_80164360
extern s8 gHumanPlayerCount;
extern s32 gIsMirrorMode; // D_800DC604
extern f32 gKartFrictionTable[];
extern f32 gKartBoundingBoxTable[];
extern f32 gKartGravityTable[];
extern s8 gControllerPakMenuSelection; // D_8018EDF0
extern s32 gModeSelection;
extern s32 gMenuTimingCounter; // D_8018EE00
extern s32 gModeSelection; // D_800DC53C
// Indicates the ID of the next title screen demo that will be played
extern u8 gNextDemoId; // D_800E86BC
extern s32 gNumD_8018E118Entries; // D_8018E758
extern u8 gNextDemoId; // D_800E86BC
extern s32 gNumD_8018E118Entries; // D_8018E758
// Maps course IDs (as defined in the COURSES enum) to an index in a given cup's track order
extern u8 gPerCupIndexByCourseId[NUM_COURSES]; // D_800EFD50
extern s32 gPlayerCountSelection1;
extern u8 gSaveDataSoundMode; // D_8018ED14
extern u8 gSaveDataSoundModeBackup; // D_8018ED8C
extern u32 gSegmentTable[16]; // D_80150258
extern u8 gSoundMode; // D_8018EDF2
extern char *gSoundModeNames[NUM_SOUND_MODES]; // D_800E7710
// Indexed by Player ID. Track time in seconds since player has last crossed the finish line
extern f32 gTimePlayerLastTouchedFinishLine[8]; // D_8015F898
extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7
extern s32 gPlayerPositions[]; // D_801643B8
extern struct_8018D9E0_entry D_8018D9E0[32]; // D_8018D9E0
extern struct_8018DEE0_entry D_8018DEE0[16]; // D_8018DEE0
extern struct_8018E118_entry D_8018E118[200]; // D_8018E118
extern u8 gSaveDataSoundMode; // D_8018ED14
extern u8 gSaveDataSoundModeBackup; // D_8018ED8C
extern u32 gSegmentTable[16]; // D_80150258
extern OSMesgQueue gSIEventMesgQueue; // D_8014F0B8
extern u8 gSoundMode; // D_8018EDF2
extern char *gSoundModeNames[NUM_SOUND_MODES]; // D_800E7710
// Indexed by Player ID. Track time in seconds since player has last crossed the finish line
extern f32 gTimePlayerLastTouchedFinishLine[8]; // D_8015F898
extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7
extern SaveData D_8018EB90;
extern struct_D_802874D8 D_802874D8;
extern s16 D_801650D0[4][8];
extern s16 D_80165110[4][8];
@ -69,7 +86,6 @@ extern s16 D_80165570;
extern s16 D_80165572;
extern s16 D_80165580;
extern s16 D_80165582;
extern s8 gCharacterSelections[4]; // D_800E86A8
extern s16 D_80165270[8];
extern Player* gPlayerOne;
extern Player* gPlayerTwo;
@ -83,7 +99,6 @@ extern Player* gPlayerOneCopy;
extern u16 D_800DC51C;
extern s8 gDebugMenuSelection; // D_8018EDEF
extern s32 D_80164A28;
extern s32 gPlayerPositions[]; // D_801643B8
extern s16 D_8016556E;
extern s32 D_80162DE0;
extern s32 D_80162DE4;

View File

@ -1,9 +1,8 @@
#include <ultra64.h>
#include <macros.h>
#include <defines.h>
extern u32 func_802B5224(void);
extern s32 gIsMirrorMode;
#include "code_80005FD0.h"
#include "variables.h"
s16 func_80005FD0(void) {
s16 temp_ret;
@ -10739,12 +10738,248 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800162CC.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/*
Failed to decompile function func_80016494:
//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
? func_8000BBD8(u16, f32, s16, u16, s16, s16); /* extern */
s16 func_8000D33C(f32, f32, s32, f32, s16, s32); /* extern */
? func_80014D30(s32, s32); /* extern */
? func_8001A348(s32, f32, s16, ?, ?); /* extern */
f32 func_802AE1C0(f32, f32, f32, f32 *); /* extern */
s16 func_802B7830(f32, f32); /* extern */
f32 sqrtf(f32, f32, s32); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
extern s32 D_80163238;
extern ? D_80164438;
extern ? D_80164550;
extern ? D_801645B0;
extern ? D_801645C8;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
extern ? D_80164668;
extern ? D_80164680;
extern ? D_80164688;
extern s32 gPlayerOne;
Gap in callee-saved word stack region. Saved: [(32, 4), (36, 4), (76, 4)], gap at: 76 != 40.
*/
void func_80016494(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
s16 spB6;
s16 spB4;
f32 spAC;
f32 spA8;
f32 spA4;
void *spA0;
s32 sp9C;
f32 sp98;
f32 sp94;
f32 sp90;
f32 sp8C;
f32 sp88;
f32 sp84;
s16 sp7A;
u16 sp78;
s32 sp68;
f32 sp64;
s32 sp5C;
f32 *sp58;
f32 *sp54;
s32 sp50; /* compiler-managed */
s32 sp4C; /* compiler-managed */
s32 sp48;
s16 *sp44;
f32 *sp40;
f32 *sp3C;
u16 *sp38;
f64 sp28;
f32 *temp_a3;
f32 *temp_t0_2;
f32 *temp_t1_2;
f32 *temp_t1_3;
f32 *temp_t4;
f32 *temp_t5;
f32 *temp_t5_2;
f32 temp_f0_3;
f32 temp_f12;
f32 temp_f12_2;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f16;
f32 temp_f18;
f32 temp_f2;
f32 temp_f2_2;
f32 temp_f2_3;
f32 temp_f2_4;
f32 temp_f2_5;
f32 temp_f4;
f32 temp_f6;
f32 temp_f6_2;
f64 temp_f0;
f64 temp_f0_2;
f64 temp_f16_2;
f64 temp_f2_6;
s16 *temp_t1;
s16 temp_t2;
s16 temp_t3_2;
s16 temp_v0_2;
s16 temp_v1;
s32 temp_a1;
s32 temp_hi;
s32 temp_ra;
s32 temp_t0;
s32 temp_v0;
s32 temp_v0_3;
u16 *temp_t7;
u16 temp_t3;
u16 temp_v1_2;
f64 phi_f0;
u16 phi_f12;
f32 phi_f18;
temp_a1 = arg3 * 4;
temp_t5 = temp_a1 + &D_80164648;
temp_t4 = temp_a1 + &D_80164658;
temp_f2 = *temp_t5;
temp_v1 = arg0->unkAE;
*temp_t5 = temp_f2 + ((*temp_t4 - temp_f2) * 0.5f);
D_80163238 = (s32) temp_v1;
temp_t0 = temp_v1 * 2;
temp_t3 = *(&D_801645B0 + temp_t0);
temp_ra = temp_v1 * 0xDD8;
temp_v0 = arg3 * 2;
temp_t1 = temp_v0 + &D_80164668;
sp4C = temp_ra;
spA0 = gPlayerOne + temp_ra;
sp44 = temp_t1;
sp48 = temp_v0;
sp50 = temp_t0;
sp58 = temp_t5;
sp54 = temp_t4;
sp5C = temp_a1;
sp9C = (s32) temp_v1;
sp68 = (s32) temp_t3;
*sp44 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_t3);
temp_t1_2 = (temp_v1 * 4) + &D_80163068;
temp_t5_2 = sp5C + &D_80164688;
temp_f2_2 = *temp_t1_2 - *temp_t5_2;
temp_t3_2 = *sp44;
temp_t7 = (sp68 * 2) + &D_801645C8;
temp_f2_3 = temp_f2_2 * temp_f2_2;
sp38 = temp_t7;
temp_t2 = *(&D_80164438 + temp_t0);
sp3C = temp_t5_2;
sp64 = temp_f2_3;
sp40 = temp_t1_2;
spB6 = temp_t3_2;
spB4 = temp_t2;
if (func_80007BF8(temp_t2 & 0xFFFF, temp_t3_2 & 0xFFFF, 0xF, 0xF, (s32) *temp_t7) <= 0) {
sp3C = temp_t5_2;
func_8001A348(arg3, *temp_t5_2, *(&D_80164680 + sp48));
phi_f12 = (bitwise u16) *temp_t5_2;
} else {
temp_f0 = (f64) *temp_t1_2;
if ((temp_f0 < 0.0) && ((f64) *temp_t5_2 < 0.0) && ((f64) temp_f2_3 < 0.01)) {
sp3C = temp_t5_2;
func_8001A348(arg3, 1.0f, 5);
phi_f12 = (bitwise u16) *temp_t5_2;
} else {
temp_f12 = *temp_t5_2;
phi_f12 = (bitwise u16) temp_f12;
if ((temp_f0 > 0.0) && ((f64) temp_f12 > 0.0) && ((f64) temp_f2_3 < 0.01)) {
sp3C = temp_t5_2;
func_8001A348((bitwise s32) temp_f12, 0.0f, (s16) arg3, 0xBF800000, 4);
phi_f12 = (bitwise u16) *temp_t5_2;
} else {
if (((s32) temp_t3_2 < (s32) temp_t2) && ((temp_t2 - temp_t3_2) < 0xA)) {
*temp_t4 = (f32) ((f64) *(&gPlayers->unk_094 + temp_ra) + 0.4);
}
if (((s32) temp_t2 < (s32) temp_t3_2) && ((temp_t3_2 - temp_t2) < 0xA)) {
*temp_t4 = (f32) ((f64) *(&gPlayers->unk_094 + temp_ra) - 0.4);
}
temp_f0_2 = (f64) *temp_t4;
phi_f0 = temp_f0_2;
if (temp_f0_2 > 10.0) {
*temp_t4 = 10.0f;
phi_f0 = (f64) *temp_t4;
}
if (phi_f0 < 0.0) {
*temp_t4 = 0.0f;
}
}
}
}
temp_v1_2 = *sp38;
temp_v0_2 = *sp44;
sp3C = sp5C + &D_80164688;
temp_hi = (s32) (temp_v0_2 + 1) % (s32) temp_v1_2;
sp78 = (u16) ((s32) (temp_v0_2 + 2) % (s32) temp_v1_2);
sp7A = (s16) temp_hi;
sp54 = (f32 *) unksp6A;
func_8000BBD8(phi_f12, 0.0f, (s16) temp_hi & 0xFFFF, phi_f12, unksp6A, (s16) temp_hi);
temp_f6 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
sp98 = temp_f6;
temp_f18 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp90 = temp_f18;
func_8000BBD8(sp78, *(sp5C + &D_80164688), unksp6A);
temp_v0_3 = *(&D_80164550 + (sp68 * 4));
temp_f4 = (f32) ((f64) temp_f6 + ((f64) D_80162FA0.unk0 * 0.5));
sp98 = temp_f4;
temp_a3 = sp5C + &D_801645F8;
temp_t0_2 = sp5C + &D_80164618;
temp_t1_3 = sp5C + &D_80164638;
sp4C = temp_t1_3;
sp50 = temp_t0_2;
sp54 = temp_a3;
temp_f14 = temp_f4 - *temp_a3;
temp_f6_2 = (f32) ((f64) ((temp_v0_3 + ((s16) sp78 * 8))->unk2 + (temp_v0_3 + (sp7A * 8))->unk2) * 0.5);
temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_3;
sp94 = temp_f6_2;
sp8C = temp_f14;
temp_f16 = temp_f6_2 - *temp_t0_2;
sp84 = temp_f2_4;
sp88 = temp_f16;
temp_f0_3 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16) + (temp_f2_4 * temp_f2_4), temp_f14, sp5C);
if ((f64) temp_f0_3 != 0.0) {
temp_f2_5 = *sp58;
sp98 = ((temp_f2_5 * temp_f14) / temp_f0_3) + *temp_a3;
sp94 = ((temp_f2_5 * temp_f16) / temp_f0_3) + *temp_t0_2;
phi_f18 = ((temp_f2_5 * sp84) / temp_f0_3) + *temp_t1_3;
} else {
sp98 = *temp_a3;
sp94 = *temp_t0_2;
phi_f18 = *temp_t1_3;
}
arg0->unk8 = phi_f18;
arg0->unk0 = sp98;
temp_f16_2 = (f64) sp94;
sp28 = temp_f16_2;
sp90 = phi_f18;
sp4C = temp_t1_3;
sp50 = temp_t0_2;
sp54 = temp_a3;
temp_f2_6 = (f64) func_802AE1C0(sp98, (f32) (temp_f16_2 + 30.0), phi_f18, temp_a3);
if ((temp_f2_6 < (temp_f16_2 - 20.0)) || (temp_f2_6 >= 3000.0)) {
arg0->unk4 = (f32) (temp_f16_2 + 10.0);
} else {
arg0->unk4 = (f32) (temp_f2_6 + 10.0);
}
*temp_t1_3 = phi_f18;
*temp_a3 = sp98;
*temp_t0_2 = sp94;
arg0->unkC = (f32) spA0->unk14;
arg0->unk10 = (f32) ((f64) spA0->unk18 + 6.0);
arg0->unk14 = (f32) spA0->unk1C;
func_80014D30(arg3, sp68);
temp_f12_2 = arg0->unkC - arg0->unk0;
spA8 = arg0->unk10 - arg0->unk4;
spAC = temp_f12_2;
temp_f14_2 = arg0->unk14 - arg0->unk8;
spA4 = temp_f14_2;
arg0->unk26 = func_802B7830(temp_f12_2, temp_f14_2);
arg0->unk24 = func_802B7830(sqrtf((spAC * spAC) + (temp_f14_2 * temp_f14_2), temp_f14_2), spA8);
arg0->unk28 = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80016494.s")
#endif
@ -11100,12 +11335,192 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017720.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/*
Failed to decompile function func_800178F4:
//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
? func_8000BBD8(u16, f32, s16, s32); /* extern */
s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
s16 func_802B7830(f32, f32); /* extern */
f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
extern s32 D_80163238;
extern ? D_80164438;
extern ? D_80164550;
extern ? D_801645B0;
extern ? D_801645C8;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
extern ? D_80164668;
extern ? D_80164680;
extern ? D_80164688;
extern s32 gPlayerOne;
Gap in callee-saved word stack region. Saved: [(32, 4), (36, 4), (80, 4)], gap at: 80 != 40.
*/
void func_800178F4(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
s16 sp9E;
s16 sp9C;
f32 sp94;
f32 sp90;
f32 sp8C;
void *sp88;
f32 sp80;
f32 sp78;
f32 sp74;
f32 sp70;
f32 sp6C;
s16 sp62;
u16 sp60;
s32 sp50;
s32 sp4C;
s32 sp44;
f32 *sp40;
f32 *sp3C;
f32 *sp38;
s32 sp34; /* compiler-managed */
s32 sp30;
s32 sp2C;
s16 *sp28;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
f32 *temp_t6;
f32 *temp_v1;
f32 *temp_v1_2;
f32 temp_f0_2;
f32 temp_f12;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f16_3;
f32 temp_f2;
f64 temp_f0;
s16 *temp_t1;
s16 temp_t1_2;
s16 temp_v0;
s16 temp_v0_2;
s32 temp_hi;
s32 temp_hi_2;
s32 temp_t2;
s32 temp_t3;
s32 temp_t4;
s32 temp_t8;
s32 temp_v0_3;
u16 temp_ra;
f64 phi_f0;
f32 phi_f2;
f32 phi_f14;
f32 phi_f18;
temp_v0 = arg0->unkAE;
temp_t4 = arg3 * 4;
temp_a1 = temp_t4 + &D_80164688;
temp_t6 = temp_t4 + &D_80164648;
sp3C = temp_t6;
temp_v1 = temp_t4 + &D_80164658;
*temp_a1 = *(&D_80163068 + (temp_v0 * 4));
temp_f16 = *temp_t6;
temp_t2 = temp_v0 * 2;
temp_t3 = temp_v0 * 0xDD8;
*temp_t6 = temp_f16 + ((*temp_v1 - temp_f16) * 0.5f);
temp_ra = *(&D_801645B0 + temp_t2);
D_80163238 = (s32) temp_v0;
sp4C = (s32) *(&D_801645C8 + (temp_ra * 2));
temp_t8 = arg3 * 2;
temp_t1 = temp_t8 + &D_80164668;
sp50 = (s32) temp_ra;
sp88 = gPlayerOne + temp_t3;
sp28 = temp_t1;
sp2C = temp_t8;
sp44 = temp_t4;
sp30 = temp_t3;
sp34 = temp_t2;
sp40 = temp_a1;
sp38 = temp_v1;
*sp28 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_ra);
temp_t1_2 = *sp28;
temp_hi = (s32) (*(&D_80164438 + temp_t2) + 3) % sp4C;
sp9C = (s16) temp_hi;
sp9E = temp_t1_2;
if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 0xD, 1, sp4C) <= 0) {
sp44 = temp_t4;
func_8001A348(arg3, *sp40, *(&D_80164680 + sp2C));
} else {
if (((s32) temp_t1_2 < (s32) sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
}
if (((s32) sp9C < (s32) temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) - 0.1);
}
temp_f0 = (f64) *temp_v1;
phi_f0 = temp_f0;
if (temp_f0 > 10.0) {
*temp_v1 = 10.0f;
phi_f0 = (f64) *temp_v1;
}
if (phi_f0 < 0.0) {
*temp_v1 = 0.0f;
}
}
temp_v0_2 = *sp28;
temp_hi_2 = (s32) (temp_v0_2 + 1) % sp4C;
sp60 = (u16) ((s32) (temp_v0_2 + 2) % sp4C);
sp62 = (s16) temp_hi_2;
sp44 = arg3 * 4;
sp38 = (f32 *) unksp52;
func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52, sp4C);
temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
temp_f14 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
temp_v0_3 = *(&D_80164550 + (sp50 * 4));
temp_a2 = (arg3 * 4) + &D_80164618;
temp_f14_2 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5));
temp_v1_2 = (arg3 * 4) + &D_801645F8;
temp_a3 = (arg3 * 4) + &D_80164638;
temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
sp70 = (f32) ((f64) ((temp_v0_3 + ((s16) sp60 * 8))->unk2 + (temp_v0_3 + (sp62 * 8))->unk2) * 0.5) - *temp_a2;
sp6C = temp_f14_2 - *temp_a3;
temp_f0_2 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C), temp_f14_2, temp_a2, temp_a3);
if ((f64) temp_f0_2 != 0.0) {
temp_f16_3 = *sp3C;
phi_f2 = ((temp_f16_3 * sp74) / temp_f0_2) + *temp_v1_2;
phi_f14 = ((temp_f16_3 * sp6C) / temp_f0_2) + *temp_a3;
phi_f18 = ((temp_f16_3 * sp70) / temp_f0_2) + *temp_a2;
} else {
phi_f2 = *temp_v1_2;
phi_f14 = *temp_a3;
phi_f18 = *temp_a2;
}
arg0->unk0 = phi_f2;
arg0->unk8 = phi_f14;
arg0->unk4 = (f32) ((f64) phi_f18 + 10.0);
*temp_v1_2 = phi_f2;
*temp_a2 = phi_f18;
*temp_a3 = phi_f14;
arg0->unkC = (f32) sp88->unk14;
arg0->unk10 = (f32) ((f64) sp88->unk18 + 6.0);
arg0->unk14 = (f32) sp88->unk1C;
func_80014D30(arg3, sp50, temp_a2, temp_a3);
temp_f12 = arg0->unkC - arg0->unk0;
sp90 = arg0->unk10 - arg0->unk4;
sp94 = temp_f12;
temp_f14_3 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14_3;
arg0->unk26 = func_802B7830(temp_f12, temp_f14_3);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk28 = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800178F4.s")
#endif
@ -11176,12 +11591,197 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017F10.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/*
Failed to decompile function func_800180F0:
//generated by mips_to_c commit 5bd751fca3befef73d6a2e20d84a88cc918a77fe
s32 func_80007BF8(s32, s32, ?, ?, s32); /* extern */
? func_8000BBD8(u16, f32, s16); /* extern */
s16 func_8000D33C(f32, f32, f32 *, f32, s16, s32); /* extern */
? func_80014D30(s32, s32, f32 *, f32 *); /* extern */
? func_8001A348(s32, f32, s16); /* extern */
s16 func_802B7830(f32, f32); /* extern */
f32 sqrtf(f32, f32, f32 *, f32 *); /* extern */
extern ? D_80162FA0;
extern ? D_80163068;
extern s32 D_80163238;
extern ? D_80164438;
extern ? D_80164550;
extern ? D_801645B0;
extern ? D_801645C8;
extern ? D_801645F8;
extern ? D_80164618;
extern ? D_80164638;
extern ? D_80164648;
extern ? D_80164658;
extern ? D_80164668;
extern ? D_80164680;
extern ? D_80164688;
extern s32 gPlayerOne;
Gap in callee-saved word stack region. Saved: [(16, 4), (28, 4), (32, 4), (36, 4)], gap at: 28 != 20.
*/
void func_800180F0(void *arg0, u16 *arg1, s8 arg2, s32 arg3) {
s16 sp9E;
s16 sp9C;
f32 sp94;
f32 sp90;
f32 sp8C;
f32 sp80;
f32 sp78;
f32 sp74;
f32 sp70;
f32 sp6C;
s16 sp62;
u16 sp60;
s32 sp50;
s32 sp4C;
s32 sp44;
f32 *sp40;
f32 *sp3C;
f32 *sp38;
s32 sp34; /* compiler-managed */
s32 sp30;
s32 sp2C;
s16 *sp28;
f32 *temp_a1;
f32 *temp_a2;
f32 *temp_a3;
f32 *temp_t6;
f32 *temp_v1;
f32 *temp_v1_2;
f32 temp_f0_2;
f32 temp_f12;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f16_3;
f32 temp_f2;
f64 temp_f0;
s16 *temp_t1;
s16 temp_t1_2;
s16 temp_v0;
s16 temp_v0_2;
s32 temp_hi;
s32 temp_hi_2;
s32 temp_t2;
s32 temp_t3;
s32 temp_t5;
s32 temp_t6_2;
s32 temp_v0_3;
u16 *temp_t4;
u16 temp_ra;
u16 temp_t4_2;
void *temp_s1;
f64 phi_f0;
f32 phi_f2;
f32 phi_f14;
f32 phi_f18;
temp_v0 = arg0->unkAE;
temp_t5 = arg3 * 4;
temp_a1 = temp_t5 + &D_80164688;
temp_t6 = temp_t5 + &D_80164648;
sp3C = temp_t6;
temp_v1 = temp_t5 + &D_80164658;
*temp_a1 = *(&D_80163068 + (temp_v0 * 4));
temp_f16 = *temp_t6;
temp_t2 = temp_v0 * 2;
*temp_t6 = temp_f16 + ((*temp_v1 - temp_f16) * 0.5f);
D_80163238 = (s32) temp_v0;
temp_ra = *(&D_801645B0 + temp_t2);
temp_t4 = &D_801645C8 + (temp_ra * 2);
temp_t4_2 = *temp_t4;
temp_t6_2 = arg3 * 2;
temp_t3 = temp_v0 * 0xDD8;
temp_t1 = temp_t6_2 + &D_80164668;
sp50 = (s32) temp_ra;
sp28 = temp_t1;
sp30 = temp_t3;
sp2C = temp_t6_2;
sp44 = temp_t5;
sp34 = temp_t2;
sp40 = temp_a1;
sp38 = temp_v1;
temp_s1 = gPlayerOne + temp_t3;
sp4C = (s32) temp_t4_2;
*sp28 = func_8000D33C(arg0->unk0, arg0->unk4, temp_a1, arg0->unk8, *temp_t1, (s32) temp_ra);
temp_t1_2 = *sp28;
temp_hi = (s32) ((*(&D_80164438 + temp_t2) + temp_t4_2) - 2) % (s32) temp_t4_2;
sp9C = (s16) temp_hi;
sp9E = temp_t1_2;
if (func_80007BF8(temp_hi & 0xFFFF, temp_t1_2 & 0xFFFF, 1, 0xA, (s32) temp_t4_2) <= 0) {
sp44 = temp_t5;
sp4C = (s32) temp_t4_2;
func_8001A348(arg3, *sp40, *(&D_80164680 + sp2C));
} else {
if (((s32) temp_t1_2 < (s32) sp9C) && ((sp9C - temp_t1_2) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) + 0.1);
}
if (((s32) sp9C < (s32) temp_t1_2) && ((temp_t1_2 - sp9C) < 3)) {
*temp_v1 = (f32) ((f64) *(&gPlayers->unk_094 + temp_t3) - 0.1);
}
temp_f0 = (f64) *temp_v1;
phi_f0 = temp_f0;
if (temp_f0 > 10.0) {
*temp_v1 = 10.0f;
phi_f0 = (f64) *temp_v1;
}
if (phi_f0 < 0.0) {
*temp_v1 = 0.0f;
}
}
temp_v0_2 = *sp28;
temp_hi_2 = (s32) (temp_v0_2 + 1) % (s32) *temp_t4;
sp60 = (u16) ((s32) (temp_v0_2 + 2) % (s32) *temp_t4);
sp62 = (s16) temp_hi_2;
sp44 = arg3 * 4;
sp38 = (f32 *) unksp52;
func_8000BBD8((s16) temp_hi_2 & 0xFFFF, *sp40, unksp52);
temp_f2 = (f32) ((f64) D_80162FA0.unk0 * 0.5);
temp_f14 = (f32) ((f64) D_80162FA0.unk8 * 0.5);
sp80 = temp_f2;
sp78 = temp_f14;
func_8000BBD8(sp60, *sp40, unksp52);
temp_v0_3 = *(&D_80164550 + (sp50 * 4));
temp_a2 = (arg3 * 4) + &D_80164618;
temp_f14_2 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5));
temp_v1_2 = (arg3 * 4) + &D_801645F8;
temp_a3 = (arg3 * 4) + &D_80164638;
temp_f16_2 = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_v1_2;
sp34 = temp_a3;
sp40 = temp_v1_2;
sp74 = temp_f16_2;
sp38 = temp_a2;
sp70 = (f32) ((f64) ((temp_v0_3 + ((s16) sp60 * 8))->unk2 + (temp_v0_3 + (sp62 * 8))->unk2) * 0.5) - *temp_a2;
sp6C = temp_f14_2 - *temp_a3;
temp_f0_2 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C), temp_f14_2, temp_a2, temp_a3);
if ((f64) temp_f0_2 != 0.0) {
temp_f16_3 = *sp3C;
phi_f2 = ((temp_f16_3 * sp74) / temp_f0_2) + *temp_v1_2;
phi_f14 = ((temp_f16_3 * sp6C) / temp_f0_2) + *temp_a3;
phi_f18 = ((temp_f16_3 * sp70) / temp_f0_2) + *temp_a2;
} else {
phi_f2 = *temp_v1_2;
phi_f14 = *temp_a3;
phi_f18 = *temp_a2;
}
arg0->unk0 = phi_f2;
arg0->unk8 = phi_f14;
arg0->unk4 = (f32) ((f64) temp_s1->unk18 + 10.0);
*temp_v1_2 = phi_f2;
*temp_a2 = phi_f18;
*temp_a3 = phi_f14;
arg0->unkC = (f32) temp_s1->unk14;
arg0->unk10 = (f32) ((f64) temp_s1->unk18 + 6.0);
arg0->unk14 = (f32) temp_s1->unk1C;
func_80014D30(arg3, sp50, temp_a2, temp_a3);
temp_f12 = arg0->unkC - arg0->unk0;
sp90 = arg0->unk10 - arg0->unk4;
sp94 = temp_f12;
temp_f14_3 = arg0->unk14 - arg0->unk8;
sp8C = temp_f14_3;
arg0->unk26 = func_802B7830(temp_f12, temp_f14_3);
arg0->unk24 = func_802B7830(sqrtf((sp94 * sp94) + (temp_f14_3 * temp_f14_3), temp_f14_3), sp90);
arg0->unk28 = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800180F0.s")
#endif

15
src/code_80005FD0.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef CODE_80005FD0_H
#define CODE_80005FD0_H
#include "common_structs.h"
/* Function Prototypes */
s16 func_80005FD0();
// math_util.c
u32 func_802B5224();
/* This is where I'd put my static data, if I had any */
#endif

View File

@ -1,19 +1,8 @@
#include <ultra64.h>
#include <macros.h>
#include <common_structs.h>
#include <defines.h>
extern Player *gPlayerOne;
extern Player *gPlayerTwo;
extern Player *gPlayerThree;
extern Player *gPlayerFour;
extern Player *gPlayerFive;
extern Player *gPlayerSix;
extern Player *gPlayerSeven;
extern Player *gPlayerEight;
extern Player *gPlayerOneCopy;
extern Camera *camera1;
#include "variables.h"
#include "code_80027D00.h"
// func_80027D00
s32 get_player_index_for_player(Player *player) {
@ -764,8 +753,6 @@ void func_80028E70(void *arg0, s32 arg1, s8 arg2, s8 arg3) {
GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80028E70.s")
#endif
extern s16 D_80164AF0;
void func_80028F70(void) {
D_80164AF0 = 0;
func_80028E70(gPlayerOneCopy, camera1, 0, 0);

22
src/code_80027D00.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef CODE_80027D00_H
#define CODE_80027D00_H
#include "common_structs.h"
/* Function Prototypes */
s32 get_player_index_for_player(Player*);
void func_80028F70();
void func_80029060();
void func_80029150();
void func_80029158();
void func_800291E8();
void func_800291F0();
void func_800291F8();
void func_8002AAC0(Player*);
/* This is where I'd put my static data, if I had any */
extern s16 D_80164AF0;
#endif

View File

@ -1,54 +1,11 @@
#include <ultra64.h>
#include <macros.h>
#include "types.h"
#include "common_structs.h"
#include "functions.h"
#include "variables.h"
#include "code_8008C1D0.h"
#include <defines.h>
// external funcs
extern s32 func_80031F48(Player *player, float arg1);
extern s32 func_8006B8B4();
extern s32 gModeSelection;
extern s16 D_80165190[4][8];
extern f32 D_80165280[];
extern s32 D_80165420[];
extern s32 D_80165440[];
extern s32 D_80165460[];
extern s32 D_80165480[];
// unk extern
extern s32 D_8018D920[];
// this file funcs
extern s32 func_8008D0E4(); // static
extern s32 func_8008D3B0(); // static
extern s32 func_8008D554(); // static
extern s32 func_8008D760(); // static
extern s32 func_8008D97C(); // static
extern s32 func_8008E884(); // static
extern s32 func_8008EC34(); // static
extern s32 func_8008EEC4(); // static
extern s32 func_8008F0E8(void *); // static
extern s32 func_8008F3E0(void *); // static
extern s32 func_8008F5A4(void *, s8); // static
extern s32 func_8008FEDC(void *, s8); // static
extern void func_8008C8C4(Player *player, s8 arg1);
extern void func_8008C6D0(Player *player, s8 arg1);
extern void func_800C90F4();
extern void func_800C9060();
extern void func_800098FC();
extern f32 D_800E37B0[];
extern f32 D_800E3790[];
extern u16 D_800DC51C;
// bss
extern s32 gPlayerPositions[];
UNUSED void func_unnamed(void) {
}

51
src/code_8008C1D0.h Normal file
View File

@ -0,0 +1,51 @@
#ifndef CODE_8008C1D0_H
#define CODE_8008C1D0_H
#include "common_structs.h"
/* Function Prototypes */
void func_8008C310(Player*);
void func_8008C354(Player*, s8);
void func_8008C528(Player*, s8);
void func_8008C62C(Player*, s8);
void func_8008C6D0(Player*, s8);
s32 func_8008D0E4();
s32 func_8008D3B0();
s32 func_8008D554();
s32 func_8008D760();
s32 func_8008D97C();
s32 func_8008E884();
s32 func_8008EC34();
s32 func_8008EEC4();
s32 func_8008F0E8(void *);
s32 func_8008F3E0(void *);
s32 func_8008F5A4(void *, s8);
s32 func_8008FEDC(void *, s8);
void func_8008C8C4(Player*, s8);
void func_8008C6D0(Player*, s8);
void func_800C90F4();
void func_800C9060();
void func_800098FC();
// code_80057C60
s32 func_8006B8B4();
// code_80027D00.c
s32 func_80031F48(Player*, float);
/* This is where I'd put my static data, if I had any */
extern u16 D_800DC51C;
extern f32 D_800E37B0[];
extern f32 D_800E3790[];
extern s16 D_80165190[4][8];
extern f32 D_80165280[];
extern s32 D_80165420[];
extern s32 D_80165440[];
extern s32 D_80165460[];
extern s32 D_80165480[];
extern s32 D_8018D920[];
#endif

View File

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <macros.h>
#include <defines.h>
#include "code_80091750.h"
#include "code_800AF9B0.h"
#include "variables.h"
f64 exponent_by_squaring(f64 base, s32 exponent) {
@ -496,15 +498,10 @@ void func_80092148(void) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092148.s")
#endif
extern s8 D_8018D9D9;
void func_800921B4(void) {
D_8018D9D9 = 0;
}
void set_text_color(s32);
extern s32 func_800B4520();
void func_800921C0(s32 test, s32 target, s32 alternative_color) {
if (test == target) {
if (func_800B4520() != 0) {
@ -627,7 +624,6 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2, s32 arg3) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092290.s")
#endif
extern s32 gModeSelection;
void func_80092500(void) {
switch(gModeSelection) {
@ -795,8 +791,6 @@ void func_80092688(void) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092688.s")
#endif
extern s8 D_8018ED91;
void func_80092C80(void) {
D_8018ED91 = 1;
}
@ -1012,8 +1006,6 @@ s32 func_80092EE4(void *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092EE4.s")
#endif
extern s16 gGlyphDisplayWidth[]; // D_800EF690
//Originally func_80093034
s32 get_string_width(char *buffer) {
s32 glyphIndex;
@ -1037,28 +1029,15 @@ s32 get_string_width(char *buffer) {
return stringWidth;
}
extern s8 gTextColor;
void set_text_color(s32 arg0) {
gTextColor = arg0;
}
void func_80093324(s32, s32, char*, s32, f32, f32);
UNUSED void func_800930E4(s32 arg0, s32 arg1, s32 *arg2) {
set_text_color(TEXT_BLUE);
func_80093324(arg0, arg1, arg2, 0, 1.0, 1.0);
}
void func_80099184(s32);
void *segmented_to_virtual(segment_address_t);
Gfx *func_8009BEF0(Gfx*, s32, f32, f32, s32, f32,f32);
void print_text1(s32, s32, char*, s32, f32, f32, s32);
void print_text2(s32, s32, char*, s32, f32, f32, s32);
extern Gfx D_020077A8[];
extern Gfx D_020077D8[];
extern s32 gGlyphTextureLUT[];
extern Gfx *gDisplayListHead;
// "tracking" is a uniform spacing between all characters in a given word
void print_text0(s32 column, s32 row, char *text, s32 tracking, f32 x_scale, f32 y_scale, s32 arg6) {
s32 stringWidth = 0;
@ -4163,9 +4142,6 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800987D0.s")
#endif
extern Gfx D_02008030[];
extern Gfx D_02008058[];
Gfx *func_80098C18(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, u32 blue, s32 alpha) {
red &= 0xFF;
green &= 0xFF;
@ -4202,7 +4178,6 @@ Gfx *func_80098C18(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32
return displayListHead;
}
extern Gfx D_02008008[];
Gfx *draw_box(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, s32 blue, s32 alpha) {
Gfx *temp_a0;
Gfx *temp_v1;
@ -5047,9 +5022,6 @@ UNUSED void func_8009A6D4(void) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A6D4.s")
#endif
segment_address_t func_8009A878(struct_8018DEE0_entry *); // extern
s32 func_8009C434(s32, struct_8018DEE0_entry *, s32, s32, s32); // extern
void func_8009A76C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
struct_8018DEE0_entry *temp = &D_8018DEE0[arg0];
if (temp->visible & 0x80000000) {
@ -5058,9 +5030,6 @@ void func_8009A76C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
}
}
void func_8009A944(struct_8018DEE0_entry *, s32); // extern
s32 func_8009C708(s32, struct_8018DEE0_entry *, s32, s32, s32, s32); // extern
void func_8009A7EC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
struct_8018DEE0_entry *temp = &D_8018DEE0[arg0];
if (temp->visible & 0x80000000) {
@ -9247,10 +9216,6 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A095C.s")
#ifdef NON_MATCHING
// Non-matching due to the constants 9 and 0xA being saved to the wrong registers
// Same functionality, but doesn't match byte for byte :/
Gfx *func_8009BA74(Gfx *, s32*, s32, s32); // extern
extern s32 D_0200157C;
extern s8 D_800E86D0[20];
void func_800A09E0(struct_8018D9E0_entry *arg0) {
s32 table_row, x = 0x20, y;
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 319, 194);
@ -9267,9 +9232,6 @@ void func_800A09E0(struct_8018D9E0_entry *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A09E0.s")
#endif
struct_8018D9E0_entry *func_800AAEF4(s32); // extern
extern s32 D_02001874;
void func_800A0AD0(struct_8018D9E0_entry *unused) {
struct_8018D9E0_entry *temp_t1;
// Find struct_8018D9E0_entry with a type/id of 0xDA
@ -9469,9 +9431,6 @@ to all jump sources and move the label, or add a nop to the delay slot).
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A10CC.s")
#endif
extern RGBA16 D_800E74A8[5];
extern Mk64_Texture_Group *D_800E82B4[5];
void func_800A11D0(struct_8018D9E0_entry *arg0, s32 arg1, s32 arg2) {
RGBA16 *temp_v1;
@ -9650,8 +9609,6 @@ void func_800A1780(void *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1780.s")
#endif
extern Gfx D_02004A0C[];
void func_800A1924(struct_8018D9E0_entry *arg0) {
func_8009A76C(arg0->D_8018DEE0_index, 0x17, 0x84, -1);
if (func_800B639C(gTimeTrialDataCourseIndex) >= TIME_TRIAL_DATA_LUIGI_RACEWAY) {
@ -12660,10 +12617,6 @@ void func_800A7258(struct_8018D9E0_entry *arg0) {
}
}
extern char *D_800E76CC[4];
extern char *D_800E76DC[4];
extern char *D_800E7500[9];
// Podium scene, top line
void func_800A72FC(struct_8018D9E0_entry *arg0) {
s32 pad;
@ -12676,10 +12629,6 @@ void func_800A72FC(struct_8018D9E0_entry *arg0) {
draw_text(arg0->column + cupNameLength, arg0->row, D_800E76DC[gCCSelection], 0, 1, 1);
}
extern s8 D_802874F5;
extern char *D_800E7A88[4];
extern char *D_800E7A98;
void func_800A7448(struct_8018D9E0_entry *arg0) {
s32 pad;
s32 sp40;
@ -12698,9 +12647,6 @@ void func_800A7448(struct_8018D9E0_entry *arg0) {
}
}
extern char *D_800E7A9C[2];
extern f32 D_800F1F30;
void func_800A75A0(struct_8018D9E0_entry *arg0) {
s32 pad;
s32 topThree;
@ -13730,14 +13676,6 @@ void func_800A8CA4(void *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8CA4.s")
#endif
extern char *D_800E77A8;
extern char *D_800E77AC;
extern char *D_800E77B0;
extern f32 D_800F24A8;
extern f32 D_800F24AC;
extern f32 D_800F24B0;
extern f32 D_800F24B4;
void func_800A8E14(struct_8018D9E0_entry *unused) {
set_text_color(TEXT_YELLOW);
draw_text(0x98, 0x44, D_800E77A8, 0, 1.0f, 1.0f);
@ -13745,9 +13683,6 @@ void func_800A8E14(struct_8018D9E0_entry *unused) {
func_80093324(0x17, 0x6A, D_800E77B0, 0, D_800F24B0, D_800F24B4);
}
extern char *D_800E7678[];
extern f32 D_800F24B8;
void func_800A8EC0(struct_8018D9E0_entry *arg0) {
if (arg0->unk20 != 0) {
func_8009A76C(arg0->D_8018DEE0_index, arg0->column, arg0->row, -1);
@ -14075,8 +14010,6 @@ void func_800A94C8(void *arg0, s32 arg1, s32 arg2) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A94C8.s")
#endif
extern f64 D_800F24C0;
void func_800A954C(struct_8018D9E0_entry *arg0) {
// Cycle lasts 26 (0x1A) frames
if (arg0->unk4 == 0) {
@ -15114,8 +15047,6 @@ block_13:
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAC18.s")
#endif
void func_800AAF94(struct_8018D9E0_entry*, s32);
void func_800AADD4(struct_8018D9E0_entry *arg0) {
s32 playerId;
s8 characterSelectionIndex;
@ -15241,8 +15172,6 @@ loop_1:
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAF30.s")
#endif
extern struct_8018D9E0_entry *func_800AAEB4(s32);
void func_800AAF94(struct_8018D9E0_entry *arg0, s32 arg1) {
struct_8018D9E0_entry *temp_v0;

125
src/code_80091750.h Normal file
View File

@ -0,0 +1,125 @@
#ifndef CODE_80091750_H
#define CODE_80091750_H
#include "common_structs.h"
/* Function Prototypes */
f64 exponent_by_squaring(f64, s32);
void swap_values(s32*, s32*);
void func_800921B4();
void func_800921C0(s32, s32, s32);
void func_80092224(s32, s32, s32);
void func_80092500();
void func_80092564();
void func_800925A0();
void func_80092604();
void func_80092630();
void func_8009265C();
void func_80092C80();
s32 char_to_glyph_index(char*);
s32 func_80092DF8();
s32 get_string_width(char*);
void set_text_color(s32);
void func_800930E4(s32, s32, s32*);
Gfx *func_8009BEF0(Gfx*, s32, f32, f32, s32, f32,f32);
void print_text0(s32, s32, char*, s32, f32, f32, s32);
void func_80093324(s32, s32, char*, s32, f32, f32);
void func_80093358(s32, s32, char*, s32, f32, f32);
void print_text1(s32, s32, char*, s32, f32, f32, s32);
void func_800936B8(s32, s32, char*, s32, f32, f32);
void draw_text(s32, s32, char*, s32, f32, f32);
void func_80093720(s32, s32, char*, s32, f32, f32);
void func_80093754(s32, s32, char*, s32, f32, f32);
void print_text2(s32, s32, char*, s32, f32, f32, s32);
void func_800939C8(s32, s32, char*, s32, f32, f32);
void text_draw(s32, s32, char*, s32, f32, f32);
void func_80093E20();
void func_80093E40();
Gfx *func_80098C18(Gfx*, s32, s32, s32, s32, s32, s32, u32, s32);
Gfx *draw_box(Gfx*, s32, s32, s32, s32, s32, s32, s32, s32);
Gfx *func_80098FC8(Gfx*, s32, s32, s32, s32);
void func_80099110();
void func_80099184(s32);
void *segmented_to_virtual(segment_address_t);
void *segmented_to_virtual_dupe(segment_address_t);
void func_80099A94(Mk64_Texture *, s32);
void func_80099E60(Mk64_Texture *, s32, s32);
void func_8009A594(s32, s32, segment_address_t);
void func_8009A640(s32, s32, s32, segment_address_t);
segment_address_t func_8009A878(struct_8018DEE0_entry*);
void func_8009A76C(s32, s32, s32, s32);
void func_8009A7EC(s32, s32, s32, s32, s32);
void func_8009A944(struct_8018DEE0_entry*, s32);
Gfx *func_8009BA74(Gfx *, Mk64_Texture*, s32, s32);
s32 func_8009C434(s32, struct_8018DEE0_entry*, s32, s32, s32);
s32 func_8009C708(s32, struct_8018DEE0_entry *, s32, s32, s32, s32);
void func_8009E1C0();
void func_8009E208();
void func_8009E258();
void func_800A0AD0(struct_8018D9E0_entry*);
void func_800A11D0(struct_8018D9E0_entry*, s32, s32);
void func_800A1924(struct_8018D9E0_entry*);
void func_800A7258(struct_8018D9E0_entry*);
void func_800A72FC(struct_8018D9E0_entry*);
void func_800A7448(struct_8018D9E0_entry*);
void func_800A75A0(struct_8018D9E0_entry*);
void convert_number_to_ascii(s32, char*);
void write_dashes(char*);
void get_time_record_minutes(s32, char*);
void get_time_record_seconds(s32 , char*);
void get_time_record_centiseconds(s32, char*);
void func_800A86E8(struct_8018D9E0_entry*);
void func_800A8E14(struct_8018D9E0_entry*);
void func_800A8EC0(struct_8018D9E0_entry*);
void func_800A954C(struct_8018D9E0_entry*);
void func_800AADD4(struct_8018D9E0_entry*);
void func_800AAE18(struct_8018D9E0_entry*);
struct_8018D9E0_entry *func_800AAEB4(s32);
struct_8018D9E0_entry *func_800AAEF4(s32);
void func_800AAF94(struct_8018D9E0_entry*, s32);
/* This is where I'd put my static data, if I had any */
extern Mk64_Texture D_0200157C;
extern Mk64_Texture D_02001874;
extern Gfx D_02004A0C[];
extern Gfx D_020077A8[];
extern Gfx D_020077D8[];
extern Gfx D_02008008[];
extern Gfx D_02008030[];
extern Gfx D_02008058[];
extern s16 gGlyphDisplayWidth[]; // D_800EF690
extern RGBA16 D_800E74A8[5];
extern char *D_800E7500[9];
extern char *D_800E7678[];
extern char *D_800E76CC[4];
extern char *D_800E76DC[4];
extern char *D_800E77A8;
extern char *D_800E77AC;
extern char *D_800E77B0;
extern char *D_800E7A88[4];
extern char *D_800E7A98;
extern char *D_800E7A9C[2];
extern s32 gGlyphTextureLUT[]; // D_800E7E84
extern Mk64_Texture_Group *D_800E82B4[5];
extern s8 D_800E86D0[20];
extern f32 D_800F1F30;
extern f32 D_800F24A8;
extern f32 D_800F24AC;
extern f32 D_800F24B0;
extern f32 D_800F24B4;
extern f32 D_800F24B8;
extern f64 D_800F24C0;
extern s8 D_8018D9D9;
extern struct_8018D9E0_entry D_8018D9E0[32]; // D_8018D9E0
extern struct_8018DEE0_entry D_8018DEE0[16]; // D_8018DEE0
extern struct_8018E118_entry D_8018E118[200]; // D_8018E118
extern s8 gTextColor; // D_8018E860
extern s8 D_8018ED91;
extern s8 D_802874F5;
#endif

View File

@ -5,62 +5,8 @@
#include <types.h>
#include "global.h"
#include "common_structs.h"
void func_8009E1C0();
void func_8009E208();
void func_8009E258();
void func_800B44AC(void);
void func_800B44BC(void);
s32 func_800B4520(void);
void func_800B4670(void);
void func_800B4728(s32 arg0);
void func_800B4820(void);
s32 func_800B492C(void);
s32 func_800B49E4(void);
void func_800B559C(s32 arg0);
void func_800B5948(void);
void play_sound2(s32);
void func_800CA330(s32);
u32 func_802A7B70(u16 x);
extern u16 gEnableDebugMode; // D_800DC520
extern s32 gModeSelection; // D_800DC53C
extern s32 D_800DC540;
extern s16 gCurrentCourseId; // D_800DC5A0
extern u16 D_800E86F0;
extern s32 D_800E86F4;
extern s8 D_800E86F8;
extern s8 D_800E86FC;
extern s16 gCupCourseOrder[NUM_CUPS][NUM_COURSES_PER_CUP]; // D_800F2BB4
extern u8 D_800F2E64;
extern u8 D_800F2E74;
extern OSMesgQueue gSIEventMesgQueue; // D_8014F0B8
extern s32 D_8018E7A8;
extern s8 D_8018E7B0;
extern OSPfs D_8018E868;
extern OSPfs D_8018E8D0;
extern s32 D_8018EB78;
extern s32 D_8018EB7C;
extern s32 D_8018EB84;
extern SaveData D_8018EB90;
extern u8 D_8018ED10[4]; // Direct reference to the grandPrixPoints section of save data
extern u8 D_8018ED11;
extern u8 D_8018ED12;
extern u8 D_8018ED13;
extern s8 D_8018ED16;
extern s8 D_8018ED17;
extern u32 D_8018EDB8;
extern u32 D_8018EDBC;
extern s8 D_8018EDE5;
extern s8 D_8018EDE6;
extern s8 D_8018EDE7;
extern s8 D_8018EDEC;
extern s8 gTimeTrialDataCourseIndex; // D_8018EDF7
extern s8 gCourseRecordsMenuSelection; // D_8018EDF8
extern s32 gMenuTimingCounter; // D_8018EE00
extern s8 gCupSelection; // D_8018EE09
extern s8 D_8018EE0A;
extern s8 gCupCourseSelection; // D_8018EE0B
#include "code_80091750.h"
#include "code_800AF9B0.h"
void func_800AF9B0(void) {
D_8018EDB8 = func_802A7B70(7680);
@ -2799,7 +2745,7 @@ void func_800B45E0(s32 arg0) {
.cupRecords[arg0 / 4] \
.courseRecords[arg0 % 4];
courseTimeTrialRecordsPtr->unknownBytes[5] = func_800B4874();
courseTimeTrialRecordsPtr->unknownBytes[5] = func_800B4874(arg0);
osEepromLongWrite(&gSIEventMesgQueue, ((u32)courseTimeTrialRecordsPtr - (u32)&D_8018EB90) >> 3, (u8*) courseTimeTrialRecordsPtr, sizeof(CourseTimeTrialRecords));
}
@ -3401,9 +3347,6 @@ void func_800B5404(s32 arg0, s32 arg1) {
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5404.s")
#endif
u8 func_800B54EC(s32, s32);
u8 func_800B5508(s32, s32, s32);
// Get Grand Prix points for a given cup and CC mode
u8 func_800B54C0(s32 cup, s32 cc_mode) {
return func_800B54EC(cup, D_8018ED10[cc_mode]);

79
src/code_800AF9B0.h Normal file
View File

@ -0,0 +1,79 @@
#ifndef CODE_800AF9B0_H
#define CODE_800AF9B0_H
#include "PR/os.h"
#include "common_structs.h"
/* Function Prototypes */
void func_800AF9B0();
void func_800B13B0(struct Controller*, s32);
s32 func_800B34E8(s32);
void func_800B3B58(struct Controller*, u16);
void func_800B44AC();
void func_800B44BC();
s32 func_800B4520();
void func_800B45E0(s32);
void func_800B4670();
void func_800B46D0();
void func_800B4728(s32);
void func_800B4820();
s32 func_800B4874(s32);
s32 func_800B492C();
s32 func_800B49E4();
void func_800B4A10();
s32 func_800B4E24(s32);
s32 func_800B4EB4(s32, s32);
s32 func_800B4F2C();
s32 func_800B4FB0(s32);
u8 func_800B54C0(s32, s32);
u8 func_800B54EC(s32, s32);
u8 func_800B5508(s32, s32, s32);
s32 func_800B5530(s32);
s32 func_800B555C();
s32 func_800B557C();
void func_800B559C(s32);
void func_800B5948();
s32 func_800B5B2C(s32);
s32 func_800B5F30();
s32 func_800B6014();
s32 func_800B6A68();
// audio/external.c
void play_sound2(s32);
void func_800CA330(s32);
// memory.c
u32 func_802A7B70(u16);
/* This is where I'd put my static data, if I had any */
extern s32 D_800DC540;
extern u16 D_800E86F0;
extern s32 D_800E86F4;
extern s8 D_800E86F8;
extern s8 D_800E86FC;
extern u8 D_800F2E64;
extern u8 D_800F2E74;
extern s32 D_8018E7A8;
extern s8 D_8018E7B0;
extern OSPfs D_8018E868;
extern OSPfs D_8018E8D0;
extern s32 D_8018EB78;
extern s32 D_8018EB7C;
extern s32 D_8018EB84;
extern u8 D_8018ED10[4]; // Direct reference to the grandPrixPoints section of save data
extern u8 D_8018ED11;
extern u8 D_8018ED12;
extern u8 D_8018ED13;
extern s8 D_8018ED16;
extern s8 D_8018ED17;
extern u32 D_8018EDB8;
extern u32 D_8018EDBC;
extern s8 D_8018EDE5;
extern s8 D_8018EDE6;
extern s8 D_8018EDE7;
extern s8 D_8018EDEC;
extern s8 D_8018EE0A;
#endif