//
// PlayLayer::loadDefaultColors from 0x10007f140 to 0x10007f4c5 (901 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x10007bb8f
// > PlayLayer::resetLevel @ 0x10008cd45
//
// This function is hookable on this platform (idp: pc, 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:20:01 +0000
//
void __fastcall PlayLayer::loadDefaultColors(__int64 a1)
{
__m128 v2; // xmm0
__int64 AllColorActions; // r14
unsigned int i; // r15d
__int64 v5; // rax
__int64 v6; // r14
unsigned int j; // r15d
__int64 v8; // rax
__int64 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(*(_QWORD *)(a1 + 2152));
for ( i = 0; i < (unsigned int)sub_1007FEF90(AllColorActions); ++i )
{
v5 = sub_1007FEFE0(AllColorActions, i);
if ( *(_BYTE *)(v5 + 84) == 1 )
{
v26[0] = *(_DWORD *)(v5 + 92);
sub_10001BC90((float *)v23, v26, v26, (__m128)0LL);
}
}
GJEffectManager::reset(*(_QWORD *)(a1 + 2152));
v6 = GJEffectManager::getAllColorActions(*(_QWORD *)(*(_QWORD *)(a1 + 3272) + 320LL));
for ( j = 0; j < (unsigned int)sub_1007FEF90(v6); ++j )
{
v8 = sub_1007FEFE0(v6, j);
v2 = 0;
(*(void (__fastcall **)(__int64, __int64, _QWORD, _QWORD, __int64, _QWORD, double, float, _DWORD, _QWORD, _DWORD, _DWORD))(*(_QWORD *)a1 + 1232LL))(
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(*(_QWORD *)(a1 + 2152));
for ( k = 0; k < (unsigned int)sub_1007FEF90(v9); ++k )
{
v11 = sub_1007FEFE0(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_10001BC90((float *)(a1 + 14584), 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(*(_QWORD *)(a1 + 2152), 0.0);
GJEffectManager::calculateBaseActiveColors(*(_QWORD *)(a1 + 2152));
GJEffectManager::processInheritedColors(*(_QWORD *)(a1 + 2152));
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);
}