From 8762a95381ea9fecde8ad27f88461219c7947037 Mon Sep 17 00:00:00 2001 From: Lucas Azevedo Date: Tue, 30 Apr 2024 02:26:06 -0300 Subject: [PATCH] Test FUN_8c010bae --- scripts/run_tests.sh | 3 + src/non_matching/_000188_8c0100bc_sound.c | 3 + tests/0100bc_sound/010a40_FUN_adxVol.php | 2 - tests/0100bc_sound/010bae_FUN.php | 68 +++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 tests/0100bc_sound/010bae_FUN.php diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 767baa6..e459c85 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -46,6 +46,9 @@ $sh4objtest "tests/0100bc_sound/010972_setAdxVol.php" "build/output/_000188_8c01 $sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/0100bc_sound_src.obj" $sh4objtest "tests/0100bc_sound/010a40_FUN_adxVol.php" "build/output/_000188_8c0100bc_sound_c.obj" +$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/0100bc_sound_src.obj" +$sh4objtest "tests/0100bc_sound/010bae_FUN.php" "build/output/_000188_8c0100bc_sound_c.obj" + # 015ab8_title assemble src/asm/decompiled/015ab8_title.src $sh4objtest "tests/015ab8_title.php" "build/output/015ab8_title_src.obj" diff --git a/src/non_matching/_000188_8c0100bc_sound.c b/src/non_matching/_000188_8c0100bc_sound.c index ca6c6fe..fc3c8b1 100644 --- a/src/non_matching/_000188_8c0100bc_sound.c +++ b/src/non_matching/_000188_8c0100bc_sound.c @@ -561,6 +561,7 @@ void setMidiVolAndInitStruct_8c0109f4(int param1) { initUknVol_8c0100bc(); } +/* Tested */ void FUN_adxVol_8c010a40() { /* 8c010a56 */ if ((var_uknAdxVol_8c157a34.flags_0x00 & 0xf) != 0) @@ -652,11 +653,13 @@ void FUN_8c010bae(int param1) { if ((var_uknAdxVol_8c157a34.flags_0x00 & 0xf0) == 0) { /* 8c010bba */ if (param1 == 0 && (var_uknAdxVol_8c157a34.flags_0x00 & 0xf) != 1) { + /* A */ var_uknAdxVol_8c157a34.flags_0x00 |= 1; var_uknAdxVol_8c157a34.field_0x04 = (init_uknAdxVol_8c03bd88.field_0x00 - 300) / 90; var_uknAdxVol_8c157a34.field_0x0c = init_uknAdxVol_8c03bd88.field_0x00 - 990; } if (param1 == 1 && (var_uknAdxVol_8c157a34.flags_0x00 & 0xf) != 2) { + /* B */ var_uknAdxVol_8c157a34.flags_0x00 |= 2; var_uknAdxVol_8c157a34.field_0x08 = (init_uknAdxVol_8c03bd88.field_0x04 - 300) / 90; var_uknAdxVol_8c157a34.field_0x10 = init_uknAdxVol_8c03bd88.field_0x04 - 990; diff --git a/tests/0100bc_sound/010a40_FUN_adxVol.php b/tests/0100bc_sound/010a40_FUN_adxVol.php index c7ad140..83a83f3 100644 --- a/tests/0100bc_sound/010a40_FUN_adxVol.php +++ b/tests/0100bc_sound/010a40_FUN_adxVol.php @@ -176,8 +176,6 @@ public function test_pathH() 0b1100_0000 ); - //$this->shouldWrite($this->addressOf('_init_8c03bd80'), 0b11011111); - $this->call('_FUN_adxVol_8c010a40')->run(); } diff --git a/tests/0100bc_sound/010bae_FUN.php b/tests/0100bc_sound/010bae_FUN.php new file mode 100644 index 0000000..cd4f572 --- /dev/null +++ b/tests/0100bc_sound/010bae_FUN.php @@ -0,0 +1,68 @@ +resolveSymbols(); + + $this->initUint32($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 1); + + $this->call('_FUN_8c010bae')->with(0)->run(); + } + + public function test_pathNone2() + { + $this->resolveSymbols(); + + $this->initUint32($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0xf0); + + $this->call('_FUN_8c010bae')->with(0)->run(); + } + + public function test_pathNone3() + { + $this->resolveSymbols(); + + $this->initUint32($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0xf0); + + $this->call('_FUN_8c010bae')->with(3)->run(); + } + + public function test_pathA() + { + $this->resolveSymbols(); + + $this->initUint32($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0b100); + $this->initUint32($this->addressOf('_init_uknAdxVol_8c03bd88') + 0x00, 660); + + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0b101); + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x04, 4); + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x0c, -330); + + $this->call('_FUN_8c010bae')->with(0)->run(); + } + + public function test_pathB() + { + $this->resolveSymbols(); + + $this->initUint32($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0b100); + $this->initUint32($this->addressOf('_init_uknAdxVol_8c03bd88') + 0x04, 660); + + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x00, 0b110); + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x08, 4); + $this->shouldWrite($this->addressOf('_var_uknAdxVol_8c157a34') + 0x10, -330); + + $this->call('_FUN_8c010bae')->with(1)->run(); + } + + private function resolveSymbols(): void + { + // Functions + $this->setSize('__divls', 4); + } +};