From 6f12152b2b711416144552a27e5f27db2a43db6e Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sat, 5 Jun 2021 15:17:20 -0500 Subject: [PATCH] Moved rodata from C to GLOBAL_ASM in lib/unknown_0CA9A0 --- .../unknown_0CA9A0/alEnvMixerPull.s | 29 +++++++++++++++-- .../unknown_0CA9A0/alResampleParam.s | 15 +++++++-- .../unknown_0CA9A0/alResamplePull.s | 7 ++++ .../unknown_0CA9A0/func_800CAC5C.s | 9 ++++++ .../unknown_0CA9A0/func_800CB2D4.s | 5 +++ lib/src/unknown_0CA9A0.c | 32 ------------------- tools/asm_processor/build.py | 3 +- 7 files changed, 63 insertions(+), 37 deletions(-) diff --git a/lib/asm/non_matchings/unknown_0CA9A0/alEnvMixerPull.s b/lib/asm/non_matchings/unknown_0CA9A0/alEnvMixerPull.s index 0223ecb5..fd46b47c 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/alEnvMixerPull.s +++ b/lib/asm/non_matchings/unknown_0CA9A0/alEnvMixerPull.s @@ -1,3 +1,22 @@ +.rdata +glabel D_800E9560 +.asciz "samples >= 0" +.ascii "\0\0\0" # padding +glabel D_800E9570 +.asciz "env.c" +.ascii "\0\0" # padding +glabel D_800E9578 +.asciz "samples <= AL_MAX_RSP_SAMPLES" +.ascii "\0\0" # padding +glabel D_800E9598 +.asciz "env.c" +.ascii "\0\0" # padding + +.late_rodata +glabel jpt_800E95B0 +.word L800CA870, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA8C4, L800CA460, L800CA460, L800CA22C, L800CA7A8, L800CA828, L800CA460 + +.text glabel alEnvMixerPull /* 0CACD0 800CA0D0 27BDFFA0 */ addiu $sp, $sp, -0x60 /* 0CACD4 800CA0D4 AFBF001C */ sw $ra, 0x1c($sp) @@ -86,12 +105,13 @@ glabel alEnvMixerPull /* 0CAE08 800CA208 102001AE */ beqz $at, .L800CA8C4 /* 0CAE0C 800CA20C 00000000 */ nop /* 0CAE10 800CA210 000C6080 */ sll $t4, $t4, 2 -/* 0CAE14 800CA214 3C01800F */ lui $at, %hi(D_800E95B0) # $at, 0x800f +/* 0CAE14 800CA214 3C01800F */ lui $at, %hi(jpt_800E95B0) # $at, 0x800f /* 0CAE18 800CA218 002C0821 */ addu $at, $at, $t4 -/* 0CAE1C 800CA21C 8C2C95B0 */ lw $t4, %lo(D_800E95B0)($at) +/* 0CAE1C 800CA21C 8C2C95B0 */ lw $t4, %lo(jpt_800E95B0)($at) /* 0CAE20 800CA220 00000000 */ nop /* 0CAE24 800CA224 01800008 */ jr $t4 /* 0CAE28 800CA228 00000000 */ nop +glabel L800CA22C /* 0CAE2C 800CA22C 8FAD0058 */ lw $t5, 0x58($sp) /* 0CAE30 800CA230 00000000 */ nop /* 0CAE34 800CA234 8DAE003C */ lw $t6, 0x3c($t5) @@ -240,6 +260,7 @@ glabel alEnvMixerPull .L800CA458: /* 0CB058 800CA458 10000134 */ b .L800CA92C /* 0CB05C 800CA45C 00000000 */ nop +glabel L800CA460 /* 0CB060 800CA460 8FB8006C */ lw $t8, 0x6c($sp) /* 0CB064 800CA464 8FA8005C */ lw $t0, 0x5c($sp) /* 0CB068 800CA468 8FA40058 */ lw $a0, 0x58($sp) @@ -460,6 +481,7 @@ glabel alEnvMixerPull /* 0CB39C 800CA79C ADF90038 */ sw $t9, 0x38($t7) /* 0CB3A0 800CA7A0 10000062 */ b .L800CA92C /* 0CB3A4 800CA7A4 00000000 */ nop +glabel L800CA7A8 /* 0CB3A8 800CA7A8 8FAD0058 */ lw $t5, 0x58($sp) /* 0CB3AC 800CA7AC 00000000 */ nop /* 0CB3B0 800CA7B0 8DAC003C */ lw $t4, 0x3c($t5) @@ -493,6 +515,7 @@ glabel alEnvMixerPull /* 0CB41C 800CA81C 01002025 */ move $a0, $t0 /* 0CB420 800CA820 10000042 */ b .L800CA92C /* 0CB424 800CA824 00000000 */ nop +glabel L800CA828 /* 0CB428 800CA828 8FAF006C */ lw $t7, 0x6c($sp) /* 0CB42C 800CA82C 8FAD005C */ lw $t5, 0x5c($sp) /* 0CB430 800CA830 8FA40058 */ lw $a0, 0x58($sp) @@ -511,6 +534,7 @@ glabel alEnvMixerPull /* 0CB464 800CA864 01802025 */ move $a0, $t4 /* 0CB468 800CA868 10000030 */ b .L800CA92C /* 0CB46C 800CA86C 00000000 */ nop +glabel L800CA870 /* 0CB470 800CA870 3C0A800E */ lui $t2, %hi(alGlobals) # $t2, 0x800e /* 0CB474 800CA874 8D4A3780 */ lw $t2, %lo(alGlobals)($t2) /* 0CB478 800CA878 00000000 */ nop @@ -533,6 +557,7 @@ glabel alEnvMixerPull /* 0CB4BC 800CA8BC 1000001B */ b .L800CA92C /* 0CB4C0 800CA8C0 00000000 */ nop .L800CA8C4: +glabel L800CA8C4 /* 0CB4C4 800CA8C4 8FAF006C */ lw $t7, 0x6c($sp) /* 0CB4C8 800CA8C8 8FAD005C */ lw $t5, 0x5c($sp) /* 0CB4CC 800CA8CC 8FA40058 */ lw $a0, 0x58($sp) diff --git a/lib/asm/non_matchings/unknown_0CA9A0/alResampleParam.s b/lib/asm/non_matchings/unknown_0CA9A0/alResampleParam.s index a587bdec..bbe73705 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/alResampleParam.s +++ b/lib/asm/non_matchings/unknown_0CA9A0/alResampleParam.s @@ -1,3 +1,8 @@ +.late_rodata +glabel jpt_800E9600 +.word L800CC0C0, L800CC150, L800CC150, L800CC0C8, L800CC150, L800CC150, L800CC134, L800CC144, L800CC104 + +.text glabel alResampleParam /* 0CCC90 800CC090 24AEFFFF */ addiu $t6, $a1, -1 /* 0CCC94 800CC094 27BDFFD8 */ addiu $sp, $sp, -0x28 @@ -6,13 +11,15 @@ glabel alResampleParam /* 0CCCA0 800CC0A0 1020002B */ beqz $at, .L800CC150 /* 0CCCA4 800CC0A4 00803825 */ move $a3, $a0 /* 0CCCA8 800CC0A8 000E7080 */ sll $t6, $t6, 2 -/* 0CCCAC 800CC0AC 3C01800F */ lui $at, %hi(D_800E9600) # $at, 0x800f +/* 0CCCAC 800CC0AC 3C01800F */ lui $at, %hi(jpt_800E9600) # $at, 0x800f /* 0CCCB0 800CC0B0 002E0821 */ addu $at, $at, $t6 -/* 0CCCB4 800CC0B4 8C2E9600 */ lw $t6, %lo(D_800E9600)($at) +/* 0CCCB4 800CC0B4 8C2E9600 */ lw $t6, %lo(jpt_800E9600)($at) /* 0CCCB8 800CC0B8 01C00008 */ jr $t6 /* 0CCCBC 800CC0BC 00000000 */ nop +glabel L800CC0C0 /* 0CCCC0 800CC0C0 10000029 */ b .L800CC168 /* 0CCCC4 800CC0C4 ACE60000 */ sw $a2, ($a3) +glabel L800CC0C8 /* 0CCCC8 800CC0C8 8CE40000 */ lw $a0, ($a3) /* 0CCCCC 800CC0CC 44802000 */ mtc1 $zero, $f4 /* 0CCCD0 800CC0D0 240F0001 */ li $t7, 1 @@ -28,6 +35,7 @@ glabel alResampleParam /* 0CCCF8 800CC0F8 00000000 */ nop /* 0CCCFC 800CC0FC 1000001B */ b .L800CC16C /* 0CCD00 800CC100 8FBF0014 */ lw $ra, 0x14($sp) +glabel L800CC104 /* 0CCD04 800CC104 8CE40000 */ lw $a0, ($a3) /* 0CCD08 800CC108 24180001 */ li $t8, 1 /* 0CCD0C 800CC10C ACF80030 */ sw $t8, 0x30($a3) @@ -40,14 +48,17 @@ glabel alResampleParam /* 0CCD28 800CC128 00000000 */ nop /* 0CCD2C 800CC12C 1000000F */ b .L800CC16C /* 0CCD30 800CC130 8FBF0014 */ lw $ra, 0x14($sp) +glabel L800CC134 /* 0CCD34 800CC134 AFA6001C */ sw $a2, 0x1c($sp) /* 0CCD38 800CC138 C7A6001C */ lwc1 $f6, 0x1c($sp) /* 0CCD3C 800CC13C 1000000A */ b .L800CC168 /* 0CCD40 800CC140 E4E60018 */ swc1 $f6, 0x18($a3) +glabel L800CC144 /* 0CCD44 800CC144 24080001 */ li $t0, 1 /* 0CCD48 800CC148 10000007 */ b .L800CC168 /* 0CCD4C 800CC14C ACE8001C */ sw $t0, 0x1c($a3) .L800CC150: +glabel L800CC150 /* 0CCD50 800CC150 8CE40000 */ lw $a0, ($a3) /* 0CCD54 800CC154 50800005 */ beql $a0, $zero, .L800CC16C /* 0CCD58 800CC158 8FBF0014 */ lw $ra, 0x14($sp) diff --git a/lib/asm/non_matchings/unknown_0CA9A0/alResamplePull.s b/lib/asm/non_matchings/unknown_0CA9A0/alResamplePull.s index d6965aea..913eafb3 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/alResamplePull.s +++ b/lib/asm/non_matchings/unknown_0CA9A0/alResamplePull.s @@ -1,3 +1,10 @@ +.late_rodata +glabel D_800E9628 +.double 1.99996 +glabel D_800E9630 +.float 1.99996 + +.text glabel alResamplePull /* 0CCD7C 800CC17C 27BDFFB0 */ addiu $sp, $sp, -0x50 /* 0CCD80 800CC180 AFBF001C */ sw $ra, 0x1c($sp) diff --git a/lib/asm/non_matchings/unknown_0CA9A0/func_800CAC5C.s b/lib/asm/non_matchings/unknown_0CA9A0/func_800CAC5C.s index 7dbcf758..f9ac2f19 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/func_800CAC5C.s +++ b/lib/asm/non_matchings/unknown_0CA9A0/func_800CAC5C.s @@ -1,3 +1,12 @@ +.rdata +glabel D_800E95A0 +.asciz "source" +.ascii "\0" # padding +glabel D_800E95A8 +.asciz "env.c" +.ascii "\0\0" # padding + +.text glabel func_800CAC5C /* 0CB85C 800CAC5C 27BDFFB0 */ addiu $sp, $sp, -0x50 /* 0CB860 800CAC60 AFBF001C */ sw $ra, 0x1c($sp) diff --git a/lib/asm/non_matchings/unknown_0CA9A0/func_800CB2D4.s b/lib/asm/non_matchings/unknown_0CA9A0/func_800CB2D4.s index 1d6e1baa..e054b24f 100644 --- a/lib/asm/non_matchings/unknown_0CA9A0/func_800CB2D4.s +++ b/lib/asm/non_matchings/unknown_0CA9A0/func_800CB2D4.s @@ -1,3 +1,8 @@ +.late_rodata +glabel D_800E95F8 +.double 65535.0 + +.text glabel func_800CB2D4 /* 0CBED4 800CB2D4 27BDFFF0 */ addiu $sp, $sp, -0x10 /* 0CBED8 800CB2D8 8FAE0020 */ lw $t6, 0x20($sp) diff --git a/lib/src/unknown_0CA9A0.c b/lib/src/unknown_0CA9A0.c index d92dbe42..38ba6f31 100644 --- a/lib/src/unknown_0CA9A0.c +++ b/lib/src/unknown_0CA9A0.c @@ -4,38 +4,6 @@ #include "types.h" #include "macros.h" -/************ .rodata ************/ - -const char D_800E9560[] = "samples >= 0"; -const char D_800E9570[] = "env.c"; -const char D_800E9578[] = "samples <= AL_MAX_RSP_SAMPLES"; -const char D_800E9598[] = "env.c"; -const char D_800E95A0[] = "source"; -const char D_800E95A8[] = "env.c"; - -// Jump table in alEnvMixerPull -const u32 D_800E95B0[] = { - 0x800CA870, 0x800CA8C4, 0x800CA8C4, 0x800CA8C4, - 0x800CA8C4, 0x800CA8C4, 0x800CA8C4, 0x800CA8C4, - 0x800CA8C4, 0x800CA8C4, 0x800CA8C4, 0x800CA460, - 0x800CA460, 0x800CA22C, 0x800CA7A8, 0x800CA828, - 0x800CA460 -}; - -const DoubleLiteral D_800E95F8 = { 65535.0 }; - -// Jump table in alResampleParam -const u32 D_800E9600[] = { - 0x800CC0C0, 0x800CC150, 0x800CC150, 0x800CC0C8, - 0x800CC150, 0x800CC150, 0x800CC134, 0x800CC144, - 0x800CC104 -}; - -const DoubleLiteral D_800E9628 = { 1.99996 }; -const FloatLiteral D_800E9630 = { 1.99996f }; - -/*********************************/ - GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/alFilterNew.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/alEnvMixerPull.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0CA9A0/alEnvmixerParam.s") diff --git a/tools/asm_processor/build.py b/tools/asm_processor/build.py index 239c3443..396c3829 100755 --- a/tools/asm_processor/build.py +++ b/tools/asm_processor/build.py @@ -32,7 +32,8 @@ opt_flags = [x for x in compile_args if x in ['-g3', '-g', '-O1', '-O2', '-frame preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c', delete=False) try: - if '-O2' in opt_flags: + # Only want to apply -mips1 flag to the main source files. Not the lib files. + if ('-O2' in opt_flags) and (not 'lib/' in in_file): opt_flags.append('-mips1') asmproc_flags = opt_flags + [in_file, '--input-enc', 'utf-8', '--output-enc', 'euc-jp'] compile_cmdline = compiler + compile_args + ['-I', in_dir, '-o', out_file, preprocessed_file.name]