//
// SelectSFXSortLayer::init from 0x6c4c70 to 0x6c506e (1022 bytes)
//
// 1 xrefs:
// > SelectSFXSortLayer::create @ 0x6c50f4
//
// 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:56:54 +0000
//
int __fastcall SelectSFXSortLayer::init(int a1, int a2)
{
int v3; // r5
int v5; // r9
int v6; // r3
cocos2d::CCDirector *v7; // r0
cocos2d::CCLayer *WinSize; // r0
int v9; // r0
int v10; // r3
int v11; // r7
void (__fastcall *v12)(int, _DWORD *); // r8
void (__fastcall *v13)(int, _DWORD *); // r8
const char *v14; // r2
int v15; // r7
void (__fastcall *v16)(int, _DWORD *); // r8
cocos2d::CCMenu *v17; // r0
int v18; // r0
const char *v19; // r1
int v20; // r0
int v21; // r8
const cocos2d::CCPoint *v22; // r11
void (__fastcall *v23)(int, _DWORD *); // r10
const cocos2d::CCPoint *v24; // r8
char *v25; // r1
ButtonSprite *v26; // r0
char *v27; // r3
ButtonSprite *v28; // r0
int v29; // r8
float v30; // r0
void (__fastcall *v32)(int, _BYTE *); // [sp+10h] [bp-6Ch]
float v33; // [sp+30h] [bp-4Ch] BYREF
float v34; // [sp+34h] [bp-48h]
_BYTE v35[8]; // [sp+38h] [bp-44h] BYREF
_BYTE v36[8]; // [sp+40h] [bp-3Ch] BYREF
_BYTE v37[8]; // [sp+48h] [bp-34h] BYREF
int (__fastcall *v38)(SelectSFXSortLayer *, cocos2d::CCObject *); // [sp+50h] [bp-2Ch]
int v39; // [sp+54h] [bp-28h]
int v40[2]; // [sp+58h] [bp-24h] BYREF
ButtonSprite *v41; // [sp+60h] [bp-1Ch]
_DWORD v42[4]; // [sp+64h] [bp-18h] BYREF
v3 = 0;
v42[0] = -1778384896;
v5 = cocos2d::CCLayerColor::initWithColor(a1, v42);
if ( v5 )
{
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
v6 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 520) = a2;
(*(void (__fastcall **)(int, int))(v6 + 500))(a1, 1);
v7 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 536))(a1, 1);
cocos2d::CCDirector::sharedDirector(v7);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v33);
v9 = cocos2d::CCLayer::create(WinSize);
v10 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 460) = v9;
(*(void (__fastcall **)(int, int))(v10 + 228))(a1, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v42, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v42);
v12 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v11 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v42, 360.0, 240.0);
v12(v11, v42);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v11, -1);
v13 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v11 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, v33 * 0.5, v34 * 0.5);
v13(v11, v42);
v15 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Select Sorting", "bigFont.fnt", v14);
v16 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, v33 * 0.5, (float)((float)(v34 * 0.5) + 120.0) - 20.0);
v16(v15, v42);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v15);
v17 = (cocos2d::CCMenu *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v15 + 80))(v15, 1061997773);
v18 = cocos2d::CCMenu::create(v17);
*(_DWORD *)(a1 + 444) = v18;
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v18, 10);
v20 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v19);
v38 = SelectSFXSortLayer::onClose;
v39 = 0;
v21 = CCMenuItemSpriteExtra::create(v20, 0, a1, (int)SelectSFXSortLayer::onClose, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v21);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v21 + 80))(v21, 1061997773);
CCMenuItemSpriteExtra::setSizeMult(v21, 1.6);
v22 = *(const cocos2d::CCPoint **)(a1 + 444);
v23 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v21 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v37,
(float)((float)(v33 * 0.5) - 180.0) + 10.0,
(float)((float)(v34 * 0.5) + 120.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v42, v22);
v23(v21, v42);
v24 = *(const cocos2d::CCPoint **)(a1 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, v33 * 0.5, (float)((float)(v34 * 0.5) + 30.0) + 15.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v35, v24);
do
{
v40[0] = 0;
v40[1] = 0;
v41 = nullptr;
std::string::__init(v40, &unk_B6B226, 0);
switch ( v3 )
{
case 1:
v25 = "Z-A";
break;
case 2:
v25 = "Shortest";
break;
case 3:
v25 = "Longest";
break;
case 4:
v25 = "Newest";
break;
case 5:
v25 = "Oldest";
break;
default:
v25 = "A-Z";
break;
}
std::string::assign(v40, v25);
if ( (v40[0] & 1) != 0 )
v26 = v41;
else
v26 = (ButtonSprite *)((char *)v40 + 1);
if ( v3 == *(_DWORD *)(a1 + 520) )
v27 = "GJ_button_02.png";
else
v27 = "GJ_button_05.png";
v28 = ButtonSprite::create(
v26,
(const char *)off_3C,
0,
0.5,
1,
"bigFont.fnt",
v27,
COERCE_CONST_CHAR_(30.0),
*(float *)&v32);
v42[1] = 0;
v42[0] = SelectSFXSortLayer::onSelect;
v29 = CCMenuItemSpriteExtra::create((int)v28, 0, a1, (int)SelectSFXSortLayer::onSelect, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v29 + 36))(v29, v3);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v29);
v32 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v29 + 92);
v30 = floorf((float)(v3 >> 1));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v36,
(float)((float)((float)(v3 & 1) * 100.0) - 100.0) + 50.0,
v30 * -60.0);
cocos2d::CCPoint::operator+(v37, v35, v36);
v32(v29, v37);
++v3;
std::string::~string((int)v40);
}
while ( v3 != 6 );
*(_DWORD *)(a1 + 500) = -1;
*(_BYTE *)(a1 + 468) = 1;
}
return v5;
}