//
// GJEffectManager::updateTimer from 0x1002ecf50 to 0x1002ed126 (470 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::activateItemEditTrigger @ 0x10014cb6b
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x10014d37c
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x10014d58a
//
// 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 GJEffectManager::updateTimer(GJEffectManager *a1, int a2, double a3)
{
int v4; // eax
unsigned int v5; // esi
double v6; // xmm0_8
unsigned __int64 value; // rcx
unsigned __int64 v8; // r11
__int64 v9; // r9
std::__hash_node_base, void *> *> *v10; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // r10
unsigned __int64 v12; // rcx
std::__hash_node_base, void *> *>::__next_pointer v13; // rax
unsigned __int64 v14; // rax
std::vector v15; // [rsp+0h] [rbp-20h] BYREF
v4 = 0;
if ( a2 > 0 )
v4 = a2;
v5 = 9999;
if ( v4 < 9999 )
v5 = v4;
v6 = 9999999.0;
if ( a3 <= 9999999.0 )
{
v6 = a3;
if ( a3 < -9999999.0 )
v6 = -9999999.0;
}
value = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
if ( !value )
goto LABEL_21;
v8 = (0x101010101010101LL
* ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v8 > 1 )
{
v9 = v5;
if ( value <= v5 )
v9 = (unsigned __int16)((unsigned __int16)v5 % (unsigned __int16)value);
}
else
{
v9 = ((_DWORD)value + 0x3FFF) & v5;
}
v10 = a1->m_timerItemMap.__table_.__bucket_list_.__ptr_.__value_[v9];
if ( !v10 || (next = v10->__next_) == nullptr )
{
LABEL_21:
memset(&v15, 0, sizeof(v15));
GJEffectManager::startTimer(a1, v5, v6, 0.0, 0, 0, 1, 1.0, 0, 0, &v15, 0, 0);
return;
}
if ( (unsigned int)v8 < 2 )
{
v12 = value - 1;
while ( 1 )
{
v13 = next[1].__next_;
if ( v13 == (std::__hash_node_base, void *> *>::__next_pointer)v5 )
{
if ( LODWORD(next[2].__next_) == v5 )
goto LABEL_32;
}
else if ( (v12 & (unsigned __int64)v13) != v9 )
{
goto LABEL_21;
}
next = next->__next_;
if ( !next )
goto LABEL_21;
}
}
while ( 1 )
{
v14 = (unsigned __int64)next[1].__next_;
if ( v14 == v5 )
break;
if ( v14 < value )
goto LABEL_28;
if ( (value | v14) >> 32 )
{
v14 %= value;
LABEL_28:
if ( v14 != v9 )
goto LABEL_21;
goto LABEL_23;
}
if ( (unsigned int)v14 % (unsigned int)value != v9 )
goto LABEL_21;
LABEL_23:
next = next->__next_;
if ( !next )
goto LABEL_21;
}
if ( LODWORD(next[2].__next_) != v5 )
goto LABEL_23;
LABEL_32:
*(double *)&next[4].__next_ = v6;
}