//
// ControlSlotsPopup::init from 0xd05ce4 to 0xd06104 (1056 bytes)
//
// 2 xrefs:
// > ControlSlotsPopup::create @ 0xd0634c
// > ??> @ 0xd92a0
//
// This function is hookable on this platform (idp: arm, 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 13:06:56 +0000
//
__int64 __fastcall ControlSlotsPopup::init(cocos2d::CCNode **this, TouchControlEditLayer *a2, char a3)
{
unsigned __int8 v6; // w0
unsigned int v7; // w27
cocos2d::CCDirector *v9; // x0
cocos2d::CCDirector *v10; // x0
float v11; // s11
float v12; // s10
unsigned int v13; // w20
cocos2d::CCString *v14; // x0
ButtonSprite *CString; // x0
const char *v16; // x6
__int64 v17; // x0
__int64 v18; // x28
float v19; // s8
cocos2d::CCString *v20; // x0
ButtonSprite *v21; // x0
const char *v22; // x6
__int64 v23; // x0
__int64 v24; // x0
__int64 v25; // x1
__int64 v26; // x28
const char *v27; // x1
__int64 v28; // x20
__int64 v29; // x20
cocos2d::CCNode *v30; // x25
void (__fastcall *v31)(__int64, __int64 *); // x23
cocos2d::CCNode *v32; // [xsp+B0h] [xbp+B0h]
cocos2d::CCNode *v33; // [xsp+B0h] [xbp+B0h]
void (__fastcall *v34)(__int64, __int64 *); // [xsp+B8h] [xbp+B8h]
void (__fastcall *v35)(__int64, __int64 *); // [xsp+B8h] [xbp+B8h]
__int64 v36; // [xsp+C8h] [xbp+C8h] BYREF
_BYTE v37[8]; // [xsp+D0h] [xbp+D0h] BYREF
_BYTE v38[8]; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v39; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v40; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v41[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v42; // [xsp+100h] [xbp+100h]
v6 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 240.0, 200.0, 7u, 0.0);
v7 = v6;
if ( v6 )
{
SetupTriggerPopup::preSetup((SetupTriggerPopup *)this);
qmemcpy(&v40, "PWi", 3);
v9 = (cocos2d::CCDirector *)SetupTriggerPopup::setCustomBGColor((__int64)this, (__int64)&v40);
*(this + 127) = a2;
*((_BYTE *)this + 1024) = a3;
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(&v36, v10);
v41[0] = 0;
v11 = *(float *)&v36 * 0.5;
v12 = *((float *)&v36 + 1) * 0.5;
v41[1] = 0;
v42 = nullptr;
std::string::__init(v41, "Control Slots", 0xDu);
SetupTriggerPopup::addTitle((__int64)this, (__int64)v41);
if ( (v41[0] & 1) != 0 )
operator delete(v42);
v13 = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v11, v12 + 25.0);
do
{
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Save %i", (const char *)v13);
CString = (ButtonSprite *)cocos2d::CCString::getCString(v14);
v17 = ButtonSprite::create(
CString,
(const char *)&dword_30 + 2,
0,
1,
0.7,
"goldFont.fnt",
"GJ_button_01.png",
v16,
28.0);
v18 = CCMenuItemSpriteExtra::create(v17, 0, (__int64)this, (__int64)ControlSlotsPopup::onSave, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v18 + 72LL))(v18, v13);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v18);
v34 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v18 + 184LL);
v32 = *(this + 69);
v19 = (float)(int)(v13 - 1) * -42.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, -45.0, v19);
cocos2d::CCPoint::operator+(&v39, v37);
cocos2d::CCNode::convertToNodeSpace(&v40, v32, (const cocos2d::CCPoint *)&v39);
v34(v18, &v40);
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Load %i", (const char *)v13);
v21 = (ButtonSprite *)cocos2d::CCString::getCString(v20);
v23 = ButtonSprite::create(
v21,
(const char *)&dword_30 + 2,
0,
1,
0.7,
"goldFont.fnt",
"GJ_button_02.png",
v22,
28.0);
v24 = CCMenuItemSpriteExtra::create(v23, 0, (__int64)this, (__int64)ControlSlotsPopup::onLoad, 0);
v25 = v13;
v26 = v24;
++v13;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v24 + 72LL))(v24, v25);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v26);
v33 = *(this + 69);
v35 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v26 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, 45.0, v19);
cocos2d::CCPoint::operator+(&v39, v37);
cocos2d::CCNode::convertToNodeSpace(&v40, v33, (const cocos2d::CCPoint *)&v39);
v35(v26, &v40);
}
while ( v13 != 4 );
v28 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v27);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 0.7);
v29 = CCMenuItemSpriteExtra::create(v28, 0, (__int64)this, 1368, 1);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v29);
v30 = *(this + 69);
v31 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v39,
v11 - (float)(*((float *)this + 183) * 0.5),
v12 + (float)(*((float *)this + 184) * 0.5));
cocos2d::CCNode::convertToNodeSpace(&v40, v30, (const cocos2d::CCPoint *)&v39);
v31(v29, &v40);
SetupTriggerPopup::postSetup((SetupTriggerPopup *)this);
}
return v7;
}