//
// EditorWindowPopup::initWindow from 0xcd9424 to 0xcd99c8 (1444 bytes)
//
// 7 xrefs:
// > MoveStepPopup::init @ 0xc60cec
// > EmotePickerPopup::init @ 0xcb97bc
// > EmotePickerPopup::init @ 0xcb98ac
// > EditorCommandsPopup::init @ 0xcbc1d0
// > FindObjectPopup::init @ 0xcbcbe4
// > GridSettingsLayer::init @ 0xcdbd8c
// > ??> @ 0xeff80
//
// 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:32 +0000
//
__int64 __fastcall EditorWindowPopup::initWindow(
EditorWindowPopup *this,
EditorUI *a2,
float a3,
float a4,
int a5,
int a6)
{
unsigned __int8 v12; // w0
unsigned int v13; // w22
__int64 v15; // x2
cocos2d::CCDirector *v16; // x0
cocos2d::CCDirector *v17; // x0
float *v18; // x0
float v19; // s0
float v20; // s4
float v21; // s2
float v22; // s3
float v23; // s0
float v24; // s8
float v25; // s2
cocos2d::CCDirector *v26; // x0
cocos2d::CCDirector *ScreenRight; // x0
float v28; // s0
float v29; // s8
cocos2d::CCDirector *v30; // x0
float v31; // s0
long double v32; // q0
float v33; // s8
__int64 v34; // x27
void (__fastcall *v35)(__int64, _BYTE *); // x28
__int64 v36; // x0
void (__fastcall *v37)(__int64, _BYTE *); // x3
const char *v38; // x1
__int64 v39; // x0
__int64 v40; // x0
cocos2d::CCMenu *v41; // x0
__int64 v42; // x0
GameManager *v43; // x0
int v44; // w23
ScrollableContentLayer *v45; // x0
float *v46; // x4
float *v47; // x0
int v48; // w3
float *v49; // x2
float v50; // s0
float v51; // s1
float v52; // s2
float v53; // s3
float v54; // s4
int v55; // w0
float v56; // s3
float v57; // s2
float v58; // s5
float v59; // s5
float v60; // s4
float v61; // s6
float v62; // s4
float v63; // s2
float v64; // s5
__int64 v65; // [xsp+98h] [xbp+98h] BYREF
char v66[8]; // [xsp+A0h] [xbp+A0h] BYREF
float v67; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v68[8]; // [xsp+B0h] [xbp+B0h] BYREF
v12 = SetupTriggerPopup::init(this, nullptr, nullptr, a3, a4, 5u, 0.0);
v13 = v12;
if ( !v12 )
return v13;
v15 = *(_QWORD *)this;
*((_QWORD *)this + 127) = a2;
*((_DWORD *)this + 288) = a5;
*((_DWORD *)this + 289) = a6;
*((float *)this + 264) = a3;
*((float *)this + 266) = 1.0;
(*(void (__fastcall **)(EditorWindowPopup *, _QWORD))(v15 + 1168))(this, 0);
v16 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(EditorWindowPopup *, __int64))(*(_QWORD *)this + 1088LL))(
this,
1);
v17 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v16);
cocos2d::CCDirector::getWinSize(&v65, v17);
v18 = *((float **)this + 127);
if ( v18 )
v19 = v18[214];
else
v19 = 0.0;
v20 = (float)((float)(*((float *)&v65 + 1) - 50.0) - v19) - 10.0;
if ( a4 > v20 )
v21 = v20 + 11.0;
else
v21 = a4 + 11.0;
v22 = *((float *)&v65 + 1) - v19;
v23 = *((float *)this + 285);
*((float *)this + 265) = v21;
v24 = v22 - 10.0;
*((float *)this + 184) = v21;
if ( v23 <= (float)(v22 - 10.0) )
v24 = v23;
*((float *)this + 285) = v24;
if ( v21 <= 0.0 )
v25 = 1.0;
else
v25 = *((float *)this + 264) / v21;
*((float *)this + 281) = v25;
v26 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v18);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v26);
v29 = (float)(v28 - 10.0) - (float)(*((float *)this + 264) * 0.5);
v30 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
cocos2d::CCDirector::getScreenTop(v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, v29, (float)(v31 - 50.0) - (float)(*((float *)this + 265) * 0.5));
*(__n128 *)&v32 = cocos2d::CCPoint::operator=((char *)this + 1068, v68);
if ( *((_BYTE *)this + 1082) )
{
EditorWindowPopup::contentCenter((cocos2d::CCPoint *)v68);
*(__n128 *)&v32 = cocos2d::CCPoint::operator=((char *)this + 1068, v68);
}
v33 = 0.0;
v34 = (*(__int64 (__fastcall **)(_QWORD, __int64, long double))(**((_QWORD **)this + 73) + 480LL))(
*((_QWORD *)this + 73),
1,
v32);
*((_QWORD *)this + 128) = v34;
v35 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v34 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v68, *((float *)this + 264), *((float *)this + 265));
v35(v34, v68);
v36 = *((_QWORD *)this + 128);
v37 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v36 + 960LL);
memset(v68, 150, 3);
v37(v36, v68);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 128) + 912LL))(*((_QWORD *)this + 128), 4294967240LL);
v39 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_deleteIcon_001.png", v38);
*((_QWORD *)this + 129) = v39;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v39 + 160LL))(v39, 0.35);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 129),
10);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v66, *((float *)this + 264), *((float *)this + 265) - 4.0);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v68, (const cocos2d::CCSize *)v66);
v40 = ScrollableContentLayer::create((const cocos2d::CCSize *)v68);
*((_QWORD *)this + 130) = v40;
v41 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v40);
v42 = cocos2d::CCMenu::create(v41);
*((_QWORD *)this + 131) = v42;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v42 + 1000LL))(v42, 0);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 131) + 296LL))(*((_QWORD *)this + 131), &unk_155F388);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 131) + 320LL))(*((_QWORD *)this + 131), &unk_155F390);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 131) + 184LL))(*((_QWORD *)this + 131), &unk_155F388);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*((_QWORD *)this + 130) + 416LL) + 456LL))(
*(_QWORD *)(*((_QWORD *)this + 130) + 416LL),
*((_QWORD *)this + 131));
v43 = (GameManager *)*((unsigned int *)this + 288);
if ( (_DWORD)v43 )
{
v46 = (float *)(GameManager::sharedState(v43) + 1120);
v47 = *(float **)v46;
v48 = *((_DWORD *)this + 288);
if ( *(_QWORD *)v46 )
{
v49 = v46;
do
{
while ( v48 <= *((_DWORD *)v47 + 7) )
{
v49 = v47;
v47 = *(float **)v47;
if ( !v47 )
goto LABEL_23;
}
v47 = *((float **)v47 + 1);
}
while ( v47 );
LABEL_23:
if ( v46 == v49 || v48 < *((_DWORD *)v49 + 7) )
{
v33 = 0.0;
}
else
{
v50 = v49[8];
v51 = v49[9];
v52 = v49[10];
v53 = v49[11];
v54 = v49[12];
v33 = v49[13];
if ( *((_DWORD *)v49 + 14) == *((_DWORD *)this + 289) )
{
v55 = *((_DWORD *)this + 279);
if ( v55 == 1 )
{
if ( v52 > 0.0 )
{
v59 = *((float *)this + 284);
v60 = *((float *)this + 282);
v61 = v49[10];
if ( v52 >= v59 )
v61 = *((float *)this + 284);
if ( v61 > v60 )
{
v60 = v49[10];
if ( v52 >= v59 )
v60 = *((float *)this + 284);
}
*((float *)this + 264) = v60;
}
if ( v53 > 0.0 )
{
v62 = *((float *)this + 285);
v63 = *((float *)this + 283);
v64 = v53;
if ( v53 >= v62 )
v64 = *((float *)this + 285);
if ( v64 > v63 )
{
v63 = v53;
if ( v53 >= v62 )
v63 = *((float *)this + 285);
}
*((float *)this + 265) = v63;
}
}
else if ( v54 > 0.0 && v55 == 2 )
{
v56 = *((float *)this + 287);
v57 = *((float *)this + 286);
v58 = v49[12];
if ( v54 >= v56 )
v58 = *((float *)this + 287);
if ( v58 > v57 )
{
v57 = v49[12];
if ( v54 >= v56 )
v57 = *((float *)this + 287);
}
*((float *)this + 266) = v57;
}
v44 = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, v50, v51);
cocos2d::CCPoint::operator=((char *)this + 1068, v68);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v67, (EditorWindowPopup *)((char *)this + 1068));
EditorWindowPopup::clampWindowCenter((__int64)this, &v67, (cocos2d::CCPoint *)v68);
cocos2d::CCPoint::operator=((char *)this + 1068, v68);
goto LABEL_15;
}
}
}
}
v44 = 0;
LABEL_15:
EditorWindowPopup::applyWindowSize(this);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 73) + 184LL))(*((_QWORD *)this + 73), &unk_155F388);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 73) + 160LL))(*((_QWORD *)this + 73), 1.0);
SetupTriggerPopup::preSetup(this);
(*(void (__fastcall **)(EditorWindowPopup *))(*(_QWORD *)this + 1512LL))(this);
SetupTriggerPopup::postSetup(this);
EditorWindowPopup::layoutWindow(this);
if ( v44 )
{
v45 = *((ScrollableContentLayer **)this + 130);
if ( v45 )
ScrollableContentLayer::scrollTo(v45, v33);
}
return v13;
}