Decomp menus.c (#229)

* update m2ctx to make N64 sgi context

* finish decomping menus.c
This commit is contained in:
tehzz
2022-07-05 22:01:42 -04:00
committed by GitHub
parent a8e5c0f212
commit 40bb0154a8
42 changed files with 1956 additions and 4308 deletions
+4
View File
@@ -4,6 +4,8 @@
#include "common_structs.h"
void play_sound2(s32);
void func_800C8EAC(u16);
void func_800CA008(u8, u8);
void func_800CA0A0();
void func_800CA0B8();
void func_800CA0CC();
@@ -11,6 +13,8 @@ void func_800CA270();
void func_800CA330(s32);
void func_800CA388(s32);
void func_800CB134();
void func_800CB2C4(void);
void func_800C90F4(u8, uintptr_t);
extern s8 D_800EA0F4;
extern s8 D_800EA108;
+1 -1
View File
@@ -34,7 +34,7 @@ extern s8 D_8018EDF3;
extern s8 gCupSelection;
extern u32 gScreenModeSelection;
extern s32 gScreenModeSelection;
extern u32 D_8015F730;
extern u32 D_8015F734;
extern u32 gPrevLoadedAddress;
+3 -2
View File
@@ -4,7 +4,6 @@
#include "common_structs.h"
/* Function Prototypes */
s16 func_80005FD0(Vec3f, Vec3f);
s32 func_80006018(f32, f32, f32, f32, f32, f32, f32, f32);
void func_80006114(Vec3f, Vec3f, s16);
@@ -30,6 +29,8 @@ s16 func_8000CD24(f32, f32, f32, s16, Player*, s32, s32);
s16 func_8000D24C(f32, f32, f32, s32*);
s16 func_8000D2B4(f32, f32, f32, s16, s32);
s16 func_8000D33C(f32, f32, f32, s16, s32);
void func_8000F0E0(void);
void func_8000F124(void);
void func_80010218(s32);
f32 func_80010480(s32, u16);
void func_800107C4(s32);
@@ -40,7 +41,7 @@ f32 func_80010FA0(f32, f32, f32, s32);
s32 process_path_data(struct TrackWayPoint*, struct TrackWayPoint*);
f32 func_80013C74(s16, s16);
f32 func_800145A8(s16, f32, s16);
void func_8001968C();
void func_8001968C(void);
/* This is where I'd put my static data, if I had any */
// Might belong in menus.h?
+1 -1
View File
@@ -215,7 +215,7 @@ void func_802A3730(struct UnkStruct_800DC5EC*);
extern u16 gPlayerBalloonStatus[8][3]; // D_8018D5F0
extern s16 gPlayerBalloonCount[]; // D_8018D8C0
extern u32 gScreenModeSelection; // D_800DC530
extern s32 gScreenModeSelection; // D_800DC530
extern struct UnkStruct_800DC5EC *D_800DC5EC;
extern struct UnkStruct_800DC5EC *D_800DC5F0;
+20 -25
View File
@@ -6951,18 +6951,13 @@ void func_8009E258(void) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E258.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_8009DFE0(?); // extern
extern s32 D_8018EDE0;
void func_8009DFE0(s32);
extern s32 D_8018EDE0; //bss
void func_8009E280(void) {
func_8009DFE0(0xA);
func_8009DFE0(10);
D_8018EDE0 = 4;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E280.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
@@ -13402,13 +13397,13 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A9710.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda
static ? D_800E86C4; /* unable to generate initializer; const */
static ? D_800E86C6; /* unable to generate initializer; const */
static ? D_800E86C7; /* unable to generate initializer; const */
static ? D_800E86C8; /* unable to generate initializer; const */
static ? D_800E86C9; /* unable to generate initializer; const */
static ? D_800E86CA; /* unable to generate initializer; const */
static ? D_800E86CB; /* unable to generate initializer; const */
static ? D_800E86CC; /* unable to generate initializer; const */
static ? (D_800E86C4 + 2); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 1); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 2); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 3); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 4); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 5); /* unable to generate initializer; const */
static ? ((D_800E86C4 + 2) + 6); /* unable to generate initializer; const */
s8 D_800E86D0[0x14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; /* const */
void func_800A97BC(struct_8018D9E0_entry *arg0) {
@@ -13439,9 +13434,9 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
if (temp_t4 >= 0x73) {
arg0->row = 0x69;
*D_800E86D0 = 0;
phi_v1 = (u32) &D_800E86CC;
phi_v1 = (u32) &((D_800E86C4 + 2) + 6);
do {
if (phi_v1 >= (u32) &D_800E86C6) {
if (phi_v1 >= (u32) &(D_800E86C4 + 2)) {
phi_v1->unk0 = (s8) phi_v1->unk-1;
} else {
temp_v0_2 = phi_v1->unk1;
@@ -13451,7 +13446,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1->unk0 = (s8) (temp_v0_2 - 1);
}
}
if (phi_v1 >= (u32) &D_800E86C7) {
if (phi_v1 >= (u32) &((D_800E86C4 + 2) + 1)) {
phi_v1->unk-1 = (s8) phi_v1->unk-2;
} else {
temp_v0_3 = phi_v1->unk0;
@@ -13461,7 +13456,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1->unk-1 = (s8) (temp_v0_3 - 1);
}
}
if (phi_v1 >= (u32) &D_800E86C8) {
if (phi_v1 >= (u32) &((D_800E86C4 + 2) + 2)) {
phi_v1->unk-2 = (s8) phi_v1->unk-3;
} else {
temp_v0_4 = phi_v1->unk-1;
@@ -13471,7 +13466,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1->unk-2 = (s8) (temp_v0_4 - 1);
}
}
if (phi_v1 >= (u32) &D_800E86C9) {
if (phi_v1 >= (u32) &((D_800E86C4 + 2) + 3)) {
phi_v1->unk-3 = (s8) phi_v1->unk-4;
} else {
temp_v0_5 = phi_v1->unk-2;
@@ -13495,7 +13490,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
*D_800E86D0 = 0;
phi_v1_2 = (u32) &D_800E86C4;
do {
if (phi_v1_2 < (u32) &D_800E86CB) {
if (phi_v1_2 < (u32) &((D_800E86C4 + 2) + 5)) {
phi_v1_2->unk0 = (s8) phi_v1_2->unk1;
} else {
temp_v0_6 = phi_v1_2->unk-1;
@@ -13505,7 +13500,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1_2->unk0 = (s8) (temp_v0_6 + 1);
}
}
if (phi_v1_2 < (u32) &D_800E86CA) {
if (phi_v1_2 < (u32) &((D_800E86C4 + 2) + 4)) {
phi_v1_2->unk1 = (s8) phi_v1_2->unk2;
} else {
temp_v0_7 = phi_v1_2->unk0;
@@ -13515,7 +13510,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1_2->unk1 = (s8) (temp_v0_7 + 1);
}
}
if (phi_v1_2 < (u32) &D_800E86C9) {
if (phi_v1_2 < (u32) &((D_800E86C4 + 2) + 3)) {
phi_v1_2->unk2 = (s8) phi_v1_2->unk3;
} else {
temp_v0_8 = phi_v1_2->unk1;
@@ -13525,7 +13520,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
phi_v1_2->unk2 = (s8) (temp_v0_8 + 1);
}
}
if (phi_v1_2 < (u32) &D_800E86C8) {
if (phi_v1_2 < (u32) &((D_800E86C4 + 2) + 2)) {
phi_v1_2->unk3 = (s8) phi_v1_2->unk4;
} else {
temp_v0_9 = phi_v1_2->unk2;
@@ -13537,7 +13532,7 @@ void func_800A97BC(struct_8018D9E0_entry *arg0) {
}
temp_v1_2 = phi_v1_2 + 4;
phi_v1_2 = temp_v1_2;
} while (temp_v1_2 != &D_800E86CC);
} while (temp_v1_2 != &((D_800E86C4 + 2) + 6));
D_800E86C4.unk8 = 0;
D_800E86C4.unk0 = (s8) D_800E86C4.unk8;
}
+8 -3
View File
@@ -137,10 +137,12 @@ Gfx *func_8009BEF0(Gfx*, s32, f32, f32, s32, f32,f32);
Gfx *func_8009C434(Gfx*, struct_8018DEE0_entry*, s32, s32, s32);
Gfx *func_8009C708(Gfx*, struct_8018DEE0_entry *, s32, s32, s32, s32);
void func_8009C918();
void func_8009E0F0(s32);
void func_8009E1C0();
void func_8009E1E4();
void func_8009E208();
void func_8009E258();
void func_8009E208(void);
void func_8009E258(void);
void func_8009E280(void);
void func_8009E5BC();
void func_8009E620();
void add_8018D9E0_entry(s32, s32, s32, s8);
@@ -246,7 +248,7 @@ extern s32 gGlyphTextureLUT[]; // D_800E7E84
extern MkTexture *D_800E82B4[5];
extern f32 D_800E8530;
extern f32 D_800E8534;
extern s8 D_800E86D0[20];
extern s8 D_800E86D0[];
extern f32 D_800F1CC8;
extern f32 D_800F1F04;
extern f32 D_800F1F08;
@@ -287,4 +289,7 @@ extern s8 D_802874F5;
extern u8 _textures_0aSegmentRomStart[];
extern u8 _textures_0bSegmentRomStart[];
extern s32 D_8018E7A8; // maybe?
extern s8 D_8018E7B0; // maybe?
#endif
+13 -4
View File
@@ -10,17 +10,26 @@
#include "main.h"
#include "math_util.h"
extern Light D_800E8680;
extern Light D_800E8688;
/*** Data ***/
Ambient D_800E8680 = {{
{31, 31, 31}, 0,
{31, 31, 31}, 0,
}};
/* BSS */
Light D_800E8688 = {{
{255, 255, 255}, 0,
{255, 255, 255}, 0,
{ 40, 40, 20}, 0,
}};
/*** BSS ****/
s16 D_8018EDB0;
s16 D_8018EDB2;
s16 D_8018EDB4;
Vtx *D_8018EDB8;
Vtx *D_8018EDBC;
/* utils */
/*** utils **/
#define SQ(x) ((x) * (x))
void func_800AF9B0(void) {
-2
View File
@@ -16,7 +16,5 @@ extern s32 D_800DC540;
extern s16 gCurrentCourseId; // D_800DC5A0
extern s32 gIsMirrorMode; // D_800DC5F4
extern s32 D_800E86A4;
extern s8 gDisplayedControllerPakTableRows[5]; // D_800E86C6
extern s32 D_800E86E4;
#endif /* CODE_800AF9B0_H */
+13 -4
View File
@@ -9,12 +9,21 @@
#include "menus.h"
#include "staff_ghosts.h"
// rodata
/*** data ***/
#define PFS_COMPANY_CODE(c0, c1) ((u16)(((c0) << 8) | ((c1))))
#define PFS_GAME_CODE(c0, c1, c2, c3) ((u32)(((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)))
u16 D_800E86F0 = PFS_COMPANY_CODE('0', '1');
u32 D_800E86F4 = PFS_GAME_CODE('N', 'K', 'T', 'J');
s8 D_800E86F8 = 0;
s8 D_800E86FC = 0;
/*** rodata ***/
const u8 D_800F2E60[4] = {0xc0, 0x27, 0x09, 0x00};
// game_name param to osPfsFindFile
const char D_800F2E64[] = {0x26, 0x1a, 0x2b, 0x22, 0x28, 0x24, 0x1a, 0x2b, 0x2d, 0x16, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00};
// ext_name param to osPfsFindFile
const char D_800F2E74[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const u8 D_800F2E64[] = {0x26, 0x1a, 0x2b, 0x22, 0x28, 0x24, 0x1a, 0x2b, 0x2d, 0x16, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00};
// ext_name param to osPfsFindFile (four total bytes, but only one is setable)
const u8 D_800F2E74[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
// new file start?
void func_800B45E0(s32 arg0) {
+13 -6
View File
@@ -14,7 +14,7 @@ union GrandPrixPointsUnion
/* Function Prototypes */
void func_800B45E0(s32);
void write_save_data_grand_prix_points_and_sound_mode();
void func_800B46D0();
void func_800B46D0(void);
void func_800B4728(s32);
void reset_save_data_grand_prix_points_and_sound_mode();
s32 func_800B4874(s32);
@@ -28,6 +28,7 @@ s32 func_800B4E24(s32);
s32 func_800B4EB4(s32, s32);
s32 func_800B4F2C();
s32 func_800B4FB0(s32);
void func_800B5404(s32, s32);
u8 func_800B54C0(s32, s32);
u8 func_800B54EC(s32, s32);
u8 func_800B5508(s32, s32, s32);
@@ -42,14 +43,20 @@ s32 compute_save_data_checksum_backup_1(void);
s32 compute_save_data_checksum_backup_2(void);
s32 validate_save_data_checksum_backup();
s32 func_800B5B2C(s32);
s32 func_800B5B94(void);
s32 func_800B5DA4(void);
s32 func_800B5F30();
s32 func_800B6014();
s32 func_800B6088(s32);
u8 func_800B60E8(s32);
s32 func_800B6178(s32);
s32 func_800B64EC(s32);
s32 func_800B65F4(s32, s32);
void func_800B6708(void);
void func_800B6798(void);
u8 func_800B6828(s32);
u8 func_800B68F4(s32);
void func_800B69BC(s32);
s32 func_800B69BC(s32);
s32 func_800B6A68();
/* data */
@@ -58,7 +65,7 @@ s32 func_800B6A68();
extern u32* D_800DC714;
extern u16 D_800E86F0;
extern s32 D_800E86F4;
extern u32 D_800E86F4; // osPfs gamecode
extern s8 D_800E86F8;
extern struct_8018EE10_entry D_8018EE10[];
extern struct_8018EE10_entry *D_8018D9C0;
@@ -70,8 +77,8 @@ extern union GrandPrixPointsUnion D_8018ED88; // D_8018EB90.grandPrixPointsBacku
extern s8 D_800E86FC;
extern const u8 D_800F2E60[];
extern const char D_800F2E64[];
extern const char D_800F2E74[];
extern const u8 D_800F2E64[];
extern const u8 D_800F2E74[];
extern OSMesgQueue gSIEventMesgQueue; // D_8014F0B8
extern u16 D_80162DD6;
extern s32 D_80162DE0;
@@ -82,7 +89,7 @@ extern OSPfsState D_8018E938[];
extern s32 D_8018EB38[16];
extern s32 D_8018EB78;
extern s32 D_8018EB7C;
extern s32 D_8018EB84;
extern s32 D_8018EB84; // osPfs file_no receiver/out param
extern s32 D_8018EB88;
extern SaveData D_8018EB90;
extern u8 D_8018ED11;
+1
View File
@@ -6,6 +6,7 @@
#include "profiler.h"
#include "main.h"
#include "memory.h"
#include "menus.h"
#include "segments.h"
#include "segment_symbols.h"
#include "common_structs.h"
+2
View File
@@ -59,6 +59,7 @@ void thread4_audio(s32);
extern struct GfxPool *gGfxPool;
extern Gfx *gDisplayListHead;
extern struct Controller gControllers[8];
extern OSIoMesg gDmaIoMesg;
extern OSMesg gMainReceivedMesg;
@@ -68,6 +69,7 @@ extern s32 gActiveScreenMode;
extern f32 D_800DC594;
extern s32 D_800DC600;
extern s32 D_8015F8B8, D_8015F8BC, D_8015F8C0, D_8015F8C4, D_8015F8C8, D_8015F8CC;
extern s32 gScreenModeSelection;
extern s16 sController1Unplugged;
+1180 -1439
View File
File diff suppressed because it is too large Load Diff
+50 -22
View File
@@ -6,32 +6,60 @@
#include <types.h>
#include <defines.h>
/* Function Prototypes */
void func_800B053C(struct Controller*, u16);
void func_800B13B0(struct Controller*, u16);
void func_800B15AC(struct Controller*, u16);
void func_800B1C40(struct Controller*, u16);
void func_800B1C90(struct Controller*, u16);
void func_800B20F4(struct Controller*, u16);
void func_800B29D8(struct Controller*, u16);
s32 func_800B34E8(s32);
void func_800B3554(struct Controller*, u16);
void func_800B3B58(struct Controller*, u16);
void func_800B44AC(void);
/* functions */
void func_800B0350(void);
void func_800B3F74(s32 menuSelection);
void func_800B44BC(void);
s32 func_800B4520(void);
/* data */
// these might not be in this file, but for now...
extern s8 gGameModeSubMenuRowSelectionForNumPlayers[SELECTED_PLAYER_DEFINES_TOTAL][MAX_NUM_MAIN_MENU_GAME_TYPES]; // D_800E869D. 0-4 players, 3 possible game types per player amouunt
extern s8 gGameModeRowSelectionForNumPlayers[SELECTED_PLAYER_DEFINES_TOTAL]; // D_800E869B. 0-4 players, game type row selected for each player amoun
extern const s32 gGameModeFromNumPlayersAndRowSelection[SELECTED_PLAYER_DEFINES_TOTAL][MAX_NUM_MAIN_MENU_GAME_TYPES]; // D_800F2B60. 0-4 players, 3 possible game types per player amount
extern s16 gPlaceItemBoxes; // D_800DC638
extern s32 gMenuSelection;
extern s32 D_800E86A4;
extern s8 gCharacterSelections[4];
extern s8 D_800E86AC[4];
extern s8 D_800E86B0[4][3];
extern s8 gNextDemoId;
extern s8 gControllerPakSelectedTableRow;
extern s8 D_800E86C4[12];
extern s8 D_800E86D0[16];
extern s32 D_8018E7A8;
extern s8 D_8018E7B0;
extern s8 D_8018EDF3;
extern s8 D_8018EDFB;
extern s8 D_8018EE0A;
extern const s8 D_800F2B60[5][3];
extern const s32 gGameModeFromNumPlayersAndRowSelection[5][3];
extern const s16 gCupCourseOrder[5][4];
extern s32 D_8018EDC0;
extern f32 D_8018EDC4;
extern f32 D_8018EDC8;
extern f32 D_8018EDCC;
extern f32 D_8018EDD0;
extern f32 D_8018EDD4;
extern f32 D_8018EDD8;
extern f32 D_8018EDDC;
extern s32 D_8018EDE0;
extern s8 gCharacterGridSelections[4];
extern s8 D_8018EDE8[4];
extern s8 D_8018EDEC;
extern s8 gMainMenuSelectionDepth;
extern s8 D_8018EDEE;
extern s8 gDebugMenuSelection;
extern s8 gControllerPakMenuSelection;
extern s8 D_8018EDF1;
extern u8 gSoundMode;
extern s8 D_8018EDF3;
extern s8 D_8018EDF4;
extern s8 D_8018EDF5;
extern s8 D_8018EDF6;
extern s8 gTimeTrialDataCourseIndex;
extern s8 gCourseRecordsMenuSelection;
extern s8 D_8018EDF9;
extern s8 gDebugGotoScene;
extern s8 D_8018EDFB;
extern s8 D_8018EDFC;
extern s32 gMenuTimingCounter;
extern s8 D_8018EE08;
extern s8 gCupSelection;
extern s8 gCupCourseSelection;
extern s8 D_8018EE0C;
extern struct_8018EE10_entry D_8018EE10[2];
#endif /* MENUS_H */
+1 -1
View File
@@ -40,7 +40,7 @@ u16 D_80162DD4;
u16 D_80162DD6;
u16 D_80162DD8;
s32 D_80162DDC;
s32 D_80162DE0;
s32 D_80162DE0; // ghost kart id?
s32 D_80162DE4;
s32 D_80162DE8;
s32 D_80162DEC;
+6 -2
View File
@@ -5,8 +5,12 @@
#include "common_structs.h"
#include <types.h>
s32 func_800051C4();
void func_8000522C();
s32 func_800051C4(void);
void func_8000522C(void);
void func_80005AE8(Player *);
extern s32 D_80162DC8;
extern s32 D_80162DCC;
extern s32 D_80162E00;
#endif /* STAFF_GHOSTS_H */