Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions MarathonRecomp/patches/audio_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <os/version.h>
#include <patches/audio_patches.h>
#include <user/config.h>
#include <app.h>

int AudioPatches::m_isAttenuationSupported = -1;

Expand Down Expand Up @@ -33,6 +34,7 @@ void AudioPatches::Update(float deltaTime)
return;

const float musicVolume = Config::MusicVolume * Config::MasterVolume;

if (Config::MusicAttenuation && CanAttenuate())
{
auto time = 1.0f - expf(2.5f * -deltaTime);
Expand All @@ -51,3 +53,38 @@ void AudioPatches::Update(float deltaTime)
pAudioEngine->m_MusicVolume = musicVolume;
}
}

// Update function for CRI cues.
// This hook fixes jingles fading the BGM back in prematurely.
PPC_FUNC_IMPL(__imp__sub_8260F168);
PPC_FUNC(sub_8260F168)
{
struct CueParams
{
be<float> Duration;
be<float> FrameTime;
be<float> Field08;
be<float> Field0C;
be<float> MusicVolume;
bool Field14;
};

auto pParams = (CueParams*)(base + ctx.r3.u32);

pParams->FrameTime = App::s_deltaTime;

__imp__sub_8260F168(ctx, base);
}

void CriCueUpdateDeltaTimeFix(PPCRegister& deltaTime)
{
deltaTime.f64 = App::s_deltaTime;
}

void PowerUpJingleDurationFix(PPCRegister& duration)
{
if (!Config::FixPowerUpJingleDuration)
return;

duration.f64 = 20.0;
}
1 change: 1 addition & 0 deletions MarathonRecomp/user/config_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableTitleInputDelay, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, HUDToggleKey, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, SkipIntroLogos, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, FixPowerUpJingleDuration, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, UseOfficialTitleOnTitleBar, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableLowResolutionFontOnCustomUI, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreContextualHUDColours, false);
Expand Down
10 changes: 10 additions & 0 deletions MarathonRecompLib/config/Marathon.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,13 @@ jump_address_on_true = 0x82653840
name = "PostureControlRotationSpeedFix"
address = 0x82201C6C
registers = ["f1", "r1"]

[[midasm_hook]]
name = "CriCueUpdateDeltaTimeFix"
address = 0x8260F238
registers = ["f13"]

[[midasm_hook]]
name = "PowerUpJingleDurationFix"
address = 0x8216CC28
registers = ["f31"]
Loading