//
// GJBaseGameLayer::activateSongTrigger from 0x100202d88 to 0x100202eb4 (300 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processQueuedAudioTriggers @ 0x100202d54
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x100206644
// > LevelEditorLayer::activateTriggerEffect @ 0x100361000
// > EffectGameObject::triggerObject @ 0x100385d08
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJBaseGameLayer::activateSongTrigger(GJBaseGameLayer *a1, SongTriggerGameObject *a2)
{
int *p_m_activeGradients; // x21
int m_songChannel; // w21
_BOOL4 m_loadPrep; // w22
FMODAudioEngine *v7; // x0
FMODAudioEngine *v8; // x20
float v9; // s0
std::string __p; // [xsp+10h] [xbp-40h] BYREF
SongTriggerGameObject *v11; // [xsp+28h] [xbp-28h] BYREF
p_m_activeGradients = &a1->m_activeGradients;
if ( a1->m_practiceMusicSync || !a1->m_isPracticeMode )
{
((void (__fastcall *)(GJBaseGameLayer *, SongTriggerGameObject *))a1->activatedAudioTrigger)(a1, a2);
if ( (p_m_activeGradients[345] & 1) == 0 )
{
if ( a1->m_startingFromBeginning )
{
v11 = a2;
sub_1000115B8((__int64)&a1->m_activeSfxTriggers, &v11);
}
else
{
m_songChannel = a2->m_songChannel;
m_loadPrep = a2->m_loadPrep;
v7 = FMODAudioEngine::sharedEngine();
v8 = v7;
if ( m_loadPrep )
{
FMODAudioEngine::activateQueuedMusic(v7, ~m_songChannel);
}
else
{
MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSong((unsigned int)a2->m_soundID, &__p);
FMODAudioEngine::sharedEngine();
v9 = FMODAudioEngine::pitchForIdx(a2->m_speed);
FMODAudioEngine::queueStartMusic(
v8,
(__int64)&__p,
a2->m_loop,
a2->m_start,
a2->m_end,
a2->m_fadeIn,
a2->m_fadeOut,
~m_songChannel,
v9,
0.0,
a2->m_volume,
1,
m_songChannel,
!a2->m_prep,
a2->m_dontReset);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
}
}
}
}
}