From a0a1e4a7bcb9c2ec27d56dfc4c7882295ddc28ed Mon Sep 17 00:00:00 2001 From: ReimousTH <51449880+ReimousTH@users.noreply.github.com> Date: Mon, 11 Aug 2025 04:14:11 +0300 Subject: [PATCH 1/2] SoundConfig --- MarathonRecomp/api/Marathon.h | 2 + .../api/Sonicteam/AudioEngineXenon.h | 31 +++++++++++ MarathonRecomp/api/Sonicteam/DocMarathonImp.h | 53 ++++++++++++++++++- .../api/Sonicteam/SoX/Audio/IAudioEngine.h | 13 +++++ MarathonRecomp/app.cpp | 4 ++ 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 MarathonRecomp/api/Sonicteam/AudioEngineXenon.h create mode 100644 MarathonRecomp/api/Sonicteam/SoX/Audio/IAudioEngine.h diff --git a/MarathonRecomp/api/Marathon.h b/MarathonRecomp/api/Marathon.h index ebdf1f766..e98ba3f31 100644 --- a/MarathonRecomp/api/Marathon.h +++ b/MarathonRecomp/api/Marathon.h @@ -17,6 +17,7 @@ #include "CSD/Platform/csdTexList.h" #include "Sonicteam/Actor.h" #include "Sonicteam/AppMarathon.h" +#include "Sonicteam/AudioEngineXenon.h" #include "Sonicteam/Camera/CameraMode.h" #include "Sonicteam/Camera/Cameraman.h" #include "Sonicteam/Camera/SonicCamera.h" @@ -48,6 +49,7 @@ #include "Sonicteam/Player/State/Object2.h" #include "Sonicteam/Player/State/TailsContext.h" #include "Sonicteam/SoX/AI/StateMachine.h" +#include "Sonicteam/SoX/Audio/IAudioEngine.h" #include "Sonicteam/SoX/Component.h" #include "Sonicteam/SoX/Engine/Doc.h" #include "Sonicteam/SoX/Engine/DocMode.h" diff --git a/MarathonRecomp/api/Sonicteam/AudioEngineXenon.h b/MarathonRecomp/api/Sonicteam/AudioEngineXenon.h new file mode 100644 index 000000000..68eadd6ea --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/AudioEngineXenon.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include + +namespace Sonicteam +{ + + class AudioEngineXenon : public SoX::Audio::IAudioEngine + { + public: + MARATHON_INSERT_PADDING(8); + be m_Audio; + be m_SoundEffects; + MARATHON_INSERT_PADDING(0x14); + + //Singleton> + static AudioEngineXenon* GetAudioEngine() + { + auto ppAudio = (xpointer*)g_memory.Translate(0x82D37AC8); + if (!ppAudio->ptr.get()) + { + auto pAudio = GuestToHostFunction(sub_824A5C78); + *ppAudio = pAudio; + } + return *ppAudio; + }; + }; +} diff --git a/MarathonRecomp/api/Sonicteam/DocMarathonImp.h b/MarathonRecomp/api/Sonicteam/DocMarathonImp.h index 75b0b6e73..8271b64d3 100644 --- a/MarathonRecomp/api/Sonicteam/DocMarathonImp.h +++ b/MarathonRecomp/api/Sonicteam/DocMarathonImp.h @@ -5,10 +5,61 @@ namespace Sonicteam { + + struct DocSaveFile + { + public: + enum EPISODE + { + EPISODE_SONIC, + EPISODE_SHADOW, + EPISODE_SILVER + //... + }; + static const uint32_t EPISODE_COUNT = 32; + static const uint32_t TRIAL_COUNT = 512; + static const uint32_t GLOBALFLAG_COUNT = 0x2800; + static const uint32_t STRING_SIZE = 0x100; + static const uint32_t STRING_SIZE_SHORT = 0x42; + + MARATHON_INSERT_PADDING(4); + be m_Episode_Lives[EPISODE_COUNT]; + be m_Episode_Rings[EPISODE_COUNT]; + be m_GlobalFlags[GLOBALFLAG_COUNT]; + char m_Episode_Lua[EPISODE_COUNT * STRING_SIZE]; + MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x80); + char m_Episode_Objective[EPISODE_COUNT * STRING_SIZE]; + char m_Episode_Area[EPISODE_COUNT * STRING_SIZE]; + char m_Episode_Terrain[EPISODE_COUNT * STRING_SIZE]; + char m_Episode_SET[EPISODE_COUNT * STRING_SIZE]; + char m_Episode_PATH[EPISODE_COUNT * STRING_SIZE]; + MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x500); + char m_Episode_MST[EPISODE_COUNT * STRING_SIZE]; + MARATHON_INSERT_PADDING(EPISODE_COUNT * 0x24C); + be m_Episode_Progress[EPISODE_COUNT]; + be m_Episode_Year[EPISODE_COUNT]; + uint8_t m_Episode_Month[EPISODE_COUNT]; + uint8_t m_Episode_Day[EPISODE_COUNT]; + uint8_t m_Episode_Hour[EPISODE_COUNT]; + uint8_t m_Episode_Minute[EPISODE_COUNT]; + char m_Episode_Location[EPISODE_COUNT * STRING_SIZE_SHORT]; + be m_Trial_ID[TRIAL_COUNT]; + be m_Trial_Rank[TRIAL_COUNT]; + be m_Trial_Time[TRIAL_COUNT]; + be m_Trial_Score[TRIAL_COUNT]; + be m_Trial_Rings[TRIAL_COUNT]; + bool m_Option_Subtitles; + be m_Option_Music; + be m_Option_Effects; + }; + class DocMarathonImp : public SoX::Engine::Doc { public: MARATHON_INSERT_PADDING(0x74); bool m_VFrame; + MARATHON_INSERT_PADDING(0X2E8); + DocSaveFile m_SaveIn; + DocSaveFile m_SaveOut; }; -} +} diff --git a/MarathonRecomp/api/Sonicteam/SoX/Audio/IAudioEngine.h b/MarathonRecomp/api/Sonicteam/SoX/Audio/IAudioEngine.h new file mode 100644 index 000000000..3c2d91732 --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SoX/Audio/IAudioEngine.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +namespace Sonicteam::SoX::Audio +{ + + class IAudioEngine + { + public: + xpointer m_pVftable; + }; +} diff --git a/MarathonRecomp/app.cpp b/MarathonRecomp/app.cpp index 272522297..47f4fe0d0 100644 --- a/MarathonRecomp/app.cpp +++ b/MarathonRecomp/app.cpp @@ -48,6 +48,10 @@ PPC_FUNC(sub_8262A568) cfg->Width = Video::s_viewportWidth; cfg->Height = Video::s_viewportHeight; + auto pAudio = Sonicteam::AudioEngineXenon::GetAudioEngine(); + pAudio->m_Audio = Config::MasterVolume * Config::MusicVolume; + pAudio->m_SoundEffects = Config::MasterVolume * Config::EffectsVolume; + LOGFN_UTILITY("Changed resolution: {}x{}", cfg->Width.get(), cfg->Height.get()); __imp__sub_8262A568(ctx, base); From bf3ead4c55365d32d15819bd7e9149a6744b32e0 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sun, 10 Aug 2025 22:26:29 +0100 Subject: [PATCH 2/2] Bump XenosRecomp Signed-off-by: Isaac Marovitz --- tools/XenosRecomp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/XenosRecomp b/tools/XenosRecomp index dbcbf360b..bfd131a61 160000 --- a/tools/XenosRecomp +++ b/tools/XenosRecomp @@ -1 +1 @@ -Subproject commit dbcbf360b6611a32c8185fa5a8b33c0a10a8e856 +Subproject commit bfd131a61ee11b9baf4de1274072d1343a8c2b3c