Import bss for audio and elsewhere (#416)

This commit is contained in:
MegaMech
2023-09-12 19:43:54 -06:00
committed by GitHub
parent f20221fab6
commit 4ee09e005f
29 changed files with 333 additions and 513 deletions
+87 -22
View File
@@ -9,12 +9,79 @@
#include "audio/data.h"
#include <sounds.h>
#include "port_eu.h"
#include "code_80091750.h"
/** bss
s8 D_8018EF10;
*/
typedef struct {
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
} UnkStruct8018EF18;
UnkStruct8018EF18 D_8018EF18[12]; // probably wrong
struct Unk_8018EFD8 D_8018EFD8[50];
u8 D_8018FB90;
u8 D_8018FB91;
Camera *D_8018FB98[4]; // Is this real?
Vec3f D_8018FBA8[4];
Vec3f D_8018FBD8[4];
u8 D_8018FC08;
s32 D_8018FC10[4]; // probably wrong.
struct Unk_8018FC20 sSoundRequests[0x100];
struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20];
u8 sSoundBankUsedListBack[SOUND_BANK_COUNT];
u8 sSoundBankFreeListFront[SOUND_BANK_COUNT];
extern u8 sNumSoundsInBank[SOUND_BANK_COUNT];
extern u8 sSoundBankDisabled[];
extern u8 D_801930D0[];
extern u8 D_80192C38;
// Warning: D_801930D0 appears to be an array of struct.
// D_80193318 has been treated as a fake pr in the assembly.
// This may not be correct.
/** Could not figure out these structs.
u8 D_80192AB8[384]; // probably wrong.
struct UnkStruct_80192C38 {
u8 unk0;
//u8 unk1[3];
u8 sSoundBankDisabled[16];
};
struct UnkStruct_80192C38 D_80192C38;
//u8 D_80192C38;
//s32 a;
//u8 sSoundBankDisabled[15]; // 0x80192C3C
typedef struct {
f32 unk0;
f32 unk4;
f32 unk8;
f32 unkC;
} UnkStruct_80192C48; // size 0x10
UnkStruct_80192C48 D_80192C48;
typedef struct {
u8 unk0[9];
} UnkStruct_80192CA8; // size 0xA
UnkStruct_80192CA8 D_80192CA8[3];
u8 D_80192CC6[10]; // unconfirmed
u32 D_80192CD0[256];
typedef struct {
u8 unk0[0x24C];
} UnkStruct_801930D0;
UnkStruct_801930D0 D_801930D0[3];
//UnkStruct_801930D0 D_80193318[2]; // Likely fake var. Probably apart of 801930D0.
*/
// Requires void in the argument list to match properly.
void func_800C13F0(void) {
@@ -690,11 +757,11 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C284C.s")
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
//extern ? D_80193318;
void func_800C29B4(u8 arg0, s32 arg1) {
func_800CBBB8((arg0 << 0x10) | 0x83000000, arg1 & 0xFFFF);
*(&D_80193318 + (arg0 * 0x24C)) = 0xFFFF;
*(&D_801930D0 + (arg0 * 0x24C)) = 0xFFFF;
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C29B4.s")
@@ -1080,7 +1147,7 @@ void func_800C3478(void) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_80193318;
//extern ? D_80193318;
u16 func_800C3508(s32 player) {
s32 temp_t6;
@@ -1090,7 +1157,7 @@ u16 func_800C3508(s32 player) {
if (((u32) gSequencePlayers[temp_t6] >> 0x1F) == 0) {
return 0xFFFFU;
}
return *(&D_80193318 + (temp_t6 * 0x24C));
return *(&D_801930D0 + (temp_t6 * 0x24C));
}
#else
GLOBAL_ASM("asm/non_matchings/audio/external/func_800C3508.s")
@@ -1166,7 +1233,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C36C4.s")
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
extern ? D_801930D0;
//extern ? D_801930D0;
void func_800C3724(void) {
f32 temp_f2;
@@ -1527,7 +1594,7 @@ void func_800C4084(u16 bankMask) {
}
extern u16 D_800EA1C4;
extern u8 D_801930D0[];
//extern u8 D_801930D0[];
void func_800C40F0(u8 arg0) {
D_800EA1C4 &= ((1 << (arg0)) ^ (u16) -1);
@@ -2090,8 +2157,7 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C4888.s")
? func_800C19D0(s32, s32, u8); /* extern */
? func_800C473C(s32, s32); /* extern */
extern ? D_80192AB8;
extern u8 D_80192C38;
extern ? D_801930D0;
//extern ? D_801930D0;
extern ? D_803B17D0;
static ? D_800EA188; /* unable to generate initializer */
u8 D_800EA1C0 = 0;
@@ -2120,27 +2186,28 @@ void func_800C4FE4(s32 arg0) {
temp_s0 = (temp_s3 * 0x3C0) + (temp_s1 * 0x30) + sSoundBanks;
temp_v0 = temp_s0->unk28;
if (temp_v0 == 2) {
temp_s0->unk2C = (u8) D_80192C38;
temp_s0->unk2C = (u8) D_80192C38.unk0;
if (temp_s0->unk24 & 0x80000) {
D_800EA1C4 |= 1 << D_80192C38;
D_800EA1C4 |= 1 << D_80192C38.unk0;
D_801930D0.unk12 = 1;
D_801930D0.unk10 = 0x28;
}
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
func_800CBBE8((D_80192C38 << 8) | 0x06020000, 1);
func_800CBBE8((D_80192C38 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24);
func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000, 1);
func_800CBBE8((D_80192C38.unk0 << 8) | 0x06020000 | 4, (s8) temp_s0->unk24);
temp_s0->unk28 = 4U;
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
if ((*(&D_803B17D0 + (D_80192C38 * 4)))->unk5F == 0x80) {
func_800CBBE8(((D_80192C38 & 0xFF) << 8) | 0x06020000 | 7, 0);
// gSequencePlayers + 0x2C0 gSequencePlayers[1].channels
if ((*(&D_803B17D0 + (D_80192C38.unk0 * 4)))->unk5F == 0x80) {
func_800CBBE8(((D_80192C38.unk0 & 0xFF) << 8) | 0x06020000 | 7, 0);
func_800C473C(temp_s3 & 0xFF, temp_s1 & 0xFF);
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
goto block_11;
}
if (temp_v0 == 3) {
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38);
func_800C19D0(temp_s3 & 0xFF, temp_s1 & 0xFF, D_80192C38.unk0);
temp_s0->unk28 = 4U;
var_v1_2 = &D_800EA188 + ((D_800EA1C0 * 6) + temp_s3);
block_11:
@@ -2150,7 +2217,7 @@ block_11:
temp_t7 = (var_s4 + 1) & 0xFF;
temp_at = temp_t7 < (s32) var_v1;
var_s4 = temp_t7;
D_80192C38 += 1;
D_80192C38.unk0 += 1;
} while (temp_at != 0);
}
}
@@ -2395,14 +2462,13 @@ GLOBAL_ASM("asm/non_matchings/audio/external/func_800C5968.s")
#endif
extern s8 D_80192C38;
extern s32 D_803B17D0;
void func_800C59C4(void) {
u8 i;
if (D_803B17D0 != (u32) &gSequenceChannelNone) {
if (gSequencePlayers[2].channels[0] != &gSequenceChannelNone) {
D_80192C38 = 0;
for(i = 0; i < 6; i++) {
func_800C4888(i);
@@ -3070,7 +3136,6 @@ void func_800C70A8(u8 playerId) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023
extern s8 D_801657E5;
extern u8 D_8018ED90;
s32 D_800E9E74[4] = { 0, 0, 0, 0 };
static ? D_800E9E94; /* unable to generate initializer */
static s32 D_800E9EA4[4] = { 0, 0, 0, 0 };
@@ -4105,7 +4170,6 @@ void func_800CA59C(u8 playerId) {
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-09-2023
s32 func_800C357C(?); /* extern */
? func_800C3608(?, ?, u8); /* extern */
extern u32 D_803B1658;
struct Unk_800E9F7C D_800E9F7C[4]; /* unable to generate initializer */
u8 D_800EA0EC[1] = { 0 };
u8 D_800EA104 = 0;
@@ -4139,6 +4203,7 @@ void func_800CA730(u8 playerId) {
func_800C9018(playerId & 0xFF, 0x0100FF2C);
} else if ((D_800EA10C->unk0 == 0) && (D_800EA10C->unk1 == 0)) {
if (D_8018FC08 != 0) {
// gSequencePlayers+0x148
if (((u32) D_803B1658 >> 0x1F) == 0) {
func_800C3608(1, 5, playerId);
func_800C8EAC(D_800EA15C);
-1
View File
@@ -242,7 +242,6 @@ extern struct Unk_80191420 sSoundBanks[SOUND_BANK_COUNT][20];
extern u8 sSoundBankUsedListBack[SOUND_BANK_COUNT];
extern u8 sSoundBankFreeListFront[SOUND_BANK_COUNT];
extern u8 sNumSoundsInBank[SOUND_BANK_COUNT];
extern u8 sSoundBankDisabled[12]; // size??
extern u8 sNumProcessedSoundRequests;
extern u8 sSoundRequestCount;
extern struct Unk_8018FC20 sSoundRequests[0x100];
+60 -8
View File
@@ -17,6 +17,66 @@ struct SharedDma {
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
}; // size = 0x10
//struct Note *gNotes; // 0x803B1508
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS];
struct SequenceChannelLayer gSequenceLayers[SEQUENCE_LAYERS];
struct SequenceChannel gSequenceChannelNone;
// D_803B5F5C
struct AudioListItem gLayerFreeList;
struct NotePool gNoteFreeLists;
OSMesgQueue gCurrAudioFrameDmaQueue;
OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE];
OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE];
OSMesgQueue D_803B6720;
OSMesg D_803B6738;
OSIoMesg D_803B6740;
struct SharedDma sSampleDmas[0x70];
u32 gSampleDmaNumListItems;
u32 sSampleDmaListSize1;
s32 D_803B6E60;
s32 load_bss_pad;
u8 sSampleDmaReuseQueue1[256]; // sSampleDmaReuseQueue1
u8 sSampleDmaReuseQueue2[256]; // sSampleDmaReuseQueue2
u8 sSampleDmaReuseQueueTail1; // sSampleDmaReuseQueueTail1
u8 sSampleDmaReuseQueueTail2; // sSampleDmaReuseQueueTail2
u8 sSampleDmaReuseQueueHead1; // sSampleDmaReuseQueueHead1
u8 sSampleDmaReuseQueueHead2; // sSampleDmaReuseQueueHead2
s32 D_803B706C;
s32 D_803B7070;
s32 D_803B7074;
u8 *gAlBankSets;
u16 D_803B707C;
struct CtlEntry *gCtlEntries;
struct AudioBufferParametersEU gAudioBufferParameters;
u32 D_803B70A8;
s32 D_803B70AC;
s32 gMaxSimultaneousNotes;
s16 D_803B70B4;
s8 gAudioLibSoundMode;
s32 D_803B70B8; // According to sm64 this is s8 not s32
s32 gCurrAudioFrameDmaCount; // file split around here?
s32 D_803B70C0;
s32 D_803B70C4;
s32 D_803B70C8[2]; // probably wrong
s32 D_803B70D0;
struct SPTask *D_803B70D4; // gAudioTask?
struct SPTask D_803B70D8[2]; // gAudioTasks?
f32 D_803B7178;
s32 D_803B717C;
void *D_803B7180[3]; // unconfirmed, osAiSetNextBuffer vaddr
u32 D_803B718C; // osAiSetNextBuffer nbytes
s16 load_bss_pad3;
u16 D_803B7192; // unconfirmed
u32 gAudioRandom;
s32 gAudioErrorFlags;
u32 D_803B71A0[4]; // unconfirmed
u8 D_803B71B0[4]; // unconfirmed
extern OSMesgQueue D_803B6720;
extern OSIoMesg D_803B6740;
@@ -24,17 +84,10 @@ extern OSMesgQueue gCurrAudioFrameDmaQueue; // gCurrAudioFrameDmaQueue
extern OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; // gCurrAudioFrameDmaMesgBufs
extern OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; // gCurrAudioFrameDmaIoMesgBufs
extern struct SharedDma sSampleDmas[0x60]; // sSampleDmas
extern u32 gSampleDmaNumListItems; // gSampleDmaNumListItems
extern u32 sSampleDmaListSize1; // sSampleDmaListSize1
extern s32 D_803B6E60; // sUnused80226B40
extern u8 sSampleDmaReuseQueue1[256]; // sSampleDmaReuseQueue1
extern u8 sSampleDmaReuseQueue2[256]; // sSampleDmaReuseQueue2
extern u8 sSampleDmaReuseQueueTail1; // sSampleDmaReuseQueueTail1
extern u8 sSampleDmaReuseQueueTail2; // sSampleDmaReuseQueueTail2
extern u8 sSampleDmaReuseQueueHead1; // sSampleDmaReuseQueueHead1
extern u8 sSampleDmaReuseQueueHead2; // sSampleDmaReuseQueueHead2
/**
* Given that (almost) all of these are format strings, it is highly likely
@@ -1019,7 +1072,6 @@ GLOBAL_ASM("asm/non_matchings/audio/load/func_800BBF44.s")
extern s8 D_803B0500;
extern s8 D_803B0501;
extern OSMesgQueue D_803B6720;
extern void *D_803B6738;
extern s32 *D_803B706C;
extern s32 *D_803B7070;
extern s32 *D_803B7074;
+8 -12
View File
@@ -53,7 +53,6 @@ extern s32 D_803B70C0;
extern s32 D_803B70C4;
extern ? D_803B70C8;
extern s32 D_803B70D0;
extern void *D_803B70D4;
extern ? D_803B70D8;
extern ? D_803B7180;
extern ? D_803B718C;
@@ -187,9 +186,6 @@ GLOBAL_ASM("asm/non_matchings/audio/port_eu/create_next_audio_frame_task.s")
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-14-2023
? func_800BBDDC(u8, ?); /* extern */
extern u8 D_803B1658;
extern u8 D_803B17A0;
extern u8 D_803B18E8;
void func_800CB818(void *arg0) {
s32 temp_a1;
@@ -224,16 +220,16 @@ void func_800CB818(void *arg0) {
gAudioLibSoundMode = (s8) arg0->unk4;
return;
case 0xF1:
*gSequencePlayers |= 0x24;
D_803B1658 |= 0x24;
D_803B17A0 |= 0x24;
D_803B18E8 |= 0x24;
gSequencePlayers[0] |= 0x24;
gSequencePlayers[1] |= 0x24;
gSequencePlayers[2] |= 0x24;
gSequencePlayers[3] |= 0x24;
return;
case 0xF2:
*gSequencePlayers = (*gSequencePlayers & 0xFFDF) | 4;
D_803B1658 = (D_803B1658 & 0xFFDF) | 4;
D_803B17A0 = (D_803B17A0 & 0xFFDF) | 4;
D_803B18E8 = (D_803B18E8 & 0xFFDF) | 4;
gSequencePlayers[0] = (gSequencePlayers[0] & 0xFFDF) | 4;
gSequencePlayers[1] = (gSequencePlayers[1] & 0xFFDF) | 4;
gSequencePlayers[2] = (gSequencePlayers[2] & 0xFFDF) | 4;
gSequencePlayers[3] = (gSequencePlayers[3] & 0xFFDF) | 4;
return;
case 0xF3:
func_800BB388((s32) arg0->unk1, (s32) arg0->unk2, (s32) arg0->unk3);
+13 -24
View File
@@ -19,10 +19,17 @@
#include "code_80057C60.h"
#include "bomb_kart.h"
#include "courses/all_course_data.h"
#include "common_textures.h"
extern UnkCommonTextureStruct0 *D_800DC720[];
//Collision D_80162E70;
//s16 D_80162EB0; LIkely a float.
s32 unk_code_80005FD0_pad[24];
Collision D_80162E70;
s16 D_80162EB0; // Possibly a float.
s16 D_80162EB2; // possibly [3]
s16 code_80005FD0_pad[2];
uintptr_t *D_80162EB8[20];
// Strings, presented by google translate!
@@ -5340,30 +5347,12 @@ s32 func_8001168C(s16 *arg0, void *arg1, s32 arg2) {
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001168C.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
void *segmented_to_virtual_dupe_2(void*); // extern
extern s32 D_800DC720;
extern ? D_80162EB8;
extern ? D_80162F08;
void func_80011A5C(void) {
? *temp_s0;
s32 *phi_s1;
? *phi_s0;
phi_s1 = &D_800DC720;
phi_s0 = &D_80162EB8;
do {
temp_s0 = phi_s0 + 4;
temp_s0->unk-4 = segmented_to_virtual_dupe_2(*phi_s1);
phi_s1 += 4;
phi_s0 = temp_s0;
} while (temp_s0 != &D_80162F08);
s32 i;
for (i = 0; i < 20; i++) {
D_80162EB8[i] = segmented_to_virtual_dupe_2(D_800DC720[i]);
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011A5C.s")
#endif
void func_80011AB8(s32 index) {
D_801632B8[index] = 0;
+78 -26
View File
@@ -36,6 +36,38 @@ s32 code_80091750_pad_2[2];
s8 D_8018E838[4]; // Import to C was required for matching.
s32 D_8018E83C;
s32 D_8018E840[4]; // This may all be one big array.
s32 D_8018E850[2]; // This is probably incorrect. Fix after decomping code.
s32 D_8018E858[2];
s8 gTextColor;
s32 D_8018E864_pad;
OSPfs gControllerPak1FileHandle;
OSPfs gControllerPak2FileHandle;
OSPfsState pfsState[16];
s32 pfsError[16]; // 0 = Ok, anything else = error.
s32 gControllerPak1NumFilesUsed;
s32 gControllerPak1MaxWriteableFiles;
s32 gControllerPak1NumPagesFree;
s32 gControllerPak1FileNote;
s32 gControllerPak2FileNote;
s32 code_80091750_bss_pad2;
SaveData gSaveData;
u8 D_8018ED90;
u8 D_8018ED91;
s32 s8018ED94;
f32 D_8018ED98; // Rotation
f32 D_8018ED9C; // Rotation
f32 D_8018EDA0; // Rotation
f32 D_8018EDA4;
f32 D_8018EDA8;
f32 D_8018EDAC;
Unk_D_800E70A0 D_800E70A0[] = {
{ 0x3d, 0x11, 0x00, 0x00 },
{ 0x15, 0x3e, 0x00, 0x00 },
@@ -1552,7 +1584,7 @@ s32 func_80091D74(void) {
}
for (i = 0; i < 16; i++) {
D_8018EB38[i] = osPfsFileState(&gControllerPak1FileHandle, i, D_8018E938 + i);
pfsError[i] = osPfsFileState(&gControllerPak1FileHandle, i, pfsState + i);
}
if (osPfsFreeBlocks(&gControllerPak1FileHandle, &gControllerPak1NumPagesFree)) {
@@ -1688,6 +1720,7 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) {
s32 temp_t8_2;
s32 temp_t9;
void *temp_a2;
s32 i;
if ((arg0 >= 4) && (arg0 < 6)) {
temp_t8 = *arg2 + 0x10;
@@ -1698,8 +1731,10 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) {
}
var_s0 = D_800E84C0;
temp_s4 = (((arg0 * 4) + (((s32) gGlobalTimer % 2) * 2)) - 6) * 0x10;
do {
temp_v0 = segmented_to_virtual_dupe_2(*var_s0);
for (i = 0; i < 12; i++) {
temp_v0 = (Vtx *) segmented_to_virtual_dupe_2(D_800E84C0[i]);
temp_a0 = *arg2;
temp_a2 = temp_v0 + temp_s4;
temp_a1 = 0x100 - temp_a0;
@@ -1719,7 +1754,30 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2) {
temp_a2->unk1D = (s8) temp_t9;
temp_a2->unk1E = (s8) temp_t7;
temp_a2->unk1F = (s8) temp_t8_2;
} while (var_s0 != D_800E84CC);
}
//do {
// temp_v0 = segmented_to_virtual_dupe_2(*var_s0);
// temp_a0 = *arg2;
// temp_a2 = temp_v0 + temp_s4;
// temp_a1 = 0x100 - temp_a0;
// var_s0 += 4;
// temp_t0 = (*arg1 * 2) + 2;
// temp_v1 = &temp_v0[temp_t0];
// temp_v1_2 = &temp_v0[(temp_t0 % 6) + 2];
// temp_t6 = (s32) ((temp_a1 * temp_v1->v.cn[0]) + (temp_a0 * temp_v1_2->v.cn[0])) / 256;
// temp_a2->unkC = (s8) temp_t6;
// temp_t9 = (s32) ((temp_a1 * temp_v1->v.cn[1]) + (temp_a0 * temp_v1_2->v.cn[1])) / 256;
// temp_a2->unkD = (s8) temp_t9;
// temp_t7 = (s32) ((temp_a1 * temp_v1->v.cn[2]) + (temp_a0 * temp_v1_2->v.cn[2])) / 256;
// temp_a2->unkE = (s8) temp_t7;
// temp_t8_2 = (s32) ((temp_a1 * temp_v1->v.cn[3]) + (temp_a0 * temp_v1_2->v.cn[3])) / 256;
// temp_a2->unkF = (s8) temp_t8_2;
// temp_a2->unk1C = (s8) temp_t6;
// temp_a2->unk1D = (s8) temp_t9;
// temp_a2->unk1E = (s8) temp_t7;
// temp_a2->unk1F = (s8) temp_t8_2;
//} while (var_s0 != D_800E84CC);
}
}
#else
@@ -2451,7 +2509,7 @@ void func_80093F10(void) {
gSPDisplayList(gDisplayListHead++, D_02007F18);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240);
func_80092290(4, D_8018E850, D_8018E858);
func_80092290(5, (s32 *) &D_8018E854, (s32 *) &D_8018E85C);
func_80092290(5, (s32 *) &D_8018E850[1], (s32 *) &D_8018E858[1]);
func_8009C918();
func_80099A70();
func_80099E54();
@@ -2471,7 +2529,7 @@ void func_800940EC(s32 arg0) {
D_80164AF0++;
gSPDisplayList(gDisplayListHead++, D_02007F18);
func_80092290(4, D_8018E850, D_8018E858);
func_80092290(5, (s32 *) &D_8018E854, (s32 *) &D_8018E85C);
func_80092290(5, (s32 *) &D_8018E850[1], (s32 *) &D_8018E858[1]);
func_80092148();
func_80099A70();
func_80099E54();
@@ -2567,7 +2625,7 @@ void func_80094A64(Mtx *arg0) {
gSPDisplayList(gDisplayListHead++, D_02007650);
func_80094C60();
func_80092290(4, &D_8018E850, &D_8018E858);
func_80092290(5, &D_8018E854, &D_8018E85C);
func_80092290(5, &D_8018E850[1], &D_8018E858[1]);
func_80099A70();
func_8009C918();
switch (gMenuSelection) {
@@ -7282,8 +7340,6 @@ s32 func_8009A478(void *, s32); /* extern */
s32 func_800B5218(); /* extern */
extern ? D_801640F4;
extern u32 D_8018CA78;
extern s8 D_8018ED90;
extern s32 D_8018ED94;
u64 gTexture7ED50C[0x32];
void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) {
@@ -7346,7 +7402,7 @@ loop_3:
var_ra->type = type;
switch (type) { /* irregular */
case 0xFA:
D_8018ED94 = 0;
s8018ED94 = 0;
D_800E8530 = 0.0f;
D_800E8534 = 3.0f;
D_8018EDC0 = 0x000009C4;
@@ -8422,7 +8478,7 @@ void func_800A0AD0(UNUSED struct_8018D9E0_entry *arg0) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
extern ? D_8018EB34;
//extern ? D_8018EB34;
void func_800A0B80(struct_8018D9E0_entry *arg0) {
? *temp_s4;
@@ -8458,8 +8514,12 @@ void func_800A0B80(struct_8018D9E0_entry *arg0) {
}
temp_v0_2 = *var_s6;
temp_s2 = arg0->row + temp_s1 + 1;
// Note this appears to actually be the very end of pfsState
// Perhaps 8018E938[temp_v0_2].game_name[15].
// It must be a fake ptr.
if (*(&D_8018EB34 + (temp_v0_2 * 4)) == 0) {
temp_s4 = &D_8018E938[temp_v0_2].unk-20;
temp_s4 = &pfsState[temp_v0_2].unk-20;
temp_s1_2 = func_800A095C(temp_s4 + 0xE, 0x00000010, 0x0000004F, temp_s2) * 8;
if (temp_s4->unkA != 0) {
func_800A08D8(0x3CU, temp_s1_2 + 0x4F, temp_s2);
@@ -10191,13 +10251,7 @@ void func_800A638C(struct_8018D9E0_entry *arg0) {
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
? guMtxCatL(Mtx *, Mtx *, Mtx *); /* extern */
extern f32 D_8018ED98;
extern f32 D_8018ED9C;
extern f32 D_8018EDA0;
extern f32 D_8018EDA4;
extern f32 D_8018EDA8;
extern f32 D_8018EDAC;
// ? guMtxCatL(Mtx *, Mtx *, Mtx *); /* extern */
void func_800A66A8(struct_8018D9E0_entry *arg0, s16 *arg1) {
Gfx *temp_v0;
@@ -10608,7 +10662,6 @@ void func_800A79F4(s32 arg0, char *arg1) {
? func_800AC458(struct_8018D9E0_entry *); /* extern */
? func_800ACF40(struct_8018D9E0_entry *); /* extern */
? func_800AEF14(struct_8018D9E0_entry *); /* extern */
extern s32 D_8018ED94;
void func_800A7A4C(s32 arg0) {
f32 temp_f18;
@@ -10639,22 +10692,22 @@ block_7:
if (var_v1 != 0) {
switch (temp_v0) { /* switch 8; irregular */
case 0xFA: /* switch 8 */
if (D_8018ED94 < 0x50) {
if (s8018ED94 < 0x50) {
D_800E8534 = 3.0f;
} else if (D_8018ED94 < 0x5A) {
} else if (s8018ED94 < 0x5A) {
temp_f0 = (f64) D_800E8530;
if (temp_f0 < 1.0) {
D_800E8530 = (f32) (temp_f0 + 0.1);
}
D_800E8534 = (f32) ((f64) D_800E8534 + 0.1);
} else if (D_8018ED94 < 0xA0) {
} else if (s8018ED94 < 0xA0) {
D_800E8534 = (f32) ((f64) D_800E8534 + 0.1);
} else if (D_8018ED94 < 0x190) {
} else if (s8018ED94 < 0x190) {
D_800E8534 = (f32) ((f64) D_800E8534 + 0.3);
}
temp_f18 = D_8018EDCC - D_800E8534;
D_8018EDCC = temp_f18;
D_8018ED94 += 1;
s8018ED94 += 1;
if (temp_f18 < -360.0f) {
D_8018EDCC = temp_f18 + 360.0f;
}
@@ -14108,7 +14161,6 @@ void func_800AEEE8(struct_8018D9E0_entry *arg0) {
}
extern u32 D_8018CA78;
extern s8 D_8018ED90;
void func_800AEF14(s32* arg0) {
if (D_8018CAE0 != 0) {
+6 -1
View File
@@ -355,7 +355,8 @@ extern Gfx *D_8018E75C; // D_8018E75C
extern s32 gNumD_8018E768Entries; // D_8018E760
extern struct_8018E768_entry D_8018E768[D_8018E768_SIZE]; // D_8018E768
extern s8 gTextColor; // D_8018E860
extern s8 D_8018ED91;
extern u8 D_8018ED90;
extern u8 D_8018ED91;
extern s8 D_8018E838[];
extern s32 D_8018E840[];
extern s32 D_8018E850[];
@@ -527,4 +528,8 @@ extern Unk_D_800E70A0 D_800E8540[][4];
extern Unk_D_800E70A0 D_800E85C0[][4];
extern Unk_D_800E70A0 D_800E8600[][4];
extern s32 gControllerPak1NumPagesFree;
extern s32 gControllerPak1FileNote;
extern s32 gControllerPak2FileNote;
#endif
-1
View File
@@ -11,7 +11,6 @@ void func_800B0004(void);
/* This is where I'd put my static data, if I had any */
extern s32 gCCSelection; // D_800DC538 in main.c
extern s32 gModeSelection; // D_800DC53C
extern s32 D_800DC540;
extern s16 gCurrentCourseId; // D_800DC5A0
extern s32 gIsMirrorMode; // D_800DC5F4
+2 -4
View File
@@ -105,12 +105,10 @@ extern s32 D_80162DE0;
extern s32 D_80162DFC;
extern OSPfs gControllerPak1FileHandle;
extern OSPfs gControllerPak2FileHandle;
extern OSPfsState D_8018E938[];
extern s32 D_8018EB38[16];
extern OSPfsState pfsState[16];
extern s32 pfsError[16];
extern s32 gControllerPak1NumFilesUsed;
extern s32 gControllerPak1MaxWriteableFiles;
extern s32 gControllerPak1FileNote; // osPfs file_no receiver/out param
extern s32 gControllerPak2FileNote;
extern s8 D_8018EDE5;
extern s8 D_8018EDE6;
extern s8 D_8018EDE7;
+1 -1
View File
@@ -1410,7 +1410,7 @@ void func_802AE434(Vtx *vtx1, Vtx *vtx2, Vtx *vtx3, s8 surfaceType, u16 sectionI
s16 y3;
s16 z3;
/* Unused variables places around doubles for dramatic effect */
/* Unused variables placed around doubles for dramatic effect */
UNUSED s32 pad2[7];
f64 crossProductX;
+2
View File
@@ -98,6 +98,8 @@ extern UNUSED Player *gPlayerFourCopy;
extern u16 D_80152308;
extern s32 gModeSelection;
extern u16 *gPhysicalFramebuffers[];
extern OSIoMesg gDmaIoMesg;
extern OSMesg gMainReceivedMesg;
+3 -3
View File
@@ -906,7 +906,7 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) {
case CONTROLLER_PAK_MENU_TABLE_GAME_DATA:
if ((buttonAndStickPress & 0x9000) != 0) {
selectedTableRow = D_800E86C4[gControllerPakSelectedTableRow + 2] - 1;
if (D_8018EB38[selectedTableRow] == 0) {
if (pfsError[selectedTableRow] == 0) {
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT;
play_sound2(SOUND_MENU_SELECT);
return;
@@ -981,14 +981,14 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) {
return;
case CONTROLLER_PAK_MENU_ERASING:
selectedTableRow = D_800E86C4[gControllerPakSelectedTableRow + 2] - 1;
osPfsState = &D_8018E938[selectedTableRow];
osPfsState = &pfsState[selectedTableRow];
switch (osPfsDeleteFile(&gControllerPak1FileHandle, osPfsState->company_code, osPfsState->game_code, (u8 *)&osPfsState->game_name, (u8 *)&osPfsState->ext_name)) {
default:
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED;
return;
case 0:
D_8018EB38[selectedTableRow] = -1;
pfsError[selectedTableRow] = -1;
gControllerPak1NumPagesFree += (((osPfsState->file_size + 0xFF) >> 8) & 0xFF);
gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA;
return;
+15 -15
View File
@@ -41,41 +41,41 @@ s32 func_80290C20(Camera *camera) {
return 0;
}
void parse_course_displaylists(uintptr_t arg0) {
s32 segment = SEGMENT_NUMBER2(arg0);
s32 offset = SEGMENT_OFFSET(arg0);
TrackSections *data = (TrackSections *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
void parse_course_displaylists(uintptr_t addr) {
s32 segment = SEGMENT_NUMBER2(addr);
s32 offset = SEGMENT_OFFSET(addr);
TrackSections *section = (TrackSections *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
while(data->addr != 0) {
if (data->flags & 0x8000) {
while(section->addr != 0) {
if (section->flags & 0x8000) {
D_8015F59C = 1;
} else {
D_8015F59C = 0;
}
if (data->flags & 0x2000) {
if (section->flags & 0x2000) {
D_8015F5A0 = 1;
} else {
D_8015F5A0 = 0;
}
if (data->flags & 0x4000) {
if (section->flags & 0x4000) {
D_8015F5A4 = 1;
} else {
D_8015F5A4 = 0;
}
find_and_set_vertex_data(data->addr, data->surfaceType, data->sectionId);
data++;
find_and_set_vertex_data(section->addr, section->surfaceType, section->sectionId);
section++;
}
}
extern u16 D_80152300[];
void load_surface_map(uintptr_t arg0, struct UnkStruct_800DC5EC *arg1) {
void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) {
Player *temp_t1 = arg1->player;
Camera *temp_a2 = arg1->camera;
u32 segment = SEGMENT_NUMBER2(arg0);
u32 offset = SEGMENT_OFFSET(arg0);
u32 segment = SEGMENT_NUMBER2(addr);
u32 offset = SEGMENT_OFFSET(addr);
// todo: Should be Gfx*
s32 *addr = (s32 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
s32 *gfx = (s32 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
s16 var_a3;
s16 temp_v1;
s16 sp1E;
@@ -178,7 +178,7 @@ void load_surface_map(uintptr_t arg0, struct UnkStruct_800DC5EC *arg1) {
}
arg1->pathCounter = temp_v1;
temp_v1 = ((temp_v1 - 1) * 4) + var_a3;
gSPDisplayList(gDisplayListHead++, addr[temp_v1]);
gSPDisplayList(gDisplayListHead++, gfx[temp_v1]);
}
void func_80291198(void) {
+1 -12
View File
@@ -4,6 +4,7 @@
#include <common_structs.h>
#include <defines.h>
#include <functions.h>
#include "main.h"
#include "code_800029B0.h"
#include "framebuffers.h"
#include "code_800B45E0.h"
@@ -60,21 +61,9 @@ u32 *D_800DC714 = (u32 *) &D_802BFB80[1][1][3];
extern u8 _kart_texturesSegmentRomStart;
extern s16 gCurrentCourseId;
extern s32 gModeSelection;
extern s32 gActiveScreenMode;
extern s32 gLapCountByPlayerId[];
extern s32 D_8018CA78;
extern Player *gPlayerOne;
extern Player* gPlayerTwo;
extern Player *gPlayerThree;
extern struct Controller *gControllerSix;
extern struct Controller *gControllerSeven;
extern struct Controller *gControllerEight;
extern struct Controller *gControllerOne;
extern StaffGhost *d_mario_raceway_staff_ghost;
extern StaffGhost *d_royal_raceway_staff_ghost;
extern StaffGhost *d_luigi_raceway_staff_ghost;