correct more warnings

This commit is contained in:
tehzz 2022-12-29 22:25:52 -05:00
parent e9a53e84c8
commit c46072c585
10 changed files with 102 additions and 101 deletions

View File

@ -29,6 +29,8 @@
// global typings
typedef unsigned long uintptr_t;
#define INT2VOID(i) ((void *)(uintptr_t)(i))
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240

View File

@ -10,16 +10,6 @@ struct UnkStruct800006C4_2 {
s32 unk28;
};
struct UnkStruct800006C4_1 {
s16 sp20;
s8 sp22;
OSMesgQueue* sp24;
void* sp28;
s32 sp2C;
s32 sp30;
s32 unk34;
};
struct UnkStruct80000A80 {
LEOCmd cmd;
union {
@ -53,7 +43,7 @@ void *func_80000A3C(struct UnkStruct800006C4_2* arg0);
void *func_80000A80(struct UnkStruct80000A80* arg0);
void *func_80000AB0(struct UnkStruct80000A80* arg0);
void *func_80000AE0(struct UnkStruct80000A80* arg0);
s32 func_80000B10(struct UnkStruct80000A80* arg0);
void *func_80000B10(struct UnkStruct80000A80* arg0);
void *func_80000B74(struct UnkStruct80000A80* arg0);
void thread20_rsp(void *arg);
void rsp_init(void);

View File

@ -28,10 +28,10 @@ s32 func_8000A630(s32 arg0, void* arg1) {
u8 sp47;
u8 sp24[0x20];
s32 sp20 = 0;
u8 padding[8];
UNUSED u8 padding[8];
if ((func_8000AF40(arg0, arg1, 0, 0x20) == 0)
&& (func_8000AEBC(arg0, &sp24, 0, 0x20) == 0)
&& (func_8000AEBC(arg0, (uintptr_t)&sp24, 0, 0x20) == 0)
&& (bcmp(&sp24, arg1, 0x20) == 0)
&& (osGbpakGetStatus(&D_800A8100[arg0], &sp47) == 0))
{
@ -47,12 +47,12 @@ s32 func_8000A6D8(s32 arg0, u8* arg1) {
if (arg1 == NULL) {
arg1 = sp34;
}
HAL_Memset(arg1, 0x55, 0x20);
HAL_Memset((char *)arg1, 0x55, 0x20);
if (func_8000A630(arg0, arg1) != 0) {
HAL_Memset(arg1, 0xAA, 0x20);
HAL_Memset((char *)arg1, 0xAA, 0x20);
if (func_8000A630(arg0, arg1) != 0) {
s32 i;
for (i = 0; i < sizeof(sp34); i++) {
for (i = 0; i < ARRAY_COUNT(sp34); i++) {
arg1[i] = osGetCount();
}
var_s0 = func_8000A630(arg0, arg1);
@ -61,7 +61,7 @@ s32 func_8000A6D8(s32 arg0, u8* arg1) {
return var_s0;
}
s32 func_8000A798(s32 arg0, u8* arg1, s32 arg2) {
s32 func_8000A798(s32 arg0, u8 *arg1, u8 *arg2) {
u8 status;
OSGbpakId gbpakId;
s32 sp28 = 0;
@ -119,16 +119,16 @@ s32 func_8000A9D0(OSGbpakId* header) {
// is the cartridge non-Japanese?
if (header->country_code == 1) {
// Which supported POKeMON version is this?
if (HAL_Strcmp(header->game_title, "POKEMON RED") == 0) {
if (HAL_Strcmp((char *)header->game_title, "POKEMON RED") == 0) {
return 1;
}
if (HAL_Strcmp(header->game_title, "POKEMON GREEN") == 0) {
if (HAL_Strcmp((char *)header->game_title, "POKEMON GREEN") == 0) {
return 1;
}
if (HAL_Strcmp(header->game_title, "POKEMON BLUE") == 0) {
if (HAL_Strcmp((char *)header->game_title, "POKEMON BLUE") == 0) {
return 1;
}
if (HAL_Strcmp(header->game_title, "POKEMON YELLOW") == 0) {
if (HAL_Strcmp((char *)header->game_title, "POKEMON YELLOW") == 0) {
return 1;
}
}
@ -187,7 +187,7 @@ s32 func_8000AA7C(void) {
s32 func_8000AC7C(s32 arg0) {
u8 status;
s32 ret = osGbpakGetStatus(&D_800A8100[arg0], &status);
u8 filler;
UNUSED u8 filler;
// check the error code returned (if applicable) by the osGbpakGetStatus
// call.
@ -212,7 +212,7 @@ s32 func_8000ACF4(s32 arg0) {
}
s32 func_8000AD68(s32 arg0) {
u8 filler[4];
UNUSED u8 filler[4];
u8 status;
OSGbpakId sp28;
@ -235,7 +235,7 @@ s32 func_8000AE28(s32 arg0, void* arg1) {
s32 sp18;
sp18 = 0;
if ((func_8000AEBC(arg0, &sp1C, 0, 0x20) == 0) && (bcmp(&sp1C, arg1, 0x20) == 0)
if ((func_8000AEBC(arg0, (uintptr_t)&sp1C, 0, 0x20) == 0) && (bcmp(&sp1C, arg1, 0x20) == 0)
&& (osGbpakGetStatus(&D_800A8100[arg0], &status) == 0)
&& !(status & OS_GBPAK_RSTB_DETECTION)) {
sp18 = 1;
@ -258,7 +258,7 @@ s32 func_8000AF40(s32 arg0, void* arg1, u16 arg2, u16 arg3) {
var_v1 = 1;
if (D_800A82A5 & (1 << arg0)) {
var_v1 = func_8000DAFC(&D_800A8100[arg0], 1, arg2, arg1, arg3);
var_v1 = func_8000DAFC(&D_800A8100[arg0], 1, arg2, (uintptr_t)arg1, arg3);
}
return var_v1;
}

View File

@ -17,8 +17,8 @@ char* HAL_Strcpy(char* dest, char* src) {
* Alternate strcpy implementation; return the post-increment altered dest pointer.
*/
char* HAL_Strcpy2(char *dest, char* src) {
size_t c = strlen(dest); // this is completely pointless. the strlen func called
// doesnt alter the pointer.
UNUSED size_t c = strlen(dest); // this is completely pointless. the strlen func called
// doesnt alter the pointer.
while ((*(dest++) = *(src++)) != '\0') {
}
return dest;

View File

@ -20,7 +20,7 @@ u8 D_800818F8[0x8];
/**
* Initialize hardware, start main thread, then idle.
*/
void thread1_idle(void *arg0) {
void thread1_idle(UNUSED void *arg0) {
osCreateViManager(OS_PRIORITY_VIMGR);
func_80001474(0, 1);
osViBlack(TRUE);

View File

@ -67,7 +67,7 @@ void Memmap_SetSegments(Gfx** gfxDl) {
Gfx* gfx = *gfxDl;
for(i = 0; i < 16; i++) {
gSPSegment(gfx++, i, osVirtualToPhysical(gSegments[i].vaddr));
gSPSegment(gfx++, i, osVirtualToPhysical((void *)gSegments[i].vaddr));
}
*gfxDl = gfx;
}
@ -83,12 +83,12 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) {
u32 *relocDataP;
u32 relocSize;
struct RelocTable* relocInfo;
u32 relocOffset;
UNUSED u32 relocOffset;
u32 reloc;
u32 temp_v0_5;
u32 i;
u32 *regValP;
s32 pad;
UNUSED s32 pad;
relocOffset = fragment->relocOffset;
relocSize = fragment->sizeInRam - fragment->relocOffset;
@ -96,7 +96,7 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) {
osInvalICache(fragment, fragment->sizeInRam);
osInvalDCache(fragment, fragment->sizeInRam);
Memmap_SetFragmentMap(id, fragment, fragment->sizeInRam);
Memmap_SetFragmentMap(id, (uintptr_t)fragment, fragment->sizeInRam);
for(i = 0; i < relocInfo->nRelocations; i++) {
reloc = relocInfo->relocations[i];
@ -138,7 +138,7 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) {
}
}
if (relocSize != 0) {
bzero(((uintptr_t)fragment->relocOffset + (uintptr_t)fragment), relocSize);
bzero((void *)((uintptr_t)fragment->relocOffset + (uintptr_t)fragment), relocSize);
}
osWritebackDCache(fragment, fragment->sizeInRam);
}
@ -207,7 +207,7 @@ void Memmap_ClearFragmentMemmap(u32 id) {
*/
uintptr_t Memmap_GetLoadedFragmentVaddr(uintptr_t addr) {
struct MemoryMap* fraglist = gFragments;
int i, j;
int i, UNUSED j;
for(i = 0, fraglist = gFragments; i < 0xF0; i++, fraglist++) {
if (addr >= fraglist->vaddr) {

134
src/rsp.c
View File

@ -22,8 +22,8 @@ struct UnkStruct80083BD0 D_80083BD0;
s16 D_80083C1C;
s32 func_800005C0(void) {
s32 unused;
s32 unused2[6];
UNUSED s32 unused;
UNUSED s32 unused2[6];
s32 result;
result = LeoCJCreateLeoManager(0x95, 0x96, &D_80083B4C, 0x10);
@ -40,9 +40,9 @@ OSPiHandle* func_80000628(void) {
static OSPiHandle sramHandle;
void* baseAddr = OS_PHYSICAL_TO_K1(SRAM_START_ADDR);
if (baseAddr != (void*)sramHandle.baseAddress) {
if (baseAddr != (void *)(uintptr_t)sramHandle.baseAddress) {
sramHandle.type = DEVICE_TYPE_SRAM;
sramHandle.baseAddress = baseAddr;
sramHandle.baseAddress = (uintptr_t)baseAddr;
sramHandle.latency = SRAM_latency;
sramHandle.pulse = SRAM_pulse;
sramHandle.pageSize = SRAM_pageSize;
@ -57,87 +57,93 @@ OSPiHandle* func_80000628(void) {
}
s32 func_800006C4(struct UnkStruct800006C4_2* arg0) {
struct UnkStruct800006C4_1 unkStruct;
s32 unk1C = func_80000628();
OSIoMesg msg;
OSPiHandle *handle = func_80000628();
msg.hdr.pri = 0;
msg.hdr.retQueue = &D_80083BD0.queue2;
msg.dramAddr = arg0->vaddr;
msg.devAddr = arg0->unk1C;
msg.size = arg0->size;
unkStruct.sp22 = 0;
unkStruct.sp24 = &D_80083BD0.queue2;
unkStruct.sp28 = arg0->vaddr;
unkStruct.sp2C = arg0->unk1C;
unkStruct.sp30 = arg0->size;
osInvalDCache(arg0->vaddr, arg0->size);
osEPiStartDma(unk1C, &unkStruct.sp20, 0);
osEPiStartDma(handle, &msg, 0);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, 1);
return 0;
}
s32 func_8000074C(struct UnkStruct800006C4_2* arg0) {
struct UnkStruct800006C4_1 unkStruct;
s32 unk1C = func_80000628();
OSIoMesg msg;
OSPiHandle *handle = func_80000628();
msg.hdr.pri = 0;
msg.hdr.retQueue = &D_80083BD0.queue2;
msg.dramAddr = arg0->vaddr;
msg.devAddr = arg0->unk1C;
msg.size = arg0->size;
unkStruct.sp22 = 0;
unkStruct.sp24 = &D_80083BD0.queue2;
unkStruct.sp28 = arg0->vaddr;
unkStruct.sp2C = arg0->unk1C;
unkStruct.sp30 = arg0->size;
osWritebackDCache(arg0->vaddr, arg0->size);
osEPiStartDma(unk1C, &unkStruct.sp20, 1);
osEPiStartDma(handle, &msg, 1);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK);
return 0;
}
s32 func_800007D4(struct UnkStruct800006C4_2* arg0, s32 arg1) {
struct UnkStruct800006C4_1 unkStruct;
OSPiHandle* handle;
if(arg1 == 0) {
OSIoMesg msg;
OSPiHandle *handle;
if (arg1 == 0) {
handle = osCartRomInit();
} else {
handle = osDriveRomInit();
}
unkStruct.sp22 = 0;
unkStruct.sp24 = &D_80083BD0.queue2;
unkStruct.sp28 = arg0->vaddr;
unkStruct.sp2C = arg0->unk1C;
unkStruct.sp30 = arg0->size;
msg.hdr.pri = 0;
msg.hdr.retQueue = &D_80083BD0.queue2;
msg.dramAddr = arg0->vaddr;
msg.devAddr = arg0->unk1C;
msg.size = arg0->size;
osInvalDCache(arg0->vaddr, arg0->size);
osEPiStartDma(handle, &unkStruct.sp20, 0);
osEPiStartDma(handle, &msg, 0);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK);
return 0;
}
s32 func_8000087C(struct UnkStruct800006C4_2* arg0) {
struct UnkStruct800006C4_1 unkStruct;
OSPiHandle* handle;
OSIoMesg msg;
OSPiHandle *handle;
handle = osCartRomInit();
unkStruct.sp22 = 0;
unkStruct.sp24 = &D_80083BD0.queue2;
unkStruct.sp28 = arg0->vaddr;
unkStruct.sp2C = arg0->unk1C;
unkStruct.sp30 = arg0->size;
msg.hdr.pri = 0;
msg.hdr.retQueue = &D_80083BD0.queue2;
msg.dramAddr = arg0->vaddr;
msg.devAddr = arg0->unk1C;
msg.size = arg0->size;
osWritebackDCache(arg0->vaddr, arg0->size);
osEPiStartDma(handle, &unkStruct.sp20, 1);
osEPiStartDma(handle, &msg, 1);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK);
return 0;
}
s32 func_80000904(struct UnkStruct800006C4_2* arg0) {
s32 arr[5];
UNUSED s32 arr[5];
s32 sp20;
osInvalDCache(arg0->vaddr, 0x80);
func_8000D0B4(&sp20, 0, arg0->unk1C, arg0->vaddr, 1, &D_80083BD0.queue2);
func_8000D0B4((uintptr_t)&sp20, 0, arg0->unk1C, arg0->vaddr, 1, &D_80083BD0.queue2);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK);
return 0;
}
s32 func_80000974(struct UnkStruct800006C4_2* arg0) {
s32 arr[5];
UNUSED s32 arr[5];
s32 sp20_4;
s32 sp20_5;
UNUSED s32 sp20_5;
func_8000CEE4(&sp20_4, 0, arg0->vaddr, &D_80083BD0.queue2);
func_8000CEE4((uintptr_t)&sp20_4, 0, arg0->vaddr, &D_80083BD0.queue2);
osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK);
return 0;
}
@ -174,12 +180,12 @@ void *func_80000AE0(struct UnkStruct80000A80* arg0) {
return func_800009C8();
}
s32 func_80000B10(struct UnkStruct80000A80* arg0) {
s32 temp_v0;
void *func_80000B10(struct UnkStruct80000A80* arg0) {
void *temp_v0;
LeoReadRTC(&arg0->cmd, &D_80083BD0.queue2);
temp_v0 = func_800009C8();
if (temp_v0 == 0) {
if (temp_v0 == NULL) {
*(LEODiskTime*)arg0->addr = arg0->cmd.data.time;
}
return temp_v0;
@ -190,9 +196,9 @@ void *func_80000B74(struct UnkStruct80000A80* arg0) {
return func_800009C8();
}
void thread20_rsp(void *arg) {
void thread20_rsp(UNUSED void *arg) {
struct UnkStruct800006C4_2* sp2C;
void* var_v0;
OSMesg var_v0;
func_800005C0();
func_8000C8F8();
@ -200,31 +206,31 @@ void thread20_rsp(void *arg) {
osRecvMesg(&D_80083BD0.queue1, (void*)&sp2C, OS_MESG_BLOCK);
switch (sp2C->unk0) {
case 0xF0:
var_v0 = func_800007D4(sp2C, 0);
var_v0 = (OSMesg)INT2VOID(func_800007D4(sp2C, 0));
break;
case 0xF1:
var_v0 = func_800007D4(sp2C, 1);
var_v0 = (OSMesg)INT2VOID(func_800007D4(sp2C, 1));
break;
case 0xF2:
var_v0 = func_800006C4(sp2C);
var_v0 = (OSMesg)INT2VOID(func_800006C4(sp2C));
break;
case 0xF3:
var_v0 = func_8000074C(sp2C);
var_v0 = (OSMesg)INT2VOID(func_8000074C(sp2C));
break;
case 0xF4:
var_v0 = func_8000087C(sp2C);
var_v0 = (OSMesg)INT2VOID(func_8000087C(sp2C));
break;
case 0xF5:
var_v0 = func_80000904(sp2C);
var_v0 = (OSMesg)INT2VOID(func_80000904(sp2C));
break;
case 0xF6:
var_v0 = func_80000974(sp2C);
var_v0 = (OSMesg)INT2VOID(func_80000974(sp2C));
break;
case 0x5:
var_v0 = func_800009F8(sp2C);
var_v0 = (OSMesg)func_800009F8(sp2C);
break;
case 0x6:
var_v0 = func_80000A3C(sp2C);
var_v0 = (OSMesg)func_80000A3C(sp2C);
break;
case 0xC:
/*
@ -232,23 +238,23 @@ void thread20_rsp(void *arg) {
* there is very tenuous aliasing going on due to s16 and u8 overlap where
* there should be word loads. What is going on here?
*/
var_v0 = func_80000A80((struct UnkStruct80000A80 *)sp2C);
var_v0 = (OSMesg)func_80000A80((struct UnkStruct80000A80 *)sp2C);
break;
case 0x7:
var_v0 = func_80000AB0((struct UnkStruct80000A80 *)sp2C);
var_v0 = (OSMesg)func_80000AB0((struct UnkStruct80000A80 *)sp2C);
break;
case 0x8:
var_v0 = func_80000AE0((struct UnkStruct80000A80 *)sp2C);
var_v0 = (OSMesg)func_80000AE0((struct UnkStruct80000A80 *)sp2C);
break;
case 0xD:
var_v0 = func_80000B10((struct UnkStruct80000A80 *)sp2C);
var_v0 = (OSMesg)func_80000B10((struct UnkStruct80000A80 *)sp2C);
break;
case 0xE:
var_v0 = func_80000B74((struct UnkStruct80000A80 *)sp2C);
var_v0 = (OSMesg)func_80000B74((struct UnkStruct80000A80 *)sp2C);
break;
}
if ((OSMesgQueue*)sp2C->unk28 != NULL) {
osSendMesg(sp2C->unk28, var_v0, 0);
if ((OSMesgQueue *)INT2VOID(sp2C->unk28) != NULL) {
osSendMesg(INT2VOID(sp2C->unk28), var_v0, 0);
}
func_80003004(sp2C);
}
@ -257,7 +263,7 @@ void thread20_rsp(void *arg) {
void rsp_init(void) {
osCreateMesgQueue(&D_80083BD0.queue2, &D_80083BCC, 1);
osCreateMesgQueue(&D_80083BD0.queue1, &D_80083B8C, 16);
osCreatePiManager(0x96, &D_80083BD0.unk4, &gRspThreadStack[0x1C], 0x20);
osCreatePiManager(0x96, (void *)&D_80083BD0.unk4, (OSMesg)&gRspThreadStack[0x1C], 0x20);
osCreateThread(&gRspThread, 20, thread20_rsp, NULL, gRspThreadStack, 90);
osStartThread(&gRspThread);
}

View File

@ -1,4 +1,5 @@
#include <ultra64.h>
#include <macros.h>
// used for padding. Splat cant auto gen these I guess
static u8 unk_bss[0x800A7320-0x80083CA0];
UNUSED static u8 unk_bss[0x800A7320-0x80083CA0];

View File

@ -1,3 +1,4 @@
#include <ultra64.h>
#include <macros.h>
static u8 unk_bss[0x80103880-0x800A7EA0];
UNUSED static u8 unk_bss[0x80103880-0x800A7EA0];

View File

@ -1,4 +1,5 @@
#include <ultra64.h>
#include <macros.h>
// used for padding. Splat cant auto gen these I guess
static u8 unk_bss[0x800A74C0-0x800A7420];
UNUSED static u8 unk_bss[0x800A74C0-0x800A7420];