Cleaning Up Warnings (#317)

* Update mk64 makefile to reflect sm64 makefile

* print func matches and fix some warnings
This commit is contained in:
MegaMech
2023-06-28 14:30:11 -06:00
committed by GitHub
parent 1b659170dc
commit d6eb25aae3
49 changed files with 2442 additions and 2417 deletions
+46 -43
View File
@@ -17,6 +17,8 @@
#include <sounds.h>
#include "code_80281780.h"
#include "memory.h"
#include "audio/external.h"
#include "hud_renderer.h"
// TODO: Move gGfxPool out of main.h
// Unfortunately that's not a small effort due to weird import structure in this project
#include "main.h"
@@ -203,8 +205,8 @@ void swap_values(s32 *arg0, s32 *arg1) {
extern s8 D_8018E7AC[]; // size of 4... Actually 5 probably.
extern s8 D_800E852C;
extern u32 D_8018D9B4;
extern u32 D_8018D9B8;
extern uintptr_t *D_8018D9B4;
extern uintptr_t *D_8018D9B8;
void func_80091B78(void) {
s32 why = 0;
@@ -227,10 +229,11 @@ void func_80091B78(void) {
set_segment_base_addr(6, decompress_segments((u8 *) &_data_825800SegmentRomStart, (u8 *) &_course_mario_raceway_dl_mio0SegmentRomStart));
}
gNextFreeMemoryAddress = D_8015F734;
D_8018D9B0 = get_next_available_memory_addr(0x000900B0);
D_8018D9B4 = get_next_available_memory_addr(0x0000CE00);
D_8018D9B8 = get_next_available_memory_addr(0x00012C00);
D_8018D9C0 = get_next_available_memory_addr(0x00001000);
// Hypothetically, this should be a ptr... But only hypothetically.
D_8018D9B0 = (intptr_t) get_next_available_memory_addr(0x000900B0);
D_8018D9B4 = (uintptr_t *) get_next_available_memory_addr(0x0000CE00);
D_8018D9B8 = (uintptr_t *) get_next_available_memory_addr(0x00012C00);
D_8018D9C0 = (struct_8018EE10_entry *) get_next_available_memory_addr(0x00001000);
func_800AF9B0();
D_8018EE0C = 0;
@@ -263,7 +266,7 @@ void func_80091B78(void) {
s32 func_80091D74(void) {
u8 sp67;
s32 pad[10];
UNUSED s32 pad[10];
s32 i;
if (!gControllerBits) {
@@ -326,10 +329,10 @@ void func_80091FA4(void) {
s32 i;
// todo: These sizes need to be sizeof() for shiftability if possible
D_8018D9B4 = get_next_available_memory_addr(0x00002800);
D_8018D9B0 = get_next_available_memory_addr(0x000124F8);
D_8018D9B8 = get_next_available_memory_addr(0x00001000);
D_8018D9BC = get_next_available_memory_addr(4);
D_8018D9B4 = (uintptr_t *) get_next_available_memory_addr(0x00002800);
D_8018D9B0 = (intptr_t) get_next_available_memory_addr(0x000124F8);
D_8018D9B8 = (uintptr_t *) get_next_available_memory_addr(0x00001000);
D_8018D9BC = (intptr_t *) get_next_available_memory_addr(4);
for (i = 0; i < 5; i++) {
D_8018E7AC[i] = 0;
@@ -883,7 +886,7 @@ void set_text_color(s32 arg0) {
gTextColor = arg0;
}
UNUSED void func_800930E4(s32 arg0, s32 arg1, s32 *arg2) {
UNUSED void func_800930E4(s32 arg0, s32 arg1, char *arg2) {
set_text_color(TEXT_BLUE);
func_80093324(arg0, arg1, arg2, 0, 1.0, 1.0);
}
@@ -898,8 +901,8 @@ void print_text0(s32 column, s32 row, char *text, s32 tracking, f32 x_scale, f32
do{
glyphIndex = char_to_glyph_index(text);
if (glyphIndex >= 0) {
func_80099184(segmented_to_virtual_dupe(gGlyphTextureLUT[glyphIndex]));
gDisplayListHead = func_8009BEF0(gDisplayListHead, segmented_to_virtual_dupe(gGlyphTextureLUT[glyphIndex]), column + (stringWidth * x_scale), row, arg6, x_scale, y_scale);
func_80099184((MkTexture *)segmented_to_virtual_dupe((const void *) gGlyphTextureLUT[glyphIndex]));
gDisplayListHead = func_8009BEF0(gDisplayListHead, (MkTexture *) segmented_to_virtual_dupe((const void *) gGlyphTextureLUT[glyphIndex]), column + (stringWidth * x_scale), row, arg6, x_scale, y_scale);
stringWidth += gGlyphDisplayWidth[glyphIndex] + tracking;
}
else if ((glyphIndex != -2) && (glyphIndex == -1)) {
@@ -980,8 +983,8 @@ void print_text1(s32 column, s32 row, char *text, s32 tracking, f32 x_scale, f32
do{
glyphIndex = char_to_glyph_index(text);
if (glyphIndex >= 0) {
func_80099184(segmented_to_virtual_dupe(gGlyphTextureLUT[glyphIndex]));
gDisplayListHead = func_8009BEF0(gDisplayListHead, segmented_to_virtual_dupe(gGlyphTextureLUT[glyphIndex]), column, row, arg6, x_scale, y_scale);
func_80099184((MkTexture *)segmented_to_virtual_dupe((const void *) gGlyphTextureLUT[glyphIndex]));
gDisplayListHead = func_8009BEF0(gDisplayListHead, (MkTexture *) segmented_to_virtual_dupe((const void *)gGlyphTextureLUT[glyphIndex]), column, row, arg6, x_scale, y_scale);
column += (gGlyphDisplayWidth[glyphIndex] + tracking);
column *= x_scale;
}
@@ -1032,7 +1035,7 @@ void print_text2(s32 column, s32 row, char *text, s32 tracking, f32 x_scale, f32
do {
glyphIndex = char_to_glyph_index(text);
if (glyphIndex >= 0) {
glyphTexture = segmented_to_virtual_dupe(gGlyphTextureLUT[glyphIndex]);
glyphTexture = (MkTexture *) segmented_to_virtual_dupe((const void *)gGlyphTextureLUT[glyphIndex]);
func_80099184(glyphTexture);
gDisplayListHead = func_8009BEF0(gDisplayListHead, glyphTexture, column - (gGlyphDisplayWidth[glyphIndex] / 2), row, arg6, x_scale, y_scale);
if ((glyphIndex >= 0xD5) && (glyphIndex < 0xE0)) {
@@ -1071,7 +1074,7 @@ void text_draw(s32 column, s32 row, char *text, s32 tracking, f32 x_scale, f32 y
extern s8 D_800F0B1C[];
void func_80093A30(s32 arg0) {
func_8009E2A8(D_800F0B1C[arg0], arg0);
func_8009E2A8(D_800F0B1C[arg0]);
}
#ifdef MIPS_TO_C
@@ -1195,8 +1198,8 @@ void func_80093F10(void) {
D_80164AF0++;
gSPDisplayList(gDisplayListHead++, D_02007F18);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240);
func_80092290(4, &D_8018E850, &D_8018E858);
func_80092290(5, &D_8018E854, &D_8018E85C);
func_80092290(4, D_8018E850, D_8018E858);
func_80092290(5, (s32 *) &D_8018E854, (s32 *) &D_8018E85C);
func_8009C918();
func_80099A70();
func_80099E54();
@@ -1215,8 +1218,8 @@ void func_800940EC(s32 arg0) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_80164AF0 + 0x3EB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
D_80164AF0++;
gSPDisplayList(gDisplayListHead++, D_02007F18);
func_80092290(4, &D_8018E850, &D_8018E858);
func_80092290(5, &D_8018E854, &D_8018E85C);
func_80092290(4, D_8018E850, D_8018E858);
func_80092290(5, (s32 *) &D_8018E854, (s32 *) &D_8018E85C);
func_80092148();
func_80099A70();
func_80099E54();
@@ -1360,7 +1363,7 @@ void func_800942D0(void) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800942D0.s")
#endif
void func_80094660(struct GfxPool *arg0, s32 unused) {
void func_80094660(struct GfxPool *arg0, UNUSED s32 arg1) {
u16 perspNorm;
move_segment_table_to_dmem();
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
@@ -1373,7 +1376,7 @@ void func_80094660(struct GfxPool *arg0, s32 unused) {
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
}
void func_800947B4(struct GfxPool *arg0, s32 unused) {
void func_800947B4(struct GfxPool *arg0, UNUSED s32 arg1) {
u16 perspNorm;
move_segment_table_to_dmem();
guPerspective(&arg0->mtxPool[1], &perspNorm, 45.0f, 1.3333334f, 100.0f, 12800.0f, 1.0f);
@@ -1725,17 +1728,21 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095574.s")
// Instead we depend on the fact that the result of func_80098C18 is left
// in v0 which means it is returned, sort of.
// Its also weird that the displayListHead argument goes entirely unused. What's up with that?
Gfx *func_800958D4(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 arg5) {
Gfx *func_800958D4(UNUSED Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 arg5) {
s32 phi_v0;
phi_v0 = ((D_8018E7A8 % arg5) << 9) / arg5;
if (phi_v0 >= 0x101) {
if (phi_v0 > 0x100) {
phi_v0 = 0x200 - phi_v0;
}
if (phi_v0 >= 0x100) {
if (phi_v0 > 0xFF) {
phi_v0 = 0xFF;
}
#if AVOID_UB
return gDisplayListHead = func_80098C18(gDisplayListHead, ulx, uly, lrx, lry, phi_v0, phi_v0, phi_v0, 0xFF);
#else
gDisplayListHead = func_80098C18(gDisplayListHead, ulx, uly, lrx, lry, phi_v0, phi_v0, phi_v0, 0xFF);
#endif
}
Gfx *func_800959A0(Gfx *displayListHead, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
@@ -3479,9 +3486,6 @@ Gfx *func_80098C18(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32
}
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;
red &= 0xFF;
green &= 0xFF;
blue &= 0xFF;
@@ -3526,7 +3530,7 @@ void dma_copy_base_729a30(u64 *arg0, size_t nbytes, void *vaddr) {
OSMesg sp2C;
osInvalDCache(vaddr, nbytes);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, &_textures_0aSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0aSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
}
@@ -3535,7 +3539,7 @@ void dma_copy_base_7fa3c0(u64 *arg0, size_t nbytes, void *vaddr) {
OSMesg sp2C;
osInvalDCache(vaddr, nbytes);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, &_textures_0bSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osPiStartDma(&sp30, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) &_textures_0bSegmentRomStart[SEGMENT_OFFSET(arg0)], vaddr, nbytes, &gDmaMesgQueue);
osRecvMesg(&gDmaMesgQueue, &sp2C, OS_MESG_BLOCK);
}
@@ -4564,8 +4568,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B538.s")
#endif
s32 func_8009B8C4(u64 *arg0) {
s32 stackPadding1;
s32 stackPadding2;
UNUSED s32 pad[2];
s32 sp4;
s32 found;
s32 someIndex;
@@ -4589,7 +4592,7 @@ s32 func_8009B8C4(u64 *arg0) {
// struct_8018EE10_entry pointer. But here its being treated as a
// Gfx pointer. It seems to be multi use.
void func_8009B938(void) {
D_8018E75C = D_8018D9C0;
D_8018E75C = (Gfx *) D_8018D9C0;
gNumD_8018E768Entries = 0;
}
@@ -4610,7 +4613,7 @@ void func_8009B998(void) {
// as the return of this function. Which seems like a bug to me
Gfx *func_8009B9D0(Gfx *displayListHead, MkTexture *textures) {
Gfx *displayList;
s32 pad;
UNUSED s32 pad;
s32 found;
s32 index;
@@ -7949,7 +7952,7 @@ void func_800A09E0(struct_8018D9E0_entry *arg0) {
if ((D_800E86D0[0] != 0) || ((table_row != 0) && (table_row != 8)))
{
y = (table_row * 0xA) + arg0->row;
gDisplayListHead = func_8009BA74(gDisplayListHead, &D_0200157C, x, y);
gDisplayListHead = func_8009BA74(gDisplayListHead, D_0200157C, x, y);
}
}
}
@@ -7957,14 +7960,14 @@ void func_800A09E0(struct_8018D9E0_entry *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A09E0.s")
#endif
void func_800A0AD0(UNUSED struct_8018D9E0_entry *unused) {
void func_800A0AD0(UNUSED struct_8018D9E0_entry *arg0) {
struct_8018D9E0_entry *temp_t1;
// Find struct_8018D9E0_entry with a type/id of 0xDA
temp_t1 = find_8018D9E0_entry_dupe(0xDA);
if ((gControllerPakMenuSelection != CONTROLLER_PAK_MENU_SELECT_RECORD) && (gControllerPakMenuSelection != CONTROLLER_PAK_MENU_END))
{
gDPSetPrimColor(gDisplayListHead++, 0, 0, 0xFF, temp_t1->unk20, 0x00, 0xFF);
gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02001874, 0x24, (gControllerPakSelectedTableRow * 0xA) + 0x7C);
gDisplayListHead = func_8009BA74(gDisplayListHead, D_02001874, 0x24, (gControllerPakSelectedTableRow * 0xA) + 0x7C);
}
}
@@ -8364,7 +8367,7 @@ 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) {
gDisplayListHead = func_800959A0(gDisplayListHead, 0x57, 0x84, 0x96, 0x95);
gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02004A0C, 0x57, 0x84);
gDisplayListHead = func_8009BA74(gDisplayListHead, D_02004A0C, 0x57, 0x84);
}
func_8004EF9C(gCupCourseOrder[gTimeTrialDataCourseIndex / 4][gTimeTrialDataCourseIndex % 4]);
do {
@@ -8382,7 +8385,7 @@ void func_800A1A20(struct_8018D9E0_entry *arg0) {
set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1);
draw_text(0x69, arg0->row + 0x19, D_800E7574[courseId], 0, 0.75f, 0.75f);
set_text_color(TEXT_RED);
func_80093324(0x2D, arg0->row + 0x28, &D_800E77D8, 0, 0.75f, 0.75f);
func_80093324(0x2D, arg0->row + 0x28, (char *)&D_800E77D8, 0, 0.75f, 0.75f);
func_800936B8(0xA5, arg0->row + 0x28, D_800E77E4[courseId], 1, 0.75f, 0.75f);
set_text_color(TEXT_YELLOW);
func_80093324(0xA0, arg0->row + 0x86, D_800E7728, 0, 0.75f, 0.75f);
@@ -12135,7 +12138,7 @@ void func_800A8CA4(struct_8018D9E0_entry *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8CA4.s")
#endif
void func_800A8E14(UNUSED struct_8018D9E0_entry *unused) {
void func_800A8E14(UNUSED struct_8018D9E0_entry *arg0) {
set_text_color(TEXT_YELLOW);
draw_text(0x98, 0x44, D_800E77A8, 0, 1.0f, 1.0f);
func_80093324(0x17, 0x58, D_800E77AC, 0, D_800F24A8, D_800F24AC);
@@ -12201,7 +12204,7 @@ void func_800A8F48(struct_8018D9E0_entry *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8F48.s")
#endif
void func_800A90D4(s32 arg0, struct_8018D9E0_entry *arg1) {
void func_800A90D4(UNUSED s32 arg0, struct_8018D9E0_entry *arg1) {
s32 temp_a2;
s32 temp_t1;
s32 temp_t7;