From 11bdbda071f7a2de6283f60b943e78bd78a791b6 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 11:10:48 -0400 Subject: [PATCH 01/25] WIP getHandle Decompilation --- src/MSound/MSoundBGM.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 9204d779..4e4acfac 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -41,6 +41,12 @@ bool MSBgm::checkPlaying(u32 param) { return false; } u32 MSBgm::getSceneNo(u32 param) { return 0; } -JAISound* MSBgm::getHandle(u8 param) { return nullptr; } +JAISound* MSBgm::getHandle(u8 param) +{ + if ((&smBgmInTrack) [param] != 0) { + return (JAISound*)((&smBgmInTrack)[param] + 0x14); + } + return 0; + } JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } From 499e91b286d890dcbfc9e923359b405c96dc8461 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 11:20:57 -0400 Subject: [PATCH 02/25] Edit 0 to nullptr for consientesy. --- src/MSound/MSoundBGM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 4e4acfac..7e0c23f9 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -46,7 +46,7 @@ JAISound* MSBgm::getHandle(u8 param) if ((&smBgmInTrack) [param] != 0) { return (JAISound*)((&smBgmInTrack)[param] + 0x14); } - return 0; + return nullptr; } JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } From 0b99bab4ebb712b22a0e8006db63b8a519f7e78b Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 12:57:40 -0400 Subject: [PATCH 03/25] Update According to @break-core revision --- src/MSound/MSoundBGM.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 7e0c23f9..f3f76f14 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -43,10 +43,11 @@ u32 MSBgm::getSceneNo(u32 param) { return 0; } JAISound* MSBgm::getHandle(u8 param) { - if ((&smBgmInTrack) [param] != 0) { - return (JAISound*)((&smBgmInTrack)[param] + 0x14); + JASystem::TTrack* track = smBgmInTrack[param]; + if (track) { + return (JAISound*)(&track[0x14]); + } + return nullptr; } - return nullptr; - } JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } From b265aef42c2365a2d13f815c271a408d3ab4d650 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 13:47:05 -0400 Subject: [PATCH 04/25] Implement getSceneNo --- src/MSound/MSoundBGM.cpp | 99 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index f3f76f14..2a5dcb76 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -39,7 +39,104 @@ void MSBgm::setStageBgmYoshiPercussion(bool param) { } bool MSBgm::checkPlaying(u32 param) { return false; } -u32 MSBgm::getSceneNo(u32 param) { return 0; } +u32 MSBgm::getSceneNo(u32 param) { + switch(param) { + case 0x80010001: + return 0x201; + case 0x80010002: + return 0x202; + case 0x80010003: + return 0x203; + case 0x80010004: + return 0x204; + case 0x80010005: + return 0x204; + case 0x80010006: + return 0x205; + case 0x80010007: + return 0x206; + case 0x80010008: + return 0x207; + case 0x80010009: + return 0x208; + case 0x8001000a: + return 0x210; + case 0x8001000b: + return 0x210; + case 0x8001000c: + return 0x210; + case 0x8001000d: + return 0x210; + case 0x8001000e: + return 0x20a; + case 0x8001000f: + return 0x209; + case 0x80010010: + return 0x20a; + case 0x80010011: + return 0xffffffff; + case 0x80010012: + return 0x20c; + case 0x80010013: + return 0x20d; + case 0x80010014: + return 0x20e; + case 0x80010015: + return 0x20f; + case 0x80010016: + return 0x210; + case 0x80010017: + return 0x210; + case 0x80010018: + return 0x206; + case 0x80010019: + return 0x211; + case 0x8001001a: + return 0x212; + case 0x8001001b: + return 0x210; + case 0x8001001c: + return 0x20a; + case 0x8001001d: + return 0x206; + case 0x8001001e: + return 0x20d; + case 0x8001001f: + return 0x210; + case 0x80010020: + return 0x210; + case 0x80010021: + return 0x214; + case 0x80010022: + return 0x206; + case 0x80010023: + return 0x204; + case 0x80010024: + return 0x210; + case 0x80010025: + return 0x20d; + case 0x80010026: + return 0x210; + case 0x80010027: + return 0x210; + case 0x80010028: + return 0x210; + case 0x80010029: + return 0x210; + case 0x8001002a: + return 0x210; + case 0x8001002b: + return 0x210; + case 0x8001002c: + return 0x206; + default: + return 0xffffffff; + case 0x8001002e: + return 0x215; + case 0x8001002f: + return 0x210; + } + } JAISound* MSBgm::getHandle(u8 param) { From 2cdbe7fb1d9e3c881ed7e8400bdd81aae7130b0d Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 13:49:53 -0400 Subject: [PATCH 05/25] 100% GETSCENENO MATCHING LETS GOOOOO --- src/MSound/MSoundBGM.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 2a5dcb76..97f23e18 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -129,12 +129,12 @@ u32 MSBgm::getSceneNo(u32 param) { return 0x210; case 0x8001002c: return 0x206; - default: - return 0xffffffff; case 0x8001002e: return 0x215; case 0x8001002f: return 0x210; + default: + return 0xffffffff; } } From c1934f870ab43d23121d2786e7e0b84bb8cc5cb7 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 14:49:06 -0400 Subject: [PATCH 06/25] Broken SetTrack Volume --- src/MSound/MSoundBGM.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 97f23e18..4740b176 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -19,7 +19,15 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) MSBgm* bgm = JALListS::search(param1 & 0x3FF); } -void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { } +void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { + JAISound* sound = nullptr; + + if (((&smBgmInTrack)[param1] != 0) && + (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { + JAISound::setVolume(param1,param2,param3,param4); + } + return; + } void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } From c64fba9098e4f0290a34ba33fe24187914a2ea74 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 15:07:11 -0400 Subject: [PATCH 07/25] 76% matching SetTrackVolume --- src/MSound/MSoundBGM.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 4740b176..9c1d3148 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -21,10 +21,12 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { JAISound* sound = nullptr; - - if (((&smBgmInTrack)[param1] != 0) && + + JASystem::TTrack* track = smBgmInTrack[param1]; + if ((track) && (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { - JAISound::setVolume(param1,param2,param3,param4); + //Using JAISound::setVolume instead causes an Static Error. + setVolume(param1,param2,param3,param4); } return; } From 0010d977d77fcc2134e74259e41a7c81d6632f36 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 21 Apr 2025 15:08:34 -0400 Subject: [PATCH 08/25] Actually 74% I forgot for a second --- src/MSound/MSoundBGM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 9c1d3148..f051db47 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -25,7 +25,7 @@ void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { JASystem::TTrack* track = smBgmInTrack[param1]; if ((track) && (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { - //Using JAISound::setVolume instead causes an Static Error. + //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. setVolume(param1,param2,param3,param4); } return; From f70783ad47534fb9a084ed5b1bda73adcdabe492 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 22 Apr 2025 15:21:23 -0400 Subject: [PATCH 09/25] I think this is what you said to do? --- include/MSound/MSoundBGM.hpp | 4 ++-- src/MSound/MSoundBGM.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index acd23e70..05cdb74a 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -14,8 +14,8 @@ class MSBgm : public JALListHioNode { MSBgm(); static JASystem::TTrack* smBgmInTrack[3]; - static f32 smMainVolume; - + static MSBgm* smMainVolume; + //static f32 smMainVolume; static void init(); static void startBGM(u32); static void stopBGM(u32, u32); diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index f051db47..d99dec51 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -2,7 +2,8 @@ #include JASystem::TTrack* MSBgm::smBgmInTrack[3]; -f32 MSBgm::smMainVolume = 0.75f; +//f32 MSBgm::smMainVolume = 0.75f; +MSBgm* MSBgm::smMainVolume; void MSBgm::init() { } From a2227c346c33003ca8f97bf3d2f8493cb286be48 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 22 Apr 2025 15:46:40 -0400 Subject: [PATCH 10/25] Change the right thing --- include/MSound/MSoundBGM.hpp | 5 ++--- src/MSound/MSoundBGM.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index 05cdb74a..f2a615f5 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -13,9 +13,8 @@ class MSBgm : public JALListHioNode { public: MSBgm(); - static JASystem::TTrack* smBgmInTrack[3]; - static MSBgm* smMainVolume; - //static f32 smMainVolume; + static MSBgm* smBgmInTrack[3]; + static f32 smMainVolume; static void init(); static void startBGM(u32); static void stopBGM(u32, u32); diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index d99dec51..4beb80e4 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -1,9 +1,8 @@ #include #include -JASystem::TTrack* MSBgm::smBgmInTrack[3]; -//f32 MSBgm::smMainVolume = 0.75f; -MSBgm* MSBgm::smMainVolume; +MSBgm* MSBgm::smBgmInTrack[3]; +f32 MSBgm::smMainVolume = 0.75f; void MSBgm::init() { } @@ -23,7 +22,7 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { JAISound* sound = nullptr; - JASystem::TTrack* track = smBgmInTrack[param1]; + MSBgm* track = smBgmInTrack[param1]; if ((track) && (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. @@ -151,7 +150,7 @@ u32 MSBgm::getSceneNo(u32 param) { JAISound* MSBgm::getHandle(u8 param) { - JASystem::TTrack* track = smBgmInTrack[param]; + MSBgm* track = smBgmInTrack[param]; if (track) { return (JAISound*)(&track[0x14]); } From 11b00e5fbec694a99e2182842a3124f5412c1e90 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 22 Apr 2025 15:47:49 -0400 Subject: [PATCH 11/25] Changing it to JAISound still doesn't work? --- src/MSound/MSoundBGM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 4beb80e4..936e316b 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -26,7 +26,7 @@ void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { if ((track) && (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. - setVolume(param1,param2,param3,param4); + JAISound::setVolume(param1,param2,param3,param4); } return; } From 339f8e27650992c0ae29a85fd68369b51cabd9c4 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 22 Apr 2025 16:01:00 -0400 Subject: [PATCH 12/25] Update DOcs I guess? --- src/MSound/MSoundBGM.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 936e316b..440b50f2 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -25,8 +25,11 @@ void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { MSBgm* track = smBgmInTrack[param1]; if ((track) && (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { + //TODO: fix FUnction to be matching //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. - JAISound::setVolume(param1,param2,param3,param4); + //Function should be something like JAISound::setVolume(param2,param3,param4); + //But due to a "a nonstatic member reference must be relative to a specific object" error with JAISound I can't + setVolume(param1, param2, param3, param4); } return; } From 41e229aa90517514c86c3a2dfabf822128e55330 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Wed, 23 Apr 2025 10:53:36 -0400 Subject: [PATCH 13/25] Change Value to track for 76% matching --- src/MSound/MSoundBGM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 440b50f2..d0dcc308 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -24,7 +24,7 @@ void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { MSBgm* track = smBgmInTrack[param1]; if ((track) && - (sound = *(JAISound **)((&smBgmInTrack)[param1] + 0x14), sound != (JAISound *)0x0)) { + (sound = *(JAISound **)(track + 0x14), sound != (JAISound *)0x0)) { //TODO: fix FUnction to be matching //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. //Function should be something like JAISound::setVolume(param2,param3,param4); From 29fc552cfc097a8bd970e09d56cf4c1f3d425d19 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Fri, 16 May 2025 17:12:52 -0400 Subject: [PATCH 14/25] Final edit to setTrackVolume For now --- src/MSound/MSoundBGM.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index d0dcc308..fb5ff094 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -22,18 +22,18 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { JAISound* sound = nullptr; - MSBgm* track = smBgmInTrack[param1]; + MSBgm* track = smBgmInTrack[param1]; if ((track) && - (sound = *(JAISound **)(track + 0x14), sound != (JAISound *)0x0)) { - //TODO: fix FUnction to be matching + (sound = *(JAISound **)(track + 0x14), sound != (JAISound*) 0x0)) { //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. //Function should be something like JAISound::setVolume(param2,param3,param4); //But due to a "a nonstatic member reference must be relative to a specific object" error with JAISound I can't - setVolume(param1, param2, param3, param4); + setVolume(param2,param3,param4, param1); } return; } + void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) { } From 14894cb64908c4154d0174fe07859ba6a14dfb75 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Fri, 16 May 2025 17:13:27 -0400 Subject: [PATCH 15/25] Format --- src/MSound/MSoundBGM.cpp | 141 ++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 69 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index fb5ff094..db59ae24 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -19,21 +19,23 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) MSBgm* bgm = JALListS::search(param1 & 0x3FF); } -void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { +void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) +{ JAISound* sound = nullptr; - - MSBgm* track = smBgmInTrack[param1]; - if ((track) && - (sound = *(JAISound **)(track + 0x14), sound != (JAISound*) 0x0)) { - //Using JAISound::setVolume instead causes an Static Error. Even though that is in the Decompiled Ghidra Code. - //Function should be something like JAISound::setVolume(param2,param3,param4); - //But due to a "a nonstatic member reference must be relative to a specific object" error with JAISound I can't - setVolume(param2,param3,param4, param1); + + MSBgm* track = smBgmInTrack[param1]; + if ((track) + && (sound = *(JAISound**)(track + 0x14), sound != (JAISound*)0x0)) { + // Using JAISound::setVolume instead causes an Static Error. Even + // though that is in the Decompiled Ghidra Code. Function should be + // something like JAISound::setVolume(param2,param3,param4); But due to + // a "a nonstatic member reference must be relative to a specific + // object" error with JAISound I can't + setVolume(param2, param3, param4, param1); } return; - } +} - void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) { } @@ -52,112 +54,113 @@ void MSBgm::setStageBgmYoshiPercussion(bool param) { } bool MSBgm::checkPlaying(u32 param) { return false; } -u32 MSBgm::getSceneNo(u32 param) { - switch(param) { +u32 MSBgm::getSceneNo(u32 param) +{ + switch (param) { case 0x80010001: - return 0x201; + return 0x201; case 0x80010002: - return 0x202; + return 0x202; case 0x80010003: - return 0x203; + return 0x203; case 0x80010004: - return 0x204; + return 0x204; case 0x80010005: - return 0x204; + return 0x204; case 0x80010006: - return 0x205; + return 0x205; case 0x80010007: - return 0x206; + return 0x206; case 0x80010008: - return 0x207; + return 0x207; case 0x80010009: - return 0x208; + return 0x208; case 0x8001000a: - return 0x210; + return 0x210; case 0x8001000b: - return 0x210; + return 0x210; case 0x8001000c: - return 0x210; + return 0x210; case 0x8001000d: - return 0x210; + return 0x210; case 0x8001000e: - return 0x20a; + return 0x20a; case 0x8001000f: - return 0x209; + return 0x209; case 0x80010010: - return 0x20a; + return 0x20a; case 0x80010011: - return 0xffffffff; + return 0xffffffff; case 0x80010012: - return 0x20c; + return 0x20c; case 0x80010013: - return 0x20d; + return 0x20d; case 0x80010014: - return 0x20e; + return 0x20e; case 0x80010015: - return 0x20f; + return 0x20f; case 0x80010016: - return 0x210; + return 0x210; case 0x80010017: - return 0x210; + return 0x210; case 0x80010018: - return 0x206; + return 0x206; case 0x80010019: - return 0x211; + return 0x211; case 0x8001001a: - return 0x212; + return 0x212; case 0x8001001b: - return 0x210; + return 0x210; case 0x8001001c: - return 0x20a; + return 0x20a; case 0x8001001d: - return 0x206; + return 0x206; case 0x8001001e: - return 0x20d; + return 0x20d; case 0x8001001f: - return 0x210; + return 0x210; case 0x80010020: - return 0x210; + return 0x210; case 0x80010021: - return 0x214; + return 0x214; case 0x80010022: - return 0x206; + return 0x206; case 0x80010023: - return 0x204; + return 0x204; case 0x80010024: - return 0x210; + return 0x210; case 0x80010025: - return 0x20d; + return 0x20d; case 0x80010026: - return 0x210; + return 0x210; case 0x80010027: - return 0x210; + return 0x210; case 0x80010028: - return 0x210; + return 0x210; case 0x80010029: - return 0x210; + return 0x210; case 0x8001002a: - return 0x210; + return 0x210; case 0x8001002b: - return 0x210; + return 0x210; case 0x8001002c: - return 0x206; + return 0x206; case 0x8001002e: - return 0x215; + return 0x215; case 0x8001002f: - return 0x210; - default: - return 0xffffffff; - } + return 0x210; + default: + return 0xffffffff; } +} -JAISound* MSBgm::getHandle(u8 param) -{ - MSBgm* track = smBgmInTrack[param]; - if (track) { - return (JAISound*)(&track[0x14]); - } - return nullptr; +JAISound* MSBgm::getHandle(u8 param) +{ + MSBgm* track = smBgmInTrack[param]; + if (track) { + return (JAISound*)(&track[0x14]); } + return nullptr; +} JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } From c868cfe7ebc407debf44f27dc9235e4902ba0bcb Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Sat, 17 May 2025 12:08:51 -0400 Subject: [PATCH 16/25] 100% SET TRACK VOLUME BABY --- include/MSound/MSoundBGM.hpp | 2 +- src/MSound/MSoundBGM.cpp | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index f2a615f5..cda638fb 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -12,7 +12,7 @@ template class JALListVirtualNode; class MSBgm : public JALListHioNode { public: MSBgm(); - + JAISound* unk_14; //0x14 Offset static MSBgm* smBgmInTrack[3]; static f32 smMainVolume; static void init(); diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index db59ae24..780fdc48 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -21,19 +21,10 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { - JAISound* sound = nullptr; - MSBgm* track = smBgmInTrack[param1]; - if ((track) - && (sound = *(JAISound**)(track + 0x14), sound != (JAISound*)0x0)) { - // Using JAISound::setVolume instead causes an Static Error. Even - // though that is in the Decompiled Ghidra Code. Function should be - // something like JAISound::setVolume(param2,param3,param4); But due to - // a "a nonstatic member reference must be relative to a specific - // object" error with JAISound I can't - setVolume(param2, param3, param4, param1); + if (track && track->unk_14) { + track->unk_14->setVolume(param2, param3, param4); } - return; } void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } From 86b2b20cf27f2d68df1a2afa2152bd412fb746f9 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Sat, 17 May 2025 13:07:48 -0400 Subject: [PATCH 17/25] Lots more functions --- include/MSound/MSoundBGM.hpp | 3 ++- src/MSound/MSoundBGM.cpp | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index cda638fb..3cf2042c 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -12,7 +12,6 @@ template class JALListVirtualNode; class MSBgm : public JALListHioNode { public: MSBgm(); - JAISound* unk_14; //0x14 Offset static MSBgm* smBgmInTrack[3]; static f32 smMainVolume; static void init(); @@ -34,6 +33,8 @@ class MSBgm : public JALListHioNode { static u32 getSceneNo(u32); static JAISound* getHandle(u8); static JAISound* getJASTrack(JAISound*, u8); +public: + /* 0x14 */ JAISound* unk_14; }; #endif diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 780fdc48..406f02ae 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -17,6 +17,9 @@ void MSBgm::stopTrackBGMs(u8 param1, u32 param2) { } void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) { MSBgm* bgm = JALListS::search(param1 & 0x3FF); + if (bgm && bgm->unk_14) { + bgm->unk_14->setVolume(param2,param3,param4); + } } void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) @@ -29,9 +32,20 @@ void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } -void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) { } +void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) +{ + MSBgm* track = smBgmInTrack[param1]; + if (track && track->unk_14) { + track->unk_14->setPan(param2, param3, param4); + } +} -void MSBgm::setDolby(u8 param1, f32 param2, u32 param3, u8 param4) { } +void MSBgm::setDolby(u8 param1, f32 param2, u32 param3, u8 param4) { + MSBgm* track = smBgmInTrack[param1]; + if (track && track->unk_14) { + track->unk_14->setDolby(param2, param3, param4); + } +} void MSBgm::setPause(u8 param1, bool param2) { } @@ -149,7 +163,7 @@ JAISound* MSBgm::getHandle(u8 param) { MSBgm* track = smBgmInTrack[param]; if (track) { - return (JAISound*)(&track[0x14]); + return track->unk_14; } return nullptr; } From 7b74abb0c532b16ba1e79d3ae5645c38fa2600bf Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Sun, 18 May 2025 20:54:47 -0400 Subject: [PATCH 18/25] WIP progress StopTrackBGM, StartBGM, and setStageBgmYoshiPercussion. Completed stopBGM and stopTrackBGM --- include/MSound/MSoundBGM.hpp | 2 +- src/MSound/MSoundBGM.cpp | 105 +++++++++++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index 3cf2042c..b9714607 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -15,7 +15,7 @@ class MSBgm : public JALListHioNode { static MSBgm* smBgmInTrack[3]; static f32 smMainVolume; static void init(); - static void startBGM(u32); + static JAISound* startBGM(u32); static void stopBGM(u32, u32); static void stopTrackBGM(u8, u32); static void stopTrackBGMs(u8, u32); diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 406f02ae..754b9b7c 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -6,13 +6,90 @@ f32 MSBgm::smMainVolume = 0.75f; void MSBgm::init() { } -void MSBgm::startBGM(u32 param) { } +JAISound* MSBgm::startBGM(u32 param) { + MSBgm * iVar1 = JALListS::search(param & 0x3FF); + if (iVar1) { + if ((param == 0x8001000a) || (param== 0x8001000c) || (param == 0x80010028)) { + for (u32 i = 0; i < 3; i++) { + stopTrackBGM(i,0); + } + } + + } + + if (iVar1 && iVar1->unk_14) { + iVar1->unk_14->setVolume(smMainVolume,0,8); + return iVar1->unk_14; + } + return 0; + } + +void MSBgm::stopBGM(u32 param1, u32 param2) { + MSBgm* track = smBgmInTrack[param1]; + u32 stack; /* Unused */ + MSBgm * iVar2; + JAISound* audio; /*Unused*/ + if (param1 == -1) { + if (smBgmInTrack[0] && smBgmInTrack[0]->unk_14) { + smBgmInTrack[0]->unk_14->stop(param2); + smBgmInTrack[0] = nullptr; + } + } else { + iVar2 = JALListS::search(param1 & 0x3FF); + if (iVar2 && iVar2->unk_14) { + u8 a = iVar2->unk_14->unk0; + if (a == 0xff) { + stopBGM(0xffffffff,10); + } else if (a < 3){ + iVar2 = smBgmInTrack[a]; + if (iVar2 && iVar2->unk_14) { + iVar2->unk_14->stop(param2); + smBgmInTrack[a] = 0; + } + } + } + } + } + +void MSBgm::stopTrackBGM(u8 param1, u32 param2) +{ + //Mostly Likely Missing an Inline function + if (param1 == 0xff) { + stopTrackBGM(0xffffffff, 10); + return; + } -void MSBgm::stopBGM(u32 param1, u32 param2) { } + if (param1 >= 3) + return; -void MSBgm::stopTrackBGM(u8 param1, u32 param2) { } + MSBgm* track = smBgmInTrack[param1]; + if (!track) + return; + + JAISound* sound = track->unk_14; + if (!sound) + return; -void MSBgm::stopTrackBGMs(u8 param1, u32 param2) { } + sound->stop(param2); + smBgmInTrack[param1] = nullptr; +} + +void MSBgm::stopTrackBGMs(u8 param1, u32 param2) +{ + for (u8 i = 0; i < 3; i++) { + if ((param1 >> i) & 1) { + if (i == 0xff) { + stopBGM(0xffffffff, 10); + } else if (i < 3) { + MSBgm* iVar2 = smBgmInTrack[i]; + if (iVar2 && iVar2->unk_14) { + iVar2->unk_14->stop(param2); + smBgmInTrack[i] = 0; + } + } + } + } +} void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) { @@ -55,7 +132,25 @@ void MSBgm::setSeqTRACKsMute(u8 param1, bool param2, u16 param3) { } void MSBgm::setSeqTRACKsMuteH(JAISound* param1, bool param2, u16 param3) { } -void MSBgm::setStageBgmYoshiPercussion(bool param) { } +void MSBgm::setStageBgmYoshiPercussion(bool param) { + // Currently Doesn't compile into anything: https://decomp.me/scratch/Z8fDP + JAISound * sound; + u32 uVar1; + JAISeqParameter *pJVar2; + if (smBgmInTrack == 0) { + sound = nullptr; + } else { + sound = smBgmInTrack[0]->unk_14; + } + + + + if (sound) { + pJVar2 = sound->getSeqParameter(); + } + + +} bool MSBgm::checkPlaying(u32 param) { return false; } From 2a3c32e2f45e08f08b384e17fb7e040c4edd6010 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 20 May 2025 11:09:20 -0400 Subject: [PATCH 19/25] Yeah I think I'm good --- include/MSound/MSoundBGM.hpp | 9 ++- src/MSound/MSoundBGM.cpp | 121 ++++++++++++++++++++++------------- 2 files changed, 83 insertions(+), 47 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index b9714607..8dcd47fd 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -8,7 +8,6 @@ #include template class JALListVirtualNode; - class MSBgm : public JALListHioNode { public: MSBgm(); @@ -33,6 +32,14 @@ class MSBgm : public JALListHioNode { static u32 getSceneNo(u32); static JAISound* getHandle(u8); static JAISound* getJASTrack(JAISound*, u8); + //TODO: Found out where this inline is from. + static JAISound* someInline() { + if (smBgmInTrack[0] != 0) { + return smBgmInTrack[0]->unk_14; + } else { + return nullptr; + } + } public: /* 0x14 */ JAISound* unk_14; }; diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 754b9b7c..6fdcc1e0 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -1,28 +1,50 @@ #include #include +#include +#include +#include MSBgm* MSBgm::smBgmInTrack[3]; f32 MSBgm::smMainVolume = 0.75f; void MSBgm::init() { } -JAISound* MSBgm::startBGM(u32 param) { - MSBgm * iVar1 = JALListS::search(param & 0x3FF); +JAISound* MSBgm::startBGM(u32 param) +{ + MSBgm* iVar1 = JALListS::search(param & 0x3FF); if (iVar1) { - if ((param == 0x8001000a) || (param== 0x8001000c) || (param == 0x80010028)) { - for (u32 i = 0; i < 3; i++) { - stopTrackBGM(i,0); + if ((param == 0x8001000a) || (param == 0x8001000c) || (param == 0x80010028)) { + for (u8 i = 0; i < 3; i++) { + if ((3 >> i & 1) != 0) { + stopTrackBGM(i,0); + } + } + MSGMSound->demoModeIn(0x16f, false); } - + MSGBasic->startSoundActor(param, &iVar1->unk_14, nullptr, 0, 4); + if (iVar1->unk_14) { + iVar1->unk_14->setVolume(smMainVolume, 0, 8); + + + if (iVar1->unk_14->unk0 < 3) { + smBgmInTrack[iVar1->unk_14->unk0] = iVar1; + } + int uVar2 = getSceneNo(param); + if ( uVar2 != -1 && uVar2 != 0x210) { + u8 temp = uVar2 >> 8; + u8 temp2 = uVar2; + iVar1->unk_14->setWaveReadMode(temp, temp2); + } + return iVar1->unk_14; + } } - if (iVar1 && iVar1->unk_14) { - iVar1->unk_14->setVolume(smMainVolume,0,8); - return iVar1->unk_14; - } + return 0; - } +} + + void MSBgm::stopBGM(u32 param1, u32 param2) { MSBgm* track = smBgmInTrack[param1]; @@ -51,28 +73,23 @@ void MSBgm::stopBGM(u32 param1, u32 param2) { } } -void MSBgm::stopTrackBGM(u8 param1, u32 param2) -{ - //Mostly Likely Missing an Inline function - if (param1 == 0xff) { - stopTrackBGM(0xffffffff, 10); - return; - } - - if (param1 >= 3) - return; - - MSBgm* track = smBgmInTrack[param1]; - if (!track) - return; - - JAISound* sound = track->unk_14; - if (!sound) - return; - - sound->stop(param2); - smBgmInTrack[param1] = nullptr; -} + void MSBgm::stopTrackBGM(u8 param1, u32 param2) + { + //Todo: Disable Inlining properly. + (void)0; (void)0; (void)0; (void)0; (void)0; + if (param1 == 0xff) { + stopTrackBGM(0, 10); + } else if (param1 < 3) { + MSBgm* track = smBgmInTrack[param1]; + if (track) { + JAISound* sound = track->unk_14; + if (sound) { + sound->stop(param2); + smBgmInTrack[param1] = 0; + } + } + } + } void MSBgm::stopTrackBGMs(u8 param1, u32 param2) { @@ -133,22 +150,34 @@ void MSBgm::setSeqTRACKsMute(u8 param1, bool param2, u16 param3) { } void MSBgm::setSeqTRACKsMuteH(JAISound* param1, bool param2, u16 param3) { } void MSBgm::setStageBgmYoshiPercussion(bool param) { - // Currently Doesn't compile into anything: https://decomp.me/scratch/Z8fDP - JAISound * sound; - u32 uVar1; - JAISeqParameter *pJVar2; - if (smBgmInTrack == 0) { - sound = nullptr; - } else { - sound = smBgmInTrack[0]->unk_14; - } - + JAISound* sound; + JAISeqParameter* pJVar2; + u32 uVar1; + u32 uVar2; + JASystem::TTrack* pTVar3; + //Inlined function in MSoundBGM.hpp TODO: Found original inline function placement. + sound = someInline(); + if (sound == nullptr) return; - - if (sound) { + uVar1 = MSGMSound->getBstSwitch(sound->unk8); + + if ( (uVar1 & 0x10000000)) { pJVar2 = sound->getSeqParameter(); - } + pTVar3 = JASystem::TrackMgr::handleToSeq(pJVar2->unk0); + if (pTVar3 == nullptr) { + pTVar3 = nullptr; + } else { + pTVar3 = pTVar3->unk2C4[0xf]; + } + if (pTVar3 != nullptr) { + if (param == 1) {uVar2 = 0;} else { + uVar2 = 1; + } + pTVar3->unk3C2 = uVar2; + + } + } } From 43660bb73c42093af66f422c50bb65fe0fa206e3 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 20 May 2025 11:09:49 -0400 Subject: [PATCH 20/25] Remove Useless Include --- src/MSound/MSoundBGM.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 6fdcc1e0..6bf47dc1 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -3,7 +3,6 @@ #include #include -#include MSBgm* MSBgm::smBgmInTrack[3]; f32 MSBgm::smMainVolume = 0.75f; From 3a0b778555451453c09cce9972269b0bab90f66f Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 20 May 2025 11:11:56 -0400 Subject: [PATCH 21/25] Format --- src/MSound/MSoundBGM.cpp | 170 ++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 83 deletions(-) diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 6bf47dc1..20532633 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -12,83 +12,84 @@ JAISound* MSBgm::startBGM(u32 param) { MSBgm* iVar1 = JALListS::search(param & 0x3FF); if (iVar1) { - if ((param == 0x8001000a) || (param == 0x8001000c) || (param == 0x80010028)) { + if ((param == 0x8001000a) || (param == 0x8001000c) + || (param == 0x80010028)) { for (u8 i = 0; i < 3; i++) { - if ((3 >> i & 1) != 0) { - stopTrackBGM(i,0); - } - + if ((3 >> i & 1) != 0) { + stopTrackBGM(i, 0); + } } - MSGMSound->demoModeIn(0x16f, false); + MSGMSound->demoModeIn(0x16f, false); } - MSGBasic->startSoundActor(param, &iVar1->unk_14, nullptr, 0, 4); - if (iVar1->unk_14) { - iVar1->unk_14->setVolume(smMainVolume, 0, 8); + MSGBasic->startSoundActor(param, &iVar1->unk_14, nullptr, 0, 4); + if (iVar1->unk_14) { + iVar1->unk_14->setVolume(smMainVolume, 0, 8); - - if (iVar1->unk_14->unk0 < 3) { - smBgmInTrack[iVar1->unk_14->unk0] = iVar1; - } - int uVar2 = getSceneNo(param); - if ( uVar2 != -1 && uVar2 != 0x210) { - u8 temp = uVar2 >> 8; - u8 temp2 = uVar2; - iVar1->unk_14->setWaveReadMode(temp, temp2); + if (iVar1->unk_14->unk0 < 3) { + smBgmInTrack[iVar1->unk_14->unk0] = iVar1; + } + int uVar2 = getSceneNo(param); + if (uVar2 != -1 && uVar2 != 0x210) { + u8 temp = uVar2 >> 8; + u8 temp2 = uVar2; + iVar1->unk_14->setWaveReadMode(temp, temp2); + } + return iVar1->unk_14; } - return iVar1->unk_14; - } } - return 0; } - - -void MSBgm::stopBGM(u32 param1, u32 param2) { +void MSBgm::stopBGM(u32 param1, u32 param2) +{ MSBgm* track = smBgmInTrack[param1]; - u32 stack; /* Unused */ - MSBgm * iVar2; + u32 stack; /* Unused */ + MSBgm* iVar2; JAISound* audio; /*Unused*/ - if (param1 == -1) { - if (smBgmInTrack[0] && smBgmInTrack[0]->unk_14) { - smBgmInTrack[0]->unk_14->stop(param2); - smBgmInTrack[0] = nullptr; - } - } else { - iVar2 = JALListS::search(param1 & 0x3FF); - if (iVar2 && iVar2->unk_14) { - u8 a = iVar2->unk_14->unk0; - if (a == 0xff) { - stopBGM(0xffffffff,10); - } else if (a < 3){ - iVar2 = smBgmInTrack[a]; - if (iVar2 && iVar2->unk_14) { + if (param1 == -1) { + if (smBgmInTrack[0] && smBgmInTrack[0]->unk_14) { + smBgmInTrack[0]->unk_14->stop(param2); + smBgmInTrack[0] = nullptr; + } + } else { + iVar2 = JALListS::search(param1 & 0x3FF); + if (iVar2 && iVar2->unk_14) { + u8 a = iVar2->unk_14->unk0; + if (a == 0xff) { + stopBGM(0xffffffff, 10); + } else if (a < 3) { + iVar2 = smBgmInTrack[a]; + if (iVar2 && iVar2->unk_14) { iVar2->unk_14->stop(param2); - smBgmInTrack[a] = 0; - } - } - } - } - } + smBgmInTrack[a] = 0; + } + } + } + } +} - void MSBgm::stopTrackBGM(u8 param1, u32 param2) - { - //Todo: Disable Inlining properly. - (void)0; (void)0; (void)0; (void)0; (void)0; - if (param1 == 0xff) { - stopTrackBGM(0, 10); - } else if (param1 < 3) { - MSBgm* track = smBgmInTrack[param1]; - if (track) { - JAISound* sound = track->unk_14; - if (sound) { - sound->stop(param2); - smBgmInTrack[param1] = 0; - } - } - } - } +void MSBgm::stopTrackBGM(u8 param1, u32 param2) +{ + // Todo: Disable Inlining properly. + (void)0; + (void)0; + (void)0; + (void)0; + (void)0; + if (param1 == 0xff) { + stopTrackBGM(0, 10); + } else if (param1 < 3) { + MSBgm* track = smBgmInTrack[param1]; + if (track) { + JAISound* sound = track->unk_14; + if (sound) { + sound->stop(param2); + smBgmInTrack[param1] = 0; + } + } + } +} void MSBgm::stopTrackBGMs(u8 param1, u32 param2) { @@ -97,7 +98,7 @@ void MSBgm::stopTrackBGMs(u8 param1, u32 param2) if (i == 0xff) { stopBGM(0xffffffff, 10); } else if (i < 3) { - MSBgm* iVar2 = smBgmInTrack[i]; + MSBgm* iVar2 = smBgmInTrack[i]; if (iVar2 && iVar2->unk_14) { iVar2->unk_14->stop(param2); smBgmInTrack[i] = 0; @@ -111,8 +112,8 @@ void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) { MSBgm* bgm = JALListS::search(param1 & 0x3FF); if (bgm && bgm->unk_14) { - bgm->unk_14->setVolume(param2,param3,param4); - } + bgm->unk_14->setVolume(param2, param3, param4); + } } void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) @@ -133,7 +134,8 @@ void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) } } -void MSBgm::setDolby(u8 param1, f32 param2, u32 param3, u8 param4) { +void MSBgm::setDolby(u8 param1, f32 param2, u32 param3, u8 param4) +{ MSBgm* track = smBgmInTrack[param1]; if (track && track->unk_14) { track->unk_14->setDolby(param2, param3, param4); @@ -148,19 +150,22 @@ void MSBgm::setSeqTRACKsMute(u8 param1, bool param2, u16 param3) { } void MSBgm::setSeqTRACKsMuteH(JAISound* param1, bool param2, u16 param3) { } -void MSBgm::setStageBgmYoshiPercussion(bool param) { +void MSBgm::setStageBgmYoshiPercussion(bool param) +{ JAISound* sound; JAISeqParameter* pJVar2; - u32 uVar1; - u32 uVar2; + u32 uVar1; + u32 uVar2; JASystem::TTrack* pTVar3; - //Inlined function in MSoundBGM.hpp TODO: Found original inline function placement. + // Inlined function in MSoundBGM.hpp TODO: Found original inline function + // placement. sound = someInline(); - if (sound == nullptr) return; + if (sound == nullptr) + return; - uVar1 = MSGMSound->getBstSwitch(sound->unk8); - - if ( (uVar1 & 0x10000000)) { + uVar1 = MSGMSound->getBstSwitch(sound->unk8); + + if ((uVar1 & 0x10000000)) { pJVar2 = sound->getSeqParameter(); pTVar3 = JASystem::TrackMgr::handleToSeq(pJVar2->unk0); if (pTVar3 == nullptr) { @@ -169,15 +174,14 @@ void MSBgm::setStageBgmYoshiPercussion(bool param) { pTVar3 = pTVar3->unk2C4[0xf]; } if (pTVar3 != nullptr) { - if (param == 1) {uVar2 = 0;} else { - uVar2 = 1; - } - pTVar3->unk3C2 = uVar2; - - - } + if (param == 1) { + uVar2 = 0; + } else { + uVar2 = 1; + } + pTVar3->unk3C2 = uVar2; + } } - } bool MSBgm::checkPlaying(u32 param) { return false; } From 0493c60fd84c5a429967a4f100601e3ae6a39685 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 20 May 2025 16:34:57 -0400 Subject: [PATCH 22/25] unk14 change --- include/MSound/MSoundBGM.hpp | 4 +-- src/MSound/MSoundBGM.cpp | 50 ++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index 8dcd47fd..63f09b61 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -35,13 +35,13 @@ class MSBgm : public JALListHioNode { //TODO: Found out where this inline is from. static JAISound* someInline() { if (smBgmInTrack[0] != 0) { - return smBgmInTrack[0]->unk_14; + return smBgmInTrack[0]->unk14; } else { return nullptr; } } public: - /* 0x14 */ JAISound* unk_14; + /* 0x14 */ JAISound* unk14; }; #endif diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index 20532633..3a75ff2e 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -21,20 +21,20 @@ JAISound* MSBgm::startBGM(u32 param) } MSGMSound->demoModeIn(0x16f, false); } - MSGBasic->startSoundActor(param, &iVar1->unk_14, nullptr, 0, 4); - if (iVar1->unk_14) { - iVar1->unk_14->setVolume(smMainVolume, 0, 8); + MSGBasic->startSoundActor(param, &iVar1->unk14, nullptr, 0, 4); + if (iVar1->unk14) { + iVar1->unk14->setVolume(smMainVolume, 0, 8); - if (iVar1->unk_14->unk0 < 3) { - smBgmInTrack[iVar1->unk_14->unk0] = iVar1; + if (iVar1->unk14->unk0 < 3) { + smBgmInTrack[iVar1->unk14->unk0] = iVar1; } int uVar2 = getSceneNo(param); if (uVar2 != -1 && uVar2 != 0x210) { u8 temp = uVar2 >> 8; u8 temp2 = uVar2; - iVar1->unk_14->setWaveReadMode(temp, temp2); + iVar1->unk14->setWaveReadMode(temp, temp2); } - return iVar1->unk_14; + return iVar1->unk14; } } @@ -48,20 +48,20 @@ void MSBgm::stopBGM(u32 param1, u32 param2) MSBgm* iVar2; JAISound* audio; /*Unused*/ if (param1 == -1) { - if (smBgmInTrack[0] && smBgmInTrack[0]->unk_14) { - smBgmInTrack[0]->unk_14->stop(param2); + if (smBgmInTrack[0] && smBgmInTrack[0]->unk14) { + smBgmInTrack[0]->unk14->stop(param2); smBgmInTrack[0] = nullptr; } } else { iVar2 = JALListS::search(param1 & 0x3FF); - if (iVar2 && iVar2->unk_14) { - u8 a = iVar2->unk_14->unk0; + if (iVar2 && iVar2->unk14) { + u8 a = iVar2->unk14->unk0; if (a == 0xff) { stopBGM(0xffffffff, 10); } else if (a < 3) { iVar2 = smBgmInTrack[a]; - if (iVar2 && iVar2->unk_14) { - iVar2->unk_14->stop(param2); + if (iVar2 && iVar2->unk14) { + iVar2->unk14->stop(param2); smBgmInTrack[a] = 0; } } @@ -82,7 +82,7 @@ void MSBgm::stopTrackBGM(u8 param1, u32 param2) } else if (param1 < 3) { MSBgm* track = smBgmInTrack[param1]; if (track) { - JAISound* sound = track->unk_14; + JAISound* sound = track->unk14; if (sound) { sound->stop(param2); smBgmInTrack[param1] = 0; @@ -99,8 +99,8 @@ void MSBgm::stopTrackBGMs(u8 param1, u32 param2) stopBGM(0xffffffff, 10); } else if (i < 3) { MSBgm* iVar2 = smBgmInTrack[i]; - if (iVar2 && iVar2->unk_14) { - iVar2->unk_14->stop(param2); + if (iVar2 && iVar2->unk14) { + iVar2->unk14->stop(param2); smBgmInTrack[i] = 0; } } @@ -111,16 +111,16 @@ void MSBgm::stopTrackBGMs(u8 param1, u32 param2) void MSBgm::setVolume(u32 param1, f32 param2, u32 param3, u8 param4) { MSBgm* bgm = JALListS::search(param1 & 0x3FF); - if (bgm && bgm->unk_14) { - bgm->unk_14->setVolume(param2, param3, param4); + if (bgm && bgm->unk14) { + bgm->unk14->setVolume(param2, param3, param4); } } void MSBgm::setTrackVolume(u8 param1, f32 param2, u32 param3, u8 param4) { MSBgm* track = smBgmInTrack[param1]; - if (track && track->unk_14) { - track->unk_14->setVolume(param2, param3, param4); + if (track && track->unk14) { + track->unk14->setVolume(param2, param3, param4); } } @@ -129,16 +129,16 @@ void MSBgm::setSeqTrackVolume(u8 param1, u8 param2, f32 param3, u32 param4) { } void MSBgm::setPan(u8 param1, f32 param2, u32 param3, u8 param4) { MSBgm* track = smBgmInTrack[param1]; - if (track && track->unk_14) { - track->unk_14->setPan(param2, param3, param4); + if (track && track->unk14) { + track->unk14->setPan(param2, param3, param4); } } void MSBgm::setDolby(u8 param1, f32 param2, u32 param3, u8 param4) { MSBgm* track = smBgmInTrack[param1]; - if (track && track->unk_14) { - track->unk_14->setDolby(param2, param3, param4); + if (track && track->unk14) { + track->unk14->setDolby(param2, param3, param4); } } @@ -290,7 +290,7 @@ JAISound* MSBgm::getHandle(u8 param) { MSBgm* track = smBgmInTrack[param]; if (track) { - return track->unk_14; + return track->unk14; } return nullptr; } From 7aad3331cce893ae1ff8dfe54e9a8f8dd9381fec Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Tue, 20 May 2025 16:46:45 -0400 Subject: [PATCH 23/25] FormatING!!! --- include/MSound/MSoundBGM.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index 63f09b61..31e4c9e9 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -32,14 +32,16 @@ class MSBgm : public JALListHioNode { static u32 getSceneNo(u32); static JAISound* getHandle(u8); static JAISound* getJASTrack(JAISound*, u8); - //TODO: Found out where this inline is from. - static JAISound* someInline() { - if (smBgmInTrack[0] != 0) { - return smBgmInTrack[0]->unk14; - } else { - return nullptr; - } - } + // TODO: Found out where this inline is from. + static JAISound* someInline() + { + if (smBgmInTrack[0] != 0) { + return smBgmInTrack[0]->unk14; + } else { + return nullptr; + } + } + public: /* 0x14 */ JAISound* unk14; }; From e8d223e0f6c69e2102f0a93bbf27c58dce653519 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Sun, 22 Jun 2025 14:54:53 -0400 Subject: [PATCH 24/25] make the repo actually proper --- include/MSound/MSoundBGM.hpp | 10 ++++++++-- src/MSound/MSoundBGM.cpp | 4 +--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/MSound/MSoundBGM.hpp b/include/MSound/MSoundBGM.hpp index 31e4c9e9..0553191e 100644 --- a/include/MSound/MSoundBGM.hpp +++ b/include/MSound/MSoundBGM.hpp @@ -10,7 +10,12 @@ template class JALListVirtualNode; class MSBgm : public JALListHioNode { public: - MSBgm(); + MSBgm(int i) + : JALListHioNode("", i, this) + , unk14(nullptr) + { + } + static MSBgm* smBgmInTrack[3]; static f32 smMainVolume; static void init(); @@ -32,6 +37,7 @@ class MSBgm : public JALListHioNode { static u32 getSceneNo(u32); static JAISound* getHandle(u8); static JAISound* getJASTrack(JAISound*, u8); + // TODO: Found out where this inline is from. static JAISound* someInline() { @@ -46,4 +52,4 @@ class MSBgm : public JALListHioNode { /* 0x14 */ JAISound* unk14; }; -#endif +#endif \ No newline at end of file diff --git a/src/MSound/MSoundBGM.cpp b/src/MSound/MSoundBGM.cpp index e8cd889f..f5f26586 100644 --- a/src/MSound/MSoundBGM.cpp +++ b/src/MSound/MSoundBGM.cpp @@ -2,8 +2,6 @@ #include #include #include -#include -#include #include MSBgm* MSBgm::smBgmInTrack[3]; @@ -307,4 +305,4 @@ JAISound* MSBgm::getHandle(u8 param) return nullptr; } -JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } +JAISound* MSBgm::getJASTrack(JAISound* param1, u8 param2) { return nullptr; } \ No newline at end of file From 6c61290ae6a15a0e21891c9110f8f3381e57b058 Mon Sep 17 00:00:00 2001 From: ThePlayerRolo Date: Mon, 23 Jun 2025 10:10:54 -0400 Subject: [PATCH 25/25] NpcCoinWork --- include/NPC/NpcCoin.hpp | 21 +++++++++++++ src/NPC/NpcCoin.cpp | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 include/NPC/NpcCoin.hpp diff --git a/include/NPC/NpcCoin.hpp b/include/NPC/NpcCoin.hpp new file mode 100644 index 00000000..dd4bbb7f --- /dev/null +++ b/include/NPC/NpcCoin.hpp @@ -0,0 +1,21 @@ +#include "MoveBG/MapObjBase.hpp" +#include "dolphin.h" +#include "dolphin/mtx.h" + + + + + + + + +class TNpcCoin { + TNpcCoin(int); + void requestAppearAfterCoin(const Vec&, f32, int); + void updateCoin(); + TMapObjBase* unk0; + s32 unk4; + JGeometry::TVec3 unk8; + JGeometry::TVec3 unk14; + +}; \ No newline at end of file diff --git a/src/NPC/NpcCoin.cpp b/src/NPC/NpcCoin.cpp index e69de29b..7e0e7fa0 100644 --- a/src/NPC/NpcCoin.cpp +++ b/src/NPC/NpcCoin.cpp @@ -0,0 +1,66 @@ +#include "NPC/NpcCoin.hpp" +#include "MSound/MSound.hpp" +#include "MSound/MSoundSE.hpp" +#include "MoveBG/ItemManager.hpp" +#include "MoveBG/MapObjBase.hpp" +#include "MoveBG/MapObjManager.hpp" +#include "System/MarDirector.hpp" +#include "types.h" + + + + +TNpcCoin::TNpcCoin(int arg1) { + unk0 = nullptr; + unk4 = 0; + unk8.x = 0.0f; + unk8.y = 0.0f; + unk8.z = 0.0f; + unk14.x = 0.0f; + unk14.y = 0.0f; + unk14.z = 0.0f; + unk0 = TMapObjBaseManager::newAndRegisterObjByEventID(arg1, nullptr); + this->unk0->kill(); +}; + +void TNpcCoin::updateCoin() { + bool bVar2; + bool bVar3; + TMapObjBase* temp; + if (0 < this->unk4) { + bVar2 = true; + bVar3 = true; + if (gpMarDirector->unk124 != 1 && gpMarDirector->unk124 != 2 ) { + bVar2 = false; + } + if (!bVar2) { + bVar2 = true; + if (gpMarDirector->unk124 != 3 && gpMarDirector->unk124 != 4) { + bVar2 = false; + } + } + if (!bVar2) { + bVar3 = false; + } + if (!bVar3 && (this->unk4--, this->unk4 != 0)) { + temp->appear(); + } else { + temp = gpItemManager->makeObjAppear(unk8.x, unk8.y, unk8.z,0x2000000e,true); + if (temp) { + f32 float2; + f32 float1; + f32 float3; + float1 = unk14.z; + float2 = unk14.y; + float3 = unk14.x; + temp->unkAC.x = float3; + temp->unkAC.y = float2; + temp->unkAC.z = float1; + temp->mLiveFlag &= ~0x10; + } + } + if (gpMSound->gateCheck(0x8807)) { + MSoundSESystem::MSoundSE::startSoundNpcActor(0x8807, unk8, 0, nullptr, 0, 4); + } + } +} \ No newline at end of file