//
// SetupArtSwitchPopup::init from 0x100410de0 to 0x100411140 (864 bytes)
//
// 1 xrefs:
// > SetupArtSwitchPopup::create @ 0x100410d90
//
// 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
//
bool __fastcall SetupArtSwitchPopup::init(
SetupArtSwitchPopup *a1,
ArtTriggerGameObject *a2,
cocos2d::CCArray *a3,
int a4)
{
_BOOL4 v6; // w19
float v7; // s8
const std::string::value_type *v8; // x1
cocos2d::CCDirector *v9; // x0
__n128 v10; // q0
__n128 v11; // q1
std::string *v12; // x0
cocos2d::CCLabelBMFont *v13; // x21
__n128 v14; // q0
__n128 v15; // q1
double v16; // d0
void **v17; // x0
cocos2d::CCSprite *m_artSprite; // x0
CCMenuItemSpriteExtra *v19; // x21
void *v21[2]; // [xsp+8h] [xbp-F8h] BYREF
char v22; // [xsp+1Fh] [xbp-E1h]
float32x2_t v23; // [xsp+20h] [xbp-E0h] BYREF
float32x2_t v24; // [xsp+28h] [xbp-D8h] BYREF
float v25; // [xsp+30h] [xbp-D0h]
float v26; // [xsp+34h] [xbp-CCh]
void *v27[2]; // [xsp+38h] [xbp-C8h] BYREF
char v28; // [xsp+4Fh] [xbp-B1h]
void *v29[2]; // [xsp+50h] [xbp-B0h] BYREF
char v30; // [xsp+67h] [xbp-99h]
void *v31[2]; // [xsp+68h] [xbp-98h] BYREF
char v32; // [xsp+7Fh] [xbp-81h]
std::string __p; // [xsp+80h] [xbp-80h] BYREF
std::string v34; // [xsp+A0h] [xbp-60h] BYREF
std::string v35; // [xsp+B8h] [xbp-48h] BYREF
cocos2d::CCPoint v36; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v37; // 0:x3.16
v6 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 200.0, 1);
if ( v6 )
{
memset(&v35, 0, sizeof(v35));
memset(&v34, 0, sizeof(v34));
v7 = ((float (__fastcall *)(SetupArtSwitchPopup *, __int64))a1->getValue)(a1, 533);
switch ( a4 )
{
case 3029:
a1->m_artType = Background;
std::string::assign(&v35, "Change Background");
v8 = "BG:";
break;
case 3030:
a1->m_artType = Ground;
std::string::assign(&v35, "Change Ground");
v8 = "G:";
break;
case 3031:
a1->m_artType = Middleground;
std::string::assign(&v35, "Change Middleground");
v8 = "MG:";
break;
default:
a1->m_artType = Background;
std::string::assign(&v35, "NA");
v8 = "NA:";
break;
}
std::string::assign(&v34, v8);
SetupTriggerPopup::preSetup(a1);
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__p, v35.__r_.__value_.__l.__data_, v35.__r_.__value_.__l.__size_);
else
__p = v35;
SetupTriggerPopup::addTitle((__int64)a1, (__int64)&__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
sub_100009900(v31, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (const char *)v31);
if ( v32 < 0 )
operator delete(v31[0]);
sub_100009900(v29, "Help");
sub_100009900(v27, "Seems pretty obvious what this does.\nWhy are you here?");
SetupTriggerPopup::addHelpButton((__int64)a1, (__int64)v29, (__int64)v27, 1.0);
if ( v28 < 0 )
operator delete(v27[0]);
if ( v30 < 0 )
operator delete(v29[0]);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
v10.n128_f32[0] = v25 * 0.5;
v11.n128_f32[0] = v26 * 0.5;
sub_100022980(v10, v11, &v24);
if ( (v34.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v12 = &v34;
else
v12 = (std::string *)v34.__r_.__value_.__r.__words[0];
v13 = cocos2d::CCLabelBMFont::create_1((const char *)v12, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v13->setScale)(v13, 0.6);
v14 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v13);
v15.n128_u32[0] = 1109393408;
v14.n128_u32[0] = 0;
sub_100022980(v14, v15, &v23);
*(float32x2_t *)&v16 = sub_1000229DC(&v24, &v23, (float32x2_t *)v21);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **, double))v13->setPosition)(v13, v21, v16);
sub_1004111F4(v21, (unsigned int)(int)v7, (unsigned int)a1->m_artType);
if ( v22 >= 0 )
v17 = v21;
else
v17 = (void **)v21[0];
m_artSprite = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v17);
a1->m_artSprite = m_artSprite;
if ( v22 < 0 )
{
operator delete(v21[0]);
m_artSprite = a1->m_artSprite;
}
v37.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupArtSwitchPopup::onArt;
v37.adj = 0;
v19 = CCMenuItemSpriteExtra::create(m_artSprite, nullptr, a1, v37);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v19);
v36 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v24);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))v19->setPosition)(v19, v21, v36.x, v36.y);
SetupTriggerPopup::postSetup(a1);
if ( SHIBYTE(v34.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v34.__r_.__value_.__l.__data_);
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v35.__r_.__value_.__l.__data_);
}
return v6;
}