//
// GJRateEditorSoundLayer::init from 0x56780c to 0x567c06 (1018 bytes)
//
// 1 xrefs:
// > GJRateEditorSoundLayer::create @ 0x567d00
//
// 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:52:29 +0000
//
int __fastcall GJRateEditorSoundLayer::init(const cocos2d::CCPoint **this, GJEditorSoundConfig *a2)
{
int v4; // r9
cocos2d::CCDirector *v6; // r0
cocos2d::CCMenu *v7; // r0
const cocos2d::CCPoint *v8; // r0
char *v9; // r1
cocos2d::CCString *v10; // r0
const char *CString; // r6
size_t v12; // r0
const char *v13; // r2
cocos2d::CCLabelBMFont *v14; // r0
cocos2d::CCLabelBMFont *v15; // r8
void (__fastcall *v16)(cocos2d::CCLabelBMFont *, _DWORD *); // r11
ButtonSprite *v17; // r8
ButtonSprite *v18; // r5
cocos2d::CCArray *v19; // r0
cocos2d::CCArray *v20; // r5
const char *v21; // r1
ButtonSprite *v22; // r0
cocos2d::CCObject *v23; // r6
const char *v24; // r1
ButtonSprite *v25; // r0
cocos2d::CCObject *v26; // r6
const cocos2d::CCPoint *v27; // r11
float v28; // [sp+10h] [bp-74h]
float v29; // [sp+10h] [bp-74h]
float v30; // [sp+34h] [bp-50h] BYREF
float v31; // [sp+38h] [bp-4Ch]
float v32; // [sp+3Ch] [bp-48h] BYREF
float v33; // [sp+40h] [bp-44h]
char v34[8]; // [sp+44h] [bp-40h] BYREF
_BYTE v35[8]; // [sp+4Ch] [bp-38h] BYREF
int v36; // [sp+54h] [bp-30h]
int v37; // [sp+58h] [bp-2Ch]
_DWORD v38[2]; // [sp+5Ch] [bp-28h] BYREF
int v39[2]; // [sp+64h] [bp-20h] BYREF
cocos2d::CCLabelBMFont *v40; // [sp+6Ch] [bp-18h]
int v41; // [sp+70h] [bp-14h] BYREF
int v42; // [sp+74h] [bp-10h]
char *v43; // [sp+78h] [bp-Ch]
if ( !a2 )
return 0;
v4 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 300.0, 180.0, 1, 0.0);
if ( !v4 )
return 0;
SetupTriggerPopup::preSetup((SetupTriggerPopup *)this);
v41 = 0;
v42 = 0;
v43 = nullptr;
std::string::__init(&v41, "Feature Sound Pack", 0x12u);
SetupTriggerPopup::addTitle(this, &v41);
std::string::~string((int)&v41);
*(this + 181) = a2;
v6 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v30);
v7 = (cocos2d::CCMenu *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v32, v30 * 0.5, v31 * 0.5);
v8 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create(v7);
*(this + 111) = v8;
(*(void (__fastcall **)(_DWORD, const cocos2d::CCPoint *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v8,
10);
std::string::basic_string(&v41, (int)*(this + 181) + 324);
if ( (v41 & 1) != 0 )
v9 = v43;
else
v9 = (char *)&v41 + 1;
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%d sounds)",
v9,
*((_DWORD *)*(this + 181) + 76));
CString = (const char *)cocos2d::CCString::getCString(v10);
v39[0] = 0;
v39[1] = 0;
v40 = nullptr;
v12 = strlen(CString);
std::string::__init(v39, CString, v12);
std::string::~string((int)&v41);
if ( (v39[0] & 1) != 0 )
v14 = v40;
else
v14 = (cocos2d::CCLabelBMFont *)((char *)v39 + 1);
v15 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v14, "goldFont.fnt", v13);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, int))(*(_DWORD *)v15 + 80))(v15, 1057803469);
cocos2d::CCLabelBMFont::limitLabelWidth(v15, *((float *)this + 139) - 80.0, 0.55, 0.3);
(*(void (__fastcall **)(_DWORD, cocos2d::CCLabelBMFont *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v15,
2);
v16 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, _DWORD *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v32, (float)(v33 + (float)(*((float *)this + 140) * 0.5)) - 40.0);
v16(v15, v38);
v41 = 0;
v42 = 0;
v43 = nullptr;
std::string::__init(&v41, "Rank:", 5u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v32, v33 + 8.0);
SetupTriggerPopup::createValueControlAdvanced(this, -20, &v41, v38, 1060320051, 1, 2, &byte_4, 1, 0, 0, 0, 0, 0, 2, 0);
std::string::~string((int)&v41);
SetupTriggerPopup::updateValue((SetupTriggerPopup *)this, -20, 1.0);
v17 = ButtonSprite::create(
(ButtonSprite *)"Unrate",
nullptr,
0,
0.35,
0,
"bigFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(25.0),
v28);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v38,
(float)((float)(*((float *)this + 139) * 0.5) + (float)(v30 * 0.5)) - 40.0,
(float)((float)(*((float *)this + 140) * 0.5) + (float)(v31 * 0.5)) - 22.0);
SetupTriggerPopup::addCustomButton(this, -21, v17, v38, 0, 0);
v18 = ButtonSprite::create(
(ButtonSprite *)"Rank\nOnly",
nullptr,
0,
0.3,
0,
"bigFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(25.0),
v29);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v38,
(float)((float)(*((float *)this + 139) * 0.5) + (float)(v30 * 0.5)) - 30.0,
(float)((float)(v31 * 0.5) - (float)(*((float *)this + 140) * 0.5)) + 20.0);
v19 = (cocos2d::CCArray *)SetupTriggerPopup::addCustomButton(this, -23, v18, v38, 0, 0);
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create(v19);
v22 = ButtonSprite::create((ButtonSprite *)"Cancel", v21);
v36 = 684;
v37 = 1;
v23 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v22, 0, (int)this, 684, 1);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v23);
cocos2d::CCArray::addObject(v20, v23);
v25 = ButtonSprite::create((ButtonSprite *)"Submit", v24);
v38[1] = 0;
v38[0] = GJRateEditorSoundLayer::onSubmit;
v26 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v25,
0,
(int)this,
(int)GJRateEditorSoundLayer::onSubmit,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v26);
cocos2d::CCArray::addObject(v20, v26);
v27 = *(this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v34,
v30 * 0.5,
(float)((float)(v31 * 0.5) - (float)(*((float *)this + 140) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v35, v27);
GameToolbox::alignItemsHorisontally(*(float *)&v20, 15.0, (int)v35, 0);
SetupTriggerPopup::postSetup((SetupTriggerPopup *)this);
std::string::~string((int)v39);
return v4;
}