//
// SetupArtSwitchPopup::init from 0xb7a840 to 0xb7ad14 (1236 bytes)
//
// 2 xrefs:
// > SetupArtSwitchPopup::create @ 0xb7af54
// > ??> @ 0x85d98
//
// 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:02:25 +0000
//
__int64 __fastcall SetupArtSwitchPopup::init(
SetupArtSwitchPopup *this,
ArtTriggerGameObject *a2,
cocos2d::CCArray *a3,
int a4)
{
unsigned __int8 v6; // w0
unsigned int v7; // w23
__int64 v8; // x2
float (__fastcall *v9)(SetupArtSwitchPopup *, __int64); // x2
int v10; // w25
__int64 v11; // x2
__int64 v12; // x3
__int64 v13; // x4
__int64 v14; // x5
const char *v15; // x6
cocos2d::CCDirector *MultiTriggerItemsDefault; // x0
cocos2d::CCDirector *v17; // x0
const char *v18; // x2
cocos2d::CCLabelBMFont *v19; // x0
__int64 v20; // x21
void (__fastcall *v21)(__int64, __int64 *); // x27
cocos2d::CCSprite *v22; // x0
__int64 v23; // x0
char v24; // w1
__int64 v25; // x21
void (__fastcall *v26)(__int64, __int64 *); // x24
__int64 v28; // [xsp+60h] [xbp+60h] BYREF
_BYTE v29[8]; // [xsp+68h] [xbp+68h] BYREF
_BYTE v30[8]; // [xsp+70h] [xbp+70h] BYREF
__int64 v31; // [xsp+78h] [xbp+78h] BYREF
__int64 v32; // [xsp+80h] [xbp+80h] BYREF
size_t v33; // [xsp+88h] [xbp+88h]
void *v34; // [xsp+90h] [xbp+90h]
__int64 v35[2]; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCLabelBMFont *v36; // [xsp+A8h] [xbp+A8h]
__int64 v37; // [xsp+B0h] [xbp+B0h] BYREF
size_t v38; // [xsp+B8h] [xbp+B8h]
void *v39; // [xsp+C0h] [xbp+C0h]
__int64 v40[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v41; // [xsp+D8h] [xbp+D8h]
__int64 v42[2]; // [xsp+E0h] [xbp+E0h] BYREF
void *v43; // [xsp+F0h] [xbp+F0h]
__int64 v44[2]; // [xsp+F8h] [xbp+F8h] BYREF
void *v45; // [xsp+108h] [xbp+108h]
__int64 v46[2]; // [xsp+110h] [xbp+110h] BYREF
cocos2d::CCSprite *v47; // [xsp+120h] [xbp+120h]
v6 = SetupTriggerPopup::init(this, a2, a3, 300.0, 200.0, 1u, 0.0);
v7 = v6;
if ( v6 )
{
v8 = *(_QWORD *)this;
v32 = 0;
v33 = 0;
v9 = *(float (__fastcall **)(SetupArtSwitchPopup *, __int64))(v8 + 1464);
v34 = nullptr;
v35[0] = 0;
v35[1] = 0;
v36 = nullptr;
v10 = (int)v9(this, 533);
if ( a4 == 3030 )
{
*((_DWORD *)this + 256) = 1;
std::string::assign(&v32, "Change Ground");
std::string::assign(v35, "G:");
}
else if ( a4 == 3031 )
{
*((_DWORD *)this + 256) = 2;
std::string::assign(&v32, "Change Middleground");
std::string::assign(v35, "MG:");
}
else
{
*((_DWORD *)this + 256) = 0;
if ( a4 == 3029 )
{
std::string::assign(&v32, "Change Background");
std::string::assign(v35, "BG:");
}
else
{
std::string::assign(&v32, "NA");
std::string::assign(v35, "NA:");
}
}
SetupTriggerPopup::preSetup(this);
v37 = 0;
v38 = 0;
v39 = nullptr;
if ( (v32 & 1) != 0 )
{
std::string::__init(&v37, v34, v33);
}
else
{
v37 = v32;
v38 = v33;
v39 = v34;
}
SetupTriggerPopup::addTitle((__int64)this, (__int64)&v37);
if ( (v37 & 1) != 0 )
operator delete(v39);
v40[0] = 0;
v40[1] = 0;
v41 = nullptr;
std::string::__init(v40, "OK", 2u);
SetupTriggerPopup::addCloseButton((__int64)this, (__int64)v40, v11, v12, v13, v14, v15);
if ( (v40[0] & 1) != 0 )
operator delete(v41);
v42[0] = 0;
v42[1] = 0;
v43 = nullptr;
std::string::__init(v42, "Help", 4u);
v44[0] = 0;
v44[1] = 0;
v45 = nullptr;
std::string::__init(v44, "Seems pretty obvious what this does.\nWhy are you here?", 0x3Eu);
SetupTriggerPopup::addHelpButton((__int64)this, (char *)v42, (char *)v44, 1.0);
if ( (v44[0] & 1) != 0 )
operator delete(v45);
if ( (v42[0] & 1) != 0 )
operator delete(v43);
MultiTriggerItemsDefault = (cocos2d::CCDirector *)SetupTriggerPopup::createMultiTriggerItemsDefault(this);
v17 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(MultiTriggerItemsDefault);
cocos2d::CCDirector::getWinSize(&v28, v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, *(float *)&v28 * 0.5, *((float *)&v28 + 1) * 0.5);
v19 = (cocos2d::CCLabelBMFont *)((char *)v35 + 1);
if ( (v35[0] & 1) != 0 )
v19 = v36;
v20 = cocos2d::CCLabelBMFont::create(v19, "goldFont.fnt", v18);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 0.6);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v20);
v21 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, 0.0, 40.0);
cocos2d::CCPoint::operator+(&v31, v29);
v21(v20, &v31);
artIconForKey(v10, *((_DWORD *)this + 256), v46);
v22 = (cocos2d::CCSprite *)((char *)v46 + 1);
if ( (v46[0] & 1) != 0 )
v22 = v47;
v23 = cocos2d::CCSprite::createWithSpriteFrameName(v22, (const char *)LOBYTE(v46[0]));
v24 = v46[0];
*((_QWORD *)this + 129) = v23;
if ( (v24 & 1) != 0 )
{
operator delete(v47);
v23 = *((_QWORD *)this + 129);
}
v25 = CCMenuItemSpriteExtra::create(v23, 0, (__int64)this, (__int64)SetupArtSwitchPopup::onArt, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v25);
v26 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v25 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v31, *((cocos2d::CCNode **)this + 69), (const cocos2d::CCPoint *)v29);
v26(v25, &v31);
SetupTriggerPopup::postSetup(this);
if ( (v35[0] & 1) != 0 )
operator delete(v36);
if ( (v32 & 1) != 0 )
operator delete(v34);
}
return v7;
}