//
// DemonFilterSelectLayer::init from 0x10005f990 to 0x10005fda4 (1044 bytes)
//
// 2 xrefs:
// > sub_10005CDB4 @ 0x10005ce2c
// > ??> @ 0x1008bf5e0
//
// 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 10:57:49 +0000
//
__int64 __fastcall DemonFilterSelectLayer::init(__int64 a1)
{
__int64 result; // x0
__int64 v3; // x0
__int64 v4; // x21
__int64 v5; // x21
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x22
__int64 v10; // x0
__int64 v11; // x0
__int64 v12; // x0
int IntForKey; // w23
__int64 v14; // x21
int v15; // w24
__int64 v16; // x27
__int64 v17; // x0
const std::string::value_type *CString; // x0
std::string *v19; // x0
__int64 v20; // x28
__int64 v21; // x28
__n128 v22; // q0
__int64 v23; // x23
__n128 v24; // q0
__int64 v25; // x0
__int64 v26; // x23
__int64 v27; // x22
__n128 v28; // q0
unsigned int v29; // [xsp+14h] [xbp-8Ch]
float v30; // [xsp+18h] [xbp-88h] BYREF
std::string v31; // [xsp+20h] [xbp-80h] BYREF
__int64 v32; // [xsp+38h] [xbp-68h] BYREF
result = FLAlertLayer::init_1(a1, 75);
if ( (_DWORD)result )
{
v29 = result;
v3 = cocos2d::CCDirector::sharedDirector(result);
cocos2d::CCDirector::getWinSize(&v32, v3);
sub_1000262CC((float *)&v31, 0.0, 0.0, 80.0, 80.0);
v4 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", &v31);
sub_1000262C4((float *)&v31, 380.0, 180.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v4 + 320LL))(v4, &v31);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v4,
0xFFFFFFFFLL);
sub_1000262BC((float *)&v31, *(float *)&v32 * 0.5, *((float *)&v32 + 1) * 0.5);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v4 + 184LL))(v4, &v31);
v5 = cocos2d::CCLabelBMFont::create_1("Demon Filter", "bigFont.fnt");
sub_1000262BC((float *)&v31, *(float *)&v32 * 0.5, (float)((float)(*((float *)&v32 + 1) * 0.5) + 90.0) + -20.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v5 + 184LL))(v5, &v31);
v6 = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v5);
v7 = sub_1002E736C(v6);
*(_QWORD *)(a1 + 664) = v7;
cocos2d::CCObject::retain(v7);
v9 = sub_1002E736C(v8);
v10 = cocos2d::CCMenu::create(v9);
*(_QWORD *)(a1 + 552) = v10;
v11 = (*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v10,
10);
v12 = GameLevelManager::sharedState(v11);
IntForKey = GameLevelManager::getIntForKey(v12, "demon_filter");
v14 = 0;
v15 = 0;
while ( 1 )
{
v16 = 6;
if ( v15 <= 1 )
{
if ( !v15 )
{
memset(&v31, 0, sizeof(v31));
std::string::assign(&v31, "difficulty_06_btn_001.png");
v16 = 0;
goto LABEL_14;
}
if ( v15 == 1 )
v16 = 7;
}
else
{
switch ( v15 )
{
case 2:
v16 = 8;
break;
case 4:
v16 = 9;
break;
case 5:
v16 = 10;
break;
}
}
memset(&v31, 0, sizeof(v31));
v17 = sub_1003065B0("difficulty_%02d_btn2_001.png", v16);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v17);
std::string::assign(&v31, CString);
LABEL_14:
if ( (v31.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v19 = &v31;
else
v19 = (std::string *)v31.__r_.__value_.__r.__words[0];
v20 = cocos2d::CCSprite::createWithSpriteFrameName(v19);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 1.1);
v21 = CCMenuItemSpriteExtra::create(v20, 0, a1, DemonFilterSelectLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v21);
v22 = sub_1002E74E0(*(_QWORD *)(a1 + 664), v21);
(*(void (__fastcall **)(__int64, __int64, __n128))(*(_QWORD *)v21 + 72LL))(v21, v16, v22);
sub_1002E74E0(v9, v21);
if ( (_DWORD)v16 == IntForKey )
v14 = v21;
if ( SHIBYTE(v31.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v31.__r_.__value_.__l.__data_);
if ( ++v15 == 6 )
{
v23 = *(_QWORD *)(a1 + 552);
sub_1000262BC(&v30, *(float *)&v32 * 0.5, (float)(*((float *)&v32 + 1) * 0.5) + 3.0);
cocos2d::CCNode::convertToNodeSpace(&v31, v23, &v30, v24);
GameToolbox::alignItemsHorisontally(v9, (float32x2_t *)&v31, 0, 18.0);
sub_1002E7674(v9);
v25 = sub_100067FAC("OK");
v26 = CCMenuItemSpriteExtra::create(v25, 0, a1, sub_10005FE90, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v26);
sub_1002E74E0(v9, v26);
v27 = *(_QWORD *)(a1 + 552);
sub_1000262BC(&v30, *(float *)&v32 * 0.5, (float)((float)(*((float *)&v32 + 1) * 0.5) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(&v31, v27, &v30, v28);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v26 + 184LL))(v26, &v31);
if ( v14 )
DemonFilterSelectLayer::selectRating(a1, v14);
return v29;
}
}
}
return result;
}