diff --git a/asm/non_matchings/unknown_0255E0/func_8002DE30.s b/asm/non_matchings/unknown_0255E0/func_8002DE30.s index 1360c30e..22c0e340 100644 --- a/asm/non_matchings/unknown_0255E0/func_8002DE30.s +++ b/asm/non_matchings/unknown_0255E0/func_8002DE30.s @@ -210,9 +210,9 @@ glabel func_8002DE30 /* 02ED5C 8002E15C 8FAB0088 */ lw $t3, 0x88($sp) /* 02ED60 8002E160 1040000F */ beqz $v0, .L8002E1A0 /* 02ED64 8002E164 001EC880 */ sll $t9, $fp, 2 -/* 02ED68 8002E168 3C01800E */ lui $at, 0x800e +/* 02ED68 8002E168 3C01800E */ lui $at, %hi(D_800DC884) #$at, 0x800e /* 02ED6C 8002E16C 00390821 */ addu $at, $at, $t9 -/* 02ED70 8002E170 C42AC884 */ lwc1 $f10, -0x377c($at) +/* 02ED70 8002E170 C42AC884 */ lwc1 $f10, %lo(D_800DC884)($at) /* 02ED74 8002E174 8EC20054 */ lw $v0, 0x54($s6) /* 02ED78 8002E178 460AB401 */ sub.s $f16, $f22, $f10 /* 02ED7C 8002E17C C4400000 */ lwc1 $f0, ($v0) diff --git a/asm/non_matchings/unknown_043920/func_80050A28.s b/asm/non_matchings/unknown_043920/func_80050A28.s index aa2e06f4..f7ef4218 100644 --- a/asm/non_matchings/unknown_043920/func_80050A28.s +++ b/asm/non_matchings/unknown_043920/func_80050A28.s @@ -747,11 +747,11 @@ glabel func_80050A28 /* 0520D4 800514D4 00000000 */ nop /* 0520D8 800514D8 46087380 */ add.s $f14, $f14, $f8 .L800514DC: -/* 0520DC 800514DC 3C01800E */ lui $at, 0x800e +/* 0520DC 800514DC 3C01800E */ lui $at, %hi(D_800DCBE8) #$at, 0x800e /* 0520E0 800514E0 3C0D800E */ lui $t5, %hi(D_800DCC34) # $t5, 0x800e /* 0520E4 800514E4 00230821 */ addu $at, $at, $v1 /* 0520E8 800514E8 01A36821 */ addu $t5, $t5, $v1 -/* 0520EC 800514EC C426CBE8 */ lwc1 $f6, -0x3418($at) +/* 0520EC 800514EC C426CBE8 */ lwc1 $f6, %lo(D_800DCBE8)($at) /* 0520F0 800514F0 8DADCC34 */ lw $t5, %lo(D_800DCC34)($t5) /* 0520F4 800514F4 8FAC0068 */ lw $t4, 0x68($sp) /* 0520F8 800514F8 0122082A */ slt $at, $t1, $v0 diff --git a/asm/non_matchings/unknown_043920/func_8005492C.s b/asm/non_matchings/unknown_043920/func_8005492C.s index 5f54f16e..2ef2f02a 100644 --- a/asm/non_matchings/unknown_043920/func_8005492C.s +++ b/asm/non_matchings/unknown_043920/func_8005492C.s @@ -120,9 +120,9 @@ glabel func_8005492C /* 0556E8 80054AE8 10810008 */ beq $a0, $at, .L80054B0C /* 0556EC 80054AEC 46009006 */ mov.s $f0, $f18 /* 0556F0 80054AF0 00047080 */ sll $t6, $a0, 2 -/* 0556F4 80054AF4 3C01800E */ lui $at, 0x800e +/* 0556F4 80054AF4 3C01800E */ lui $at, %hi(D_800DCB9C) #$at, 0x800e /* 0556F8 80054AF8 002E0821 */ addu $at, $at, $t6 -/* 0556FC 80054AFC C426CB9C */ lwc1 $f6, -0x3464($at) +/* 0556FC 80054AFC C426CB9C */ lwc1 $f6, %lo(D_800DCB9C)($at) /* 055700 80054B00 18800002 */ blez $a0, .L80054B0C /* 055704 80054B04 46069000 */ add.s $f0, $f18, $f6 /* 055708 80054B08 00801825 */ move $v1, $a0 diff --git a/asm/non_matchings/unknown_0AEE70/func_800B0698.s b/asm/non_matchings/unknown_0AEE70/func_800B0698.s index 6e102e5c..58da9dfc 100644 --- a/asm/non_matchings/unknown_0AEE70/func_800B0698.s +++ b/asm/non_matchings/unknown_0AEE70/func_800B0698.s @@ -218,12 +218,12 @@ glabel func_800B0698 /* 0B15C0 800B09C0 0C02C004 */ jal func_800B0010 /* 0B15C4 800B09C4 AFA3002C */ sw $v1, 0x2c($sp) /* 0B15C8 800B09C8 8E0D0040 */ lw $t5, 0x40($s0) -/* 0B15CC 800B09CC 3C01800E */ lui $at, 0x800e +/* 0B15CC 800B09CC 3C01800E */ lui $at, %hi(D_800E2E2C) #$at, 0x800e /* 0B15D0 800B09D0 000D7903 */ sra $t7, $t5, 4 /* 0B15D4 800B09D4 31EE0007 */ andi $t6, $t7, 7 /* 0B15D8 800B09D8 000EC080 */ sll $t8, $t6, 2 /* 0B15DC 800B09DC 00380821 */ addu $at, $at, $t8 -/* 0B15E0 800B09E0 C4322E2C */ lwc1 $f18, 0x2e2c($at) +/* 0B15E0 800B09E0 C4322E2C */ lwc1 $f18, %lo(D_800E2E2C)($at) /* 0B15E4 800B09E4 92190039 */ lbu $t9, 0x39($s0) /* 0B15E8 800B09E8 8FA3002C */ lw $v1, 0x2c($sp) /* 0B15EC 800B09EC 8FA60034 */ lw $a2, 0x34($sp) diff --git a/asm/non_matchings/unknown_0AEE70/func_800B1130.s b/asm/non_matchings/unknown_0AEE70/func_800B1130.s index 1a7151e9..422f24af 100644 --- a/asm/non_matchings/unknown_0AEE70/func_800B1130.s +++ b/asm/non_matchings/unknown_0AEE70/func_800B1130.s @@ -687,12 +687,12 @@ glabel func_800B1130 /* 0B2724 800B1B24 0C02C004 */ jal func_800B0010 /* 0B2728 800B1B28 02203825 */ move $a3, $s1 /* 0B272C 800B1B2C 8E0C0040 */ lw $t4, 0x40($s0) -/* 0B2730 800B1B30 3C01800E */ lui $at, 0x800e +/* 0B2730 800B1B30 3C01800E */ lui $at, %hi(D_800E2E2C) #$at, 0x800e /* 0B2734 800B1B34 000C6903 */ sra $t5, $t4, 4 /* 0B2738 800B1B38 31AF0007 */ andi $t7, $t5, 7 /* 0B273C 800B1B3C 000F7080 */ sll $t6, $t7, 2 /* 0B2740 800B1B40 002E0821 */ addu $at, $at, $t6 -/* 0B2744 800B1B44 C4242E2C */ lwc1 $f4, 0x2e2c($at) +/* 0B2744 800B1B44 C4242E2C */ lwc1 $f4, %lo(D_800E2E2C)($at) /* 0B2748 800B1B48 92180039 */ lbu $t8, 0x39($s0) /* 0B274C 800B1B4C 8FA60044 */ lw $a2, 0x44($sp) /* 0B2750 800B1B50 24010005 */ li $at, 5 diff --git a/data/dkr.data.s b/data/dkr.data.s index 2d942215..facf2d7b 100644 --- a/data/dkr.data.s +++ b/data/dkr.data.s @@ -14187,6 +14187,8 @@ glabel D_800E98B0 .word 0x00000000 .word 0x4197D784 .word 0x00000000 + +glabel D_800E98C0 .word 0x7F810000 .word 0x00000000 .word 0x00000000 diff --git a/lib/asm/non_matchings/unknown_0D3020/cosf.s b/lib/asm/non_matchings/unknown_0D3020/cosf.s index 964b2c59..f2f95704 100644 --- a/lib/asm/non_matchings/unknown_0D3020/cosf.s +++ b/lib/asm/non_matchings/unknown_0D3020/cosf.s @@ -87,12 +87,12 @@ glabel cosf /* 0D57F0 800D4BF0 460A5032 */ c.eq.s $f10, $f10 .L800D4BF4: -/* 0D57F4 800D4BF4 3C01800F */ lui $at, 0x800f +/* 0D57F4 800D4BF4 3C01800F */ lui $at, %hi(D_800E98C0) #$at, 0x800f /* 0D57F8 800D4BF8 45010004 */ bc1t .L800D4C0C /* 0D57FC 800D4BFC 00000000 */ nop /* 0D5800 800D4C00 3C01800F */ lui $at, 0x800f /* 0D5804 800D4C04 03E00008 */ jr $ra -/* 0D5808 800D4C08 C42098C0 */ lwc1 $f0, -0x6740($at) +/* 0D5808 800D4C08 C42098C0 */ lwc1 $f0, %lo(D_800E98C0)($at) .L800D4C0C: /* 0D580C 800D4C0C C4209800 */ lwc1 $f0, -0x6800($at) diff --git a/lib/asm/non_matchings/unknown_0D3020/sinf.s b/lib/asm/non_matchings/unknown_0D3020/sinf.s index 4a758449..2278aa9b 100644 --- a/lib/asm/non_matchings/unknown_0D3020/sinf.s +++ b/lib/asm/non_matchings/unknown_0D3020/sinf.s @@ -112,12 +112,12 @@ glabel sinf .L800D4DB8: /* 0D59B8 800D4DB8 46042032 */ c.eq.s $f4, $f4 -/* 0D59BC 800D4DBC 3C01800F */ lui $at, 0x800f +/* 0D59BC 800D4DBC 3C01800F */ lui $at, %hi(D_800E98C0) #$at, 0x800f /* 0D59C0 800D4DC0 45010004 */ bc1t .L800D4DD4 /* 0D59C4 800D4DC4 00000000 */ nop /* 0D59C8 800D4DC8 3C01800F */ lui $at, 0x800f /* 0D59CC 800D4DCC 03E00008 */ jr $ra -/* 0D59D0 800D4DD0 C42098C0 */ lwc1 $f0, -0x6740($at) +/* 0D59D0 800D4DD0 C42098C0 */ lwc1 $f0, %lo(D_800E98C0)($at) .L800D4DD4: /* 0D59D4 800D4DD4 C4209850 */ lwc1 $f0, -0x67b0($at) diff --git a/src/unknown_043920.c b/src/unknown_043920.c index 54c512b4..38febf2c 100644 --- a/src/unknown_043920.c +++ b/src/unknown_043920.c @@ -22,17 +22,20 @@ f32 D_800DCB60[14] = { }; s32 D_800DCB98 = 0; // Currently unknown, might be a different type. -f32 D_800DCB9C[38] = { +f32 D_800DCB9C[19] = { 0.004f, 0.007f, 0.0099999999f, 0.004f, 0.0099999999f, 0.0099999999f, 0.0099999999f, 0.0099999999f, 0.0099999999f, 0.0099999999f, 0.004f, 0.004f, 0.004f, 0.004f, 0.004f, 0.004f, - 0.004f, 0.004f, 0.004f, 0.8f, - 0.85f, 0.85f, 0.5f, 0.5f, - 0.5f, 0.5f, 0.5f, 0.5f, - 0.5f, 0.5f, 0.8f, 0.8f, - 0.84f, 0.8f, 0.8f, 0.8f, - 0.8f, 0.8f + 0.004f, 0.004f, 0.004f +}; + +f32 D_800DCBE8[19] = { + 0.8f, 0.85f, 0.85f, 0.5f, + 0.5f, 0.5f, 0.5f, 0.5f, + 0.5f, 0.5f, 0.5f, 0.8f, + 0.8f, 0.84f, 0.8f, 0.8f, + 0.8f, 0.8f, 0.8f }; // Unused? Not sure if this is actually an array or just some random data. diff --git a/src/unknown_0AEE70.c b/src/unknown_0AEE70.c index 0a2b8784..4af88825 100644 --- a/src/unknown_0AEE70.c +++ b/src/unknown_0AEE70.c @@ -92,8 +92,10 @@ unk800E2DF8 D_800E2DF8[2] = { }, }; -f32 D_800E2E28[9] = { - 0.0f, 0.0f, 0.1, 0.2f, 0.3f, 0.45f, 0.525f, 0.6f, 0.8f +f32 D_800E2E28 = 0.0f; + +f32 D_800E2E2C[8] = { + 0.0f, 0.1, 0.2f, 0.3f, 0.45f, 0.525f, 0.6f, 0.8f }; s32 D_800E2E4C = 0; diff --git a/tools/python/find_glabels.py b/tools/python/find_glabels.py index c5f7dc14..b0b1bf07 100644 --- a/tools/python/find_glabels.py +++ b/tools/python/find_glabels.py @@ -3,13 +3,13 @@ import re from file_util import FileUtil LINE_START_REGEX = r'\n(/\* ([0-9A-F]{6}) [0-9A-F]{8} [0-9A-F]{8} \*/\s+|\.L80[0-9A-F]{6}:)' -REG_REGEX = r'(\$(at|v[0-1]|a[0-3]|t[0-9]|s[0-7]|k[0-1]|gp|sp|fp|ra|zero))' +REG_REGEX = r'(\$(at|v[0-1]|a[0-3]|t[0-9]|s[0-7]|f[0-9]{1,2}|k[0-1]|gp|sp|fp|ra|zero))' GLABEL_UPPER_REGEX = '(' + LINE_START_REGEX + r'lui\s+' + REG_REGEX + r',\s+(0x80[0-9a-f]{2}))' -GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'[sl][bhw]u?\s+' + REG_REGEX + r',\s+(-?0x[0-9a-f]{4})\(\4\))' +GLABEL_LOWER_REGEX = '(' + LINE_START_REGEX + r'[sl][bhw](u|c1)?\s+' + REG_REGEX + r',\s+(-?0x[0-9a-f]{4})\(\4\))' GLABEL_REGEX = GLABEL_UPPER_REGEX + '(' + LINE_START_REGEX + '[^\n]*){0,10}' + GLABEL_LOWER_REGEX UPPER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*lui\s+)([^\n]*)' -LOWER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*[ls][bhw]u?\s+' + REG_REGEX + r',\s+)-?0x[0-9a-f]{4}([^\n]*)' +LOWER_INSTR_REGEX_TMPL = r'(/\* %s[^\n]*[ls][bhw](u|c1)?\s+' + REG_REGEX + r',\s+)-?0x[0-9a-f]{4}([^\n]*)' IGNORE_GLABELS = ['D_800E389E', 'D_801264A1', 'D_800E1B84'] @@ -22,7 +22,7 @@ def _find_glabels(asm): reg = match[3] offsets = (match[2], match[11]) # ROM offsets of the lui and [sl][bhw] glabel_upper = int(match[5], 16) # upper immediate of glabel - glabel_lower = int(match[14], 16) # lower immediate of the glabel + glabel_lower = int(match[15], 16) # lower immediate of the glabel if glabel_lower < 0: glabel_lower = (-glabel_lower ^ 0xFFFF) + 1 if glabel_lower & 0x8000: @@ -36,7 +36,7 @@ def _find_glabels(asm): contents) # replace lower instruction contents = re.sub(LOWER_INSTR_REGEX_TMPL % offsets[1], - r'\1' + '%%lo(%s)' % (glabel) + r'\4', + r'\1' + '%%lo(%s)' % (glabel) + r'\5', contents) if len(matches): FileUtil.write_text_to_file(file, contents) diff --git a/undefined_syms.txt b/undefined_syms.txt index 28c6dac2..b54de153 100755 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -168,6 +168,7 @@ D_800DCB50 = 0x800DCB50; D_800DCB54 = 0x800DCB54; D_800DCB98 = 0x800DCB98; D_800DCB9C = 0x800DCB9C; +D_800DCBE8 = 0x800DCBE8; D_800DCC34 = 0x800DCC34; D_800DCC80 = 0x800DCC80; D_800DCCCC = 0x800DCCCC; @@ -683,6 +684,7 @@ D_800E2D58 = 0x800E2D58; D_800E2D78 = 0x800E2D78; D_800E2DF8 = 0x800E2DF8; D_800E2E28 = 0x800E2E28; +D_800E2E2C = 0x800E2E2C; D_800E2E4C = 0x800E2E4C; D_800E2E50 = 0x800E2E50; D_800E2E54 = 0x800E2E54; @@ -1815,6 +1817,7 @@ D_800E9860 = 0x800E9860; D_800E98A8 = 0x800E98A8; D_800E98AC = 0x800E98AC; D_800E98B0 = 0x800E98B0; +D_800E98C0 = 0x800E98C0; D_800E98D0 = 0x800E98D0; D_800EA3A0 = 0x800EA3A0; D_800EABA0 = 0x800EABA0;