diff --git a/Makefile b/Makefile index cc2cf081..6cbd4f32 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ CC := ido/ido5.3_recomp/cc CPP := cpp GCC := $(CROSS)gcc AS := $(CROSS)as -LD := $(CROSS)ld -b elf32-tradbigmips +LD := LD_LIBRARY_PATH=../../papermario ../../papermario/mips-linux-gnu-ld.bfd -b elf32-tradbigmips OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy PYTHON := python3 @@ -316,7 +316,7 @@ $(DECOMPRESSED_BASEROM): $(BASEROM) $(BK_ROM_DECOMPRESS) # .o -> .elf (dummy symbols) $(PRELIM_ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T undefined_syms_auto.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T rzip_dummy_addrs.txt -o $@ + @$(LD) $(LDFLAGS) -T rzip_dummy_addrs.txt -o $@ # .elf -> .z64 (dummy symbols) $(PRELIM_Z64) : $(PRELIM_ELF) @@ -330,7 +330,7 @@ $(COMPRESSED_SYMBOLS): $(PRELIM_ELF) $(PRELIM_Z64) $(BK_ROM_COMPRESS) # .o -> .elf (game) $(ELF): $(ALL_OBJS) $(LD_SCRIPT) $(ASSET_OBJS) $(COMPRESSED_SYMBOLS) $(call print1,Linking elf:,$@) - @$(LD) $(LDFLAGS) -T undefined_syms_auto.$(VERSION).txt -T undefined_syms.$(VERSION).txt -T $(COMPRESSED_SYMBOLS) -o $@ + @$(LD) $(LDFLAGS) -T $(COMPRESSED_SYMBOLS) -o $@ # .elf -> .z64 (uncompressed) $(UNCOMPRESSED_Z64) : $(ELF) @@ -361,7 +361,6 @@ clean: @$(RM) -rf $(addprefix $(ASM_ROOT)/,$(filter-out core1,$(OVERLAYS))) @$(RM) -rf $(ASM_ROOT)/core1/*.s @$(RM) -rf $(ASM_ROOT)/core1/os - @$(RM) -f undefined_syms_auto* undefined_funcs_auto* @$(RM) -f *.ld # Per-file flag definitions diff --git a/asm/core1/ultra/exceptasm.s b/asm/core1/ultra/exceptasm.s index 6620a849..6048455b 100644 --- a/asm/core1/ultra/exceptasm.s +++ b/asm/core1/ultra/exceptasm.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" /* assembler directives */ @@ -59,6 +60,8 @@ __osIntTable: .section .text, "ax" +/* Generated by spimdisasm 1.24.3 */ + # Handwritten function glabel func_8026A2E0 /* F45B10 8026A2E0 3C1A8027 */ lui $k0, %hi(D_8026A300) @@ -141,8 +144,8 @@ D_8026A300: /* F45C40 8026A410 0369D825 */ or $k1, $k1, $t1 /* F45C44 8026A414 AF5B0118 */ sw $k1, 0x118($k0) .L8026A418: -/* F45C48 8026A418 3C09A430 */ lui $t1, %hi(D_A430000C) -/* F45C4C 8026A41C 8D29000C */ lw $t1, %lo(D_A430000C)($t1) +/* F45C48 8026A418 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* F45C4C 8026A41C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) /* F45C50 8026A420 5120000C */ beql $t1, $zero, .L8026A454 /* F45C54 8026A424 AF490128 */ sw $t1, 0x128($k0) /* F45C58 8026A428 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) @@ -258,21 +261,21 @@ rcp: /* F45DE4 8026A5B4 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) /* F45DE8 8026A5B8 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* F45DEC 8026A5BC 8D080000 */ lw $t0, 0x0($t0) -/* F45DF0 8026A5C0 3C11A430 */ lui $s1, %hi(D_A4300008) -/* F45DF4 8026A5C4 8E310008 */ lw $s1, %lo(D_A4300008)($s1) +/* F45DF0 8026A5C0 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) +/* F45DF4 8026A5C4 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) /* F45DF8 8026A5C8 00084402 */ srl $t0, $t0, 16 /* F45DFC 8026A5CC 02288824 */ and $s1, $s1, $t0 /* F45E00 8026A5D0 32290001 */ andi $t1, $s1, 0x1 /* F45E04 8026A5D4 51200014 */ beql $t1, $zero, .L8026A628 /* F45E08 8026A5D8 32290008 */ andi $t1, $s1, 0x8 -/* F45E0C 8026A5DC 3C0CA404 */ lui $t4, %hi(D_A4040010) -/* F45E10 8026A5E0 8D8C0010 */ lw $t4, %lo(D_A4040010)($t4) +/* F45E0C 8026A5DC 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) +/* F45E10 8026A5E0 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) /* F45E14 8026A5E4 24090008 */ addiu $t1, $zero, 0x8 -/* F45E18 8026A5E8 3C01A404 */ lui $at, %hi(D_A4040010) +/* F45E18 8026A5E8 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) /* F45E1C 8026A5EC 318C0300 */ andi $t4, $t4, 0x300 /* F45E20 8026A5F0 3231003E */ andi $s1, $s1, 0x3E /* F45E24 8026A5F4 11800007 */ beqz $t4, .L8026A614 -/* F45E28 8026A5F8 AC290010 */ sw $t1, %lo(D_A4040010)($at) +/* F45E28 8026A5F8 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) /* F45E2C 8026A5FC 0C09AA09 */ jal func_8026A824 /* F45E30 8026A600 24040020 */ addiu $a0, $zero, 0x20 /* F45E34 8026A604 52200039 */ beql $s1, $zero, .L8026A6EC @@ -287,9 +290,9 @@ rcp: /* F45E54 8026A624 32290008 */ andi $t1, $s1, 0x8 .L8026A628: /* F45E58 8026A628 11200007 */ beqz $t1, .L8026A648 -/* F45E5C 8026A62C 3C01A440 */ lui $at, %hi(D_A4400010) +/* F45E5C 8026A62C 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) /* F45E60 8026A630 32310037 */ andi $s1, $s1, 0x37 -/* F45E64 8026A634 AC200010 */ sw $zero, %lo(D_A4400010)($at) +/* F45E64 8026A634 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) /* F45E68 8026A638 0C09AA09 */ jal func_8026A824 /* F45E6C 8026A63C 24040038 */ addiu $a0, $zero, 0x38 /* F45E70 8026A640 5220002A */ beql $s1, $zero, .L8026A6EC @@ -299,9 +302,9 @@ rcp: /* F45E7C 8026A64C 5120000A */ beql $t1, $zero, .L8026A678 /* F45E80 8026A650 32290002 */ andi $t1, $s1, 0x2 /* F45E84 8026A654 24090001 */ addiu $t1, $zero, 0x1 -/* F45E88 8026A658 3C01A450 */ lui $at, %hi(D_A450000C) +/* F45E88 8026A658 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) /* F45E8C 8026A65C 3231003B */ andi $s1, $s1, 0x3B -/* F45E90 8026A660 AC29000C */ sw $t1, %lo(D_A450000C)($at) +/* F45E90 8026A660 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) /* F45E94 8026A664 0C09AA09 */ jal func_8026A824 /* F45E98 8026A668 24040030 */ addiu $a0, $zero, 0x30 /* F45E9C 8026A66C 5220001F */ beql $s1, $zero, .L8026A6EC @@ -309,9 +312,9 @@ rcp: /* F45EA4 8026A674 32290002 */ andi $t1, $s1, 0x2 .L8026A678: /* F45EA8 8026A678 11200007 */ beqz $t1, .L8026A698 -/* F45EAC 8026A67C 3C01A480 */ lui $at, %hi(D_A4800018) +/* F45EAC 8026A67C 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) /* F45EB0 8026A680 3231003D */ andi $s1, $s1, 0x3D -/* F45EB4 8026A684 AC200018 */ sw $zero, %lo(D_A4800018)($at) +/* F45EB4 8026A684 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) /* F45EB8 8026A688 0C09AA09 */ jal func_8026A824 /* F45EBC 8026A68C 24040028 */ addiu $a0, $zero, 0x28 /* F45EC0 8026A690 52200016 */ beql $s1, $zero, .L8026A6EC @@ -321,9 +324,9 @@ rcp: /* F45ECC 8026A69C 5120000A */ beql $t1, $zero, .L8026A6C8 /* F45ED0 8026A6A0 32290020 */ andi $t1, $s1, 0x20 /* F45ED4 8026A6A4 24090002 */ addiu $t1, $zero, 0x2 -/* F45ED8 8026A6A8 3C01A460 */ lui $at, %hi(D_A4600010) +/* F45ED8 8026A6A8 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) /* F45EDC 8026A6AC 3231002F */ andi $s1, $s1, 0x2F -/* F45EE0 8026A6B0 AC290010 */ sw $t1, %lo(D_A4600010)($at) +/* F45EE0 8026A6B0 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) /* F45EE4 8026A6B4 0C09AA09 */ jal func_8026A824 /* F45EE8 8026A6B8 24040040 */ addiu $a0, $zero, 0x40 /* F45EEC 8026A6BC 5220000B */ beql $s1, $zero, .L8026A6EC @@ -333,9 +336,9 @@ rcp: /* F45EF8 8026A6C8 51200008 */ beql $t1, $zero, .L8026A6EC /* F45EFC 8026A6CC 2401FBFF */ addiu $at, $zero, -0x401 /* F45F00 8026A6D0 24090800 */ addiu $t1, $zero, 0x800 -/* F45F04 8026A6D4 3C01A430 */ lui $at, %hi(D_A4300000) +/* F45F04 8026A6D4 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_MODE_REG)) /* F45F08 8026A6D8 3231001F */ andi $s1, $s1, 0x1F -/* F45F0C 8026A6DC AC290000 */ sw $t1, %lo(D_A4300000)($at) +/* F45F0C 8026A6DC AC290000 */ sw $t1, %lo(PHYS_TO_K1(MI_MODE_REG))($at) /* F45F10 8026A6E0 0C09AA09 */ jal func_8026A824 /* F45F14 8026A6E4 24040048 */ addiu $a0, $zero, 0x48 /* F45F18 8026A6E8 2401FBFF */ addiu $at, $zero, -0x401 @@ -427,6 +430,7 @@ enqueueRunning: /* F4604C 8026A81C 0809AA99 */ j __osDispatchThread /* F46050 8026A820 00000000 */ nop endlabel func_8026A2E0 +.size func_8026A2E0, . - func_8026A2E0 # Handwritten function glabel func_8026A824 @@ -493,6 +497,7 @@ glabel func_8026A824 /* F46134 8026A904 1000FFB5 */ b enqueueRunning /* F46138 8026A908 AF5B0118 */ sw $k1, 0x118($k0) endlabel func_8026A824 +.size func_8026A824, . - func_8026A824 # Handwritten function glabel __osEnqueueAndYield @@ -528,7 +533,7 @@ glabel __osEnqueueAndYield /* F461AC 8026A97C 8CBB0118 */ lw $k1, 0x118($a1) /* F461B0 8026A980 3369FF00 */ andi $t1, $k1, 0xFF00 /* F461B4 8026A984 5120000E */ beql $t1, $zero, .L8026A9C0 -/* F461B8 8026A988 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* F461B8 8026A988 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) /* F461BC 8026A98C 3C088027 */ lui $t0, %hi(__OSGlobalIntMask) /* F461C0 8026A990 25087130 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* F461C4 8026A994 8D080000 */ lw $t0, 0x0($t0) @@ -541,9 +546,9 @@ glabel __osEnqueueAndYield /* F461E0 8026A9B0 0361D824 */ and $k1, $k1, $at /* F461E4 8026A9B4 0369D825 */ or $k1, $k1, $t1 /* F461E8 8026A9B8 ACBB0118 */ sw $k1, 0x118($a1) -/* F461EC 8026A9BC 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* F461EC 8026A9BC 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) .L8026A9C0: -/* F461F0 8026A9C0 8F7B000C */ lw $k1, %lo(D_A430000C)($k1) +/* F461F0 8026A9C0 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) /* F461F4 8026A9C4 1360000B */ beqz $k1, .L8026A9F4 /* F461F8 8026A9C8 00000000 */ nop /* F461FC 8026A9CC 3C1A8027 */ lui $k0, %hi(__OSGlobalIntMask) @@ -565,6 +570,7 @@ glabel __osEnqueueAndYield /* F46234 8026AA04 0809AA99 */ j __osDispatchThread /* F46238 8026AA08 00000000 */ nop endlabel __osEnqueueAndYield +.size __osEnqueueAndYield, . - __osEnqueueAndYield glabel __osEnqueueThread /* F4623C 8026AA0C 8C980000 */ lw $t8, 0x0($a0) @@ -588,6 +594,7 @@ glabel __osEnqueueThread /* F4627C 8026AA4C 03E00008 */ jr $ra /* F46280 8026AA50 ACA40008 */ sw $a0, 0x8($a1) endlabel __osEnqueueThread +.size __osEnqueueThread, . - __osEnqueueThread glabel __osPopThread /* F46284 8026AA54 8C820000 */ lw $v0, 0x0($a0) @@ -595,6 +602,7 @@ glabel __osPopThread /* F4628C 8026AA5C 03E00008 */ jr $ra /* F46290 8026AA60 AC990000 */ sw $t9, 0x0($a0) endlabel __osPopThread +.size __osPopThread, . - __osPopThread # Handwritten function glabel __osDispatchThread @@ -686,8 +694,8 @@ glabel __osDispatchThread /* F463E4 8026ABB4 275A8C60 */ addiu $k0, $k0, %lo(__osRcpImTable) /* F463E8 8026ABB8 037AD821 */ addu $k1, $k1, $k0 /* F463EC 8026ABBC 977B0000 */ lhu $k1, 0x0($k1) -/* F463F0 8026ABC0 3C1AA430 */ lui $k0, %hi(D_A430000C) -/* F463F4 8026ABC4 275A000C */ addiu $k0, $k0, %lo(D_A430000C) +/* F463F0 8026ABC0 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* F463F4 8026ABC4 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) /* F463F8 8026ABC8 AF5B0000 */ sw $k1, 0x0($k0) /* F463FC 8026ABCC 00000000 */ nop /* F46400 8026ABD0 00000000 */ nop @@ -695,6 +703,7 @@ glabel __osDispatchThread /* F46408 8026ABD8 00000000 */ nop /* F4640C 8026ABDC 42000018 */ eret endlabel __osDispatchThread +.size __osDispatchThread, . - __osDispatchThread glabel __osCleanupThread /* F46410 8026ABE0 0C09936C */ jal osDestroyThread @@ -702,6 +711,7 @@ glabel __osCleanupThread /* F46418 8026ABE8 00000000 */ nop /* F4641C 8026ABEC 00000000 */ nop endlabel __osCleanupThread +.size __osCleanupThread, . - __osCleanupThread # Handwritten function glabel osMapTLBRdb @@ -730,3 +740,4 @@ glabel osMapTLBRdb /* F46478 8026AC48 00000000 */ nop /* F4647C 8026AC4C 00000000 */ nop endlabel osMapTLBRdb +.size osMapTLBRdb, . - osMapTLBRdb diff --git a/asm/core1/ultra/setintmask.s b/asm/core1/ultra/setintmask.s index a561e22f..a5cf9f88 100644 --- a/asm/core1/ultra/setintmask.s +++ b/asm/core1/ultra/setintmask.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives .set noat # allow manual use of $at @@ -100,8 +101,8 @@ glabel osSetIntMask xor $t0, $t3, $at andi $t0, $t0, 0xff00 or $v0, $v0, $t0 - lui $t2, %hi(D_A430000C) - lw $t2, %lo(D_A430000C)($t2) + lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) + lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) beqz $t2, setintmask_1 srl $t1, $t3, 0x10 addiu $at, $zero, -1 @@ -118,8 +119,8 @@ setintmask_1: lui $t2, %hi(__osRcpImTable) addu $t2, $t2, $t0 lhu $t2, %lo(__osRcpImTable)($t2) - lui $at, %hi(D_A430000C) - sw $t2, %lo(D_A430000C)($at) + lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) + sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) andi $t0, $a0, 0xff01 andi $t1, $t3, 0xff00 and $t0, $t0, $t1 diff --git a/asm/ultra/exceptasm.s b/asm/ultra/exceptasm.s index 307ba0fa..ac13e866 100644 --- a/asm/ultra/exceptasm.s +++ b/asm/ultra/exceptasm.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives @@ -146,8 +147,8 @@ glabel __osException /* 2F90 80002390 0369D825 */ or $k1, $k1, $t1 /* 2F94 80002394 AF5B0118 */ sw $k1, 0x118($k0) .L80002398: -/* 2F98 80002398 3C09A430 */ lui $t1, %hi(D_A430000C) -/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(D_A430000C)($t1) +/* 2F98 80002398 3C09A430 */ lui $t1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 2F9C 8000239C 8D29000C */ lw $t1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t1) /* 2FA0 800023A0 5120000C */ beql $t1, $zero, .L800023D4 /* 2FA4 800023A4 AF490128 */ sw $t1, 0x128($k0) /* 2FA8 800023A8 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) @@ -262,21 +263,21 @@ rcp: /* 3134 80002534 3C088000 */ lui $t0, %hi(__OSGlobalIntMask) /* 3138 80002538 250850F0 */ addiu $t0, $t0, %lo(__OSGlobalIntMask) /* 313C 8000253C 8D080000 */ lw $t0, ($t0) -/* 3140 80002540 3C11A430 */ lui $s1, %hi(D_A4300008) -/* 3144 80002544 8E310008 */ lw $s1, %lo(D_A4300008)($s1) +/* 3140 80002540 3C11A430 */ lui $s1, %hi(PHYS_TO_K1(MI_INTR_REG)) +/* 3144 80002544 8E310008 */ lw $s1, %lo(PHYS_TO_K1(MI_INTR_REG))($s1) /* 3148 80002548 00084402 */ srl $t0, $t0, 0x10 /* 314C 8000254C 02288824 */ and $s1, $s1, $t0 /* 3150 80002550 32290001 */ andi $t1, $s1, 1 /* 3154 80002554 51200014 */ beql $t1, $zero, .L800025A8 /* 3158 80002558 32290008 */ andi $t1, $s1, 8 -/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(D_A4040010) -/* 3160 80002560 8D8C0010 */ lw $t4, %lo(D_A4040010)($t4) +/* 315C 8000255C 3C0CA404 */ lui $t4, %hi(PHYS_TO_K1(SP_STATUS_REG)) +/* 3160 80002560 8D8C0010 */ lw $t4, %lo(PHYS_TO_K1(SP_STATUS_REG))($t4) /* 3164 80002564 24090008 */ addiu $t1, $zero, 8 -/* 3168 80002568 3C01A404 */ lui $at, %hi(D_A4040010) +/* 3168 80002568 3C01A404 */ lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG)) /* 316C 8000256C 318C0300 */ andi $t4, $t4, 0x300 /* 3170 80002570 3231003E */ andi $s1, $s1, 0x3e /* 3174 80002574 11800007 */ beqz $t4, .L80002594 -/* 3178 80002578 AC290010 */ sw $t1, %lo(D_A4040010)($at) +/* 3178 80002578 AC290010 */ sw $t1, %lo(PHYS_TO_K1(SP_STATUS_REG))($at) /* 317C 8000257C 0C0009E9 */ jal send_mesg /* 3180 80002580 24040020 */ addiu $a0, $zero, 0x20 /* 3184 80002584 52200039 */ beql $s1, $zero, .L8000266C @@ -291,9 +292,9 @@ rcp: /* 31A4 800025A4 32290008 */ andi $t1, $s1, 8 .L800025A8: /* 31A8 800025A8 11200007 */ beqz $t1, .L800025C8 -/* 31AC 800025AC 3C01A440 */ lui $at, %hi(D_A4400010) +/* 31AC 800025AC 3C01A440 */ lui $at, %hi(PHYS_TO_K1(VI_CURRENT_REG)) /* 31B0 800025B0 32310037 */ andi $s1, $s1, 0x37 -/* 31B4 800025B4 AC200010 */ sw $zero, %lo(D_A4400010)($at) +/* 31B4 800025B4 AC200010 */ sw $zero, %lo(PHYS_TO_K1(VI_CURRENT_REG))($at) /* 31B8 800025B8 0C0009E9 */ jal send_mesg /* 31BC 800025BC 24040038 */ addiu $a0, $zero, 0x38 /* 31C0 800025C0 5220002A */ beql $s1, $zero, .L8000266C @@ -303,9 +304,9 @@ rcp: /* 31CC 800025CC 5120000A */ beql $t1, $zero, .L800025F8 /* 31D0 800025D0 32290002 */ andi $t1, $s1, 2 /* 31D4 800025D4 24090001 */ addiu $t1, $zero, 1 -/* 31D8 800025D8 3C01A450 */ lui $at, %hi(D_A450000C) +/* 31D8 800025D8 3C01A450 */ lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG)) /* 31DC 800025DC 3231003B */ andi $s1, $s1, 0x3b -/* 31E0 800025E0 AC29000C */ sw $t1, %lo(D_A450000C)($at) +/* 31E0 800025E0 AC29000C */ sw $t1, %lo(PHYS_TO_K1(AI_STATUS_REG))($at) /* 31E4 800025E4 0C0009E9 */ jal send_mesg /* 31E8 800025E8 24040030 */ addiu $a0, $zero, 0x30 /* 31EC 800025EC 5220001F */ beql $s1, $zero, .L8000266C @@ -313,9 +314,9 @@ rcp: /* 31F4 800025F4 32290002 */ andi $t1, $s1, 2 .L800025F8: /* 31F8 800025F8 11200007 */ beqz $t1, .L80002618 -/* 31FC 800025FC 3C01A480 */ lui $at, %hi(D_A4800018) +/* 31FC 800025FC 3C01A480 */ lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG)) /* 3200 80002600 3231003D */ andi $s1, $s1, 0x3d -/* 3204 80002604 AC200018 */ sw $zero, %lo(D_A4800018)($at) +/* 3204 80002604 AC200018 */ sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at) /* 3208 80002608 0C0009E9 */ jal send_mesg /* 320C 8000260C 24040028 */ addiu $a0, $zero, 0x28 /* 3210 80002610 52200016 */ beql $s1, $zero, .L8000266C @@ -325,9 +326,9 @@ rcp: /* 321C 8000261C 5120000A */ beql $t1, $zero, .L80002648 /* 3220 80002620 32290020 */ andi $t1, $s1, 0x20 /* 3224 80002624 24090002 */ addiu $t1, $zero, 2 -/* 3228 80002628 3C01A460 */ lui $at, %hi(D_A4600010) +/* 3228 80002628 3C01A460 */ lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG)) /* 322C 8000262C 3231002F */ andi $s1, $s1, 0x2f -/* 3230 80002630 AC290010 */ sw $t1, %lo(D_A4600010)($at) +/* 3230 80002630 AC290010 */ sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at) /* 3234 80002634 0C0009E9 */ jal send_mesg /* 3238 80002638 24040040 */ addiu $a0, $zero, 0x40 /* 323C 8000263C 5220000B */ beql $s1, $zero, .L8000266C @@ -545,9 +546,9 @@ glabel __osEnqueueAndYield /* 3530 80002930 0361D824 */ and $k1, $k1, $at /* 3534 80002934 0369D825 */ or $k1, $k1, $t1 /* 3538 80002938 ACBB0118 */ sw $k1, 0x118($a1) -/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(D_A430000C) +/* 353C 8000293C 3C1BA430 */ lui $k1, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) .L80002940: -/* 3540 80002940 8F7B000C */ lw $k1, %lo(D_A430000C)($k1) +/* 3540 80002940 8F7B000C */ lw $k1, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($k1) /* 3544 80002944 1360000B */ beqz $k1, .L80002974 /* 3548 80002948 00000000 */ nop /* 354C 8000294C 3C1A8000 */ lui $k0, %hi(__OSGlobalIntMask) @@ -689,8 +690,8 @@ glabel __osDispatchThread /* 3734 80002B34 275A51D0 */ addiu $k0, $k0, %lo(__osRcpImTable) /* 3738 80002B38 037AD821 */ addu $k1, $k1, $k0 /* 373C 80002B3C 977B0000 */ lhu $k1, ($k1) -/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(D_A430000C) -/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(D_A430000C) +/* 3740 80002B40 3C1AA430 */ lui $k0, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 3744 80002B44 275A000C */ addiu $k0, $k0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG)) /* 3748 80002B48 AF5B0000 */ sw $k1, ($k0) /* 374C 80002B4C 00000000 */ nop /* 3750 80002B50 00000000 */ nop diff --git a/asm/ultra/setintmask.s b/asm/ultra/setintmask.s index 5af09ba5..c5c891d8 100644 --- a/asm/ultra/setintmask.s +++ b/asm/ultra/setintmask.s @@ -1,4 +1,5 @@ #include +#include .include "macro.inc" # assembler directives .set noat # allow manual use of $at @@ -100,8 +101,8 @@ glabel func_80003A30 /* 4648 80003A48 01614026 */ xor $t0, $t3, $at /* 464C 80003A4C 3108FF00 */ andi $t0, $t0, 0xff00 /* 4650 80003A50 00481025 */ or $v0, $v0, $t0 -/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(D_A430000C) -/* 4658 80003A58 8D4A000C */ lw $t2, %lo(D_A430000C)($t2) +/* 4654 80003A54 3C0AA430 */ lui $t2, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 4658 80003A58 8D4A000C */ lw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($t2) /* 465C 80003A5C 11400005 */ beqz $t2, .L80003A74 /* 4660 80003A60 000B4C02 */ srl $t1, $t3, 0x10 /* 4664 80003A64 2401FFFF */ addiu $at, $zero, -1 @@ -118,8 +119,8 @@ glabel func_80003A30 /* 468C 80003A8C 3C0A8000 */ lui $t2, %hi(__osRcpImTable) /* 4690 80003A90 01485021 */ addu $t2, $t2, $t0 /* 4694 80003A94 954A51D0 */ lhu $t2, %lo(__osRcpImTable)($t2) -/* 4698 80003A98 3C01A430 */ lui $at, %hi(D_A430000C) -/* 469C 80003A9C AC2A000C */ sw $t2, %lo(D_A430000C)($at) +/* 4698 80003A98 3C01A430 */ lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG)) +/* 469C 80003A9C AC2A000C */ sw $t2, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at) /* 46A0 80003AA0 3088FF01 */ andi $t0, $a0, 0xff01 /* 46A4 80003AA4 3169FF00 */ andi $t1, $t3, 0xff00 /* 46A8 80003AA8 01094024 */ and $t0, $t0, $t1 diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index fa7e0ea9..dadbfb14 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -15,12 +15,14 @@ options: #include "variables.h" undefined_syms_path: undefined_syms.us.v10.txt symbol_addrs_path: symbol_addrs.us.v10.txt - undefined_funcs_auto_path: undefined_funcs_auto.us.v10.txt - undefined_syms_auto_path: undefined_syms_auto.us.v10.txt + create_undefined_funcs_auto: no + create_undefined_syms_auto: no base_path: . target_path: decompressed.us.v10.z64 asset_path: bin build_path: build/us.v10 + libultra_symbols: True + hardware_regs: True segments: - name: header type: header @@ -123,18 +125,20 @@ segments: start: 0x5E90 subsegments: - [0x5E90, bin, assets] -- name: soundfont1 +- name: soundfont1ctl type: bin start: 0xD846C0 - subsegments: - - [0xD846C0, bin, soundfont1.ctl] - - [0xD954B0, bin, soundfont1.tbl] -- name: soundfont2 +- name: soundfont1tbl + type: bin + start: 0xD954B0 + +- name: soundfont2ctl type: bin start: 0xEA3EB0 - subsegments: - - [0xEA3EB0, bin, soundfont2.ctl] - - [0xEADE60, bin, soundfont2.tbl] +- name: soundfont2tbl + type: bin + start: 0xEADE60 + - name: core1 dir: core1 type: code @@ -1496,6 +1500,7 @@ segments: - [0x1048560, .bss, code_41FB0] - [0x1048560, .bss, code_42CB0] - [0x1048560, .bss, mapspecificflags] + - [0x1048560, .bss, code_47BD0] - [0x1048560, .bss, code_4A6F0] - [0x1048560, .bss, code_4C020] - [0x1048560, .bss, ch/badShad] @@ -1614,6 +1619,7 @@ segments: - [0x1048560, .bss, code_C5440] - [0x1048560, .bss, code_C89C0] - [0x1048560, .bss, code_C97F0] + - [0x1048560, .bss, code_C9E70] - [0x1048560, .bss, code_C9F00] - [0x1048560, .bss, code_CB8A0] - [0x1048560, .bss, code_CBBF0] @@ -1882,7 +1888,7 @@ segments: - [0x1068340, .rodata, ch/grublin] - [0x1068350, .rodata, ch/jujuhitbox] - [0x1068360, .rodata, ch/juju] - - [0x1068370, .bss, bss_pad] + - [0x1068370, .bss, ch/hut] - [0x1068370, .bss, ch/juju] - name: BGS dir: BGS @@ -2112,7 +2118,8 @@ segments: - [0x108AB50, .bss, sirslushgame] - [0x108AB50, .bss, snowmanbuttongame] - [0x108AB50, .bss, racectrl] - - [0x108AB50, .bss, bss_end_pad] + - [0x108AB50, .bss, ch/xmastreestar] + - [0x108AB50, .bss, code_B4D0] - name: SM dir: SM type: code diff --git a/first_diff.py b/first_diff.py index a2546fc1..3bffd788 100755 --- a/first_diff.py +++ b/first_diff.py @@ -184,7 +184,7 @@ def hexbytes(bs): found_instr_diff = [] map_search_diff = [] diffs = 0 -shift_cap = 1000 +shift_cap = 100000 for i in range(24, len(mybin), 4): # (mybin[i:i+4] != basebin[i:i+4], but that's slightly slower in CPython...) if diffs <= shift_cap and ( diff --git a/include/assets.h b/include/assets.h index a762c0e1..6dde267f 100644 --- a/include/assets.h +++ b/include/assets.h @@ -16,6 +16,6 @@ typedef struct asset_file_meta_s{ } AssetFileMeta; -extern u8 D_5E90; //rom file asset bin; +extern u8 assets_ROM_START[]; //rom file asset bin; #endif diff --git a/include/core2/code_C9E70.h b/include/core2/code_C9E70.h index 480ac104..bd6793e1 100644 --- a/include/core2/code_C9E70.h +++ b/include/core2/code_C9E70.h @@ -42,8 +42,6 @@ struct FF_StorageStruct_48 { struct FF_StorageStruct_48_sub data[4]; }; // 0x90 - - // FF: generic storage struct struct FF_StorageStruct { /* 00 */ BKModel *unk0; diff --git a/src/FP/bss_end_pad.c b/src/FP/bss_end_pad.c deleted file mode 100644 index 7c0e2803..00000000 --- a/src/FP/bss_end_pad.c +++ /dev/null @@ -1 +0,0 @@ -char pad_FP_803935A8[0x20]; diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 7e8914d8..9b1efd8b 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -29,8 +29,8 @@ ActorInfo D_80391318 = { MARKER_AA_HISTUP, ACTOR_11C_HISTUP, ASSET_3DE_MODEL_HIS extern struct { s32 unk0; s32 unk4; + s32 unk8; }GV_D_80391AB0; -extern s32 D_80391AB8; /* .code */ int func_8038D920(Actor *this, f32 arg1){ @@ -114,7 +114,7 @@ void func_8038DBDC(Actor *this){ actor_collisionOff(this); subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); - D_80391AB8 = 0; + GV_D_80391AB0.unk8 = 0; func_8038DB4C(0); this->unk1C[0] = 0.0f; }//L8038DC90 @@ -134,7 +134,7 @@ void func_8038DBDC(Actor *this){ case 2: //8038DD3C if(!(func_8038E178() < 5)){ func_8038DB88(this); - if(D_80391AB8){ + if(GV_D_80391AB0.unk8){ subaddie_set_state_with_direction(this, 3, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); this->unk1C[0] = 0.0f; @@ -196,7 +196,7 @@ void func_8038DBDC(Actor *this){ animctrl_setDuration(this->animctrl, 1.6f); func_80386608(); func_8038DB4C(0); - D_80391AB8 = FALSE; + GV_D_80391AB0.unk8 = FALSE; func_8025A58C(-1, 0x190); func_8025A7DC(COMUSIC_27_GV_RUBEES_SONG); if(!this->unk44_31){ diff --git a/src/GV/code_7D50.c b/src/GV/code_7D50.c index 0e94027b..f4476b9d 100644 --- a/src/GV/code_7D50.c +++ b/src/GV/code_7D50.c @@ -4,7 +4,7 @@ struct { s32 unk0; - u8 pad4[4]; + s32 unk4; s32 unk8; }GV_D_80391AB0; diff --git a/src/MM/bss_pad.c b/src/MM/bss_pad.c deleted file mode 100644 index 28806312..00000000 --- a/src/MM/bss_pad.c +++ /dev/null @@ -1 +0,0 @@ -char pad_MM_D_80389C80[0x10]; diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index 9600d4ec..1493d8fe 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -19,6 +19,7 @@ void func_80389598(Actor *this); Actor* func_80389014(ActorMarker *, Gfx **, Mtx**, Vtx** ); /* .bss */ +u8 MM_pad_80389C80[0x10]; s32 MM_D_80389C90; /* .data */ diff --git a/src/RBB/propellorctrl.c b/src/RBB/propellorctrl.c index cfa06f82..cf31c61c 100644 --- a/src/RBB/propellorctrl.c +++ b/src/RBB/propellorctrl.c @@ -3,7 +3,8 @@ #include "variables.h" -s32 pad_803912C0[2]; +s32 pad_803912C0[1]; +f32 __propellorTimer2; // TODO rematch __propellorCtrl_setState to merge this with __propellorTimer u8 __propellorCtrlState; void __propellorCtrl_setState(s32 arg0){ @@ -49,14 +50,12 @@ void rbb_propellorCtrl_start(void){ } void rbb_propellorCtrl_update(void){ - extern f32 __propellorTimer; - if( __propellorCtrlState == 0) if(levelSpecificFlags_get(0x27) && levelSpecificFlags_get(0x28)) __propellorCtrl_setState(1); if(__propellorCtrlState == 1) - if(ml_timer_update(&__propellorTimer,time_getDelta())) + if(ml_timer_update(&__propellorTimer2,time_getDelta())) __propellorCtrl_setState(2); if(__propellorCtrlState == 2) diff --git a/src/core1/code_10A00.c b/src/core1/code_10A00.c index 35dec438..858af440 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/code_10A00.c @@ -2,12 +2,7 @@ #include "functions.h" #include "variables.h" - -#ifndef CORE2_DATA_CRC2 - #define CORE2_DATA_CRC2 0 -#endif - -extern s32 core2_D_803727F4; +extern s32 D_803727F4; extern struct { u8 pad0[4]; @@ -32,7 +27,7 @@ typedef struct { f32 joystick[2]; }Struct_core1_10A00_1; -extern s32 D_80276574; // = CORE2_DATA_CRC2 +extern s32 D_80276574; /* .data */ s32 D_80275D30 = 0xC3A68832; //WHAT IS THIS? @@ -73,7 +68,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) { f32 phi_f2; phi_f2 = 0.0125f; - if ((D_80379B90.unk4 != core2_D_803727F4) || (D_80379B90.unkC != D_80276574)) { + if ((D_80379B90.unk4 != D_803727F4) || (D_80379B90.unkC != D_80276574)) { phi_f2 = 0.00625f; } if (arg0 > 0) { @@ -341,6 +336,10 @@ void func_8024F1F0(void){ void func_8024F224(void){ s32 iCont, j; + // for(iCont = 0; iCont < 4; iCont++){ + // D_80281250[iCont].unk0 = 0; + // } + for(iCont = 0; iCont < 4; iCont++){ D_80281250[iCont].unk0 = 0; D_80281250[iCont].unk2 = 0; diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index f2a05573..cfa70c3d 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -9,8 +9,9 @@ extern void func_8025F570(ALCSPlayer *, u8); extern void func_8025F510(ALCSPlayer *, u8, u8); extern void func_8025F5C0(ALCSPlayer *, u8); -extern ALBankFile D_EA3EB0; -extern ALWaveTable D_EADE60; +extern u8 soundfont2ctl_ROM_START[]; +extern u8 soundfont2ctl_ROM_END[]; +extern u8 soundfont2tbl_ROM_START[]; /* dependent functions */ void func_8024FA98(u8, enum comusic_e); @@ -220,10 +221,10 @@ void musicInstruments_init(void){ s32 i; f32 tmpf1; - size = (u8*)&D_EADE60 - (u8*)&D_EA3EB0; + size = soundfont2ctl_ROM_END - soundfont2ctl_ROM_START; bnk_f = malloc(size); osWriteBackDCacheAll(); - osPiStartDma(func_802405D0(), 0, 0, &D_EA3EB0, bnk_f, size, func_802405C4()); + osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont2ctl_ROM_START, bnk_f, size, func_802405C4()); osRecvMesg(func_802405C4(), 0, 1); //osRecvMesg D_80282104 = 0xAD; D_802820E0 = (MusicTrack **) malloc(D_80282104 * sizeof(MusicTrack *)); @@ -242,7 +243,7 @@ void musicInstruments_init(void){ n_alCSPNew(&D_80281720[i].cseqp, &D_802820E8); } - alBnkfNew(bnk_f, (u8 *)&D_EADE60); + alBnkfNew(bnk_f, soundfont2tbl_ROM_START); D_80282108 = bnk_f->bankArray[0]; for(i = 0; i < 6; i++){ alCSPSetBank(&D_80281720[i].cseqp, D_80282108); diff --git a/src/core1/code_13990.c b/src/core1/code_13990.c index fcf1ddc6..086bf7a5 100644 --- a/src/core1/code_13990.c +++ b/src/core1/code_13990.c @@ -9,7 +9,7 @@ f32 func_80263FF0(f32); f32 cosf(f32); #ifndef CORE2_DATA_CRC2 - #define CORE2_DATA_CRC2 0 + #define CORE2_DATA_CRC2 0x84D7B4F8 #endif s32 D_80276570 = 0xFF62C2B8; //WHAT IS THIS? diff --git a/src/core1/code_1D00.c b/src/core1/code_1D00.c index d20c8ef6..e88dea9f 100644 --- a/src/core1/code_1D00.c +++ b/src/core1/code_1D00.c @@ -147,9 +147,9 @@ ALHeap D_8027CFF0; u8 * D_8027D000; s32 D_8027D004; OSMesgQueue D_8027D008; -OSMesg D_8027D020; +OSMesg D_8027D020[50]; OSIoMesg D_8027D0E8; -Struct_core1_1D00_4 D_8027D100[58]; +Struct_core1_1D00_4 D_8027D100[50]; struct { u8 unk0; Struct_1D00_3 *unk4; @@ -297,7 +297,7 @@ void audioManager_create(void) { int i; f32 var_f0; - osCreateMesgQueue(&D_8027D008, &D_8027D020, 0x32); + osCreateMesgQueue(&D_8027D008, D_8027D020, 50); osCreateMesgQueue(&audioManager.audioReplyMsgQ, audioManager.audioReplyMsgBuf, 8); //audioReplyMesgQueue osCreateMesgQueue(&audioManager.audioFrameMsgQ, audioManager.audioFrameMsgBuf, 8); var_f0 = 733.333313f; diff --git a/src/core1/code_2BD0.c b/src/core1/code_2BD0.c index 3f06cb29..13b56978 100644 --- a/src/core1/code_2BD0.c +++ b/src/core1/code_2BD0.c @@ -3,8 +3,10 @@ #include "variables.h" OSIoMesg D_8027E090; -OSMesg D_8027E0A8; -OSMesgQueue D_8027E0AC; +struct { + OSMesg mesg; + OSMesgQueue queue; +} D_8027E0A8; OSMesg D_8027E0C8[16]; //g_PimgrMesgBuffer OSMesgQueue D_8027E108; //g_PimgrMesgQueue @@ -19,20 +21,20 @@ void func_802405F0(u32 * arg0, s32 arg1, s32 size){ block_remainder = size % block_size; for(i = 0; i < block_cnt; i++){ - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0AC); - osRecvMesg(&D_8027E0AC, NULL, 1); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0A8.queue); + osRecvMesg(&D_8027E0A8.queue, NULL, 1); arg1 += 0x20000; arg0 += 0x8000; } - osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0AC); - osRecvMesg(&D_8027E0AC, NULL, 1); + osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0A8.queue); + osRecvMesg(&D_8027E0A8.queue, NULL, 1); osInvalDCache(arg0, size); } void piMgr_create(void){ - osCreateMesgQueue(&D_8027E0AC, &D_8027E0A8, 1); + osCreateMesgQueue(&D_8027E0A8.queue, &D_8027E0A8.mesg, 1); osCreateMesgQueue(&D_8027E108, &D_8027E0C8[0], 16); osCreatePiManager(OS_PRIORITY_PIMGR, &D_8027E108, &D_8027E0C8[0], 16); } diff --git a/src/core1/code_5650.c b/src/core1/code_5650.c index fe4fc37d..b677532c 100644 --- a/src/core1/code_5650.c +++ b/src/core1/code_5650.c @@ -21,7 +21,7 @@ void func_80244978(s32 arg0, s16 type, s32 arg2); N_ALSndPlayer D_8027EEC0; s16 *D_8027EF14; -extern struct { +struct { s32 volume[4]; }D_8027EF18; diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 8bbb3703..950442d9 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -53,7 +53,7 @@ s32 D_80275768 = 6; //dbits /* .data */ extern struct huft D_803FBE00; struct huft *D_8027BF00; -u8 pad_8027BF00[0xC]; +u8 pad_8027BF08[0x8]; u8 *D_8027BF10; //inbuf u8 *D_8027BF14; //slide u32 D_8027BF18; //inptr diff --git a/src/core1/code_72B0.c b/src/core1/code_72B0.c index eb83d545..00dc82fa 100644 --- a/src/core1/code_72B0.c +++ b/src/core1/code_72B0.c @@ -12,7 +12,6 @@ extern f32 func_8031C5D4(struct0*); extern void func_8031C5AC(struct0 *, f32 *); /* .bss */ -u8 pad_D_8027EF20[0x10]; f32 D_8027EF30; /* .code */ diff --git a/src/core1/code_8C50.c b/src/core1/code_8C50.c index 9187e78b..64f8958a 100644 --- a/src/core1/code_8C50.c +++ b/src/core1/code_8C50.c @@ -61,7 +61,7 @@ s32 D_8027599C = 0; /* .bss */ u64 D_8027EF40[OS_YIELD_DATA_SIZE / sizeof(u64)]; -static u8 pad[0x28]; // 8027FB40 +static u8 pad[0x20]; // 8027FB40 OSMesgQueue D_8027FB60; OSMesg D_8027FB78[20]; OSMesgQueue D_8027FBC8; @@ -74,7 +74,7 @@ s32 D_8027FC18; s32 D_8027FC1C; s32 D_8027FC20; s32 D_8027FC24; -u8 D_8027FC28[2040]; //stack for thread D_80280428; +u8 D_8027FC28[2048]; //stack for thread D_80280428; OSThread D_80280428; Struct_Core1_8C50_s * D_802805D8[20]; volatile s32 D_80280628; @@ -458,7 +458,7 @@ void func_80247560(void){ tmp_v0 = D_8027EF40; while((u32)tmp_v0 % 0x10){((u32)tmp_v0)++;} D_80275950.t.yield_data_ptr = tmp_v0; - osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2040], 60); + osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2048], 60); osStartThread(&D_80280428); } diff --git a/src/core1/code_E360.c b/src/core1/code_E360.c index 8158d989..9a6054a7 100644 --- a/src/core1/code_E360.c +++ b/src/core1/code_E360.c @@ -61,12 +61,16 @@ u32 D_80280724; u32 D_80280728; struct1 D_80280730[8]; OSMesgQueue D_80280770; +OSMesg D_80280788[10]; OSMesgQueue D_802807B0; +OSMesg D_802807C8[1]; OSMesgQueue D_802807D0; +OSMesg D_802807E8[60]; volatile s32 D_802808D8; s32 D_802808DC; OSThread D_802808E0; -u8 pad_80280970[0x520]; +#define THREAD0_STACK_SIZE 0x400 +u8 thread0_stack[THREAD0_STACK_SIZE]; extern u8 D_803A5D00[2][0x1ECC0]; //framebuffer @@ -100,7 +104,6 @@ void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ } void func_8024BE30(void){ - extern s32 D_80280E90; s32 i; func_8024C428(); @@ -113,9 +116,9 @@ void func_8024BE30(void){ osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON); osViSetSpecialFeatures(OS_VI_GAMMA_OFF); osViSwapBuffer(&D_803A5D00); - osCreateMesgQueue(&D_80280770, (&D_80280770 + 1), 10); - osCreateMesgQueue(&D_802807B0, (&D_802807B0 + 1), 1); - osCreateMesgQueue(&D_802807D0, (&D_802807D0 + 1), 0x3C); + osCreateMesgQueue(&D_80280770, D_80280788, 10); + osCreateMesgQueue(&D_802807B0, D_802807C8, 1); + osCreateMesgQueue(&D_802807D0, D_802807E8, 60); osViSetEvent(&D_80280770,NULL,1); D_80280720 = 0; D_80280724 = 1; @@ -125,7 +128,7 @@ void func_8024BE30(void){ } D_802808D8 = 0; func_8024BF94(2); - osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&D_80280E90,0x50); + osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&thread0_stack[THREAD0_STACK_SIZE],80); osStartThread(&D_802808E0); } diff --git a/src/core2/bs/dronevanish.c b/src/core2/bs/dronevanish.c index 2ef91e5f..12b80bbd 100644 --- a/src/core2/bs/dronevanish.c +++ b/src/core2/bs/dronevanish.c @@ -12,6 +12,7 @@ struct { f32 unkC; f32 unk10; }D_8037D450; +u32 pad_8037D464; u8 D_8037D468; /* .code */ diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index 021c0cf8..49615def 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -7,7 +7,7 @@ #endif extern s16 D_803A5D00[2][0xF660]; //framebuffer -extern u8 D_8037DCC8[]; //bottels bonus flags??? +extern u8 D_8037DCC8; //bottles bonus flags??? extern void ml_vec3f_assign(f32[3], f32, f32, f32); @@ -61,9 +61,8 @@ ActorInfo D_80368418 = { /* .bss */ ActorMarker *chBottlesBonusCursorMarker; -f32 D_8037E068[20][2]; +f32 D_8037E068[60][2]; Struct_core2_584D0_0 D_8037E248[20]; //puzzle pieces -u8 pad_8037E478[0x140]; s32 D_8037E5B8; struct { s32 unk0; diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index caa23cf3..b4ee783e 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/code_C9E70.h" #include "core2/modelRender.h" #ifndef ABS @@ -77,10 +78,21 @@ ActorInfo D_80365F00 = { 0xE6, 0x197, 0x532, 0x1, D_80365ED0, func_802C4C14, fun /* .bss */ -// Remove this when this memory region is properly symbolized -u8 unk_8037DCB0[0x8037DCE0 - 0x8037DCB0]; - -extern u8 D_8037DCCE[0x12]; +s32 D_8037DCB0; +u32 D_8037DCB4; +struct FF_StorageStruct* D_8037DCB8; +s32 D_8037DCBC; +u8 D_8037DCC0[7]; +u8 D_8037DCC7; +u8 D_8037DCC8; +u8 D_8037DCC9; +u8 D_8037DCCA; +u8 D_8037DCCB; +u8 D_8037DCCC; +u8 D_8037DCCD; +u8 D_8037DCCE[3]; +s32 pad_8037DCD4; +s32 pad_8037DCD8; struct { u8 *unk0; diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 820098ec..fee020d4 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/code_C9E70.h" extern void func_8030DBFC(u32, f32, f32, f32); extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); @@ -45,8 +46,6 @@ ActorInfo D_80367310 = {MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPR 0, 0, 1.0f, 0 }; - -/* .bss */ extern s32 D_8037DCBC; /* .code */ diff --git a/src/core2/code_59D40.c b/src/core2/code_59D40.c index 0d0472ae..48fcbd18 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/code_59D40.c @@ -39,6 +39,7 @@ ActorInfo D_80368620 = { /* .bss */ ActorMarker *D_8037E620; +f32 D_8037E624; f32 D_8037E628; s32 D_8037E62C; s32 D_8037E630; @@ -292,7 +293,6 @@ void chsnacker_update(Actor *this) { this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; } -extern f32 D_8037E624; void func_802E1790(void){ D_8037E624 = 0.0f; D_8037E628 = 1.0f; diff --git a/src/core2/code_5BEB0.c b/src/core2/code_5BEB0.c index a92a825b..295376fe 100644 --- a/src/core2/code_5BEB0.c +++ b/src/core2/code_5BEB0.c @@ -9,7 +9,6 @@ typedef struct map_savestate_s{ /* .bss */ s32 D_8037E650[0x9A]; -u8 pad_8037E8A8[0x18]; /* public functions */ void func_802E3BD0(s32 frame_buffer_indx); diff --git a/src/core2/code_AE290.c b/src/core2/code_AE290.c index fde2f575..620d6b12 100644 --- a/src/core2/code_AE290.c +++ b/src/core2/code_AE290.c @@ -5,8 +5,9 @@ extern ALBank *music_get_sound_bank(void); -extern u8 D_D846C0; -extern u8 D_D954B0; +extern u8 soundfont1ctl_ROM_START[]; +extern u8 soundfont1ctl_ROM_END[]; +extern u8 soundfont1tbl_ROM_START[]; struct { s32 unk0; //sound state cnt @@ -25,12 +26,12 @@ void sfxInstruments_init(void){ ALBankFile * bnkf; - size = &D_D954B0 - &D_D846C0; + size = soundfont1ctl_ROM_END - soundfont1ctl_ROM_START; bnkf = (ALBankFile *)malloc(size); osWritebackDCache(bnkf, size); - osPiStartDma(func_802405D0(), 0, 0, &D_D846C0, bnkf, size, func_802405C4()); + osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont1ctl_ROM_START, bnkf, size, func_802405C4()); osRecvMesg(func_802405C4(), NULL, 1); - alBnkfNew(bnkf, &D_D954B0); + alBnkfNew(bnkf, soundfont1tbl_ROM_START); bnk = bnkf->bankArray[0]; inst = bnk->instArray[0]; D_803835F0.unk0 = inst->soundCount; diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index 96bced6f..59065812 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -437,7 +437,7 @@ void assetCache_init(void){ assetCacheAssetIdList = (s16 *)malloc(150*sizeof(s16)); assetCacheLength = 0; assetSectionRomHeader = (AssetROMHead *)malloc(sizeof(AssetROMHead)); - D_80383CC8 = (u32) &D_5E90; + D_80383CC8 = (u32)assets_ROM_START; func_802405F0(assetSectionRomHeader, D_80383CC8, sizeof(AssetROMHead)); assetSectionRomMetaList = (AssetFileMeta *)malloc(assetSectionRomHeader->count*sizeof(AssetFileMeta)); func_802405F0(assetSectionRomMetaList, D_80383CC8 + sizeof(AssetROMHead),assetSectionRomHeader->count*sizeof(AssetFileMeta)); diff --git a/src/core2/code_C9E70.c b/src/core2/code_C9E70.c index fe74d0c8..1522c47b 100644 --- a/src/core2/code_C9E70.c +++ b/src/core2/code_C9E70.c @@ -4,7 +4,7 @@ #include "core2/code_C9E70.h" -struct FF_StorageStruct *D_8037DCB8; +extern struct FF_StorageStruct *D_8037DCB8; void func_80350E00(void){ quizQuestionAskedBitfield_defrag(); diff --git a/src/core2/code_CF5F0.c b/src/core2/code_CF5F0.c index ecaa9d91..f85d466f 100644 --- a/src/core2/code_CF5F0.c +++ b/src/core2/code_CF5F0.c @@ -15,7 +15,7 @@ extern u8 crc_ROM_START[]; // bk_boot segment crc next word s32 D_803727F0 = 0; -s32 core2_D_803727F4 = CORE2_CODE_CRC2; +s32 D_803727F4 = CORE2_CODE_CRC2; s32 D_803727F8 = 0; s32 D_803727FC = 0; diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 992fbcdc..7c8db6a8 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -14,8 +14,8 @@ enum transformation_e D_8037C2D0; f32 D_8037C2D8[3]; f32 D_8037C2E4; enum asset_e D_8037C2E8; -u8 D_8037C2ED; u8 D_8037C2EC; +u8 D_8037C2ED; struct{ f32 unk0; diff --git a/src/core2/nc/dynamicCamera.c b/src/core2/nc/dynamicCamera.c index af64857f..914f75da 100644 --- a/src/core2/nc/dynamicCamera.c +++ b/src/core2/nc/dynamicCamera.c @@ -41,7 +41,6 @@ s32 D_8037D940; f32 D_8037D948[3]; f32 cameraPosition[3]; f32 cameraRotation[3]; -f32 D_8037D96C; f32 D_8037D974; f32 D_8037D978; f32 D_8037D97C; @@ -188,7 +187,7 @@ void func_802BCA58(void) { player_getPosition(player_position); ml_vec3f_diff_copy(sp34, player_position, cameraPosition); sp4C = player_getYaw(); - sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(D_8037D96C - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980); + sp48 = ml_map_f(mlAbsF((f32) (mlNormalizeAngle(cameraRotation[1] - sp4C) - 180.0)), 0.0f, 180.0f, D_8037D97C, D_8037D980); func_80256E24(D_8037D9A8, 0.0f, sp4C, 0.0f, 0.0f, ml_map_f(gu_sqrtf(sp34[0]*sp34[0] + sp34[2]*sp34[2]), 300.0f, 450.0f, 0.0f, sp48)); ml_vec3f_diff_copy(sp34, D_8037D9A8, D_8037D9B8); if (func_802BC428()) { diff --git a/src/done/bk_boot_1050.c b/src/done/bk_boot_1050.c index 0c7720d4..924c77a3 100644 --- a/src/done/bk_boot_1050.c +++ b/src/done/bk_boot_1050.c @@ -12,7 +12,7 @@ u64 gEntryStack[ENTRY_STACK_LEN_U64]; extern u8 core1_us_v10_rzip_ROM_START[]; extern u8 core1_us_v10_rzip_ROM_END[]; extern u8 D_8002D500; -extern u8 D_8023DA20; +extern u8 core1_VRAM; extern u32 D_803FFE00[4]; void func_80000594(u8 **, u8 **); @@ -23,7 +23,7 @@ void func_80000450(s32 arg0){ u8 *dst; tmp = &D_8002D500; - dst = &D_8023DA20; + dst = &core1_VRAM; osInitialize(); osPiRawStartDma(OS_READ, core1_us_v10_rzip_ROM_START, tmp, core1_us_v10_rzip_ROM_END - core1_us_v10_rzip_ROM_START); while(osPiGetStatus() & PI_STATUS_DMA_BUSY); diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 1840fae5..f0978ec4 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -1466,7 +1466,7 @@ u8 D_8039286A; u8 D_8039286B; u8 D_8039286C[0x4C]; -f32 D_803928B8[2]; +f32 D_803928B8[3]; void chfinalboss_phase3_update(ActorMarker *marker) { static f32 D_803917A4[4] = {500.0f, 650.0f, 800.0f, 950.0f}; diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index 31698801..a0506114 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -16,7 +16,7 @@ ActorAnimationInfo fight_D_803919F0[] ={ {0x265, 1e+8f}, {0x265, 1e+8f}, }; -ActorInfo D_80391A10 = { +ActorInfo fight_D_80391A10 = { MARKER_276_STONE_JINJO, ACTOR_3A1_STONE_JINJO, ASSET_545_MODEL_STONE_JINJO, 0x1, fight_D_803919F0, chstonejinjo_update, func_80326224, actor_draw, diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index a6900e91..05834d40 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -186,7 +186,7 @@ extern Struct_lair_5ED0_0 D_80393760[FF_QNF_CNT - 1] = { }; -extern struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { +struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { { 0x0, 100}, { 0x64, 118}, { 0xDA, 51}, @@ -194,7 +194,7 @@ extern struct FF_QuestionTypeInfo FF_QuestionTypeInfoArr[5] = { {0x12B, 6} }; -extern struct { +struct { u8 unk0; s16 unk2; s16 unk4; diff --git a/undefined_syms.libultra.txt b/undefined_syms.libultra.txt index 78fa6052..1ef69a36 100644 --- a/undefined_syms.libultra.txt +++ b/undefined_syms.libultra.txt @@ -1,35 +1,46 @@ +/* Fixed-address libultra symbols */ osTvType = 0x80000300; osRomBase = 0x80000308; osResetType = 0x8000030C; osCicId = 0x80000310; osAppNMIBuffer = 0x8000031C; -D_8023DA20 = 0x8023DA20; + +/* Microcode renames to match ucode.h names */ +n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; +n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; +gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; +gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; +gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; +gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; +n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; +n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; +gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; +gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; +gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; +gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end; + +/* Fixed-address buffers */ +D_8000E800 = 0x8000E800; +D_8002D500 = 0x8002D500; +D_8023DA00 = 0x8023DA00; /* confirm */ +D_803FBE00 = 0x803FBE00; +D_803FFE00 = 0x803FFE00; +D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; -func_8023DA20 = 0x8023DA20; +D_803A5D00 = 0x803A5D00; /* framebuffers */ + +/* Renames for the boot segment */ +boot_osTvType = osTvType; +boot_osRomBase = osRomBase; +boot_osResetType = osResetType; +boot_osCicId = osCicId; +boot_osAppNMIBuffer = osAppNMIBuffer; -boot_osTvType = 0x80000300; -boot_osRomBase = 0x80000308; -boot_osResetType = 0x8000030C; -boot_osAppNMIBuffer = 0x8000031C; boot_D_8002D500 = D_8002D500; -boot_func_8023DA20 = func_8023DA20; -boot_D_8023DA20 = core1_VRAM; -boot_gOverlayTable = gOverlayTable; +boot_core1_VRAM = core1_VRAM; boot_D_803FBE00 = D_803FBE00; -boot_D_803FFE00 = 0x803FFE00; +boot_D_803FFE00 = D_803FFE00; +boot_gOverlayTable = gOverlayTable; +boot_func_8023DA20 = func_8023DA20; -boot_D_A430000C = 0xA430000C; -boot_D_A4300008 = 0xA4300008; -boot_D_A4300008 = 0xA4300008; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4040010 = 0xA4040010; -boot_D_A4400010 = 0xA4400010; -boot_D_A4400010 = 0xA4400010; -boot_D_A450000C = 0xA450000C; -boot_D_A450000C = 0xA450000C; -boot_D_A4800018 = 0xA4800018; -boot_D_A4800018 = 0xA4800018; -boot_D_A4600010 = 0xA4600010; -boot_D_A4600010 = 0xA4600010; +__propellorTimer = 0x803912CC; diff --git a/undefined_syms.us.v10.txt b/undefined_syms.us.v10.txt deleted file mode 100644 index 38d9bf15..00000000 --- a/undefined_syms.us.v10.txt +++ /dev/null @@ -1,34 +0,0 @@ -/* lair */ -FF_QuestionTypeInfoArr = 0x80394340; -D_80392EB0 = 0x80392EB0; -D_80392E20 = 0x80392E20; -lair_D_80392D90 = 0x80392D90; -MMM_D_8038C510 = 0x8038C510; -func_803863F0 = 0x803863F0; -D_8038D6A0 = 0x8038D6A0; -D_8038D378 = 0x8038D378; -D_8038D4DC = 0x8038D4DC; -D_8038D534 = 0x8038D534; -D_8038D590 = 0x8038D590; -D_8038D6DC = 0x8038D6DC; -D_8038D844 = 0x8038D844; -fight_D_80391A10 = 0x80391A10; -FP_D_80392840 = 0x80392840; -core1_D_803727F4 = 0x803727F4; -__osBaseTimer = 0x80285D00; -FP_D_80392864 = 0x80392864; -D_803687F0 = 0x803687F0; -D_80276E70 = 0x80276E70; - -n_aspMainTextStart = _binary_bin_core1_n_aspMain_text_bin_start; -n_aspMainTextEnd = _binary_bin_core1_n_aspMain_text_bin_end; -gSPF3DEX_fifoTextStart = _binary_bin_core1_gSPF3DEX_fifo_text_bin_start; -gSPF3DEX_fifoTextEnd = _binary_bin_core1_gSPF3DEX_fifo_text_bin_end; -gSPL3DEX_fifoTextStart = _binary_bin_core1_gSPL3DEX_fifo_text_bin_start; -gSPL3DEX_fifoTextEnd = _binary_bin_core1_gSPL3DEX_fifo_text_bin_end; -n_aspMainDataStart = _binary_bin_core1_n_aspMain_data_bin_start; -n_aspMainDataEnd = _binary_bin_core1_n_aspMain_data_bin_end; -gSPF3DEX_fifoDataStart = _binary_bin_core1_gSPF3DEX_fifo_data_bin_start; -gSPF3DEX_fifoDataEnd = _binary_bin_core1_gSPF3DEX_fifo_data_bin_end; -gSPL3DEX_fifoDataStart = _binary_bin_core1_gSPL3DEX_fifo_data_bin_start; -gSPL3DEX_fifoDataEnd = _binary_bin_core1_gSPL3DEX_fifo_data_bin_end;