//
// GJBaseGameLayer::activatePersistentItemTrigger from 0x9ece04 to 0x9ed130 (812 bytes)
//
// 2 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x899510
// > ??> @ 0x74260
//
// 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:59:04 +0000
//
__int64 __fastcall GJBaseGameLayer::activatePersistentItemTrigger(GJBaseGameLayer *this, ItemTriggerGameObject *a2)
{
__int64 v5; // x20
int *v6; // x19
unsigned __int64 v7; // x1
__int64 *i; // x20
int *v9; // x20
_DWORD *v10; // x20
_QWORD *v11; // x0
_QWORD *v12; // x19
void *v13; // x0
void *v14; // [xsp+48h] [xbp+48h] BYREF
int *v15; // [xsp+50h] [xbp+50h]
int *v16; // [xsp+58h] [xbp+58h] BYREF
void *v17; // [xsp+60h] [xbp+60h] BYREF
_BYTE *v18; // [xsp+68h] [xbp+68h]
void *v19; // [xsp+70h] [xbp+70h]
if ( *((_BYTE *)a2 + 1895) )
{
if ( *((_BYTE *)a2 + 1893) )
{
if ( *((_BYTE *)a2 + 1894) )
{
std::unordered_set::unordered_set((unsigned __int64)&v17, *((_QWORD *)this + 269) + 792LL);
v10 = v19;
if ( v19 )
{
do
{
while ( !(unsigned __int8)GJEffectManager::timerExists(*((GJEffectManager **)this + 269), v10[4]) )
{
v10 = *(_DWORD **)v10;
if ( !v10 )
goto LABEL_37;
}
GJEffectManager::updateTimer(*((GJEffectManager **)this + 269), v10[4], 0.0);
v10 = *(_DWORD **)v10;
}
while ( v10 );
LABEL_37:
v11 = v19;
if ( v19 )
{
do
{
v12 = (_QWORD *)*v11;
operator delete(v11);
v11 = v12;
}
while ( v12 );
}
}
v13 = v17;
v17 = nullptr;
if ( v13 )
operator delete(v13);
}
if ( !*((_BYTE *)a2 + 1892) )
GJEffectManager::removePersistentFromAllTimers(*((GJEffectManager **)this + 269));
}
else
{
GJEffectManager::toggleTimerPersistent(
*((GJEffectManager **)this + 269),
*((_DWORD *)a2 + 420),
*((_BYTE *)a2 + 1892));
if ( *((_BYTE *)a2 + 1894)
&& (unsigned __int8)GJEffectManager::timerExists(*((GJEffectManager **)this + 269), *((_DWORD *)a2 + 420)) )
{
GJEffectManager::updateTimer(*((GJEffectManager **)this + 269), *((_DWORD *)a2 + 420), 0.0);
}
}
}
else if ( *((_BYTE *)a2 + 1893) )
{
if ( *((_BYTE *)a2 + 1894) )
{
v5 = *((_QWORD *)this + 269);
v14 = nullptr;
v6 = nullptr;
v15 = nullptr;
v7 = *(_QWORD *)(v5 + 776);
v16 = nullptr;
if ( v7 )
{
std::__split_buffer::__split_buffer((__int64 *)&v17, v7, 0, (__int64)&v16);
std::vector::__swap_out_circular_buffer((__int64)&v14, &v17);
if ( v18 != v19 )
v19 = (char *)v19 + 4 * ~((unsigned __int64)((char *)v19 - 4 - v18) >> 2);
if ( v17 )
operator delete(v17);
v6 = v15;
}
for ( i = *(__int64 **)(v5 + 768); i; i = (__int64 *)*i )
{
if ( v16 == v6 )
{
std::vector::__push_back_slow_path((__int64)&v14, (_DWORD *)i + 4);
v6 = v15;
}
else
{
if ( v6 )
{
*v6 = *((_DWORD *)i + 4);
v6 = v15;
}
v15 = ++v6;
}
}
v9 = (int *)v14;
if ( v14 != v6 )
{
do
{
GJEffectManager::updateCountForItem(*((GJEffectManager **)this + 269), *v9, 0);
GJBaseGameLayer::updateCounters(this, *v9++, 0);
}
while ( v6 != v9 );
v6 = (int *)v14;
}
if ( v6 )
{
if ( v6 != v15 )
v15 += ~((unsigned __int64)((char *)(v15 - 1) - (char *)v6) >> 2);
operator delete(v6);
}
}
if ( !*((_BYTE *)a2 + 1892) )
GJEffectManager::removePersistentFromAllItems(*((GJEffectManager **)this + 269));
}
else
{
GJEffectManager::toggleItemPersistent(
*((GJEffectManager **)this + 269),
*((_DWORD *)a2 + 420),
*((_BYTE *)a2 + 1892));
if ( *((_BYTE *)a2 + 1894) )
{
GJEffectManager::updateCountForItem(*((GJEffectManager **)this + 269), *((_DWORD *)a2 + 420), 0);
GJBaseGameLayer::updateCounters(this, *((_DWORD *)a2 + 420), 0);
}
}
return _stack_chk_guard;
}