//
// CustomizeObjectLayer::getActiveMode from 0x1401434e0 to 0x140143675 (405 bytes)
//
// 11 xrefs:
// > CustomizeObjectLayer::onLiveEdit @ 0x140141fb9
// > CustomizeObjectLayer::onPaste @ 0x1401421fc
// > CustomizeObjectLayer::onEditColor @ 0x14014253f
// > CustomizeObjectLayer::updateColorSprite @ 0x140142608
// > CustomizeObjectLayer::onSelectMode @ 0x1401432ae
// > CustomizeObjectLayer::toggleVisible @ 0x140143481
// > CustomizeObjectLayer::updateCurrentSelection @ 0x14014368b
// > CustomizeObjectLayer::onSelectColor @ 0x140143e94
// > ??> @ 0x140899e9c
// > ??> @ 0x140899eac
// > ??> @ 0x1409173d8
//
// 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 11:27:10 +0000
//
__int64 __fastcall CustomizeObjectLayer::getActiveMode(__int64 a1, char a2)
{
__int64 v3; // rcx
unsigned int *RelativeSpriteColor; // rax
unsigned int *v6; // rcx
__int64 result; // rax
unsigned int v8; // ecx
char v9; // bp
unsigned int v10; // ebx
unsigned int v11; // edi
struct cocos2d::CCObject *v12; // rdx
__int16 v13; // ax
bool v14; // al
unsigned int **v15; // rcx
int v16; // r8d
char v17; // r8
unsigned int *v18; // rdx
unsigned int v19; // eax
unsigned int v20; // ecx
v3 = *(_QWORD *)(a1 + 688);
if ( v3 )
{
RelativeSpriteColor = (unsigned int *)GameObject::getRelativeSpriteColor(v3, *(unsigned int *)(a1 + 744));
v6 = RelativeSpriteColor;
if ( !RelativeSpriteColor )
return 0;
result = *RelativeSpriteColor;
v8 = v6[1];
if ( v8 == (_DWORD)result || !(_DWORD)result )
result = v8;
if ( !a2 && v8 == (_DWORD)result )
return 0;
return result;
}
v9 = a2 ^ 1;
v10 = -1;
v11 = 0;
if ( !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 696)) )
goto LABEL_36;
while ( 1 )
{
v12 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 696), v11);
v13 = *((_WORD *)v12 + 524);
v14 = v13 ? v13 == 1 : *((_BYTE *)v12 + 1300);
if ( v14
|| *((_QWORD *)v12 + 112)
|| (v15 = (unsigned int **)((char *)v12 + 1104), v16 = *(_DWORD *)(*((_QWORD *)v12 + 138) + 4LL), v16 == 1004)
|| !v16 )
{
v17 = 0;
v15 = (unsigned int **)((char *)v12 + 1104);
}
else
{
v17 = 1;
}
if ( *(_DWORD *)(a1 + 744) == 2 )
break;
if ( !v17 )
goto LABEL_24;
LABEL_33:
if ( ++v11 >= cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 696)) )
goto LABEL_36;
}
if ( !v17 )
v15 = (unsigned int **)((char *)v12 + 1112);
LABEL_24:
v18 = *v15;
if ( !*v15 )
goto LABEL_33;
v19 = *v18;
v20 = v18[1];
if ( v20 == *v18 || !v19 )
v19 = v18[1];
if ( v9 )
v9 = v19 == v20;
if ( v10 == -1 )
{
v10 = v19;
goto LABEL_33;
}
if ( v10 == v19 )
goto LABEL_33;
v10 = -1;
LABEL_36:
if ( v9 )
return 0;
return v10;
}