//
// GJEffectManager::toggleTimerPersistent from 0x5cf88c to 0x5cfa20 (404 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x5bd42e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:54:03 +0000
//
void __fastcall GJEffectManager::toggleTimerPersistent(GJEffectManager *this, unsigned int a2, int a3)
{
unsigned int v3; // r6
unsigned int v5; // r4
unsigned int v7; // r11
_DWORD *v8; // r3
_DWORD *i; // r9
unsigned int v10; // r0
int v11; // r1
float v12; // s13
float v13; // s15
bool v14; // r6
unsigned int v15; // r4
unsigned int v16; // r1
void **v17; // r3
unsigned int v18; // r0
int v19; // r1
unsigned int v20; // [sp+4h] [bp-18h] BYREF
void *v21; // [sp+8h] [bp-14h] BYREF
v20 = a2;
if ( !a3 )
{
std::__hash_table,std::equal_to,std::allocator>::__erase_unique(
(int *)this + 125,
&v20);
return;
}
v5 = *((_DWORD *)this + 126);
if ( v5 )
{
v7 = v5 - 1;
v3 = ((v5 - 1) & v5) != 0 ? a2 % v5 : v7 & a2;
v8 = *(_DWORD **)(*((_DWORD *)this + 125) + 4 * v3);
if ( v8 )
{
for ( i = (_DWORD *)*v8; i; i = (_DWORD *)*i )
{
v10 = i[1];
v11 = ((v5 - 1) & v5) != 0 ? v10 % v5 : v7 & v10;
if ( v11 != v3 )
break;
if ( i[2] == a2 )
return;
}
}
}
std::__hash_table,std::equal_to,std::allocator>::__construct_node_hash(
(int)&v21,
(int)this + 500,
a2,
&v20);
v12 = *((float *)this + 129);
v13 = (float)(unsigned int)(*((_DWORD *)this + 128) + 1);
if ( v13 > (float)((float)v5 * v12) )
{
v14 = v5 > 2 && ((v5 - 1) & v5) == 0;
goto LABEL_17;
}
if ( !v5 )
{
v14 = 0;
LABEL_17:
v15 = 2 * v5 + !v14;
v16 = (unsigned int)ceilf(v13 / v12);
if ( v16 < v15 )
v16 = v15;
std::__hash_table,std::equal_to,std::allocator>::rehash((int)this + 500, v16);
v5 = *((_DWORD *)this + 126);
if ( ((v5 - 1) & v5) != 0 )
v3 = a2 % v5;
else
v3 = (v5 - 1) & a2;
}
v17 = *(void ***)(*((_DWORD *)this + 125) + 4 * v3);
if ( v17 )
{
*(_DWORD *)v21 = *v17;
*v17 = v21;
}
else
{
*(_DWORD *)v21 = *((_DWORD *)this + 127);
*((_DWORD *)this + 127) = v21;
*(_DWORD *)(*((_DWORD *)this + 125) + 4 * v3) = (char *)this + 508;
if ( *(_DWORD *)v21 )
{
v18 = *(_DWORD *)(*(_DWORD *)v21 + 4);
if ( ((v5 - 1) & v5) != 0 )
v19 = v18 % v5;
else
v19 = (v5 - 1) & v18;
*(_DWORD *)(*((_DWORD *)this + 125) + 4 * v19) = v21;
}
}
++*((_DWORD *)this + 128);
}