//
// EditorUI::setIDPopupClosed from 0x1400e6c50 to 0x1400e6ed9 (649 bytes)
//
// 2 xrefs:
// > ??> @ 0x140552738
// > ??> @ 0x1406c8d84
//
// 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
//
// Hidden C++ exception states: #wind=3
void EditorUI::setIDPopupClosed(EditorUI *a1, SetIDPopup *a2, int a3)
{
GameManager *v6; // rcx
cocos2d::CCString *v7; // rax
const char *CString; // rax
GameManager *v9; // rcx
char *v10; // rax
size_t v11; // r8
void **v12; // rbx
void **v13; // rdx
void *v14; // rcx
void *v15; // [rsp+20h] [rbp-68h]
void *v16; // [rsp+20h] [rbp-68h]
void *Block[2]; // [rsp+28h] [rbp-60h] BYREF
__int128 v18; // [rsp+38h] [rbp-50h]
_QWORD v19[4]; // [rsp+48h] [rbp-40h] BYREF
if ( a2->getTag(a2) == 1 )
{
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v15 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v6, "0133", a3);
v7 = cocos2d::CCString::createWithFormat("%i", a3);
CString = cocos2d::CCString::getCString(v7);
ButtonSprite::setString((ButtonSprite *)a1->m_editButtonDict, CString);
}
else if ( a2->getTag(a2) == 2 )
{
v9 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = (GameManager *)qword_1406C2ED8;
}
GameManager::setIntGameVariable(v9, "0139", a3);
*(_OWORD *)Block = 0;
*(_QWORD *)&v18 = 0;
*((_QWORD *)&v18 + 1) = 15;
LOBYTE(Block[0]) = 0;
if ( a3 < 1000 )
{
v12 = (void **)GameToolbox::intToString(v19, a3);
if ( Block != v12 )
{
*(_QWORD *)&v18 = 0;
*((_QWORD *)&v18 + 1) = 15;
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)v12;
v18 = *((_OWORD *)v12 + 1);
v12[2] = nullptr;
v12[3] = (void *)15;
*(_BYTE *)v12 = 0;
}
sub_14003A830((__int64)v19);
}
else
{
v10 = (char *)GJSpecialColorSelect::textForColorIdx(a3);
v11 = -1;
do
++v11;
while ( v10[v11] );
sub_14003CCE0(Block, v10, v11);
}
v13 = Block;
if ( *((_QWORD *)&v18 + 1) > 0xFu )
v13 = (void **)Block[0];
ButtonSprite::setString((ButtonSprite *)a1->m_createButtonBar, (const char *)v13);
if ( *((_QWORD *)&v18 + 1) > 0xFu )
{
v14 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v18 + 1) + 1LL) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
}
else if ( a2->getTag(a2) == 3 )
{
EditorUI::findAndSelectObject(
(EditorUI *)((char *)a1 - 456),
a3,
(bool)a2[1].FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable);
}
}