// // GJBaseGameLayer::processActivatedAudioTriggers from 0x1002065c0 to 0x100206f7c (2492 bytes) // // 4 xrefs: // > PlayLayer::startMusic @ 0x1001198a8 // > PlayLayer::loadFromCheckpoint @ 0x100121094 // > LevelEditorLayer::updateGameObjects @ 0x100358e24 // > LevelEditorLayer::onPlaytest @ 0x100362fe4 // // 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::processActivatedAudioTriggers(GJBaseGameLayer *a1, float a2) { std::__hash_node_base, void *> *>::__next_pointer next; // x24 char v5; // w26 SongTriggerGameObject *v6; // x1 SongTriggerGameObject *v7; // x21 float v8; // s0 float v9; // s9 float m_volume; // s10 FMODAudioEngine *v11; // x22 FMODAudioEngine *v12; // x0 int v13; // w23 float m_spawnTriggerDelay; // s11 int m_start; // w22 std::vector *v16; // x3 bool v18; // w8 FMODAudioEngine *v19; // x20 float m_songOffset; // s9 std::vector *v21; // x3 FMODAudioEngine *v22; // x0 __int64 canProcessSFX; // x0 std::vector *p_m_sfxTriggerStates; // x20 std::__vector_base::pointer begin; // x21 std::__vector_base::pointer end; // x25 SFXTriggerGameObject *m_sfxTriggerGameObject; // x28 int m_objectID; // w8 _QWORD *v29; // x0 int m_unkInt2; // w22 _QWORD *v31; // x0 int m_groupID; // w1 cocos2d::CCArray *Group; // x0 cocos2d::CCArray *v34; // x23 cocos2d::ccArray *data; // x9 __int64 num; // x8 cocos2d::CCObject **arr; // x26 unsigned __int64 v38; // x25 cocos2d::CCObject *v39; // x8 _QWORD *v40; // x0 int *v41; // x22 int *v42; // x23 _QWORD *v43; // x0 int *v44; // x22 int *v45; // x23 int *i; // x23 GJBaseGameLayer *v47; // x0 _QWORD *v48; // x0 int *v49; // x22 int *v50; // x23 int *j; // x23 GJBaseGameLayer *v52; // x0 double v53; // d10 char v54; // w8 AudioModType v55; // w21 char v56; // w25 _OWORD *v57; // x8 _OWORD *v58; // x26 float v59; // s9 double v60; // d0 double v61; // d1 float v62; // s1 int v63; // w22 FMODAudioEngine *v64; // x0 std::__vector_base::pointer v65; // x21 std::__vector_base::pointer v66; // x24 SFXTriggerGameObject *v67; // x22 int v68; // w8 double m_unkDouble1; // d9 FMODAudioEngine *v70; // x0 float v71; // s0 bool m_preload; // w27 int m_end; // w28 int v74; // w8 float v75; // s0 float m_duration; // s9 float v77; // s0 int v78; // w23 FMODAudioEngine *v79; // x0 FMODAudioEngine *v80; // x0 FMODAudioEngine *v81; // x0 FMOD::Channel *v82; // x23 bool *p_m_isPlatformer; // [xsp+8h] [xbp-288h] std::__vector_base::pointer v84; // [xsp+10h] [xbp-280h] unsigned int m_uReference; // [xsp+1Ch] [xbp-274h] BYREF __int128 v86; // [xsp+20h] [xbp-270h] BYREF __int128 v87; // [xsp+30h] [xbp-260h] int v88; // [xsp+40h] [xbp-250h] _QWORD v89[4]; // [xsp+50h] [xbp-240h] BYREF int v90; // [xsp+70h] [xbp-220h] _QWORD v91[4]; // [xsp+80h] [xbp-210h] BYREF int v92; // [xsp+A0h] [xbp-1F0h] _QWORD v93[4]; // [xsp+B0h] [xbp-1E0h] BYREF int v94; // [xsp+D0h] [xbp-1C0h] std::unordered_map v95; // [xsp+E0h] [xbp-1B0h] BYREF std::unordered_map v96; // [xsp+110h] [xbp-180h] BYREF void *v97[4]; // [xsp+140h] [xbp-150h] BYREF int v98; // [xsp+160h] [xbp-130h] _DWORD *v99[4]; // [xsp+170h] [xbp-120h] BYREF int v100; // [xsp+190h] [xbp-100h] __int128 v101; // [xsp+1A0h] [xbp-F0h] BYREF char v102; // [xsp+1B7h] [xbp-D9h] std::string v103; // [xsp+1B8h] [xbp-D8h] BYREF std::unordered_set v104; // [xsp+1D0h] [xbp-C0h] BYREF _DWORD *v105[3]; // [xsp+208h] [xbp-88h] BYREF p_m_isPlatformer = &a1->m_isPlatformer; a1->m_processingAudioTriggers = 1; memset(&v104, 0, 32); v104.__table_.__p3_.__value_ = 1.0; next = a1->m_gameState.m_songChannelStates.__table_.__p1_.__value_.__next_; if ( !next ) goto LABEL_27; v5 = 0; do { LODWORD(v97[0]) = next[2].__next_; v6 = (SongTriggerGameObject *)next[5].__next_; if ( v6 ) GJBaseGameLayer::activateSongTrigger(a1, v6); v7 = (SongTriggerGameObject *)next[3].__next_; if ( v7 ) { v8 = *(double *)&next[4].__next_; v7->m_spawnTriggerDelay = v8; FMODAudioEngine::sharedEngine(); v9 = FMODAudioEngine::pitchForIdx(v7->m_speed); m_volume = v7->m_volume; v11 = FMODAudioEngine::sharedEngine(); MusicDownloadManager::sharedState(); MusicDownloadManager::pathForSong((unsigned int)v7->m_soundID, &v103); FMODAudioEngine::loadMusic( (__int64)v11, (__int128 *)&v103, v7->m_loop, LODWORD(v97[0]), 0, v7->m_dontReset, v9, 0.0, m_volume); if ( SHIBYTE(v103.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v103.__r_.__value_.__l.__data_); if ( v7->m_loop && (v7->m_start > 0 || v7->m_end >= 1) ) { v12 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::startMusic(v12, v7->m_start, v7->m_end, 0, 0, 1, (int)v97[0], 1, v7->m_dontReset); } v13 = (int)v97[0]; m_spawnTriggerDelay = v7->m_spawnTriggerDelay; m_start = v7->m_start; if ( sub_100018814(&a1->m_gameState.m_songTriggerStateVectors.__table_.__bucket_list_.__ptr_.__value_, (int *)v97) ) { v99[0] = v97; v16 = (std::vector *)(sub_10001A284( (unsigned __int64)&a1->m_gameState.m_songTriggerStateVectors, (int *)v97, (__int64)&unk_10063A31C, v99) + 3); } else { v16 = nullptr; } if ( GJBaseGameLayer::processSongState(a1, v13, m_spawnTriggerDelay, a2, m_start, m_volume, v9, v16, v7) ) sub_10001C1B0((unsigned __int64)&v104, (int *)v97, v97); } if ( !LODWORD(v97[0]) ) { v18 = *(double *)&next[4].__next_ > 0.0 || v7 != nullptr; v5 |= v18; } next = next->__next_; } while ( next ); if ( (v5 & 1) == 0 ) { LABEL_27: if ( !a1->m_gameState.m_unkBool30 ) { v19 = FMODAudioEngine::sharedEngine(); GJGameLevel::getAudioFileName((__int64)a1->m_level, &v101); FMODAudioEngine::loadMusic( (__int64)v19, &v101, *p_m_isPlatformer, 0, 0, a1->m_levelSettings->m_dontReset, 1.0, 0.0, 1.0); if ( v102 < 0 ) operator delete((void *)v101); m_songOffset = a1->m_levelSettings->m_songOffset; LODWORD(v97[0]) = 0; if ( sub_100018814(&a1->m_gameState.m_songTriggerStateVectors.__table_.__bucket_list_.__ptr_.__value_, (int *)v97) ) { LODWORD(v96.__table_.__bucket_list_.__ptr_.__value_) = 0; v99[0] = &v96; v21 = (std::vector *)(sub_10001A284( (unsigned __int64)&a1->m_gameState.m_songTriggerStateVectors, (int *)&v96, (__int64)&unk_10063A31C, v99) + 3); } else { v21 = nullptr; } if ( GJBaseGameLayer::processSongState( a1, 0, 0.0, a2, (int)(float)(m_songOffset * 1000.0), 1.0, 1.0, v21, nullptr) ) { LODWORD(v99[0]) = 0; sub_10001C1B0((unsigned __int64)&v104, (int *)v99, v99); } } } v22 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::stopMusicNotInSet(v22, &v104); memset(v99, 0, sizeof(v99)); v100 = 1065353216; memset(v97, 0, sizeof(v97)); v98 = 1065353216; memset(&v96, 0, 32); v96.__table_.__p3_.__value_ = 1.0; memset(&v95, 0, 32); v95.__table_.__p3_.__value_ = 1.0; memset(v93, 0, sizeof(v93)); v94 = 1065353216; memset(v91, 0, sizeof(v91)); v92 = 1065353216; memset(v89, 0, sizeof(v89)); v90 = 1065353216; p_m_sfxTriggerStates = &a1->m_gameState.m_sfxTriggerStates; begin = a1->m_gameState.m_sfxTriggerStates.__begin_; end = a1->m_gameState.m_sfxTriggerStates.__end_; if ( begin != end ) { v84 = a1->m_gameState.m_sfxTriggerStates.__end_; do { m_sfxTriggerGameObject = begin->m_sfxTriggerGameObject; m_objectID = begin->m_sfxTriggerGameObject->m_objectID; if ( m_objectID == 3603 ) { v86 = 0u; v87 = 0u; v88 = 1065353216; m_groupID = m_sfxTriggerGameObject->m_groupID; if ( m_groupID >= 1 ) { Group = GJBaseGameLayer::getGroup(a1, m_groupID); v34 = Group; if ( Group ) { if ( (unsigned int)sub_10024A36C(Group) ) { data = v34->data; num = data->num; if ( (_DWORD)num ) { arr = data->arr; v38 = (unsigned __int64)&arr[num - 1]; do { v39 = *arr; if ( !*arr ) break; if ( v39[18].m_uReference == 3602 ) { m_uReference = v39[16].m_uReference; v105[0] = &m_uReference; v40 = sub_10001A284((unsigned __int64)v99, (int *)&m_uReference, (__int64)&unk_10063A31C, v105); v42 = (int *)v40[3]; v41 = (int *)v40[4]; while ( v42 != v41 ) { sub_10001C1B0((unsigned __int64)&v86, v42, v42); ++v42; } } ++arr; } while ( (unsigned __int64)arr <= v38 ); } } } } if ( m_sfxTriggerGameObject->m_sfxUniqueID >= 1 && sub_100018814(&v96, &m_sfxTriggerGameObject->m_sfxUniqueID) ) { v105[0] = &m_sfxTriggerGameObject->m_sfxUniqueID; m_uReference = p_m_sfxTriggerStates->__begin_[*((int *)sub_10001D150( (unsigned __int64)&v96, &m_sfxTriggerGameObject->m_sfxUniqueID, (__int64)&unk_10063A31C, v105) + 5)].m_sfxTriggerGameObject->m_uniqueID; v105[0] = &m_uReference; v43 = sub_10001A284((unsigned __int64)v99, (int *)&m_uReference, (__int64)&unk_10063A31C, v105); v45 = (int *)v43[3]; v44 = (int *)v43[4]; while ( v45 != v44 ) { sub_10001C1B0((unsigned __int64)&v86, v45, v45); ++v45; } } for ( i = (int *)v87; i; i = *(int **)i ) { v47 = (GJBaseGameLayer *)sub_100018814(v93, i + 4); if ( v47 ) GJBaseGameLayer::processSFXState(v47, &p_m_sfxTriggerStates->__begin_[v47->m_uReference], begin, 0, a2); } if ( m_sfxTriggerGameObject->m_sfxGroup > 0 ) { sub_100018054(&v86); v105[0] = &m_sfxTriggerGameObject->m_sfxGroup; v48 = sub_10001A284((unsigned __int64)v97, &m_sfxTriggerGameObject->m_sfxGroup, (__int64)&unk_10063A31C, v105); v50 = (int *)v48[3]; v49 = (int *)v48[4]; while ( v50 != v49 ) { sub_10001C1B0((unsigned __int64)&v86, v50, v50); ++v50; } for ( j = (int *)v87; j; j = *(int **)j ) { v52 = (GJBaseGameLayer *)sub_100018814(v93, j + 4); if ( v52 ) GJBaseGameLayer::processSFXState(v52, &p_m_sfxTriggerStates->__begin_[v52->m_uReference], begin, 1, a2); } if ( m_sfxTriggerGameObject->m_changeVolume ) sub_1002064CC((double *)begin, v91, begin->m_unkFloat1); if ( m_sfxTriggerGameObject->m_changeSpeed ) sub_1002064CC((double *)begin, v89, begin->m_unkFloat3); } canProcessSFX = sub_100017A98((__int64)&v86); end = v84; } else if ( m_objectID == 3602 ) { canProcessSFX = GJBaseGameLayer::canProcessSFX(a1, begin, &v96, &v95, &a1->m_gameState.m_sfxTriggerStates); if ( (_DWORD)canProcessSFX ) { LODWORD(v105[0]) = m_sfxTriggerGameObject->m_uniqueID; *(_QWORD *)&v86 = v105; v29 = sub_10001A284((unsigned __int64)v99, (int *)v105, (__int64)&unk_10063A31C, (_DWORD **)&v86); sub_10000CBA8((__int64)(v29 + 3), &begin->m_unkInt1); m_unkInt2 = begin->m_unkInt2; *(_QWORD *)&v86 = &begin->m_unkInt1; canProcessSFX = (__int64)sub_10001D150( (unsigned __int64)v93, &begin->m_unkInt1, (__int64)&unk_10063A31C, (_DWORD **)&v86); *(_DWORD *)(canProcessSFX + 20) = m_unkInt2; if ( m_sfxTriggerGameObject->m_sfxGroup >= 1 ) { *(_QWORD *)&v86 = &m_sfxTriggerGameObject->m_sfxGroup; v31 = sub_10001A284( (unsigned __int64)v97, &m_sfxTriggerGameObject->m_sfxGroup, (__int64)&unk_10063A31C, (_DWORD **)&v86); sub_10000CBA8((__int64)(v31 + 3), &begin->m_unkInt1); } } else { begin->m_processed = 1; } } ++begin; } while ( begin != end ); } v53 = a2; v54 = 1; v55 = Pitch; do { v56 = v54; if ( (v54 & 1) != 0 ) v57 = v91; else v57 = v89; v58 = v57 + 1; while ( 1 ) { v58 = *(_OWORD **)v58; if ( !v58 ) break; v59 = *((float *)v58 + 10); v61 = *((double *)v58 + 3); v60 = *((double *)v58 + 4); if ( v61 + v60 > v53 ) { v62 = v53 - v61; v59 = *((float *)v58 + 11) + (float)(v59 - *((float *)v58 + 11)) * (v62 / v60); } v63 = *((_DWORD *)v58 + 4); v64 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::updateChannel(v64, v63, SFXGroup, v55, 0.0, v59); } v54 = 0; v55 = Volume; } while ( (v56 & 1) != 0 ); v65 = a1->m_gameState.m_sfxTriggerStates.__begin_; v66 = a1->m_gameState.m_sfxTriggerStates.__end_; if ( v65 != v66 ) { do { GJBaseGameLayer::processSFXState((GJBaseGameLayer *)canProcessSFX, v65, nullptr, 0, a2); v67 = v65->m_sfxTriggerGameObject; v68 = v65->m_sfxTriggerGameObject->m_objectID; if ( v68 == 3603 ) { m_duration = v67->m_duration; v77 = (float)(m_duration + v67->m_spawnTriggerDelay) - a2; v67->m_duration = v77; if ( v77 < 0.0 ) v67->m_applyDisabled = 1; if ( v67->m_targetGroupID > 0 || !v67->m_applyDisabled ) GJBaseGameLayer::activateSFXEditTrigger(a1, v67); v67->m_duration = m_duration; v67->m_applyDisabled = 0; } else if ( v68 == 3602 && !v65->m_processed ) { m_unkDouble1 = v65->m_unkDouble1; v70 = FMODAudioEngine::sharedEngine(); v71 = m_unkDouble1; v70->m_audioState.m_elapsed = v71; m_preload = v67->m_preload; v67->m_preload = 1; m_end = v67->m_end; if ( !v67->m_loop && v67->m_fadeOut ) { v74 = v67->m_end; if ( m_end <= 0 ) { if ( v67->m_speed ) { FMODAudioEngine::sharedEngine(); v75 = FMODAudioEngine::pitchForIdx(v67->m_speed); } else { v75 = 1.0; } v74 = (int)(float)(v75 * (float)(v67->m_soundDuration * 1000.0)); v67->m_end = v74; } v67->m_end = (int)((double)v74 - v65->m_unkDouble2); } GJBaseGameLayer::activateSFXTrigger(a1, v67); v78 = canProcessSFX; v67->m_preload = m_preload; v67->m_end = (int)(float)m_end; if ( (int)canProcessSFX >= 1 ) { v79 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::updateChannel(v79, v78, SFXChannel, Pitch, 0.0, v65->m_unkFloat1); v80 = FMODAudioEngine::sharedEngine(); FMODAudioEngine::updateChannel(v80, v78, SFXChannel, Volume, 0.0, v65->m_unkFloat3); v81 = FMODAudioEngine::sharedEngine(); canProcessSFX = (__int64)FMODAudioEngine::channelForChannelID(v81, v78); v82 = (FMOD::Channel *)canProcessSFX; if ( canProcessSFX ) { if ( v67->m_loop && !v65->m_unkBool1 ) FMOD::Channel::setLoopCount((FMOD::Channel *)canProcessSFX, 0); canProcessSFX = FMOD::Channel::setPosition( v82, (unsigned int)(v65->m_unkDouble2 + (double)v67->m_start - (double)(int)(float)(v65->m_unkFloat4 * (float)(int)vcvtmd_s64_f64(v65->m_unkDouble2 / v65->m_unkFloat4))), 1u); } } } ++v65; } while ( v65 != v66 ); v65 = p_m_sfxTriggerStates->__begin_; } a1->m_gameState.m_sfxTriggerStates.__end_ = v65; FMODAudioEngine::sharedEngine()->m_audioState.m_elapsed = a2; p_m_isPlatformer[1543] = 0; sub_100017A98((__int64)v89); sub_100017A98((__int64)v91); sub_100017A98((__int64)v93); sub_100017A98((__int64)&v95); sub_100017A98((__int64)&v96); sub_100017A1C(v97); sub_100017A1C((void **)v99); sub_100017A98((__int64)&v104); }
GD Web Decomp Icon

GD Web Decomp

Raw Source