From eec03d0f574080d89d02550c956de47b8b9f9e7b Mon Sep 17 00:00:00 2001 From: Mittenshugg Date: Tue, 4 Aug 2020 14:10:36 -0500 Subject: [PATCH] c: osSetEventMesg --- Makefile | 1 + .../unknown_066AA0/func_8006A10C.s | 2 +- .../unknown_079F50/func_80079350.s | 6 ++-- asm/non_matchings/unknown_0AEE70/D_800B6FC4.s | 4 +-- .../unknown_0B8920/func_800C6000.s | 2 +- .../unknown_0B8920/osCreatePiManager.s | 2 +- lib/asm/exception/send_mesg.s | 4 +-- .../osSetEventMsg_0CD7B0/osSetEventMsg.s | 31 ---------------- .../unknown_0D2590/osCreateViManager.s | 4 +-- lib/src/osSetEventMesg.c | 23 ++++++++++++ lib/src/osSetEventMsg.c | 7 ---- lib/src/osSetTime.c | 7 +++- lib/src/unknown_0D3160.c | 36 ------------------- src/unknown_066AA0.c | 2 +- undefined_syms.txt | 2 +- 15 files changed, 44 insertions(+), 89 deletions(-) delete mode 100644 lib/asm/non_matchings/osSetEventMsg_0CD7B0/osSetEventMsg.s create mode 100644 lib/src/osSetEventMesg.c delete mode 100644 lib/src/osSetEventMsg.c diff --git a/Makefile b/Makefile index 4b241fb2..d7c2b148 100755 --- a/Makefile +++ b/Makefile @@ -185,6 +185,7 @@ $(BUILD_DIR)/lib/src/osPfsFreeBlocks.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osPiStartDma.o : OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osRecvMesg.o : OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osSendMesg.o : OPT_FLAGS := -O1 +$(BUILD_DIR)/lib/src/osSetEventMesg.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osSetTimer.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osStopThread.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osTimer.o: OPT_FLAGS := -O1 diff --git a/asm/non_matchings/unknown_066AA0/func_8006A10C.s b/asm/non_matchings/unknown_066AA0/func_8006A10C.s index 36a72fc9..64615811 100644 --- a/asm/non_matchings/unknown_066AA0/func_8006A10C.s +++ b/asm/non_matchings/unknown_066AA0/func_8006A10C.s @@ -11,7 +11,7 @@ glabel func_8006A10C /* 06AD30 8006A130 8CC610FC */ lw $a2, %lo(D_801210FC)($a2) /* 06AD34 8006A134 3C058012 */ lui $a1, %hi(D_801210E0) # $a1, 0x8012 /* 06AD38 8006A138 24A510E0 */ addiu $a1, %lo(D_801210E0) # addiu $a1, $a1, 0x10e0 -/* 06AD3C 8006A13C 0C0332EC */ jal osSetEventMsg +/* 06AD3C 8006A13C 0C0332EC */ jal osSetEventMesg /* 06AD40 8006A140 24040005 */ li $a0, 5 /* 06AD44 8006A144 3C048012 */ lui $a0, %hi(D_801210E0) # $a0, 0x8012 /* 06AD48 8006A148 3C068012 */ lui $a2, %hi(D_80121100) # $a2, 0x8012 diff --git a/asm/non_matchings/unknown_079F50/func_80079350.s b/asm/non_matchings/unknown_079F50/func_80079350.s index 1af277c3..2d3fa628 100644 --- a/asm/non_matchings/unknown_079F50/func_80079350.s +++ b/asm/non_matchings/unknown_079F50/func_80079350.s @@ -43,15 +43,15 @@ glabel func_80079350 /* 079FF4 800793F4 24060008 */ li $a2, 8 /* 079FF8 800793F8 24040004 */ li $a0, 4 /* 079FFC 800793FC 02202825 */ move $a1, $s1 -/* 07A000 80079400 0C0332EC */ jal osSetEventMsg +/* 07A000 80079400 0C0332EC */ jal osSetEventMesg /* 07A004 80079404 2406029B */ li $a2, 667 /* 07A008 80079408 24040009 */ li $a0, 9 /* 07A00C 8007940C 02202825 */ move $a1, $s1 -/* 07A010 80079410 0C0332EC */ jal osSetEventMsg +/* 07A010 80079410 0C0332EC */ jal osSetEventMesg /* 07A014 80079414 2406029C */ li $a2, 668 /* 07A018 80079418 2404000E */ li $a0, 14 /* 07A01C 8007941C 02202825 */ move $a1, $s1 -/* 07A020 80079420 0C0332EC */ jal osSetEventMsg +/* 07A020 80079420 0C0332EC */ jal osSetEventMesg /* 07A024 80079424 2406029D */ li $a2, 669 /* 07A028 80079428 93A6003B */ lbu $a2, 0x3b($sp) /* 07A02C 8007942C 02202025 */ move $a0, $s1 diff --git a/asm/non_matchings/unknown_0AEE70/D_800B6FC4.s b/asm/non_matchings/unknown_0AEE70/D_800B6FC4.s index d1a1b0c8..2028fed9 100644 --- a/asm/non_matchings/unknown_0AEE70/D_800B6FC4.s +++ b/asm/non_matchings/unknown_0AEE70/D_800B6FC4.s @@ -17,11 +17,11 @@ glabel D_800B6FC4 /* 0B7C00 800B7000 24060008 */ li $a2, 8 /* 0B7C04 800B7004 2404000C */ li $a0, 12 /* 0B7C08 800B7008 02802825 */ move $a1, $s4 -/* 0B7C0C 800B700C 0C0332EC */ jal osSetEventMsg +/* 0B7C0C 800B700C 0C0332EC */ jal osSetEventMesg /* 0B7C10 800B7010 24060008 */ li $a2, 8 /* 0B7C14 800B7014 2404000A */ li $a0, 10 /* 0B7C18 800B7018 02802825 */ move $a1, $s4 -/* 0B7C1C 800B701C 0C0332EC */ jal osSetEventMsg +/* 0B7C1C 800B701C 0C0332EC */ jal osSetEventMesg /* 0B7C20 800B7020 24060002 */ li $a2, 2 /* 0B7C24 800B7024 3C058013 */ lui $a1, %hi(D_801297E8) # $a1, 0x8013 /* 0B7C28 800B7028 3C068013 */ lui $a2, %hi(D_801297C8) # $a2, 0x8013 diff --git a/asm/non_matchings/unknown_0B8920/func_800C6000.s b/asm/non_matchings/unknown_0B8920/func_800C6000.s index 6b3d992e..d0ac521f 100644 --- a/asm/non_matchings/unknown_0B8920/func_800C6000.s +++ b/asm/non_matchings/unknown_0B8920/func_800C6000.s @@ -31,7 +31,7 @@ glabel osCreatePiManager /* 0C6C70 800C6070 3C062222 */ lui $a2, (0x22222222 >> 16) # lui $a2, 0x2222 /* 0C6C74 800C6074 34C62222 */ ori $a2, (0x22222222 & 0xFFFF) # ori $a2, $a2, 0x2222 /* 0C6C78 800C6078 24A5AAB0 */ addiu $a1, %lo(D_8012AAB0) # addiu $a1, $a1, -0x5550 -/* 0C6C7C 800C607C 0C0332EC */ jal osSetEventMsg +/* 0C6C7C 800C607C 0C0332EC */ jal osSetEventMesg /* 0C6C80 800C6080 24040008 */ li $a0, 8 /* 0C6C84 800C6084 2418FFFF */ li $t8, -1 /* 0C6C88 800C6088 AFB80028 */ sw $t8, 0x28($sp) diff --git a/asm/non_matchings/unknown_0B8920/osCreatePiManager.s b/asm/non_matchings/unknown_0B8920/osCreatePiManager.s index 6b3d992e..d0ac521f 100644 --- a/asm/non_matchings/unknown_0B8920/osCreatePiManager.s +++ b/asm/non_matchings/unknown_0B8920/osCreatePiManager.s @@ -31,7 +31,7 @@ glabel osCreatePiManager /* 0C6C70 800C6070 3C062222 */ lui $a2, (0x22222222 >> 16) # lui $a2, 0x2222 /* 0C6C74 800C6074 34C62222 */ ori $a2, (0x22222222 & 0xFFFF) # ori $a2, $a2, 0x2222 /* 0C6C78 800C6078 24A5AAB0 */ addiu $a1, %lo(D_8012AAB0) # addiu $a1, $a1, -0x5550 -/* 0C6C7C 800C607C 0C0332EC */ jal osSetEventMsg +/* 0C6C7C 800C607C 0C0332EC */ jal osSetEventMesg /* 0C6C80 800C6080 24040008 */ li $a0, 8 /* 0C6C84 800C6084 2418FFFF */ li $t8, -1 /* 0C6C88 800C6088 AFB80028 */ sw $t8, 0x28($sp) diff --git a/lib/asm/exception/send_mesg.s b/lib/asm/exception/send_mesg.s index c49361a8..e410fb4c 100644 --- a/lib/asm/exception/send_mesg.s +++ b/lib/asm/exception/send_mesg.s @@ -1,6 +1,6 @@ glabel send_mesg -/* 0D3DE4 800D31E4 3C0A8013 */ lui $t2, %hi(D_8012CCD0) # $t2, 0x8013 -/* 0D3DE8 800D31E8 254ACCD0 */ addiu $t2, %lo(D_8012CCD0) # addiu $t2, $t2, -0x3330 +/* 0D3DE4 800D31E4 3C0A8013 */ lui $t2, %hi(__osEventStateTab) # $t2, 0x8013 +/* 0D3DE8 800D31E8 254ACCD0 */ addiu $t2, %lo(__osEventStateTab) # addiu $t2, $t2, -0x3330 /* 0D3DEC 800D31EC 01445021 */ addu $t2, $t2, $a0 /* 0D3DF0 800D31F0 8D490000 */ lw $t1, ($t2) /* 0D3DF4 800D31F4 03E09025 */ move $s2, $ra diff --git a/lib/asm/non_matchings/osSetEventMsg_0CD7B0/osSetEventMsg.s b/lib/asm/non_matchings/osSetEventMsg_0CD7B0/osSetEventMsg.s deleted file mode 100644 index 8a2be78c..00000000 --- a/lib/asm/non_matchings/osSetEventMsg_0CD7B0/osSetEventMsg.s +++ /dev/null @@ -1,31 +0,0 @@ -glabel osSetEventMsg -/* 0CD7B0 800CCBB0 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 0CD7B4 800CCBB4 AFBF001C */ sw $ra, 0x1c($sp) -/* 0CD7B8 800CCBB8 AFA40028 */ sw $a0, 0x28($sp) -/* 0CD7BC 800CCBBC AFA5002C */ sw $a1, 0x2c($sp) -/* 0CD7C0 800CCBC0 AFA60030 */ sw $a2, 0x30($sp) -/* 0CD7C4 800CCBC4 0C034958 */ jal __osDisableInt -/* 0CD7C8 800CCBC8 AFB00018 */ sw $s0, 0x18($sp) -/* 0CD7CC 800CCBCC 8FAE0028 */ lw $t6, 0x28($sp) -/* 0CD7D0 800CCBD0 3C188013 */ lui $t8, %hi(D_8012CCD0) # $t8, 0x8013 -/* 0CD7D4 800CCBD4 8FA8002C */ lw $t0, 0x2c($sp) -/* 0CD7D8 800CCBD8 2718CCD0 */ addiu $t8, %lo(D_8012CCD0) # addiu $t8, $t8, -0x3330 -/* 0CD7DC 800CCBDC 000E78C0 */ sll $t7, $t6, 3 -/* 0CD7E0 800CCBE0 01F8C821 */ addu $t9, $t7, $t8 -/* 0CD7E4 800CCBE4 AFB90020 */ sw $t9, 0x20($sp) -/* 0CD7E8 800CCBE8 AF280000 */ sw $t0, ($t9) -/* 0CD7EC 800CCBEC 8FAA0020 */ lw $t2, 0x20($sp) -/* 0CD7F0 800CCBF0 8FA90030 */ lw $t1, 0x30($sp) -/* 0CD7F4 800CCBF4 00408025 */ move $s0, $v0 -/* 0CD7F8 800CCBF8 02002025 */ move $a0, $s0 -/* 0CD7FC 800CCBFC 0C034960 */ jal __osRestoreInt -/* 0CD800 800CCC00 AD490004 */ sw $t1, 4($t2) -/* 0CD804 800CCC04 8FBF001C */ lw $ra, 0x1c($sp) -/* 0CD808 800CCC08 8FB00018 */ lw $s0, 0x18($sp) -/* 0CD80C 800CCC0C 27BD0028 */ addiu $sp, $sp, 0x28 -/* 0CD810 800CCC10 03E00008 */ jr $ra -/* 0CD814 800CCC14 00000000 */ nop - -/* 0CD818 800CCC18 00000000 */ nop -/* 0CD81C 800CCC1C 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0D2590/osCreateViManager.s b/lib/asm/non_matchings/unknown_0D2590/osCreateViManager.s index ce503149..8fb6815d 100644 --- a/lib/asm/non_matchings/unknown_0D2590/osCreateViManager.s +++ b/lib/asm/non_matchings/unknown_0D2590/osCreateViManager.s @@ -30,13 +30,13 @@ glabel osCreateViManager /* 0D2600 800D1A00 A0E00002 */ sb $zero, 2($a3) /* 0D2604 800D1A04 ACE00004 */ sw $zero, 4($a3) /* 0D2608 800D1A08 24A5D130 */ addiu $a1, %lo(D_8012D130) # addiu $a1, $a1, -0x2ed0 -/* 0D260C 800D1A0C 0C0332EC */ jal osSetEventMsg +/* 0D260C 800D1A0C 0C0332EC */ jal osSetEventMesg /* 0D2610 800D1A10 24040007 */ li $a0, 7 /* 0D2614 800D1A14 3C078013 */ lui $a3, 0x8013 /* 0D2618 800D1A18 3C058013 */ lui $a1, %hi(D_8012D130) # $a1, 0x8013 /* 0D261C 800D1A1C 24E6D178 */ addiu $a2, $a3, -0x2e88 /* 0D2620 800D1A20 24A5D130 */ addiu $a1, %lo(D_8012D130) # addiu $a1, $a1, -0x2ed0 -/* 0D2624 800D1A24 0C0332EC */ jal osSetEventMsg +/* 0D2624 800D1A24 0C0332EC */ jal osSetEventMesg /* 0D2628 800D1A28 24040003 */ li $a0, 3 /* 0D262C 800D1A2C 2419FFFF */ li $t9, -1 /* 0D2630 800D1A30 AFB90028 */ sw $t9, 0x28($sp) diff --git a/lib/src/osSetEventMesg.c b/lib/src/osSetEventMesg.c new file mode 100644 index 00000000..347200fa --- /dev/null +++ b/lib/src/osSetEventMesg.c @@ -0,0 +1,23 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800CCBB0 */ + +#include "libultra_internal.h" + +typedef struct __OSEventState +{ + OSMesgQueue *messageQueue; + OSMesg message; +} __OSEventState; + + +__OSEventState __osEventStateTab[OS_NUM_EVENTS];//__osEventStateTab[OS_NUM_EVENTS]; +void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg) +{ + register u32 saveMask = __osDisableInt(); + __OSEventState *es; + + es = &__osEventStateTab[event]; + es->messageQueue = mq; + es->message = msg; + __osRestoreInt(saveMask); +} \ No newline at end of file diff --git a/lib/src/osSetEventMsg.c b/lib/src/osSetEventMsg.c deleted file mode 100644 index acf045bc..00000000 --- a/lib/src/osSetEventMsg.c +++ /dev/null @@ -1,7 +0,0 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800CCBB0 */ - -#include "types.h" -#include "macros.h" - -GLOBAL_ASM("lib/asm/non_matchings/osSetEventMsg_0CD7B0/osSetEventMsg.s") diff --git a/lib/src/osSetTime.c b/lib/src/osSetTime.c index a33ca664..ab1b7e63 100644 --- a/lib/src/osSetTime.c +++ b/lib/src/osSetTime.c @@ -3,5 +3,10 @@ #include "types.h" #include "macros.h" +#include "libultra_internal.h" -GLOBAL_ASM("lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s") +//GLOBAL_ASM("lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s") + +void osSetTime(OSTime time){ + __osCurrentTime = time; +} \ No newline at end of file diff --git a/lib/src/unknown_0D3160.c b/lib/src/unknown_0D3160.c index 05abd575..da6e3282 100644 --- a/lib/src/unknown_0D3160.c +++ b/lib/src/unknown_0D3160.c @@ -4,41 +4,6 @@ #include "types.h" #include "macros.h" -<<<<<<< HEAD -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDisableInt.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osRestoreInt.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D25A0.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D2680.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/D_800D2760.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osViInit.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D2C60.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDequeueThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osExceptionPreamble.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osException.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/send_mesg.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osEnqueueAndYield.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osEnqueueThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osPopThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osDispatchThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osCleanupThread.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osProbeTLB.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D3670.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osJamMesg.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osPiGetCmdQueue.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D3820.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/_Putfld.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/_Printf.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osGetSR.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSetFpcCsr.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSiRawReadIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osSiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osWritebackDCache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osWritebackICache.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osMapTLBRdb.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/osPiRawWriteIo.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D47F0.s") -======= GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/D_800D25A0.s") @@ -47,4 +12,3 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/D_800D2760.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osViInit.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/func_800D2C60.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDequeueThread.s") ->>>>>>> 1ea984894c2baacd9f5fc72c2f6b34bed05b3021 diff --git a/src/unknown_066AA0.c b/src/unknown_066AA0.c index fd9892b4..cfeb27fe 100644 --- a/src/unknown_066AA0.c +++ b/src/unknown_066AA0.c @@ -835,7 +835,7 @@ extern u8 D_80121103; s32 func_8006A10C(void) { u8 sp23; osCreateMesgQueue(&D_801210E0, &D_801210F8, 1); - osSetEventMsg(5, &D_801210E0, D_801210FC); + osSetEventMesg(5, &D_801210E0, D_801210FC); func_800CCC20(&D_801210E0, &sp23, &D_80121100); func_800CCFE0(&D_801210E0); func_8006A434(); diff --git a/undefined_syms.txt b/undefined_syms.txt index d67dbd55..b924450b 100755 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -2810,7 +2810,7 @@ D_8012AAF0 = 0x8012AAF0; D_8012ACA0 = 0x8012ACA0; D_8012ACB8 = 0x8012ACB8; D_8012CCC0 = 0x8012CCC0; -D_8012CCD0 = 0x8012CCD0; +__osEventStateTab = 0x8012CCD0; D_8012CD50 = 0x8012CD50; D_8012CD8C = 0x8012CD8C; D_8012CD90 = 0x8012CD90;