//
// SelectSFXSortLayer::init from 0xb90824 to 0xb90d78 (1364 bytes)
//
// 2 xrefs:
// > SelectSFXSortLayer::create @ 0xb90ed8
// > ??> @ 0xbd340
//
// 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:38 +0000
//
__int64 __fastcall SelectSFXSortLayer::init(__int64 a1, int a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w28
int v7; // w20
cocos2d::CCDirector *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCLayer *WinSize; // x0
__int64 v11; // x0
__int64 v12; // x22
void (__fastcall *v13)(__int64, __int64 *); // x25
void (__fastcall *v14)(__int64, __int64 *); // x25
const char *v15; // x2
__int64 v16; // x22
void (__fastcall *v17)(__int64, __int64 *); // x25
cocos2d::CCMenu *v18; // x0
__int64 v19; // x0
const char *v20; // x1
__int64 v21; // x0
__int64 v22; // x22
void (__fastcall *v23)(__int64, __int64 *); // x25
cocos2d::CCNode *v24; // x22
ButtonSprite *v25; // x0
const char *v26; // x5
__int64 v27; // x0
__int64 v28; // x22
void (__fastcall *v29)(__int64, __int64 *); // x25
const char *v30; // x6
cocos2d::CCNode *v31; // [xsp+88h] [xbp+88h]
__int64 v32; // [xsp+98h] [xbp+98h] BYREF
__int64 v33; // [xsp+A0h] [xbp+A0h] BYREF
_BYTE v34[8]; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v35[2]; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v36[2]; // [xsp+C0h] [xbp+C0h] BYREF
void *v37; // [xsp+D0h] [xbp+D0h]
LODWORD(v35[0]) = -1778384896;
v4 = cocos2d::CCLayerColor::initWithColor(a1, v35);
v5 = v4;
if ( v4 )
{
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
*(_DWORD *)(a1 + 660) = a2;
v7 = 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1000LL))(a1, 1);
v8 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize(&v32, v9);
v11 = cocos2d::CCLayer::create(WinSize);
*(_QWORD *)(a1 + 584) = v11;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v35, 0.0, 0.0, 80.0, 80.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v35);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v35, 360.0, 240.0);
v13(v12, v35);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v12,
0xFFFFFFFFLL);
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35, *(float *)&v32 * 0.5, *((float *)&v32 + 1) * 0.5);
v14(v12, v35);
v16 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Select Sorting", "bigFont.fnt", v15);
v17 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v16 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v35,
*(float *)&v32 * 0.5,
(float)((float)(*((float *)&v32 + 1) * 0.5) + 120.0) - 20.0);
v17(v16, v35);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v16);
v18 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v16 + 160LL))(v16, 0.8);
v19 = cocos2d::CCMenu::create(v18);
*(_QWORD *)(a1 + 552) = v19;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v19, 10);
v21 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v20);
v22 = CCMenuItemSpriteExtra::create(v21, 0, a1, (__int64)SelectSFXSortLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v22);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v22 + 160LL))(v22, 0.8);
CCMenuItemSpriteExtra::setSizeMult(v22, 1.6);
v23 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v22 + 184LL);
v31 = *(cocos2d::CCNode **)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v34,
(float)((float)(*(float *)&v32 * 0.5) + -180.0) + 10.0,
(float)((float)(*((float *)&v32 + 1) * 0.5) + 120.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(v35, v31, (const cocos2d::CCPoint *)v34);
v23(v22, v35);
v24 = *(cocos2d::CCNode **)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v35,
*(float *)&v32 * 0.5,
(float)((float)(*((float *)&v32 + 1) * 0.5) + 30.0) + 15.0);
cocos2d::CCNode::convertToNodeSpace(&v33, v24, (const cocos2d::CCPoint *)v35);
while ( 1 )
{
v36[0] = 0;
v36[1] = 0;
v37 = nullptr;
std::string::__init(v36, &byte_11B8890, 0);
switch ( v7 )
{
case 1:
std::string::assign(v36, "Z-A");
break;
case 2:
std::string::assign(v36, "Shortest");
break;
case 3:
std::string::assign(v36, "Longest");
break;
case 4:
std::string::assign(v36, "Newest");
break;
case 5:
std::string::assign(v36, "Oldest");
break;
default:
std::string::assign(v36, "A-Z");
break;
}
if ( (v36[0] & 1) != 0 )
{
v25 = (ButtonSprite *)v37;
if ( *(_DWORD *)(a1 + 660) == v7 )
{
LABEL_12:
v26 = "GJ_button_02.png";
goto LABEL_6;
}
}
else
{
v25 = (ButtonSprite *)((char *)v36 + 1);
if ( *(_DWORD *)(a1 + 660) == v7 )
goto LABEL_12;
}
v26 = "GJ_button_05.png";
LABEL_6:
v27 = ButtonSprite::create(v25, (const char *)&word_3C, 0, 1, 0.5, "bigFont.fnt", v26, v30, 30.0);
v28 = CCMenuItemSpriteExtra::create(v27, 0, a1, (__int64)SelectSFXSortLayer::onSelect, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v28 + 72LL))(v28, (unsigned int)v7);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v28);
v29 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v34,
(float)((float)((float)(v7 & 1) * 100.0) + -100.0) + 50.0,
floorf((float)(v7 >> 1)) * -60.0);
cocos2d::CCPoint::operator+(v35, &v33);
v29(v28, v35);
if ( (v36[0] & 1) != 0 )
{
++v7;
operator delete(v37);
if ( v7 == 6 )
{
LABEL_19:
*(_DWORD *)(a1 + 640) = -1;
*(_BYTE *)(a1 + 596) = 1;
return v5;
}
}
else if ( ++v7 == 6 )
{
goto LABEL_19;
}
}
}
return v5;
}