diff --git a/Makefile b/Makefile index 4619ae08..2e2c281e 100755 --- a/Makefile +++ b/Makefile @@ -264,6 +264,8 @@ $(BUILD_DIR)/lib/src/printf.o : OPT_FLAGS := -O3 $(BUILD_DIR)/lib/src/unknown_0D29F0.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D3360.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/al/unknown_0C9C90.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 +#$(BUILD_DIR)/lib/src/libc/llcvt.o: OPT_FLAGS := +#$(BUILD_DIR)/lib/src/libc/llcvt.o: MIPSISET := -mips3 32 $(BUILD_DIR)/lib/%.o: MIPSISET := -mips2 $(BUILD_DIR)/lib/src/mips1/%.o: MIPSISET := -mips1 diff --git a/lib/asm/non_matchings/sched/func_80079818.s b/lib/asm/non_matchings/sched/func_80079818.s index 6762e0ac..2be643fd 100644 --- a/lib/asm/non_matchings/sched/func_80079818.s +++ b/lib/asm/non_matchings/sched/func_80079818.s @@ -71,7 +71,7 @@ glabel func_80079818 /* 07A518 80079918 AC20E758 */ sw $zero, %lo(D_800DE758)($at) /* 07A51C 8007991C 0C033490 */ jal __osSpSetStatus /* 07A520 80079920 3484AA82 */ ori $a0, (0x00AAAA82 & 0xFFFF) # ori $a0, $a0, 0xaa82 -/* 07A524 80079924 0C033494 */ jal func_800CD250 +/* 07A524 80079924 0C033494 */ jal osDpSetStatus /* 07A528 80079928 240401D6 */ li $a0, 470 /* 07A52C 8007992C 10000005 */ b .L80079944 /* 07A530 80079930 00000000 */ nop diff --git a/lib/asm/non_matchings/unknown_0CD820/func_800CD14C.s b/lib/asm/non_matchings/unknown_0CD820/__osPackReadData.s similarity index 99% rename from lib/asm/non_matchings/unknown_0CD820/func_800CD14C.s rename to lib/asm/non_matchings/unknown_0CD820/__osPackReadData.s index d31c9226..f5005ee2 100644 --- a/lib/asm/non_matchings/unknown_0CD820/func_800CD14C.s +++ b/lib/asm/non_matchings/unknown_0CD820/__osPackReadData.s @@ -1,4 +1,4 @@ -glabel func_800CD14C +glabel __osPackReadData /* 0CDD4C 800CD14C 27BDFFF0 */ addiu $sp, $sp, -0x10 /* 0CDD50 800CD150 3C0E8013 */ lui $t6, %hi(D_8012CD50) # $t6, 0x8013 /* 0CDD54 800CD154 25CECD50 */ addiu $t6, %lo(D_8012CD50) # addiu $t6, $t6, -0x32b0 diff --git a/lib/asm/non_matchings/unknown_0CD820/osContStartReadData.s b/lib/asm/non_matchings/unknown_0CD820/osContStartReadData.s index e0e68a7b..93432d31 100644 --- a/lib/asm/non_matchings/unknown_0CD820/osContStartReadData.s +++ b/lib/asm/non_matchings/unknown_0CD820/osContStartReadData.s @@ -9,7 +9,7 @@ glabel osContStartReadData /* 0CDBFC 800CCFFC 24010001 */ li $at, 1 /* 0CDC00 800CD000 11C1000C */ beq $t6, $at, .L800CD034 /* 0CDC04 800CD004 00000000 */ nop -/* 0CDC08 800CD008 0C033453 */ jal func_800CD14C +/* 0CDC08 800CD008 0C033453 */ jal __osPackReadData /* 0CDC0C 800CD00C 00000000 */ nop /* 0CDC10 800CD010 3C058013 */ lui $a1, %hi(D_8012CD50) # $a1, 0x8013 /* 0CDC14 800CD014 24A5CD50 */ addiu $a1, %lo(D_8012CD50) # addiu $a1, $a1, -0x32b0 diff --git a/lib/asm/non_matchings/unknown_0CDE50/func_800CD250.s b/lib/asm/non_matchings/unknown_0CDE50/func_800CD250.s deleted file mode 100644 index d287663a..00000000 --- a/lib/asm/non_matchings/unknown_0CDE50/func_800CD250.s +++ /dev/null @@ -1,7 +0,0 @@ -glabel func_800CD250 -/* 0CDE50 800CD250 3C0EA410 */ lui $t6, 0xa410 -/* 0CDE54 800CD254 03E00008 */ jr $ra -/* 0CDE58 800CD258 ADC4000C */ sw $a0, 0xc($t6) - -/* 0CDE5C 800CD25C 00000000 */ nop - diff --git a/lib/src/unknown_0CA530.c b/lib/src/al/global_asm/unknown_0CA530.c similarity index 69% rename from lib/src/unknown_0CA530.c rename to lib/src/al/global_asm/unknown_0CA530.c index 0c6bbb03..967c2c76 100644 --- a/lib/src/unknown_0CA530.c +++ b/lib/src/al/global_asm/unknown_0CA530.c @@ -6,5 +6,3 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/alSynFreeVoice.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/alCents2Ratio.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/osSetIntMask.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/sqrtf.s") diff --git a/lib/src/unknown_0CCF90.c b/lib/src/al/global_asm/unknown_0CCF90.c similarity index 100% rename from lib/src/unknown_0CCF90.c rename to lib/src/al/global_asm/unknown_0CCF90.c diff --git a/lib/src/gu/sqrtf.c b/lib/src/gu/sqrtf.c new file mode 100644 index 00000000..93e98c45 --- /dev/null +++ b/lib/src/gu/sqrtf.c @@ -0,0 +1,8 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C9AD0 */ + +#include "types.h" +#include "macros.h" + +//I don't believe it's possible to decomp this one +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/sqrtf.s") diff --git a/lib/src/libc/llcvt.c b/lib/src/libc/llcvt.c new file mode 100644 index 00000000..2564a703 --- /dev/null +++ b/lib/src/libc/llcvt.c @@ -0,0 +1,39 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C9B30 */ + +#if 1 +#include "types.h" +#include "macros.h" + +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__d_to_ll.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__f_to_ll.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__ll_to_f.s") + +#else +//This needs to be compiled with mips3, which isn't yet supported + +long long __d_to_ll(double d) { + return d; +} +long long __f_to_ll(float f) { + return f; +} +unsigned long long __d_to_ull(double d) { + return d; +} +unsigned long long __f_to_ull(float f) { + return f; +} +double __ll_to_d(long long s) { + return s; +} +float __ll_to_f(long long s) { + return s; +} +double __ull_to_d(unsigned long long u) { + return u; +} +float __ull_to_f(unsigned long long u) { + return u; +} +#endif diff --git a/lib/src/unknown_0CDE50.c b/lib/src/os/osDpSetStatus.c similarity index 50% rename from lib/src/unknown_0CDE50.c rename to lib/src/os/osDpSetStatus.c index f6f309c2..c14cb5a7 100644 --- a/lib/src/unknown_0CDE50.c +++ b/lib/src/os/osDpSetStatus.c @@ -1,7 +1,8 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800CD250 */ -#include "types.h" -#include "macros.h" +#include "libultra_internal.h" -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CDE50/func_800CD250.s") +void osDpSetStatus(u32 data) { + IO_WRITE(DPC_STATUS_REG, data); +} diff --git a/lib/src/os/osSetIntMask.c b/lib/src/os/osSetIntMask.c new file mode 100644 index 00000000..cbe2348f --- /dev/null +++ b/lib/src/os/osSetIntMask.c @@ -0,0 +1,8 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C9A30 */ + +#include "types.h" +#include "macros.h" + +//I don't believe it's possible to decomp this one +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA530/osSetIntMask.s") diff --git a/lib/src/unknown_0CD820.c b/lib/src/os/unknown_0CD820.c similarity index 92% rename from lib/src/unknown_0CD820.c rename to lib/src/os/unknown_0CD820.c index cc6a67ea..18cc8de8 100644 --- a/lib/src/unknown_0CD820.c +++ b/lib/src/os/unknown_0CD820.c @@ -29,4 +29,4 @@ GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/__osContGetInitData.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/__osPackRequestData.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/osContStartReadData.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/osContGetReadData.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/func_800CD14C.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0CD820/__osPackReadData.s") diff --git a/lib/src/unknown_0CA730.c b/lib/src/unknown_0CA730.c deleted file mode 100644 index 1d48aaaa..00000000 --- a/lib/src/unknown_0CA730.c +++ /dev/null @@ -1,9 +0,0 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800C9B30 */ - -#include "types.h" -#include "macros.h" - -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__d_to_ll.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__f_to_ll.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA730/__ll_to_f.s") diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index efa8ad91..cf52f2eb 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -792,7 +792,7 @@ void thread3_main(s32 arg0) { audioStopThread(); stop_thread30(); __osSpSetStatus(0xAAAA82); - func_800CD250(0x1D6); + osDpSetStatus(0x1D6); while(1); // Infinite loop } render(); diff --git a/tools/python/generate_ld.py b/tools/python/generate_ld.py index 22d72202..0b8c87d4 100644 --- a/tools/python/generate_ld.py +++ b/tools/python/generate_ld.py @@ -30,7 +30,7 @@ LATE_DATA_FILES = [ BSS_LIB_ORDER_FILES = [ BUILD_DIR + '/lib/src/os/osViMgr.o', BUILD_DIR + '/lib/src/os/osSetEventMesg.o', - BUILD_DIR + '/lib/src/unknown_0CD820.o', + BUILD_DIR + '/lib/src/os/unknown_0CD820.o', BUILD_DIR + '/lib/src/unknown_0CE200.o' ]