//
// CustomizeObjectLayer::updateColorSprite from 0x1401425e0 to 0x1401427e8 (520 bytes)
//
// 9 xrefs:
// > CustomizeObjectLayer::onPaste @ 0x1401421f2
// > CustomizeObjectLayer::colorSetupClosed @ 0x1401424c7
// > CustomizeObjectLayer::colorSelectClosed @ 0x1401427f7
// > CustomizeObjectLayer::onNextColorChannel @ 0x14014309e
// > CustomizeObjectLayer::onSelectMode @ 0x1401432a4
// > CustomizeObjectLayer::onUpdateCustomColor @ 0x14014374d
// > CustomizeObjectLayer::textChanged @ 0x140143a99
// > CustomizeObjectLayer::onSelectColor @ 0x140143e8a
// > ??> @ 0x140917378
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall CustomizeObjectLayer::updateColorSprite(__int64 a1, __int64 a2)
{
int ActiveMode; // edi
__int64 v4; // rax
int v5; // edx
__int64 v6; // rcx
__int64 ColorAction; // rax
__int64 v8; // rsi
__int64 v9; // rbx
void *v11; // [rsp+30h] [rbp+8h] BYREF
ActiveMode = 0;
if ( *(_DWORD *)(a1 + 744) == 3 )
goto LABEL_18;
LOBYTE(a2) = 1;
ActiveMode = CustomizeObjectLayer::getActiveMode(a1, a2);
if ( ActiveMode <= 0 )
goto LABEL_13;
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v11 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
v5 = ActiveMode;
if ( ActiveMode > 1101 )
v5 = 1101;
v6 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v4 + 568) + 3528LL) + 320LL);
if ( *(_QWORD *)(*(_QWORD *)(v6 + 736) + 8LL * v5) )
{
ColorAction = GJEffectManager::getColorAction(v6, (unsigned int)ActiveMode);
v8 = ColorAction;
v9 = *(_QWORD *)(a1 + 896);
if ( ColorAction )
{
ColorChannelSprite::updateCopyLabel(
*(_QWORD *)(a1 + 896),
*(unsigned int *)(ColorAction + 120),
*(unsigned __int8 *)(ColorAction + 126));
ColorChannelSprite::updateOpacity(v9);
ColorChannelSprite::updateBlending(v9, *(unsigned __int8 *)(v8 + 84));
LOWORD(v11) = *(_WORD *)(v8 + 72);
BYTE2(v11) = *(_BYTE *)(v8 + 74);
if ( *(_DWORD *)(v8 + 120) && !*(_BYTE *)(v8 + 126) )
{
LOWORD(v11) = -22874;
BYTE2(v11) = -90;
}
(**(void (__fastcall ***)(__int64, void **))(v9 + 320))(v9 + 320, &v11);
goto LABEL_18;
}
}
else
{
LABEL_13:
v9 = *(_QWORD *)(a1 + 896);
}
(**(void (__fastcall ***)(__int64, __int16 *))(v9 + 320))(v9 + 320, &word_140703460);
if ( *(_QWORD *)(v9 + 600) )
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v9 + 600) + 336LL))(*(_QWORD *)(v9 + 600), 0);
ColorChannelSprite::updateOpacity(v9);
if ( *(_QWORD *)(v9 + 616) )
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v9 + 616) + 336LL))(*(_QWORD *)(v9 + 616), 0);
LABEL_18:
LOBYTE(a2) = ActiveMode < 1;
switch ( ActiveMode )
{
case 1005:
case 1006:
case 1007:
case 1010:
case 1011:
case 1012:
LOBYTE(a2) = 1;
break;
default:
break;
}
LOBYTE(a2) = a2 ^ 1;
return (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 904) + 336LL))(*(_QWORD *)(a1 + 904), a2);
}