//
// PlayLayer::loadDefaultColors from 0x1000b1bf0 to 0x1000b1f75 (901 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x1000ae5de
// > PlayLayer::resetLevel @ 0x1000be915
//
// 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 PlayLayer::loadDefaultColors(PlayLayer *a1)
{
__m128 v2; // xmm0
cocos2d::CCArray *AllColorActions; // r14
unsigned int i; // r15d
__int64 v5; // rax
cocos2d::CCArray *v6; // r14
unsigned int j; // r15d
__int64 v8; // rax
cocos2d::CCArray *v9; // r14
unsigned int k; // r12d
__int64 v11; // rax
char v12; // r8
int v13; // ecx
unsigned __int64 v14; // r11
unsigned __int64 v15; // rdi
__int64 **v16; // rax
__int64 *v17; // r10
unsigned __int64 v18; // rax
__int64 v19; // rax
_QWORD *v20; // rdi
_QWORD *v21; // rbx
void *v22; // rdi
void *v23[2]; // [rsp+20h] [rbp-60h] BYREF
void *__p[2]; // [rsp+30h] [rbp-50h]
int v25; // [rsp+40h] [rbp-40h]
int v26[11]; // [rsp+54h] [rbp-2Ch] BYREF
v2 = 0;
*(_OWORD *)__p = 0;
*(_OWORD *)v23 = 0;
v25 = 1065353216;
AllColorActions = GJEffectManager::getAllColorActions(a1->m_effectManager);
for ( i = 0; i < (unsigned int)sub_100720070(AllColorActions); ++i )
{
v5 = sub_1007200C0(AllColorActions, i);
if ( *(_BYTE *)(v5 + 84) == 1 )
{
v26[0] = *(_DWORD *)(v5 + 92);
sub_100056510((float *)v23, v26, v26, (__m128)0LL);
}
}
GJEffectManager::reset(a1->m_effectManager);
v6 = GJEffectManager::getAllColorActions(a1->m_levelSettings->GJBaseGameLayer::m_effectManager);
for ( j = 0; j < (unsigned int)sub_100720070(v6); ++j )
{
v8 = sub_1007200C0(v6, j);
v2 = 0;
((void (__fastcall *)(PlayLayer *, __int64, _QWORD, _QWORD, __int64, _QWORD, double, float, _DWORD, _QWORD, _DWORD, _DWORD))a1->updateColor)(
a1,
v8 + 72,
*(unsigned int *)(v8 + 92),
*(unsigned __int8 *)(v8 + 84),
v8 + 104,
*(unsigned int *)(v8 + 120),
0.0,
*(float *)(v8 + 96),
*(unsigned __int8 *)(v8 + 125),
0,
*(_DWORD *)(v8 + 128),
*(_DWORD *)(v8 + 132));
}
v9 = GJEffectManager::getAllColorActions(a1->m_effectManager);
for ( k = 0; k < (unsigned int)sub_100720070(v9); ++k )
{
v11 = sub_1007200C0(v9, k);
v12 = *(_BYTE *)(v11 + 84);
v13 = *(_DWORD *)(v11 + 92);
if ( !v23[1] )
goto LABEL_42;
v14 = (0x101010101010101LL
* (((((unsigned __int64)v23[1] - (((unsigned __int64)v23[1] >> 1) & 0x5555555555555555LL))
& 0x3333333333333333LL)
+ ((((unsigned __int64)v23[1] - (((unsigned __int64)v23[1] >> 1) & 0x5555555555555555LL)) >> 2)
& 0x3333333333333333LL)
+ (((((unsigned __int64)v23[1] - (((unsigned __int64)v23[1] >> 1) & 0x5555555555555555LL))
& 0x3333333333333333LL)
+ ((((unsigned __int64)v23[1] - (((unsigned __int64)v23[1] >> 1) & 0x5555555555555555LL)) >> 2)
& 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v14 > 1 )
{
v15 = v13;
if ( v23[1] > (void *)v13 )
goto LABEL_20;
if ( ((unsigned __int64)v23[1] | v13) >> 32 )
{
v15 = v13 % (unsigned __int64)v23[1];
LABEL_20:
v16 = *((__int64 ***)v23[0] + v15);
if ( !v16 )
goto LABEL_42;
LABEL_21:
v17 = *v16;
if ( !*v16 )
goto LABEL_42;
if ( (unsigned int)v14 < 2 )
{
while ( 1 )
{
v19 = v17[1];
if ( v19 == v13 )
{
if ( *((_DWORD *)v17 + 4) == v13 )
goto LABEL_39;
}
else if ( (((unsigned __int64)v23[1] - 1) & v19) != v15 )
{
goto LABEL_42;
}
v17 = (__int64 *)*v17;
if ( !v17 )
goto LABEL_42;
}
}
LABEL_26:
v18 = v17[1];
if ( v18 == v13 )
{
if ( *((_DWORD *)v17 + 4) == v13 )
{
LABEL_39:
if ( v12 )
continue;
LABEL_10:
v26[0] = v13;
sub_100056510((float *)&a1->m_blendingColors, v26, v26, v2);
continue;
}
}
else if ( (void *)v18 < v23[1] )
{
LABEL_30:
if ( v18 != v15 )
goto LABEL_42;
}
else
{
if ( ((unsigned __int64)v23[1] | v18) >> 32 )
{
v18 %= (unsigned __int64)v23[1];
goto LABEL_30;
}
if ( (unsigned int)v18 % LODWORD(v23[1]) != v15 )
goto LABEL_42;
}
v17 = (__int64 *)*v17;
if ( !v17 )
goto LABEL_42;
goto LABEL_26;
}
v15 = (unsigned int)v13 % LODWORD(v23[1]);
v16 = *((__int64 ***)v23[0] + v15);
if ( v16 )
goto LABEL_21;
}
else
{
v15 = v13 & ((unsigned __int64)v23[1] - 1);
v16 = *((__int64 ***)v23[0] + v15);
if ( v16 )
goto LABEL_21;
}
LABEL_42:
if ( v12 )
goto LABEL_10;
}
GJEffectManager::updateEffects(a1->m_effectManager, 0.0);
GJEffectManager::calculateBaseActiveColors(a1->m_effectManager);
GJEffectManager::processInheritedColors(a1->m_effectManager);
v20 = __p[0];
if ( __p[0] )
{
do
{
v21 = (_QWORD *)*v20;
operator delete(v20);
v20 = v21;
}
while ( v21 );
}
v22 = v23[0];
v23[0] = nullptr;
if ( v22 )
operator delete(v22);
}