mirror of
https://github.com/n64decomp/mk64
synced 2026-08-04 00:49:03 -04:00
Match OS funcs (#152)
* Matched osSyncPrintf.c * Matched contramread.c * Matched contramwrite.c * Matched osPfsInit and osPfsGetStatus
This commit is contained in:
+7
-7
@@ -318,7 +318,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80091B78.s")
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
s32 func_800CE720(OSMesgQueue *, OSPfs *, ?); // extern
|
||||
s32 osPfsInit(OSMesgQueue *, OSPfs *, ?); // extern
|
||||
extern OSPfs D_8018E868;
|
||||
extern ? D_8018E938;
|
||||
extern ? D_8018EB38;
|
||||
@@ -347,7 +347,7 @@ extern OSMesgQueue gSIEventMesgQueue;
|
||||
}
|
||||
osPfsIsPlug(&gSIEventMesgQueue, &sp67);
|
||||
if ((sp67 & 1) != 0) {
|
||||
if (func_800CE720(&gSIEventMesgQueue, &D_8018E868, 0) != 0) {
|
||||
if (osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0) != 0) {
|
||||
return 0;
|
||||
}
|
||||
phi_s0 = 0;
|
||||
@@ -2010,7 +2010,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095AE0.s")
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
void *func_800959F8(void *, ? *, void *, s32); // extern
|
||||
? func_80095AE0(void *, s32, s32, s32, f32); // extern
|
||||
? func_800CF774(? *); // extern
|
||||
? rmonPrintf(? *); // extern
|
||||
extern ? D_02007BB8;
|
||||
extern ? D_02007CD8;
|
||||
extern ? D_02007DF8;
|
||||
@@ -2036,7 +2036,7 @@ void *func_80095BD0(void *arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32 arg5
|
||||
if (temp_v0 < 0x2F7) {
|
||||
sp28 = gGfxPool + (temp_v0 << 6) + 0xFAC0;
|
||||
if (temp_v0 < 0) {
|
||||
func_800CF774(&D_800F0BCC);
|
||||
rmonPrintf(&D_800F0BCC);
|
||||
}
|
||||
func_80095AE0(sp28, arg2, arg3, arg6, arg7);
|
||||
arg0->unk0 = 0x1020040;
|
||||
@@ -2080,7 +2080,7 @@ void *func_80095BD0(void *arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32 arg5
|
||||
}
|
||||
return func_800959F8(temp_s0 + 8, phi_a1, temp_s0, temp_a3);
|
||||
}
|
||||
func_800CF774(&D_800F0BEC);
|
||||
rmonPrintf(&D_800F0BEC);
|
||||
return arg0;
|
||||
}
|
||||
#else
|
||||
@@ -14323,7 +14323,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA280.s")
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909
|
||||
s32 check_for_controller_pak(?); /* extern */
|
||||
s32 func_800CE720(? *, ? *, ?); /* extern */
|
||||
s32 osPfsInit(? *, ? *, ?); /* extern */
|
||||
s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */
|
||||
s32 osPfsFreeBlocks(? *, s32 *); /* extern */
|
||||
s32 osPfsNumFiles(? *, s32 *, s32 *); /* extern */
|
||||
@@ -14380,7 +14380,7 @@ block_12:
|
||||
arg0->unk4 = 2;
|
||||
return;
|
||||
}
|
||||
temp_v0_3 = func_800CE720(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
if (temp_v0_3 != 0) {
|
||||
if (temp_v0_3 != 1) {
|
||||
if (temp_v0_3 != 4) {
|
||||
|
||||
+12
-12
@@ -2630,7 +2630,7 @@ s32 func_800B4520(void) {
|
||||
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit cc33060578851a93591ed035e96ffd1f15c765f1
|
||||
? func_800CF774(? *, s32); /* extern */
|
||||
? rmonPrintf(? *, s32); /* extern */
|
||||
extern ? D_800F2BE8;
|
||||
extern ? D_800F2BF8;
|
||||
extern ? D_800F2C0C;
|
||||
@@ -2643,9 +2643,9 @@ UNUSED void func_800B4560(s32 arg0, s32 arg1) {
|
||||
s32 sp18;
|
||||
|
||||
sp18 = D_8018D9C0;
|
||||
func_800CF774(&D_800F2BE8, D_80162DE0);
|
||||
func_800CF774(&D_800F2BF8, (s32) *(&D_8018EE16 + (arg0 << 7)));
|
||||
func_800CF774(&D_800F2C0C, (s32) ((arg1 << 7) + sp18)->unk6);
|
||||
rmonPrintf(&D_800F2BE8, D_80162DE0);
|
||||
rmonPrintf(&D_800F2BF8, (s32) *(&D_8018EE16 + (arg0 << 7)));
|
||||
rmonPrintf(&D_800F2C0C, (s32) ((arg1 << 7) + sp18)->unk6);
|
||||
}
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4560.s")
|
||||
@@ -3467,7 +3467,7 @@ s32 check_for_controller_pak(s32 controller) {
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
s32 check_for_controller_pak(s32); // extern
|
||||
s32 func_800CE720(? *, OSPfs *, ?); // extern
|
||||
s32 osPfsInit(? *, OSPfs *, ?); // extern
|
||||
extern u16 D_800E86F0;
|
||||
extern u32 D_800E86F4;
|
||||
extern s8 D_800E86F8;
|
||||
@@ -3512,7 +3512,7 @@ block_9:
|
||||
if (check_for_controller_pak(0) == 0) {
|
||||
return 1;
|
||||
}
|
||||
temp_v0_3 = func_800CE720(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
if (temp_v0_3 != 0) {
|
||||
if (temp_v0_3 != 1) {
|
||||
if (temp_v0_3 != 4) {
|
||||
@@ -3560,7 +3560,7 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B5B94.s")
|
||||
#ifdef MIPS_TO_C
|
||||
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
|
||||
s32 check_for_controller_pak(?); // extern
|
||||
s32 func_800CE720(? *, OSPfs *, ?); // extern
|
||||
s32 osPfsInit(? *, OSPfs *, ?); // extern
|
||||
extern u16 D_800E86F0;
|
||||
extern u32 D_800E86F4;
|
||||
extern s8 D_800E86FC;
|
||||
@@ -3602,7 +3602,7 @@ block_8:
|
||||
if (check_for_controller_pak(1) == 0) {
|
||||
return 1;
|
||||
}
|
||||
temp_v0_3 = func_800CE720(&gSIEventMesgQueue, &D_8018E8D0, 1);
|
||||
temp_v0_3 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1);
|
||||
if (temp_v0_3 != 0) {
|
||||
if (temp_v0_3 != 1) {
|
||||
if (temp_v0_3 != 4) {
|
||||
@@ -3649,7 +3649,7 @@ s32 func_800B5F30(void) {
|
||||
return -4;
|
||||
}
|
||||
if (check_for_controller_pak(0) != 0) {
|
||||
sp1C = func_800CE720(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
sp1C = osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0);
|
||||
if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) {
|
||||
D_800E86F8 = 0;
|
||||
return -2;
|
||||
@@ -3674,7 +3674,7 @@ s32 func_800B6014(void) {
|
||||
return -4;
|
||||
}
|
||||
if (check_for_controller_pak(1) != 0) {
|
||||
temp_v0 = func_800CE720(&gSIEventMesgQueue, &D_8018E8D0, 1);
|
||||
temp_v0 = osPfsInit(&gSIEventMesgQueue, &D_8018E8D0, 1);
|
||||
if (temp_v0 == 0) {
|
||||
D_800E86FC = 1;
|
||||
}
|
||||
@@ -4116,7 +4116,7 @@ s32 func_800B6A68(void) {
|
||||
//generated by mips_to_c commit cc33060578851a93591ed035e96ffd1f15c765f1
|
||||
s32 check_for_controller_pak(?); /* extern */
|
||||
? func_800B6A68(); /* extern */
|
||||
s32 func_800CE720(? *, ? *, ?); /* extern */
|
||||
s32 osPfsInit(? *, ? *, ?); /* extern */
|
||||
s32 osPfsFindFile(? *, u16, s32, ? *, ? *, ? *); /* extern */
|
||||
s32 osPfsFreeBlocks(? *, s32 *); /* extern */
|
||||
s32 osPfsNumFiles(? *, s32 *, s32 *); /* extern */
|
||||
@@ -4135,7 +4135,7 @@ extern ? gSIEventMesgQueue;
|
||||
UNUSED void func_800B6AF8(void) {
|
||||
s32 temp_t1;
|
||||
|
||||
if ((check_for_controller_pak(0) != 0) && (func_800CE720(&gSIEventMesgQueue, &D_8018E868, 0) == 0) && (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) != 0) && (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) == 0) && (D_8018EB7C < D_8018EB78) && (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) == 0)) {
|
||||
if ((check_for_controller_pak(0) != 0) && (osPfsInit(&gSIEventMesgQueue, &D_8018E868, 0) == 0) && (osPfsFindFile(&D_8018E868, D_800E86F0, D_800E86F4, &D_800F2E64, &D_800F2E74, &D_8018EB84) != 0) && (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) == 0) && (D_8018EB7C < D_8018EB78) && (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) == 0)) {
|
||||
temp_t1 = (s32) gControllerPakNumPagesFree >> 8;
|
||||
gControllerPakNumPagesFree = temp_t1;
|
||||
if (temp_t1 >= 0x79) {
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ void func_800CA330(s32);
|
||||
void func_800CA388(s32);
|
||||
|
||||
// os
|
||||
s32 func_800CE720(OSMesgQueue*, OSPfs*, s32);
|
||||
s32 osPfsInit(OSMesgQueue*, OSPfs*, s32);
|
||||
|
||||
// memory.c
|
||||
u32 func_802A7B70(u16);
|
||||
|
||||
+7
-12
@@ -2,11 +2,9 @@
|
||||
#include "PR/rcp.h"
|
||||
#include "controller.h"
|
||||
|
||||
extern s32 func_800CE7D4(OSMesgQueue *, s32);
|
||||
extern s32 __osPfsGetStatus(OSMesgQueue *, s32);
|
||||
void __osPackRamReadData(int channel, u16 address);
|
||||
|
||||
//u32 D_801965CC;
|
||||
|
||||
s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer) {
|
||||
s32 ret;
|
||||
int i;
|
||||
@@ -21,11 +19,12 @@ s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer) {
|
||||
__osPackRamReadData(channel, address);
|
||||
ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
for (i = 0; i < 16; i++) {
|
||||
__osPfsPifRam.ramarray[i] = 0xFF;
|
||||
}
|
||||
do {
|
||||
//D_801965CC = 0;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
__osPfsPifRam.ramarray[i] = 0xFF;
|
||||
}
|
||||
__osPfsPifRam.pifstatus = 0;
|
||||
ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
ptr = (u8 *)&__osPfsPifRam;
|
||||
@@ -40,7 +39,7 @@ s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer) {
|
||||
u8 c;
|
||||
c = __osContDataCrc((u8*)&ramreadformat.data);
|
||||
if (c != ramreadformat.datacrc) {
|
||||
ret = func_800CE7D4(mq, channel);
|
||||
ret = __osPfsGetStatus(mq, channel);
|
||||
if (ret != 0) {
|
||||
__osSiRelAccess();
|
||||
return ret;
|
||||
@@ -52,10 +51,6 @@ s32 __osContRamRead(OSMesgQueue *mq, int channel, u16 address, u8 *buffer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// diff here somewhere
|
||||
else {
|
||||
ret = 1/* PFS_ERR_NOPACK */;
|
||||
}
|
||||
if (ret != PFS_ERR_CONTRFAIL) {
|
||||
break;
|
||||
}
|
||||
|
||||
+6
-10
@@ -2,9 +2,8 @@
|
||||
#include "PR/rcp.h"
|
||||
#include "controller.h"
|
||||
|
||||
extern s32 func_800CE7D4(OSMesgQueue *, s32);
|
||||
extern s32 __osPfsGetStatus(OSMesgQueue *, s32);
|
||||
void __osPackRamWriteData(int channel, u16 address, u8 *buffer);
|
||||
//extern u32 D_801965CC;
|
||||
|
||||
s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int force) {
|
||||
s32 ret;
|
||||
@@ -24,11 +23,11 @@ s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int
|
||||
__osPackRamWriteData(channel, address, buffer);
|
||||
ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
for (i = 0; i < 16; i++) {
|
||||
__osPfsPifRam.ramarray[i] = 0xFF;
|
||||
}
|
||||
do {
|
||||
//D_801965CC = 0;
|
||||
for (i = 0; i < 16; i++) {
|
||||
__osPfsPifRam.ramarray[i] = 0xFF;
|
||||
}
|
||||
__osPfsPifRam.pifstatus = 0;
|
||||
ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
ptr = (u8 *)&__osPfsPifRam;
|
||||
@@ -43,16 +42,13 @@ s32 __osContRamWrite(OSMesgQueue *mq, int channel, u16 address, u8 *buffer, int
|
||||
ret = CHNL_ERR(ramreadformat);
|
||||
if (ret == 0) {
|
||||
if (__osContDataCrc(buffer) != ramreadformat.datacrc) {
|
||||
ret = func_800CE7D4(mq, channel);
|
||||
ret = __osPfsGetStatus(mq, channel);
|
||||
if (ret != 0) {
|
||||
__osSiRelAccess();
|
||||
return ret;
|
||||
}
|
||||
ret = PFS_ERR_CONTRFAIL;
|
||||
}
|
||||
// same diff as contramread
|
||||
} else {
|
||||
ret = PFS_ERR_NOPACK;
|
||||
}
|
||||
if (ret != PFS_ERR_CONTRFAIL) {
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "controller.h"
|
||||
|
||||
// osPfsInit
|
||||
s32 osPfsInit(OSMesgQueue *queue, OSPfs *pfs, int channel)
|
||||
{
|
||||
s32 ret;
|
||||
ret = 0;
|
||||
|
||||
__osSiGetAccess();
|
||||
ret = __osPfsGetStatus(queue, channel);
|
||||
__osSiRelAccess();
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
pfs->queue = queue;
|
||||
pfs->channel = channel;
|
||||
pfs->status = 0;
|
||||
ERRCK(__osGetId(pfs));
|
||||
|
||||
ret = osPfsChecker(pfs);
|
||||
pfs->status |= PFS_INITIALIZED;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// __osPfsGetStatus
|
||||
s32 __osPfsGetStatus(OSMesgQueue *queue, int channel)
|
||||
{
|
||||
s32 ret;
|
||||
OSMesg dummy;
|
||||
u8 pattern;
|
||||
OSContStatus data[MAXCONTROLLERS];
|
||||
|
||||
ret = 0;
|
||||
__osPfsRequestData(0);
|
||||
ret = __osSiRawStartDma(OS_WRITE, &__osPfsPifRam);
|
||||
osRecvMesg(queue, &dummy, OS_MESG_BLOCK);
|
||||
ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam);
|
||||
osRecvMesg(queue, &dummy, OS_MESG_BLOCK);
|
||||
__osPfsGetInitData(&pattern, &data);
|
||||
|
||||
if (((data[channel].status & CONT_CARD_ON) != 0) && ((data[channel].status & CONT_CARD_PULL) != 0))
|
||||
return PFS_ERR_NEW_PACK;
|
||||
if ((data[channel].errno != 0) || ((data[channel].status & CONT_CARD_ON) == 0))
|
||||
return PFS_ERR_NOPACK;
|
||||
if ((data[channel].status & CONT_ADDR_CRC_ER) != 0)
|
||||
return PFS_ERR_CONTRFAIL;
|
||||
return ret;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "libc/stdarg.h"
|
||||
|
||||
// neither function matches
|
||||
|
||||
void osSyncPrintf(const char *fmt, ...) {
|
||||
if (1);
|
||||
char *osSyncPrintf(char *arg0, const char *arg1, size_t size) {
|
||||
// ifdef'd formatting code?
|
||||
return (1);
|
||||
}
|
||||
|
||||
void func_800CF774(const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
_Printf(osSyncPrintf, 0, fmt, &args);
|
||||
void rmonPrintf(const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
_Printf(osSyncPrintf, NULL, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user