Fix startup race condition

This commit is contained in:
Mr-Wiseguy
2025-02-18 17:13:15 -05:00
parent 6d21c8ae17
commit 1375500e28
5 changed files with 31 additions and 15 deletions
-7
View File
@@ -2,9 +2,6 @@
#include "overlay_loading.h"
#include "misc_funcs.h"
// Forced .data to make patches.bin not be empty.
__attribute__((used)) int x = 4;
struct Overlay {
void *start;
void *end;
@@ -176,10 +173,6 @@ RECOMP_PATCH void ucode_load(void) {
}
}
// @recomp Stub this out
RECOMP_PATCH void func_80247380(void){
}
typedef struct Animation_s Animation;
typedef struct animctrl_s{
+8 -7
View File
@@ -10,18 +10,19 @@
__attribute__((noinline, weak, used, section(".recomp_event"))) void func {} \
_Pragma("GCC diagnostic pop")
#include "n64_types.h"
#define osInvalDCache osInvalDCache_recomp
#define osInvalICache osInvalICache_recomp
#define osWritebackDCache osWritebackDCache_recomp
#define osWriteBackDCacheAll osWritebackDCacheAll_recomp
#define bzero bzero_recomp
void osInvalDCache(void *, s32);
void osInvalICache(void *, s32);
void osWritebackDCache(void *, s32);
#define osSendMesg osSendMesg_recomp
#define osRecvMesg osRecvMesg_recomp
#define osGetCount osGetCount_recomp
#define osCreateMesgQueue osCreateMesgQueue_recomp
void osWriteBackDCacheAll(void);
void bzero(void *, int);
#define bzero bzero_recomp
#define osDpSetStatus osDpSetStatus_recomp
#include "ultra64.h"
typedef int bool;
+17
View File
@@ -0,0 +1,17 @@
#include "patches.h"
extern OSMesgQueue sMesgQueue2;
// @recomp Clear the RDP freeze bit here to prevent a race condition.
// TODO look into why this is needed.
RECOMP_PATCH void viMgr_func_8024BFAC(void){
osSendMesg(&sMesgQueue2, 0, OS_MESG_NOBLOCK);
// @recomp Clear the freeze bit.
osDpSetStatus(DPC_CLR_FREEZE);
}
// @recomp Remove the original functionality.
RECOMP_PATCH void func_80247380(void){
}
+5
View File
@@ -10,3 +10,8 @@ osWritebackDCache_recomp = 0x8F000014;
osWritebackDCacheAll_recomp = 0x8F000018;
bzero_recomp = 0x8F00001C;
recomp_load_overlays_by_rom = 0x8F000020;
osSendMesg_recomp = 0x8F000024;
osGetCount_recomp = 0x8F000028;
osCreateMesgQueue_recomp = 0x8F00002C;
osRecvMesg_recomp = 0x8F000030;
osDpSetStatus_recomp = 0x8F000034;