//
// SelectSFXSortLayer::init from 0x58484c to 0x584c36 (1002 bytes)
//
// 1 xrefs:
// > SelectSFXSortLayer::create @ 0x584cb4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool SelectSFXSortLayer::init(SelectSFXSortLayer *a1, AudioSortType a2)
{
int v3; // r5
int v5; // r9
SelectSFXSortLayer_vtbl *v6; // r3
cocos2d::CCDirector *v7; // r0
cocos2d::CCLayer *v8; // r0
SelectSFXSortLayer_vtbl *v9; // r3
cocos2d::CCNode *v10; // r7
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v13; // r7
void (__fastcall *v14)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCMenu *v15; // r0
cocos2d::CCSprite *v16; // r0
CCMenuItemSpriteExtra *v17; // r8
cocos2d::CCMenu *m_buttonMenu; // r11
void (__fastcall *v19)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCMenu *v20; // r8
char *v21; // r1
char *v22; // r3
ButtonSprite *v23; // r0
CCMenuItemSpriteExtra *v24; // r8
float v25; // r0
float v27; // r2
float v28; // r3
void (__fastcall *v29)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+10h] [bp-64h]
ButtonSprite *v30; // [sp+30h] [bp-44h] BYREF
cocos2d::CCSize v31; // [sp+34h] [bp-40h] BYREF
cocos2d::CCPoint v32; // [sp+3Ch] [bp-38h] BYREF
cocos2d::CCPoint v33; // [sp+44h] [bp-30h] BYREF
cocos2d::CCPoint v34; // [sp+4Ch] [bp-28h] BYREF
void (*v35)(SelectSFXSortLayer *, cocos2d::CCObject *); // [sp+54h] [bp-20h]
int v36; // [sp+58h] [bp-1Ch]
cocos2d::CCRect v37; // [sp+5Ch] [bp-18h] BYREF
cocos2d::CCSize v38; // 0:^0.8
cocos2d::CCRect v39; // 0:kr00_16.16
v3 = 0;
v37.origin.x = -1.034e-25;
v5 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v37);
if ( v5 )
{
FLAlertLayer::incrementForcePrio(a1);
v6 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_sortType = a2;
v6->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v31, v7);
v8 = cocos2d::CCLayer::create();
v9 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v8;
v9->addChild(a1, v8);
cocos2d::CCRect::CCRect(&v37, 0.0, 0.0, 80.0, 80.0);
v39.origin.x = v27;
v39.origin.y = v28;
v39.size = v38;
v10 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v37,
v39);
setContentSize = v10->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v37, 360.0, 240.0);
setContentSize(v10, (const cocos2d::CCSize *)&v37);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v10, -1);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v37.origin, v31.width * 0.5, v31.height * 0.5);
setPosition(v10, &v37.origin);
v13 = cocos2d::CCLabelBMFont::create();
v14 = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v37.origin, v31.width * 0.5, (float)((float)(v31.height * 0.5) + 120.0) - 20.0);
v14(v13, &v37.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v13);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->setScale)(v13, 1061997773);
v15 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v15;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, 10);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v35 = SelectSFXSortLayer::onClose;
v36 = 0;
v17 = CCMenuItemSpriteExtra::create(
v16,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SelectSFXSortLayer::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v17);
((void (__fastcall *)(CCMenuItemSpriteExtra *, int))v17->setScale)(v17, 1061997773);
CCMenuItemSpriteExtra::setSizeMult(v17, 1.6);
m_buttonMenu = a1->m_buttonMenu;
v19 = v17->setPosition;
cocos2d::CCPoint::CCPoint(
&v34,
(float)((float)(v31.width * 0.5) - 180.0) + 10.0,
(float)((float)(v31.height * 0.5) + 120.0) - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v37.origin, m_buttonMenu, &v34);
v19(v17, &v37.origin);
v20 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v37.origin, v31.width * 0.5, (float)((float)(v31.height * 0.5) + 30.0) + 15.0);
cocos2d::CCNode::convertToNodeSpace(&v32, v20, &v37.origin);
do
{
sub_776584((int)&v30, (char *)&unk_939830);
switch ( v3 )
{
case 1:
v21 = "Name-";
break;
case 2:
v21 = "Len+";
break;
case 3:
v21 = "Len-";
break;
case 4:
v21 = "ID+";
break;
case 5:
v21 = "ID-";
break;
default:
v21 = "Name+";
break;
}
sub_7753D4((int)&v30, v21);
if ( v3 == a1->m_sortType )
v22 = "GJ_button_02.png";
else
v22 = "GJ_button_05.png";
v23 = ButtonSprite::create(
v30,
(const char *)off_3C,
0,
0.5,
1,
"bigFont.fnt",
v22,
COERCE_CONST_CHAR_(30.0),
*(float *)&v29);
v37.origin.y = 0.0;
LODWORD(v37.origin.x) = SelectSFXSortLayer::onSelect;
v24 = CCMenuItemSpriteExtra::create(
v23,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SelectSFXSortLayer::onSelect, (unsigned int)a1));
v24->setTag(v24, v3);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v24);
v29 = v24->setPosition;
v25 = floorf((float)(v3 >> 1));
cocos2d::CCPoint::CCPoint(&v33, (float)((float)((float)(v3 & 1) * 100.0) - 100.0) + 50.0, v25 * -60.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v33);
v29(v24, &v34);
++v3;
sub_774008(&v30);
}
while ( v3 != 6 );
a1->m_joystickConnected = -1;
a1->m_noElasticity = 1;
}
return v5;
}