//
// CustomizeObjectLayer::getActiveMode from 0x1400a93c0 to 0x1400a9546 (390 bytes)
//
// 11 xrefs:
// > CustomizeObjectLayer::onLiveEdit @ 0x1400a7f29
// > CustomizeObjectLayer::onPaste @ 0x1400a8153
// > CustomizeObjectLayer::onEditColor @ 0x1400a848f
// > CustomizeObjectLayer::updateColorSprite @ 0x1400a8558
// > CustomizeObjectLayer::onSelectMode @ 0x1400a918e
// > CustomizeObjectLayer::toggleVisible @ 0x1400a935e
// > CustomizeObjectLayer::updateCurrentSelection @ 0x1400a955b
// > CustomizeObjectLayer::onSelectColor @ 0x1400a9d04
// > ??> @ 0x14066ab24
// > ??> @ 0x14066ab34
// > ??> @ 0x1406c7818
//
// 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
//
int CustomizeObjectLayer::getActiveMode(CustomizeObjectLayer *a1, bool a2)
{
GameObject *m_targetObject; // rcx
GJSpriteColor *RelativeSpriteColor; // rax
int m_defaultColorID; // ecx
int result; // eax
bool v8; // bp
int v9; // ebx
unsigned int v10; // esi
struct cocos2d::CCObject *v11; // rcx
__int16 m_unknown2; // ax
bool v13; // al
int v14; // edx
bool v15; // al
int *v16; // rax
int v17; // ecx
int v18; // eax
m_targetObject = a1->m_targetObject;
if ( m_targetObject )
{
RelativeSpriteColor = GameObject::getRelativeSpriteColor(m_targetObject, a1->m_selectedMode);
if ( !RelativeSpriteColor )
return 0;
m_defaultColorID = RelativeSpriteColor->m_defaultColorID;
result = RelativeSpriteColor->m_colorID;
if ( m_defaultColorID == result || !result )
result = m_defaultColorID;
if ( !a2 && m_defaultColorID == result )
return 0;
return result;
}
v8 = !a2;
v9 = -1;
v10 = 0;
if ( !cocos2d::CCArray::count(a1->m_targetObjects) )
goto LABEL_36;
while ( 1 )
{
v11 = cocos2d::CCArray::objectAtIndex(a1->m_targetObjects, v10);
m_unknown2 = v11[18].m_unknown2;
v13 = m_unknown2 ? m_unknown2 == 1 : LOBYTE(v11[23].m_nLuaID);
v15 = false;
if ( !v13 && !v11[16].__vftable )
{
v14 = *(_DWORD *)(*(_QWORD *)&v11[19].m_unknown2 + 4LL);
if ( v14 != 1004 )
{
if ( v14 )
v15 = true;
}
}
if ( a1->m_selectedMode == 2 )
break;
if ( !v15 )
goto LABEL_23;
LABEL_33:
if ( ++v10 >= cocos2d::CCArray::count(a1->m_targetObjects) )
goto LABEL_36;
}
if ( !v15 )
{
v16 = *(int **)&v11[19].m_uOrderOfArrival;
goto LABEL_24;
}
LABEL_23:
v16 = *(int **)&v11[19].m_unknown2;
LABEL_24:
if ( !v16 )
goto LABEL_33;
v17 = v16[1];
v18 = *v16;
if ( v17 == v18 || !v18 )
v18 = v17;
if ( v8 )
v8 = v18 == v17;
if ( v9 == -1 )
{
v9 = v18;
goto LABEL_33;
}
if ( v9 == v18 )
goto LABEL_33;
v9 = -1;
LABEL_36:
if ( v8 )
return 0;
return v9;
}