Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/src/func_802F4A20.c
7857 views
1
#include "new_func.h"
2
3
void func_802F4A20(void) {
4
__OSTranxInfo *sp1c;
5
volatile u32 sp18;
6
sp1c = &__osDiskHandle->transferInfo;
7
WAIT_ON_IOBUSY(sp18);
8
HW_REG(ASIC_BM_CTL, u32) = BUFFER_MANAGER_RESET | sp1c->bmCtlShadow; //should be unk10??
9
WAIT_ON_IOBUSY(sp18);
10
HW_REG(ASIC_BM_CTL, u32) = sp1c->bmCtlShadow;
11
func_802F4B08();
12
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
13
__OSGlobalIntMask |= 0x00100401; // TODO: fix magic numbers
14
}
15
16
typedef struct OSEventMessageStruct_0_s {
17
OSMesgQueue *queue;
18
OSMesg msg;
19
} OSEventMessageStruct_0;
20
21
extern OSEventMessageStruct_0 __osEventStateTab[16]; // should be OS_NUM_EVENTS + 1 I think
22
23
void func_802F4B08(void) {
24
OSEventMessageStruct_0 *sp2c;
25
OSMesgQueue *sp28;
26
u32 sp24;
27
register OSThread *s0;
28
sp2c = &__osEventStateTab[OS_EVENT_PI];
29
sp28 = sp2c->queue;
30
if (!sp28 || sp28->validCount >= sp28->msgCount) {
31
return;
32
}
33
sp24 = (sp28->first + sp28->validCount) % sp28->msgCount;
34
sp28->msg[sp24] = sp2c->msg;
35
sp28->validCount += 1;
36
if (sp28->mtqueue->next != NULL) {
37
s0 = __osPopThread(&sp28->mtqueue);
38
__osEnqueueThread(&D_80334898, s0);
39
}
40
}
41
42