//
// DemonFilterSelectLayer::init from 0x495d0c to 0x495fde (722 bytes)
//
// 1 xrefs:
// > DemonFilterSelectLayer::create @ 0x49595c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:41 +0000
//
GameManager *__fastcall DemonFilterSelectLayer::init(cocos2d::CCArray **this)
{
GameManager *v2; // r0
GameManager *v3; // r11
int v4; // r6
void (__fastcall *v5)(int, _DWORD *); // r7
void (__fastcall *v6)(int, _DWORD *); // r7
const char *v7; // r2
int v8; // r6
void (__fastcall *v9)(int, _DWORD *); // r7
int v10; // r1
int v11; // r6
cocos2d::CCObject *v12; // r8
cocos2d::CCArray *v13; // r0
cocos2d::CCObject *v14; // r0
cocos2d::CCArray *v15; // r0
cocos2d::CCMenu *v16; // r9
cocos2d::CCArray *v17; // r0
GameLevelManager *v18; // r0
GameLevelManager *v19; // r0
const char *v20; // r10
char *CString; // r1
const char *v22; // r1
cocos2d::CCSprite *v23; // r0
cocos2d::CCString *v24; // r0
int v25; // r7
cocos2d::CCObject *v26; // r7
const cocos2d::CCPoint *v27; // r7
const char *v28; // r1
ButtonSprite *v29; // r0
cocos2d::CCObject *v30; // r5
const cocos2d::CCPoint *v31; // r10
void (__fastcall *v32)(cocos2d::CCObject *, _BYTE *); // r9
const char *IntForKey; // [sp+Ch] [bp-58h]
float v35; // [sp+20h] [bp-44h] BYREF
float v36; // [sp+24h] [bp-40h]
char v37[8]; // [sp+28h] [bp-3Ch] BYREF
_BYTE v38[8]; // [sp+30h] [bp-34h] BYREF
unsigned int (__fastcall *v39)(DemonFilterSelectLayer *, cocos2d::CCObject *); // [sp+38h] [bp-2Ch]
int v40; // [sp+3Ch] [bp-28h]
int v41[2]; // [sp+40h] [bp-24h] BYREF
cocos2d::CCSprite *v42; // [sp+48h] [bp-1Ch]
_DWORD v43[4]; // [sp+4Ch] [bp-18h] BYREF
v2 = FLAlertLayer::init((FLAlertLayer *)this, 75);
v3 = v2;
if ( v2 )
{
cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v35);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v43, 0.0, 0.0, 80.0, 80.0);
v4 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v43);
v5 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v4 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v43, 380.0, 180.0);
v5(v4, v43);
(*(void (__fastcall **)(_DWORD, int, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), v4, -1);
v6 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v4 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, v35 * 0.5, v36 * 0.5);
v6(v4, v43);
v8 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Demon Filter", "bigFont.fnt", v7);
v9 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, v35 * 0.5, (float)((float)(v36 * 0.5) + 90.0) - 20.0);
v9(v8, v43);
v10 = v8;
v11 = 0;
v12 = nullptr;
v13 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 115) + 228))(*(this + 115), v10);
v14 = (cocos2d::CCObject *)cocos2d::CCArray::create(v13);
*(this + 130) = v14;
v15 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v14);
v16 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v15);
v17 = (cocos2d::CCArray *)cocos2d::CCMenu::create(v16);
*(this + 111) = v17;
v18 = (GameLevelManager *)(*(int (__fastcall **)(_DWORD, cocos2d::CCArray *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v17,
10);
v19 = (GameLevelManager *)GameLevelManager::sharedState(v18);
IntForKey = (const char *)GameLevelManager::getIntForKey(v19, "demon_filter");
do
{
v20 = (const char *)byte_BEC004[v11];
v41[0] = 0;
v41[1] = 0;
v42 = nullptr;
if ( v11 )
{
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn2_001.png",
v20);
CString = (char *)cocos2d::CCString::getCString(v24);
}
else
{
CString = "difficulty_06_btn_001.png";
}
std::string::assign(v41, CString);
if ( (v41[0] & 1) != 0 )
v23 = v42;
else
v23 = (cocos2d::CCSprite *)((char *)v41 + 1);
v25 = cocos2d::CCSprite::createWithSpriteFrameName(v23, v22);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v25 + 80))(v25, 1066192077);
v39 = DemonFilterSelectLayer::selectRating;
v40 = 0;
v26 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v25,
0,
(int)this,
(int)DemonFilterSelectLayer::selectRating,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v26);
cocos2d::CCArray::addObject(*(this + 130), v26);
(*(void (__fastcall **)(cocos2d::CCObject *, const char *))(*(_DWORD *)v26 + 36))(v26, v20);
cocos2d::CCArray::addObject(v16, v26);
++v11;
if ( v20 == IntForKey )
v12 = v26;
std::string::~string((int)v41);
}
while ( v11 != 6 );
v27 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v35 * 0.5, (float)(v36 * 0.5) + 3.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v43, v27);
GameToolbox::alignItemsHorisontally(*(float *)&v16, 18.0, (int)v43, 0);
cocos2d::CCArray::removeAllObjects(v16);
v29 = ButtonSprite::create((ButtonSprite *)"OK", v28);
v43[0] = DemonFilterSelectLayer::onClose;
v43[1] = 0;
v30 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v29,
0,
(int)this,
(int)DemonFilterSelectLayer::onClose,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v30);
cocos2d::CCArray::addObject(v16, v30);
v31 = *(this + 111);
v32 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v30 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v35 * 0.5, (float)((float)(v36 * 0.5) - 90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v38, v31);
v32(v30, v38);
if ( v12 )
DemonFilterSelectLayer::selectRating((DemonFilterSelectLayer *)this, v12);
}
return v3;
}