//
// EditorUI::updateDeleteButtons from 0x1401f5100 to 0x1401f5a87 (2439 bytes)
//
// 6 xrefs:
// > EditorUI::updateButtons @ 0x1401ad309
// > EditorUI::resetUI @ 0x1401afcd4
// > EditorUI::onUpdateDeleteFilter @ 0x1401b20a3
// > EditorUI::onShowUIBtn @ 0x1401b3d4c
// > EditorUI::handleEditorAction @ 0x1401c3320
// > ??> @ 0x14091aa68
//
// 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:28:09 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall EditorUI::updateDeleteButtons(__int64 a1)
{
__int64 v2; // rbx
cocos2d::CCString *v3; // rax
int v4; // esi
void *v5; // r8
const char *v6; // rdi
const char *v7; // rbx
__int64 v8; // rax
const char *v9; // rbx
__int64 v10; // rax
const char *v11; // rbx
__int64 v12; // rax
__int64 v13; // rax
size_t v14; // r15
__int64 v15; // rbx
cocos2d::CCString *v16; // rax
int v17; // ebx
void *v18; // r8
__int64 v19; // rax
_QWORD *v20; // rax
size_t v21; // r8
void **v22; // rsi
__int64 v23; // rdi
__int64 v24; // rbx
cocos2d::CCSpriteFrameCache *v25; // rax
struct cocos2d::CCSpriteFrame *v26; // rax
__int64 v27; // rdx
void *v28; // rcx
__int64 v29; // r8
__int64 v30; // rax
_QWORD *v31; // rax
size_t v32; // r8
void **v33; // rsi
__int64 v34; // rdi
__int64 v35; // rbx
cocos2d::CCSpriteFrameCache *v36; // rax
struct cocos2d::CCSpriteFrame *v37; // rax
__int64 v38; // rdx
__int64 v39; // rsi
__int64 v40; // r8
__int64 v41; // rax
_QWORD *v42; // rax
void **v43; // rsi
__int64 v44; // rdi
__int64 v45; // rbx
cocos2d::CCSpriteFrameCache *v46; // rax
struct cocos2d::CCSpriteFrame *v47; // rax
__int64 v48; // rdx
void *v49; // rcx
bool v50; // dl
__int16 *v51; // r12
__int16 *v52; // rax
__int16 v53; // bx
char v54; // di
_QWORD *v55; // r15
__int64 v56; // rcx
__int64 v57; // rcx
__int64 v58; // rcx
bool v59; // dl
__int16 *v60; // rax
__int16 v61; // bx
char v62; // di
_QWORD *v63; // rsi
__int64 v64; // rcx
__int64 v65; // rcx
__int64 v66; // rcx
__int16 v68; // bx
char v69; // di
__int64 result; // rax
_QWORD *v71; // rsi
__int64 v72; // rcx
__int64 v73; // rcx
__int64 v74; // rcx
_QWORD v75[2]; // [rsp+38h] [rbp-39h] BYREF
void *v76; // [rsp+48h] [rbp-29h]
void *v77[2]; // [rsp+50h] [rbp-21h] BYREF
__int64 v78; // [rsp+60h] [rbp-11h]
unsigned __int64 v79; // [rsp+68h] [rbp-9h]
void *Block[2]; // [rsp+70h] [rbp-1h] BYREF
__int64 v81; // [rsp+80h] [rbp+Fh]
unsigned __int64 v82; // [rsp+88h] [rbp+17h]
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v76 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v76);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
*(_OWORD *)Block = 0;
v81 = 3;
v82 = 15;
LODWORD(Block[0]) = 6256231;
sub_140044D80(Block, "0005", 4u);
v3 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v2 + 432), Block);
v4 = cocos2d::CCString::intValue(v3);
LODWORD(v76) = v4;
if ( v82 > 0xF )
{
v5 = Block[0];
if ( v82 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v5);
}
v6 = "GJ_button_04.png";
v7 = "GJ_button_04.png";
if ( !v4 )
v7 = "GJ_button_02.png";
v8 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1296) + 952LL))(*(_QWORD *)(a1 + 1296));
ButtonSprite::updateBGImage(v8, v7);
v9 = "GJ_button_04.png";
if ( v4 == 2 )
v9 = "GJ_button_02.png";
v10 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1304) + 952LL))(*(_QWORD *)(a1 + 1304));
ButtonSprite::updateBGImage(v10, v9);
v11 = "GJ_button_04.png";
if ( v4 == 1 )
v11 = "GJ_button_02.png";
v12 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1312) + 952LL))(*(_QWORD *)(a1 + 1312));
ButtonSprite::updateBGImage(v12, v11);
if ( v4 == 3 )
v6 = "GJ_button_02.png";
v13 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1320) + 952LL))(*(_QWORD *)(a1 + 1320));
ButtonSprite::updateBGImage(v13, v6);
v14 = -1;
if ( v4 == 3 )
{
v15 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v75[0] = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v75[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v15 = qword_14090BFD0;
}
*(_OWORD *)Block = 0;
v81 = 3;
v82 = 15;
LODWORD(Block[0]) = 6256231;
sub_140044D80(Block, "0006", 4u);
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v15 + 432), Block);
v17 = cocos2d::CCString::intValue(v16);
if ( v82 > 0xF )
{
v18 = Block[0];
if ( v82 + 1 >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
LODWORD(v75[0]) = v17;
v19 = ObjectToolbox::sharedState();
v20 = (_QWORD *)sub_1402D6130(v19 + 320, v75);
if ( v20[3] > 0xFu )
v20 = (_QWORD *)*v20;
*(_OWORD *)v77 = 0;
v78 = 0;
v79 = 0;
v21 = -1;
do
++v21;
while ( *((_BYTE *)v20 + v21) );
sub_14003D230(v77, v20, v21);
v22 = v77;
if ( v79 > 0xF )
v22 = (void **)v77[0];
v23 = **(_QWORD **)(a1 + 1272);
v24 = *(_QWORD *)(a1 + 1272);
v25 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v26 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v25, (const char *)v22);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(v23 + 1008))(v24, v26);
LOBYTE(v27) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1272) + 336LL))(*(_QWORD *)(a1 + 1272), v27);
if ( v79 > 0xF )
{
v28 = v77[0];
if ( v79 + 1 >= 0x1000 )
{
v28 = *((void **)v77[0] - 1);
if ( (unsigned __int64)((char *)v77[0] - (char *)v28 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
LABEL_34:
j_j_free(v28);
}
}
else if ( !*(_QWORD *)(a1 + 1568) || (unsigned __int8)GameObject::isSpecialObject(*(_QWORD *)(a1 + 1568)) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1272) + 336LL))(*(_QWORD *)(a1 + 1272), 0);
}
else
{
LODWORD(v75[0]) = *(_DWORD *)(v29 + 1036);
v30 = ObjectToolbox::sharedState();
v31 = (_QWORD *)sub_1402D6130(v30 + 320, v75);
if ( v31[3] > 0xFu )
v31 = (_QWORD *)*v31;
*(_OWORD *)v77 = 0;
v78 = 0;
v79 = 0;
v32 = -1;
do
++v32;
while ( *((_BYTE *)v31 + v32) );
sub_14003D230(v77, v31, v32);
v33 = v77;
if ( v79 > 0xF )
v33 = (void **)v77[0];
v34 = **(_QWORD **)(a1 + 1272);
v35 = *(_QWORD *)(a1 + 1272);
v36 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v37 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v36, (const char *)v33);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(v34 + 1008))(v35, v37);
LOBYTE(v38) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1272) + 336LL))(*(_QWORD *)(a1 + 1272), v38);
if ( v79 > 0xF )
{
v28 = v77[0];
if ( v79 + 1 >= 0x1000 )
{
v28 = *((void **)v77[0] - 1);
if ( (unsigned __int64)((char *)v77[0] - (char *)v28 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
goto LABEL_34;
}
}
v39 = a1;
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1272) + 160LL))(*(_QWORD *)(a1 + 1272));
if ( (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1272) + 168LL))(*(_QWORD *)(a1 + 1272)) <= 1.0 )
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1272) + 168LL))(*(_QWORD *)(a1 + 1272));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1272) + 160LL))(*(_QWORD *)(a1 + 1272));
if ( !*(_QWORD *)(a1 + 1568)
|| cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944))
|| (unsigned __int8)GameObject::isSpecialObject(*(_QWORD *)(a1 + 1568)) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1264) + 336LL))(*(_QWORD *)(a1 + 1264), 0);
}
else
{
LODWORD(v75[0]) = *(_DWORD *)(v40 + 1036);
v41 = ObjectToolbox::sharedState();
v42 = (_QWORD *)sub_1402D6130(v41 + 320, v75);
if ( v42[3] > 0xFu )
v42 = (_QWORD *)*v42;
*(_OWORD *)v77 = 0;
v78 = 0;
v79 = 0;
do
++v14;
while ( *((_BYTE *)v42 + v14) );
sub_14003D230(v77, v42, v14);
v43 = v77;
if ( v79 > 0xF )
v43 = (void **)v77[0];
v44 = **(_QWORD **)(a1 + 1264);
v45 = *(_QWORD *)(a1 + 1264);
v46 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v47 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v46, (const char *)v43);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(v44 + 1008))(v45, v47);
LOBYTE(v48) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1264) + 336LL))(*(_QWORD *)(a1 + 1264), v48);
if ( v79 > 0xF )
{
v49 = v77[0];
if ( v79 + 1 >= 0x1000 )
{
v49 = *((void **)v77[0] - 1);
if ( (unsigned __int64)((char *)v77[0] - (char *)v49 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v49);
}
v39 = a1;
}
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1264) + 160LL))(*(_QWORD *)(a1 + 1264));
if ( (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1264) + 168LL))(*(_QWORD *)(a1 + 1264)) <= 1.0 )
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1264) + 168LL))(*(_QWORD *)(a1 + 1264));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1264) + 160LL))(*(_QWORD *)(a1 + 1264));
v50 = *(_QWORD *)(v39 + 1568) || cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944));
v51 = (__int16 *)&unk_1407033D0;
v52 = (__int16 *)&unk_1407033D0;
if ( v50 )
v52 = &word_1407033D4;
v53 = *v52;
v54 = *((_BYTE *)v52 + 2);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1280) + 936LL))(*(_QWORD *)(a1 + 1280));
v55 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1280) + 952LL))(*(_QWORD *)(a1 + 1280));
LOWORD(v75[0]) = v53;
BYTE2(v75[0]) = v54;
v56 = v55[79];
if ( v56 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v56 + 368))(v56 + 368, v75);
v57 = v55[80];
if ( v57 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v57 + 320))(v57 + 320, v75);
v58 = v55[82];
if ( v58 || (v58 = v55[81]) != 0 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v58 + 320))(v58 + 320, v75);
v59 = *(_QWORD *)(v39 + 1568) && !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944));
v60 = (__int16 *)&unk_1407033D0;
if ( v59 )
v60 = &word_1407033D4;
v61 = *v60;
v62 = *((_BYTE *)v60 + 2);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1288) + 936LL))(*(_QWORD *)(a1 + 1288));
v63 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1288) + 952LL))(*(_QWORD *)(a1 + 1288));
LOWORD(v75[0]) = v61;
BYTE2(v75[0]) = v62;
v64 = v63[79];
if ( v64 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v64 + 368))(v64 + 368, v75);
v65 = v63[80];
if ( v65 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v65 + 320))(v65 + 320, v75);
v66 = v63[82];
if ( v66 || (v66 = v63[81]) != 0 )
(**(void (__fastcall ***)(__int64, _QWORD *))(v66 + 320))(v66 + 320, v75);
if ( (_DWORD)v76 == 3 || *(_QWORD *)(a1 + 1568) && !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
v51 = &word_1407033D4;
v68 = *v51;
v69 = *((_BYTE *)v51 + 2);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1320) + 936LL))(*(_QWORD *)(a1 + 1320));
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1320) + 952LL))(*(_QWORD *)(a1 + 1320));
v71 = (_QWORD *)result;
LOWORD(v75[0]) = v68;
BYTE2(v75[0]) = v69;
v72 = *(_QWORD *)(result + 632);
if ( v72 )
result = (**(__int64 (__fastcall ***)(__int64, _QWORD *))(v72 + 368))(v72 + 368, v75);
v73 = v71[80];
if ( v73 )
result = (**(__int64 (__fastcall ***)(__int64, _QWORD *))(v73 + 320))(v73 + 320, v75);
v74 = v71[82];
if ( v74 )
return (**(__int64 (__fastcall ***)(__int64, _QWORD *))(v74 + 320))(v74 + 320, v75);
v74 = v71[81];
if ( v74 )
return (**(__int64 (__fastcall ***)(__int64, _QWORD *))(v74 + 320))(v74 + 320, v75);
return result;
}