diff --git a/Makefile b/Makefile index b23aa45c..9213b972 100755 --- a/Makefile +++ b/Makefile @@ -177,6 +177,7 @@ $(BUILD_DIR)/lib/src/osSetTimer.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osTimer.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osViBlack.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osViSwapBuffer.o : OPT_FLAGS := -O1 +$(BUILD_DIR)/lib/src/unknown_0C91A0.o : OPT_FLAGS := -O1 ######################## Targets ############################# diff --git a/lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s b/lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s index 2c7d89a6..205807c6 100644 --- a/lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s +++ b/lib/asm/non_matchings/osSetTime_0CDE60/osSetTime.s @@ -2,9 +2,9 @@ glabel osSetTime /* 0CDE60 800CD260 AFA40000 */ sw $a0, ($sp) /* 0CDE64 800CD264 8FAE0000 */ lw $t6, ($sp) /* 0CDE68 800CD268 AFA50004 */ sw $a1, 4($sp) -/* 0CDE6C 800CD26C 3C018013 */ lui $at, %hi(D_8012D220) # $at, 0x8013 +/* 0CDE6C 800CD26C 3C018013 */ lui $at, %hi(__osCurrentTime) # $at, 0x8013 /* 0CDE70 800CD270 8FAF0004 */ lw $t7, 4($sp) -/* 0CDE74 800CD274 AC2ED220 */ sw $t6, %lo(D_8012D220)($at) +/* 0CDE74 800CD274 AC2ED220 */ sw $t6, %lo(__osCurrentTime)($at) /* 0CDE78 800CD278 3C018013 */ lui $at, 0x8013 /* 0CDE7C 800CD27C 03E00008 */ jr $ra /* 0CDE80 800CD280 AC2FD224 */ sw $t7, -0x2ddc($at) diff --git a/lib/asm/non_matchings/unknown_0C91A0/osCreateMesgQueue.s b/lib/asm/non_matchings/unknown_0C91A0/osCreateMesgQueue.s deleted file mode 100644 index 224b900c..00000000 --- a/lib/asm/non_matchings/unknown_0C91A0/osCreateMesgQueue.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel osCreateMesgQueue -/* 0C9420 800C8820 3C0E800E */ lui $t6, %hi(D_800E4880) # $t6, 0x800e -/* 0C9424 800C8824 3C0F800E */ lui $t7, %hi(D_800E4880) # $t7, 0x800e -/* 0C9428 800C8828 25CE4880 */ addiu $t6, %lo(D_800E4880) # addiu $t6, $t6, 0x4880 -/* 0C942C 800C882C 25EF4880 */ addiu $t7, %lo(D_800E4880) # addiu $t7, $t7, 0x4880 -/* 0C9430 800C8830 AC8E0000 */ sw $t6, ($a0) -/* 0C9434 800C8834 AC8F0004 */ sw $t7, 4($a0) -/* 0C9438 800C8838 AC800008 */ sw $zero, 8($a0) -/* 0C943C 800C883C AC80000C */ sw $zero, 0xc($a0) -/* 0C9440 800C8840 AC860010 */ sw $a2, 0x10($a0) -/* 0C9444 800C8844 03E00008 */ jr $ra -/* 0C9448 800C8848 AC850014 */ sw $a1, 0x14($a0) - -/* 0C944C 800C884C 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0D2590/viMgrMain.s b/lib/asm/non_matchings/unknown_0D2590/viMgrMain.s index 34ef350b..7c902d6c 100644 --- a/lib/asm/non_matchings/unknown_0D2590/viMgrMain.s +++ b/lib/asm/non_matchings/unknown_0D2590/viMgrMain.s @@ -22,10 +22,10 @@ glabel viMgrMain /* 0D2758 800D1B58 A423D190 */ sh $v1, %lo(D_8012D190)($at) .L800D1B5C: /* 0D275C 800D1B5C 3C138013 */ lui $s3, %hi(D_8012D22C) # $s3, 0x8013 -/* 0D2760 800D1B60 3C128013 */ lui $s2, %hi(D_8012D228) # $s2, 0x8013 -/* 0D2764 800D1B64 3C118013 */ lui $s1, %hi(D_8012D220) # $s1, 0x8013 -/* 0D2768 800D1B68 2631D220 */ addiu $s1, %lo(D_8012D220) # addiu $s1, $s1, -0x2de0 -/* 0D276C 800D1B6C 2652D228 */ addiu $s2, %lo(D_8012D228) # addiu $s2, $s2, -0x2dd8 +/* 0D2760 800D1B60 3C128013 */ lui $s2, %hi(__osBaseCounter) # $s2, 0x8013 +/* 0D2764 800D1B64 3C118013 */ lui $s1, %hi(__osCurrentTime) # $s1, 0x8013 +/* 0D2768 800D1B68 2631D220 */ addiu $s1, %lo(__osCurrentTime) # addiu $s1, $s1, -0x2de0 +/* 0D276C 800D1B6C 2652D228 */ addiu $s2, %lo(__osBaseCounter) # addiu $s2, $s2, -0x2dd8 /* 0D2770 800D1B70 2673D22C */ addiu $s3, %lo(D_8012D22C) # addiu $s3, $s3, -0x2dd4 /* 0D2774 800D1B74 2415000D */ li $s5, 13 /* 0D2778 800D1B78 27B40044 */ addiu $s4, $sp, 0x44 diff --git a/lib/asm/non_matchings/unknown_0D29F0/osGetTime.s b/lib/asm/non_matchings/unknown_0D29F0/osGetTime.s deleted file mode 100644 index be636839..00000000 --- a/lib/asm/non_matchings/unknown_0D29F0/osGetTime.s +++ /dev/null @@ -1,39 +0,0 @@ -glabel osGetTime -/* 0D2DB0 800D21B0 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 0D2DB4 800D21B4 AFBF001C */ sw $ra, 0x1c($sp) -/* 0D2DB8 800D21B8 0C034958 */ jal __osDisableInt -/* 0D2DBC 800D21BC AFB00018 */ sw $s0, 0x18($sp) -/* 0D2DC0 800D21C0 0C031E34 */ jal osGetCount -/* 0D2DC4 800D21C4 00408025 */ move $s0, $v0 -/* 0D2DC8 800D21C8 AFA20034 */ sw $v0, 0x34($sp) -/* 0D2DCC 800D21CC 3C0F8013 */ lui $t7, %hi(D_8012D228) # $t7, 0x8013 -/* 0D2DD0 800D21D0 8DEFD228 */ lw $t7, %lo(D_8012D228)($t7) -/* 0D2DD4 800D21D4 8FAE0034 */ lw $t6, 0x34($sp) -/* 0D2DD8 800D21D8 3C088013 */ lui $t0, %hi(D_8012D220) # $t0, 0x8013 -/* 0D2DDC 800D21DC 3C098013 */ lui $t1, %hi(D_8012D224) # $t1, 0x8013 -/* 0D2DE0 800D21E0 8D29D224 */ lw $t1, %lo(D_8012D224)($t1) -/* 0D2DE4 800D21E4 8D08D220 */ lw $t0, %lo(D_8012D220)($t0) -/* 0D2DE8 800D21E8 01CFC023 */ subu $t8, $t6, $t7 -/* 0D2DEC 800D21EC AFB80030 */ sw $t8, 0x30($sp) -/* 0D2DF0 800D21F0 02002025 */ move $a0, $s0 -/* 0D2DF4 800D21F4 AFA9002C */ sw $t1, 0x2c($sp) -/* 0D2DF8 800D21F8 0C034960 */ jal __osRestoreInt -/* 0D2DFC 800D21FC AFA80028 */ sw $t0, 0x28($sp) -/* 0D2E00 800D2200 8FB90030 */ lw $t9, 0x30($sp) -/* 0D2E04 800D2204 8FAD002C */ lw $t5, 0x2c($sp) -/* 0D2E08 800D2208 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D2E0C 800D220C 03205825 */ move $t3, $t9 -/* 0D2E10 800D2210 016D1821 */ addu $v1, $t3, $t5 -/* 0D2E14 800D2214 8FAC0028 */ lw $t4, 0x28($sp) -/* 0D2E18 800D2218 240A0000 */ li $t2, 0 -/* 0D2E1C 800D221C 006D082B */ sltu $at, $v1, $t5 -/* 0D2E20 800D2220 002A1021 */ addu $v0, $at, $t2 -/* 0D2E24 800D2224 8FB00018 */ lw $s0, 0x18($sp) -/* 0D2E28 800D2228 27BD0038 */ addiu $sp, $sp, 0x38 -/* 0D2E2C 800D222C 03E00008 */ jr $ra -/* 0D2E30 800D2230 004C1021 */ addu $v0, $v0, $t4 - -/* 0D2E34 800D2234 00000000 */ nop -/* 0D2E38 800D2238 00000000 */ nop -/* 0D2E3C 800D223C 00000000 */ nop - diff --git a/lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s b/lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s index 060b944b..7795e85c 100644 --- a/lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s +++ b/lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s @@ -1,13 +1,13 @@ glabel __osTimerServicesInit -/* 0D5AC0 800D4EC0 3C018013 */ lui $at, %hi(D_8012D220) # $at, 0x8013 +/* 0D5AC0 800D4EC0 3C018013 */ lui $at, %hi(__osCurrentTime) # $at, 0x8013 /* 0D5AC4 800D4EC4 240E0000 */ li $t6, 0 /* 0D5AC8 800D4EC8 240F0000 */ li $t7, 0 /* 0D5ACC 800D4ECC AC2FD224 */ sw $t7, %lo(D_8012D224)($at) -/* 0D5AD0 800D4ED0 AC2ED220 */ sw $t6, %lo(D_8012D220)($at) -/* 0D5AD4 800D4ED4 3C018013 */ lui $at, %hi(D_8012D228) # $at, 0x8013 +/* 0D5AD0 800D4ED0 AC2ED220 */ sw $t6, %lo(__osCurrentTime)($at) +/* 0D5AD4 800D4ED4 3C018013 */ lui $at, %hi(__osBaseCounter) # $at, 0x8013 /* 0D5AD8 800D4ED8 3C18800E */ lui $t8, %hi(D_800E4910) # $t8, 0x800e /* 0D5ADC 800D4EDC 8F184910 */ lw $t8, %lo(D_800E4910)($t8) -/* 0D5AE0 800D4EE0 AC20D228 */ sw $zero, %lo(D_8012D228)($at) +/* 0D5AE0 800D4EE0 AC20D228 */ sw $zero, %lo(__osBaseCounter)($at) /* 0D5AE4 800D4EE4 3C018013 */ lui $at, %hi(D_8012D22C) # $at, 0x8013 /* 0D5AE8 800D4EE8 AC20D22C */ sw $zero, %lo(D_8012D22C)($at) /* 0D5AEC 800D4EEC 3C19800E */ lui $t9, %hi(D_800E4910) # $t9, 0x800e diff --git a/lib/src/osTimer.c b/lib/src/osTimer.c index 44af47eb..dc3937b5 100644 --- a/lib/src/osTimer.c +++ b/lib/src/osTimer.c @@ -5,8 +5,8 @@ #include "libultra_internal.h" extern OSTimer *D_800E4910; -extern OSTime D_8012D220; -extern u32 D_8012D228; +extern OSTime __osCurrentTime; +extern u32 __osBaseCounter; extern u32 D_8012D22C; extern u32 D_8012D230; @@ -17,8 +17,8 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/__osTimerServicesInit.s") /*void __osTimerServicesInit(void) { //D_8012D224 = 0; - D_8012D220 = 0; - D_8012D228 = 0; + __osCurrentTime = 0; + __osBaseCounter = 0; D_8012D22C = 0; D_800E4910->prev = D_800E4910; D_800E4910->next = D_800E4910->prev; diff --git a/lib/src/unknown_0C91A0.c b/lib/src/unknown_0C91A0.c index 593d5caf..093dd00f 100644 --- a/lib/src/unknown_0C91A0.c +++ b/lib/src/unknown_0C91A0.c @@ -1,6 +1,7 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800C85A0 */ +#include "libultra_internal.h" #include "types.h" #include "macros.h" @@ -11,4 +12,15 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/func_800C8760.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/func_800C8790.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/func_800C87B4.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/func_800C87EC.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/osCreateMesgQueue.s") +//GLOBAL_ASM("lib/asm/non_matchings/unknown_0C91A0/osCreateMesgQueue.s") + +extern OSThread D_800E4880; +void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msg, s32 msgCount) +{ + mq->mtqueue = (OSThread *)&D_800E4880; + mq->fullqueue = (OSThread *)&D_800E4880; + mq->validCount = 0; + mq->first = 0; + mq->msgCount = msgCount; + mq->msg = msg; +} \ No newline at end of file diff --git a/lib/src/unknown_0D29F0.c b/lib/src/unknown_0D29F0.c index e4e8aa06..750a4cfc 100644 --- a/lib/src/unknown_0D29F0.c +++ b/lib/src/unknown_0D29F0.c @@ -5,8 +5,8 @@ #include "macros.h" #include "libultra_internal.h" -extern OSTime D_8012D220;//__osCurrentTime -extern u32 D_8012D228; //__osBaseCounter +extern OSTime __osCurrentTime;//__osCurrentTime +extern u32 __osBaseCounter; //__osBaseCounter GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1DF0.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1E70.s") @@ -14,7 +14,6 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1EB0.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/_VirtualToPhysicalTask.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osSpTaskLoad.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osSpTaskStartGo.s") -//GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osGetTime.s") OSTime osGetTime() { @@ -24,8 +23,8 @@ OSTime osGetTime() register u32 saveMask; saveMask = __osDisableInt(); tmptime = osGetCount(); - elapseCount = tmptime - D_8012D228; - currentCount = D_8012D220; + elapseCount = tmptime - __osBaseCounter; + currentCount = __osCurrentTime; __osRestoreInt(saveMask); return currentCount + elapseCount; } diff --git a/undefined_syms.txt b/undefined_syms.txt index 8c1cd0d9..4e872a21 100755 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -2832,9 +2832,9 @@ D_8012D190 = 0x8012D190; D_8012D1A0 = 0x8012D1A0; D_8012D1E0 = 0x8012D1E0; D_8012D1E8 = 0x8012D1E8; -D_8012D220 = 0x8012D220; +__osCurrentTime = 0x8012D220; D_8012D224 = 0x8012D224; -D_8012D228 = 0x8012D228; +__osBaseCounter = 0x8012D228; D_8012D22C = 0x8012D22C; D_8012D230 = 0x8012D230; D_8012D240 = 0x8012D240;