Skip to content

Commit

Permalink
Fixed Pitch Shifter and Speedhack FMOD offsets for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Aug 7, 2024
1 parent 7641ee2 commit 52f9c3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Added **Customizable Noclip Tint Colour**
- Added **CPS Counter instant colour fade**
- Added **Customizable Pause Countdown Time**
- **Added Intel macOS support**
- **Added [EXPERIMENTAL] Intel macOS support**

# 1.5.3

Expand Down
8 changes: 4 additions & 4 deletions src/Hacks/PitchShifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void updatePitch()
{
if (pitchDSP)
#ifdef GEODE_IS_IOS
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, FMOD::DSP*)>(geode::base::get() + 0x501e90)(masterGroup, pitchDSP); //removeDSP
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, FMOD::DSP*)>(geode::base::get() + 0x50e448)(masterGroup, pitchDSP); //removeDSP
#else
masterGroup->removeDSP(pitchDSP);
#endif
Expand All @@ -20,15 +20,15 @@ void updatePitch()
return;

#ifdef GEODE_IS_IOS
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::System*, FMOD_DSP_TYPE, FMOD::DSP**)>(geode::base::get() + 0x4c883c)(FMODAudioEngine::sharedEngine()->m_system, FMOD_DSP_TYPE_PITCHSHIFT, &pitchDSP); //createDSPByType
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, int, FMOD::DSP*)>(geode::base::get() + 0x501d60)(masterGroup, 0, pitchDSP); //addDSP
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::System*, FMOD_DSP_TYPE, FMOD::DSP**)>(geode::base::get() + 0x4d4df4)(FMODAudioEngine::sharedEngine()->m_system, FMOD_DSP_TYPE_PITCHSHIFT, &pitchDSP); //createDSPByType
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, int, FMOD::DSP*)>(geode::base::get() + 0x50e318)(masterGroup, 0, pitchDSP); //addDSP
#else
FMODAudioEngine::sharedEngine()->m_system->createDSPByType(FMOD_DSP_TYPE_PITCHSHIFT, &pitchDSP);
masterGroup->addDSP(0, pitchDSP);
#endif

#ifdef GEODE_IS_IOS
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::DSP*, int, float)>(geode::base::get() + 0x482a84)(pitchDSP, FMOD_DSP_PITCHSHIFT_PITCH, Client::GetModuleEnabled("pitch-shifter") ? pitchAmount->getFloatValue() : 1); //setParameterFloat
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::DSP*, int, float)>(geode::base::get() + 0x48f03c)(pitchDSP, FMOD_DSP_PITCHSHIFT_PITCH, Client::GetModuleEnabled("pitch-shifter") ? pitchAmount->getFloatValue() : 1); //setParameterFloat
#else
pitchDSP->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, Client::GetModuleEnabled("pitch-shifter") ? pitchAmount->getFloatValue() : 1);
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/Hacks/Speedhack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ float speedhackLogic(float dt)
if (!(PlayLayer::get() || GameManager::sharedState()->getEditorLayer())) { v = 1.0f; }

#ifdef GEODE_IS_IOS
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, float)>(geode::base::get() + 0x4ffec4)(masterGroup, SpeedhackMus::instance->enabled ? v : 1);
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, float)>(geode::base::get() + 50c47c)(masterGroup, SpeedhackMus::instance->enabled ? v : 1);
#else
masterGroup->setPitch(SpeedhackMus::instance->enabled ? v : 1);
#endif
Expand All @@ -40,7 +40,7 @@ float speedhackLogic(float dt)
}

#ifdef GEODE_IS_IOS
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, float)>(geode::base::get() + 0x4ffec4)(masterGroup, 1);
reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::ChannelControl*, float)>(geode::base::get() + 0x50c47c)(masterGroup, 1);
#else
masterGroup->setPitch(1);
#endif
Expand Down Expand Up @@ -85,7 +85,7 @@ void myUpdate(CCScheduler* ins, float dt)
#ifdef GEODE_IS_IOS

FMOD_RESULT FMOD_System_createChannelGroup(FMOD::System* self, const char *name, FMOD::ChannelGroup **channelgroup) {
auto res = reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::System*, const char*, FMOD::ChannelGroup**)>(geode::base::get() + 0x4c8964)(self, name, channelgroup);
auto res = reinterpret_cast<FMOD_RESULT(__cdecl*)(FMOD::System*, const char*, FMOD::ChannelGroup**)>(geode::base::get() + 0x4d4f1c)(self, name, channelgroup);

if (!masterGroup)
masterGroup = *channelgroup;
Expand All @@ -97,7 +97,7 @@ FMOD_RESULT FMOD_System_createChannelGroup(FMOD::System* self, const char *name,

$execute {
Mod::get()->hook(
reinterpret_cast<void*>(geode::base::get() + 0x4c8964), // address
reinterpret_cast<void*>(geode::base::get() + 0x4d4f1c), // address
&FMOD_System_createChannelGroup, // detour
"FMOD::System::createChannelGroup", // display name, shows up on the console
tulip::hook::TulipConvention::Cdecl // calling convention
Expand Down

0 comments on commit 52f9c3a

Please sign in to comment.