//
// CustomizeObjectLayer::getActiveMode from 0x1001da870 to 0x1001da95b (235 bytes)
//
// 7 xrefs:
// > CustomizeObjectLayer::onSelectMode @ 0x1001d99f2
// > CustomizeObjectLayer::onSelectColor @ 0x1001d9f74
// > CustomizeObjectLayer::onEditColor @ 0x1001da1bf
// > CustomizeObjectLayer::onLiveEdit @ 0x1001da21f
// > CustomizeObjectLayer::onPaste @ 0x1001da7c0
// > CustomizeObjectLayer::updateCurrentSelection @ 0x1001da973
// > CustomizeObjectLayer::updateColorSprite @ 0x1001daa41
//
// 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:26:25 +0000
//
__int64 __fastcall CustomizeObjectLayer::getActiveMode(__int64 a1, char a2)
{
__int64 v3; // rdi
unsigned int *RelativeSpriteColor; // rax
unsigned int *v5; // rcx
__int64 result; // rax
unsigned int v7; // ecx
char v8; // bl
unsigned int v9; // r15d
unsigned int v10; // r12d
__int64 v11; // rax
unsigned int *v12; // rax
unsigned int v13; // ecx
unsigned int v14; // eax
char v15; // dl
v3 = *(_QWORD *)(a1 + 688);
if ( v3 )
{
RelativeSpriteColor = (unsigned int *)GameObject::getRelativeSpriteColor(v3, *(unsigned int *)(a1 + 744));
if ( RelativeSpriteColor )
{
v5 = RelativeSpriteColor;
result = *RelativeSpriteColor;
v7 = v5[1];
if ( !(_DWORD)result )
result = v7;
if ( !a2 && v7 == (_DWORD)result )
return 0;
}
else
{
return 0;
}
}
else
{
v8 = a2 ^ 1;
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 696)) )
{
v9 = 0;
v10 = -1;
while ( 1 )
{
v11 = sub_1007FEFE0(*(_QWORD *)(a1 + 696), v9);
v12 = (unsigned int *)GameObject::getRelativeSpriteColor(v11, *(unsigned int *)(a1 + 744));
if ( v12 )
{
v13 = *v12;
v14 = v12[1];
if ( !v13 )
v13 = v14;
v15 = v8;
v8 = v13 == v14;
if ( (v15 & 1) == 0 )
v8 = v15;
if ( v10 == -1 )
{
v10 = v13;
}
else if ( v10 != v13 )
{
break;
}
}
if ( ++v9 >= (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 696)) )
goto LABEL_21;
}
}
v10 = -1;
LABEL_21:
result = 0;
if ( (v8 & 1) == 0 )
return v10;
}
return result;
}