//
// GJBaseGameLayer::activateSFXEditTrigger from 0x9dfdd4 to 0x9e010c (824 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::activateTriggerEffect @ 0x795bf0
// > EffectGameObject::triggerObject @ 0x8988cc
// > GJBaseGameLayer::processQueuedAudioTriggers @ 0x9e01d0
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x9e2e24
// > ??> @ 0x81ef8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:58:54 +0000
//
__int64 __fastcall GJBaseGameLayer::activateSFXEditTrigger(GJBaseGameLayer *this, SFXTriggerGameObject *a2)
{
char *v3; // x0
SFXTriggerGameObject **v4; // x1
SFXTriggerGameObject *v6; // x3
int v7; // w1
cocos2d::CCObject *Group; // x0
cocos2d::CCObject *v9; // x19
unsigned int *v10; // x1
__int64 *v11; // x23
__int64 v12; // x0
char *v13; // x25
__int64 v14; // x2
__int64 *v15; // x19
int *v16; // x3
__int64 *v17; // x0
_QWORD **v18; // x19
int v19; // w1
FMODAudioEngine *v20; // x0
FMODAudioEngine *v21; // x0
int v22; // w1
__int64 *v23; // x1
__int64 *v24; // x1
__int64 v25; // x0
int *v26; // x24
int *v27; // x19
SFXTriggerGameObject *v28; // [xsp+68h] [xbp+68h] BYREF
int v29; // [xsp+7Ch] [xbp+7Ch] BYREF
__int64 *v30; // [xsp+80h] [xbp+80h] BYREF
_QWORD v31[2]; // [xsp+88h] [xbp+88h] BYREF
v3 = (char *)this + 12288;
v28 = a2;
if ( v3[257] || !v3[256] )
{
if ( v3[1516] )
{
(*(void (__fastcall **)(GJBaseGameLayer *, SFXTriggerGameObject *))(*(_QWORD *)this + 1520LL))(this, v28);
}
else if ( *((_BYTE *)this + 1983) )
{
v4 = *((SFXTriggerGameObject ***)this + 249);
if ( v4 == *((SFXTriggerGameObject ***)this + 250) )
{
std::vector::__push_back_slow_path(
(void **)this + 248,
&v28);
}
else
{
if ( v4 )
{
*v4 = v28;
v4 = *((SFXTriggerGameObject ***)this + 249);
}
*((_QWORD *)this + 249) = v4 + 1;
}
}
else
{
v6 = v28;
v7 = *((_DWORD *)v28 + 490);
if ( v7 > 0 )
{
Group = GJBaseGameLayer::getGroup(this, v7);
v9 = Group;
if ( Group )
{
if ( (unsigned int)cocos2d::CCArray::count(Group) )
{
v10 = *((unsigned int **)v9 + 7);
v31[0] = 0;
v31[1] = 0;
v30 = v31;
if ( *v10 )
{
v11 = *((__int64 **)v10 + 2);
v12 = 8LL * *v10 - 8;
v13 = (char *)v11 + v12;
if ( v11 <= (__int64 *)((char *)v11 + v12) )
{
v14 = *v11;
if ( *v11 )
{
do
{
if ( *(_DWORD *)(v14 + 1028) == 3602 )
{
v29 = *(_DWORD *)(v14 + 916);
v25 = std::unordered_map>::operator[]((unsigned __int64)this + 1728, &v29);
v26 = *(int **)(v25 + 8);
v27 = *(int **)v25;
if ( *(int **)v25 != v26 )
{
do
{
std::__tree::__emplace_unique_key_args(&v30, v27, v27);
++v27;
}
while ( v26 != v27 );
}
}
if ( v13 < (char *)++v11 )
break;
v14 = *v11;
}
while ( *v11 );
v15 = v30;
if ( v30 == v31 )
{
v18 = (_QWORD **)v31[0];
}
else
{
do
{
v16 = (int *)v28;
if ( !*((_BYTE *)v28 + 1980) )
{
GJBaseGameLayer::applySFXEditTrigger(this, *((_DWORD *)v15 + 7), 0, v28);
v16 = (int *)v28;
}
if ( v16[366] > 0 )
GJBaseGameLayer::addProximityVolumeEffect(
(__int64 **)this,
*((_DWORD *)v15 + 7),
0,
(SFXTriggerGameObject *)v16);
v17 = (__int64 *)v15[1];
if ( v17 )
{
do
{
v15 = v17;
v17 = (__int64 *)*v17;
}
while ( v17 );
}
else
{
do
{
v23 = v15;
v15 = (__int64 *)v15[2];
if ( v23 == (__int64 *)*v15 )
break;
v24 = v15;
v15 = (__int64 *)v15[2];
}
while ( v24 != (__int64 *)*v15 );
}
}
while ( v15 != v31 );
v18 = (_QWORD **)v31[0];
}
if ( v18 )
{
std::__tree::destroy((__int64)&v30, *v18);
std::__tree::destroy((__int64)&v30, v18[1]);
operator delete(v18);
}
}
}
}
}
}
v6 = v28;
}
v19 = *((_DWORD *)v6 + 488);
if ( v19 > 0 )
{
if ( !*((_BYTE *)v6 + 1980) )
{
GJBaseGameLayer::applySFXEditTrigger(this, v19, 1, v6);
v6 = v28;
}
if ( *((int *)v6 + 366) > 0 )
{
GJBaseGameLayer::addProximityVolumeEffect((__int64 **)this, *((_DWORD *)v6 + 488), 1, v6);
v6 = v28;
}
}
v20 = (FMODAudioEngine *)*((unsigned int *)v6 + 478);
if ( (int)v20 > 0 )
{
v21 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(v20);
v22 = FMODAudioEngine::channelIDForUniqueID(v21, *((_DWORD *)v28 + 478));
if ( !*((_BYTE *)v28 + 1980) )
GJBaseGameLayer::applySFXEditTrigger(this, v22, 0, v28);
}
}
}
return _stack_chk_guard;
}