//
// EditorUI::reloadCustomItems from 0x1401f6770 to 0x1401f69d2 (610 bytes)
//
// 5 xrefs:
// > EditorUI::onNewCustomItem @ 0x1401f5f53
// > EditorUI::onDeleteCustomItem @ 0x1401f60c5
// > EditorUI::orderUpCustomItem @ 0x1401f615f
// > EditorUI::orderDownCustomItem @ 0x1401f61ef
// > ??> @ 0x14091aab0
//
// 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
void __fastcall EditorUI::reloadCustomItems(__int64 a1)
{
__int64 v2; // rbx
cocos2d::CCString *v3; // rax
int v4; // r14d
void *v5; // r8
__int64 v6; // rdi
cocos2d::CCString *v7; // rax
int v8; // edi
void *v9; // r8
__int64 v10; // rbx
cocos2d::CCObject *CustomItems; // rax
void *v12; // [rsp+30h] [rbp-50h]
void *v13; // [rsp+30h] [rbp-50h]
void *Block[2]; // [rsp+38h] [rbp-48h] BYREF
__int64 v15; // [rsp+48h] [rbp-38h]
unsigned __int64 v16; // [rsp+50h] [rbp-30h]
void *Src[2]; // [rsp+58h] [rbp-28h] BYREF
__int64 v18; // [rsp+68h] [rbp-18h]
unsigned __int64 v19; // [rsp+70h] [rbp-10h]
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v12 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
*(_OWORD *)Block = 0;
v15 = 3;
v16 = 15;
LODWORD(Block[0]) = 6256231;
sub_140044D80(Block, "0049", 4u);
v3 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v2 + 432), Block);
v4 = cocos2d::CCString::intValue(v3);
if ( v16 > 0xF )
{
v5 = Block[0];
if ( v16 + 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);
}
v15 = 0;
v16 = 15;
LOBYTE(Block[0]) = 0;
v6 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v13 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = qword_14090BFD0;
}
*(_OWORD *)Src = 0;
v18 = 3;
v19 = 15;
LODWORD(Src[0]) = 6256231;
sub_140044D80(Src, "0050", 4u);
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v6 + 432), Src);
v8 = cocos2d::CCString::intValue(v7);
if ( v19 > 0xF )
{
v9 = Src[0];
if ( v19 + 1 >= 0x1000 )
{
v9 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
v10 = *(_QWORD *)(a1 + 672);
CustomItems = EditorUI::createCustomItems(a1);
EditButtonBar::loadFromItems(v10, CustomItems, v4, v8, 1);
}