//
// EditorSFXSettingsPopup::init from 0xcc7ca8 to 0xcc812c (1156 bytes)
//
// 2 xrefs:
// > EditorSFXSettingsPopup::create @ 0xcc8348
// > ??> @ 0x614b0
//
// 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:06:22 +0000
//
__int64 __fastcall EditorSFXSettingsPopup::init(EditorSFXSettingsPopup *this, int a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w20
char *v7; // x0
size_t v8; // x0
size_t v9; // x21
unsigned __int64 v10; // x24
char *v11; // x1
size_t v12; // x2
const char *v13; // x1
size_t v14; // x0
__int64 v15; // x2
__int64 v16; // x3
__int64 v17; // x4
__int64 v18; // x5
const char *v19; // x6
cocos2d::CCDirector *v20; // x0
cocos2d::CCDirector *v21; // x0
unsigned __int64 v22; // x25
char *v23; // x26
unsigned __int64 v24; // x0
__int64 v25; // x27
char *v26; // x0
char *v27; // x28
char *v28; // [xsp+98h] [xbp+68h]
char *v29; // [xsp+98h] [xbp+68h]
_BYTE v30[8]; // [xsp+A0h] [xbp+70h] BYREF
__int64 v31; // [xsp+A8h] [xbp+78h] BYREF
char v32[8]; // [xsp+B0h] [xbp+80h] BYREF
char v33[8]; // [xsp+B8h] [xbp+88h] BYREF
__int64 v34; // [xsp+C0h] [xbp+90h] BYREF
_QWORD v35[2]; // [xsp+C8h] [xbp+98h] BYREF
void *v36; // [xsp+D8h] [xbp+A8h]
__int64 v37[2]; // [xsp+E0h] [xbp+B0h] BYREF
void *v38; // [xsp+F0h] [xbp+C0h]
cocos2d::CCDirector *v39[2]; // [xsp+F8h] [xbp+C8h] BYREF
void *v40; // [xsp+108h] [xbp+D8h]
__int64 v41; // [xsp+110h] [xbp+E0h] BYREF
size_t v42; // [xsp+118h] [xbp+E8h]
void *v43; // [xsp+120h] [xbp+F0h]
v4 = SetupTriggerPopup::init(this, nullptr, nullptr, 320.0, 160.0, 7u, 0.0);
v5 = v4;
if ( !v4 )
return v5;
*((_DWORD *)this + 253) = a2;
*((_BYTE *)this + 596) = 1;
SetupTriggerPopup::preSetup(this);
qmemcpy(v30, "PWi", 3);
SetupTriggerPopup::setCustomBGColor((__int64)this, (__int64)v30);
v7 = EditorSFXManager::actionToString((EditorSFXManager *)*((unsigned int *)this + 253));
v41 = 0;
v28 = v7;
v42 = 0;
v43 = nullptr;
v8 = strlen(v7);
std::string::__init(&v41, v28, v8);
if ( (v41 & 1) != 0 )
{
v9 = v42;
v10 = (v41 & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v10 - v42 > 0xA )
{
v11 = (char *)v43;
goto LABEL_5;
}
v22 = v42 + 11;
v25 = -17;
if ( -17LL - (v41 & 0xFFFFFFFFFFFFFFFELL) >= v42 + 11 - v10 )
{
v23 = (char *)v43;
if ( v10 > 0x7FFFFFFFFFFFFFE6LL )
{
LABEL_28:
v26 = (char *)operator new(v25);
v27 = v26;
if ( v9 )
memcpy(v26, v23, v9);
qmemcpy(&v27[v9], " - Settings", 11);
if ( v10 != 22 )
operator delete(v23);
v43 = v27;
v42 = v22;
v41 = v25 | 1;
v27[v22] = 0;
goto LABEL_8;
}
LABEL_24:
v24 = 2 * v10;
v25 = 23;
if ( 2 * v10 < v22 )
v24 = v22;
if ( v24 > 0x16 )
v25 = (v24 + 16) & 0xFFFFFFFFFFFFFFF0LL;
goto LABEL_28;
}
LABEL_36:
sub_630ED8();
}
v9 = (unsigned __int8)v41 >> 1;
v10 = 22;
v11 = (char *)&v41 + 1;
if ( 22 - v9 <= 0xA )
{
v22 = v9 + 11;
if ( v9 - 11 <= 0xFFFFFFFFFFFFFFD8LL )
{
v23 = (char *)&v41 + 1;
goto LABEL_24;
}
goto LABEL_36;
}
LABEL_5:
v12 = v9 + 11;
qmemcpy(&v11[v9], " - Settings", 11);
if ( (v41 & 1) != 0 )
v42 = v9 + 11;
else
LOBYTE(v41) = 2 * v12;
v11[v12] = 0;
LABEL_8:
v35[0] = v41;
if ( (v41 & 1) != 0 )
v13 = (const char *)v43;
else
v13 = (char *)v35 + 1;
v36 = v43;
v29 = (char *)v13;
v35[1] = v42;
v37[0] = 0;
v37[1] = 0;
v38 = nullptr;
v14 = strlen(v13);
std::string::__init(v37, v29, v14);
SetupTriggerPopup::addTitle((__int64)this, (__int64)v37);
if ( (v37[0] & 1) != 0 )
operator delete(v38);
v39[0] = nullptr;
v39[1] = nullptr;
v40 = nullptr;
std::string::__init((__int64 *)v39, "OK", 2u);
SetupTriggerPopup::addCloseButton((__int64)this, (__int64)v39, v15, v16, v17, v18, v19);
v20 = (cocos2d::CCDirector *)LOBYTE(v39[0]);
if ( ((__int64)v39[0] & 1) != 0 )
operator delete(v40);
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);
cocos2d::CCDirector::getWinSize(&v31, v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v32, *(float *)&v31 * 0.5, *((float *)&v31 + 1) * 0.5);
v41 = 0;
v42 = 0;
v43 = nullptr;
std::string::__init(&v41, "Min Interval", 0xCu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v33, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v34, v32);
SetupTriggerPopup::createValueControlAdvanced(
(cocos2d::CCArray **)this,
9001,
(char *)&v41,
(__int64)&v34,
0,
1,
5,
0,
0.8,
0.0,
1.0,
0,
0,
0,
2,
0);
if ( (v41 & 1) != 0 )
operator delete(v43);
SetupTriggerPopup::postSetup(this);
if ( (v35[0] & 1) != 0 )
operator delete(v36);
return v5;
}