//
// DemonFilterSelectLayer::init from 0x7e45d4 to 0x7e4a0c (1080 bytes)
//
// 3 xrefs:
// > DemonFilterSelectLayer::create @ 0x7e4b58
// > ??> @ 0x7e748
// > ??> @ 0x143b370
//
// 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 12:54:28 +0000
//
__int64 __fastcall DemonFilterSelectLayer::init(cocos2d::CCArray **this)
{
cocos2d::CCDirector *v2; // x0
unsigned int v3; // w27
cocos2d::CCDirector *v5; // x0
__int64 v6; // x21
cocos2d::CCObject *v7; // x24
__int64 v8; // x20
void (__fastcall *v9)(__int64, __int64 *); // x23
void (__fastcall *v10)(__int64, __int64 *); // x23
const char *v11; // x2
__int64 v12; // x20
void (__fastcall *v13)(__int64, __int64 *); // x23
cocos2d::CCArray *v14; // x0
cocos2d::CCObject *v15; // x0
cocos2d::CCArray *v16; // x0
cocos2d::CCMenu *v17; // x26
__int64 v18; // x0
GameLevelManager *v19; // x0
GameLevelManager *v20; // x0
unsigned int v21; // w23
cocos2d::CCString *v22; // x0
char *CString; // x0
const char *v24; // x1
cocos2d::CCSprite *v25; // x0
__int64 v26; // x20
cocos2d::CCObject *v27; // x20
cocos2d::CCNode *v28; // x20
const char *v29; // x1
__int64 v30; // x2
__int64 v31; // x3
bool v32; // w4
__int64 v33; // x5
const char *v34; // x6
__int64 v35; // x0
cocos2d::CCObject *v36; // x20
cocos2d::CCNode *v37; // x23
void (__fastcall *v38)(cocos2d::CCObject *, __int64 *); // x21
int IntForKey; // [xsp+8Ch] [xbp+8Ch]
__int64 v40; // [xsp+90h] [xbp+90h] BYREF
_BYTE v41[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v42[2]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v43[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v44; // [xsp+C0h] [xbp+C0h]
v2 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init((FLAlertLayer *)this, 75);
v3 = (unsigned __int8)v2;
if ( (_BYTE)v2 )
{
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
v6 = 0;
v7 = nullptr;
cocos2d::CCDirector::getWinSize(&v40, v5);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v42, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v42);
v9 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v8 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v42, 380.0, 180.0);
v9(v8, v42);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v8, 0xFFFFFFFFLL);
v10 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v8 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, *(float *)&v40 * 0.5, *((float *)&v40 + 1) * 0.5);
v10(v8, v42);
v12 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Demon Filter", "bigFont.fnt", v11);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v42,
*(float *)&v40 * 0.5,
(float)((float)(*((float *)&v40 + 1) * 0.5) + 90.0) - 20.0);
v13(v12, v42);
v14 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(
*(this + 73),
v12);
v15 = (cocos2d::CCObject *)cocos2d::CCArray::create(v14);
*(this + 83) = v15;
v16 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v15);
v17 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v16);
v18 = cocos2d::CCMenu::create(v17);
*(this + 69) = (cocos2d::CCArray *)v18;
v19 = (GameLevelManager *)(*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v18,
10);
v20 = (GameLevelManager *)GameLevelManager::sharedState(v19);
IntForKey = GameLevelManager::getIntForKey(v20, "demon_filter");
do
{
v43[0] = 0;
v43[1] = 0;
v44 = nullptr;
v21 = dword_1143DC0[v6];
if ( v6 )
{
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn2_001.png",
(const char *)v21);
CString = (char *)cocos2d::CCString::getCString(v22);
std::string::assign(v43, CString);
}
else
{
std::string::assign(v43, "difficulty_06_btn_001.png");
}
if ( (v43[0] & 1) != 0 )
v25 = (cocos2d::CCSprite *)v44;
else
v25 = (cocos2d::CCSprite *)((char *)v43 + 1);
v26 = cocos2d::CCSprite::createWithSpriteFrameName(v25, v24);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v26 + 160LL))(v26, 1.1);
v27 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v26,
0,
(__int64)this,
(__int64)DemonFilterSelectLayer::selectRating,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v27);
cocos2d::CCArray::addObject(*(this + 83), v27);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v27 + 72LL))(v27, v21);
cocos2d::CCArray::addObject(v17, v27);
if ( v21 == IntForKey )
v7 = v27;
if ( (v43[0] & 1) != 0 )
operator delete(v44);
++v6;
}
while ( v6 != 6 );
v28 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v41, *(float *)&v40 * 0.5, (float)(*((float *)&v40 + 1) * 0.5) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v42, v28, (const cocos2d::CCPoint *)v41);
GameToolbox::alignItemsHorisontally((__int64)v17, (__int64)v42, 0, 18.0);
cocos2d::CCArray::removeAllObjects(v17);
v35 = ButtonSprite::create((ButtonSprite *)"OK", v29, v30, v31, v32, v33, v34);
v36 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v35,
0,
(__int64)this,
(__int64)DemonFilterSelectLayer::onClose,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v36);
cocos2d::CCArray::addObject(v17, v36);
v37 = *(this + 69);
v38 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v36 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v41,
*(float *)&v40 * 0.5,
(float)((float)(*((float *)&v40 + 1) * 0.5) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v42, v37, (const cocos2d::CCPoint *)v41);
v38(v36, v42);
if ( v7 )
DemonFilterSelectLayer::selectRating((DemonFilterSelectLayer *)this, v7);
}
return v3;
}