//
// SetupPulsePopup::colorSelectClosed from 0x8ed64c to 0x8ed9a8 (860 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'SetupPulsePopup::colorSelectClosed @ 0x8ed9ac
// > ??> @ 0x754f8
// > ??> @ 0x11a48e0
//
// 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
//
void SetupPulsePopup::colorSelectClosed(SetupPulsePopup *a1, GJSpecialColorSelect *a2, int a3)
{
CCTextInputNode *m_idInput; // x22
void *v6; // x0
int v7; // w0
CCTextInputNode *v8; // x20
char *v9; // x0
void *v10; // x0
CCTextInputNode *m_colorIDInput; // x22
void *v12; // x0
int v13; // w0
CCTextInputNode *v14; // x20
char *v15; // x0
void *v16; // x0
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x20
int v20; // w1
unsigned int *v21; // x20
int v22; // w1
unsigned int *v23; // x1
int v24; // w2
int v26[2]; // [xsp+60h] [xbp+60h] BYREF
if ( a3 > 999 )
{
if ( a2->getTag(a2) == 7 )
{
a1->m_disableTextDelegate = 1;
a1->m_copyColorID = a3;
m_colorIDInput = a1->m_colorIDInput;
sub_D153B8((int)v26, "0");
CCTextInputNode::setString(m_colorIDInput, (const unsigned __int8 **)v26);
v12 = (void *)(*(_QWORD *)v26 - 24LL);
if ( (__int64 *)(*(_QWORD *)v26 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(*(_QWORD *)v26 - 8LL);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(*(_QWORD *)v26 - 8LL);
*(_DWORD *)(*(_QWORD *)v26 - 8LL) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v12);
}
v13 = a3;
v14 = a1->m_colorIDInput;
v15 = (char *)GJSpecialColorSelect::textForColorIdx(v13);
sub_D153B8((int)v26, v15);
CCTextInputNode::updateLabel(v14, (const void **)v26);
v16 = (void *)(*(_QWORD *)v26 - 24LL);
if ( (__int64 *)(*(_QWORD *)v26 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(*(_QWORD *)v26 - 8LL);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(*(_QWORD *)v26 - 8LL);
*(_DWORD *)(*(_QWORD *)v26 - 8LL) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v16);
}
SetupPulsePopup::updateCopyColor(a1);
a1->m_disableTextDelegate = 0;
}
else if ( a2->getTag(a2) == 6 )
{
a1->m_disableTextDelegate = 1;
a1->m_targetGroupID = a3;
m_idInput = a1->m_idInput;
sub_D153B8((int)v26, "0");
CCTextInputNode::setString(m_idInput, (const unsigned __int8 **)v26);
v6 = (void *)(*(_QWORD *)v26 - 24LL);
if ( (__int64 *)(*(_QWORD *)v26 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(*(_QWORD *)v26 - 8LL);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(*(_QWORD *)v26 - 8LL);
*(_DWORD *)(*(_QWORD *)v26 - 8LL) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v6);
}
v7 = a3;
v8 = a1->m_idInput;
v9 = (char *)GJSpecialColorSelect::textForColorIdx(v7);
sub_D153B8((int)v26, v9);
CCTextInputNode::updateLabel(v8, (const void **)v26);
v10 = (void *)(*(_QWORD *)v26 - 24LL);
if ( (__int64 *)(*(_QWORD *)v26 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(*(_QWORD *)v26 - 8LL);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(*(_QWORD *)v26 - 8LL);
*(_DWORD *)(*(_QWORD *)v26 - 8LL) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v10);
}
SetupPulsePopup::updateTargetID(a1);
SetupTriggerPopup::updateEditorLabel(a1);
a1->m_disableTextDelegate = 0;
}
}
}