//
// EditorWindowPopup::initWindow from 0x78c844 to 0x78ccb8 (1140 bytes)
//
// 5 xrefs:
// > MoveStepPopup::init @ 0x744906
// > EmotePickerPopup::init @ 0x779222
// > EditorCommandsPopup::init @ 0x77a928
// > FindObjectPopup::init @ 0x77b292
// > GridSettingsLayer::init @ 0x78e452
//
// 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:59:37 +0000
//
GameManager *__fastcall EditorWindowPopup::initWindow(
EditorWindowPopup *this,
EditorUI *a2,
float a3,
float a4,
int a5,
int a6)
{
GameManager *v10; // r8
cocos2d::CCDirector *v11; // r0
cocos2d::CCDirector *WinSize; // r0
int v13; // r3
float v14; // s13
float v15; // s15
float v16; // s14
bool v17; // cc
float v18; // s17
float v19; // s12
bool v20; // fzf
bool v21; // fnf
cocos2d::CCDirector *v22; // r0
float v23; // r0
float v24; // s16
cocos2d::CCDirector *v25; // r0
float v26; // r0
int v27; // r0
float v28; // r2
float v29; // r1
int v30; // r9
void (__fastcall *v31)(int, _BYTE *); // r10
int v32; // r0
void (__fastcall *v33)(int, _BYTE *); // r2
const char *v34; // r1
int v35; // r0
int v36; // r1
int v37; // r2
int v38; // r3
int *v39; // r0
cocos2d::CCMenu *v40; // r0
int v41; // r0
GameManager *v42; // r0
int v43; // r0
int v44; // lr
_DWORD *v45; // r2
int v46; // r0
_DWORD *v47; // r3
_DWORD *v48; // r1
float v49; // r1
float v50; // r2
float v51; // s14
float v52; // r9
float v53; // s15
float v54; // s13
int v55; // r5
ScrollableContentLayer *v56; // r0
int v58; // r3
float v59; // s13
float v60; // s12
float v61; // s11
float v62; // s14
float v63; // s13
float v64; // s12
float v65; // s15
float v66; // s14
float v67; // s12
_BYTE v68[4]; // [sp+14h] [bp-24h] BYREF
float v69; // [sp+18h] [bp-20h]
_BYTE v70[8]; // [sp+1Ch] [bp-1Ch] BYREF
float v71[2]; // [sp+24h] [bp-14h] BYREF
_BYTE v72[8]; // [sp+2Ch] [bp-Ch] BYREF
v10 = SetupTriggerPopup::init(this, nullptr, nullptr, a3, a4, &byte_5, 0.0);
if ( !v10 )
return v10;
*((_DWORD *)this + 178) = a2;
*((float *)this + 183) = a3;
*((_DWORD *)this + 207) = a5;
*((_DWORD *)this + 208) = a6;
*((_DWORD *)this + 185) = 1065353216;
(*(void (__fastcall **)(EditorWindowPopup *, _DWORD))(*(_DWORD *)this + 584))(this, 0);
v11 = (cocos2d::CCDirector *)(*(int (__fastcall **)(EditorWindowPopup *, int))(*(_DWORD *)this + 544))(this, 1);
cocos2d::CCDirector::sharedDirector(v11);
WinSize = (cocos2d::CCDirector *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v68);
v13 = *((_DWORD *)this + 178);
if ( v13 )
v14 = *(float *)(v13 + 632);
else
v14 = 0.0;
v15 = (float)((float)(v69 - 50.0) - v14) - 10.0;
v16 = v69 - v14;
v17 = a4 <= v15;
if ( a4 <= v15 )
v15 = a4 + 11.0;
v18 = v16 - 10.0;
if ( !v17 )
v15 = v15 + 11.0;
v19 = *((float *)this + 204);
*((float *)this + 184) = v15;
v20 = v15 == 0.0;
v21 = v15 < 0.0;
*((float *)this + 140) = v15;
if ( v19 <= v18 )
v18 = v19;
if ( v21 || v20 )
v15 = 1.0;
else
v16 = *((float *)this + 183);
*((float *)this + 204) = v18;
if ( !v21 && !v20 )
v15 = v16 / v15;
*((float *)this + 200) = v15;
v22 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(WinSize);
v23 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v22));
v24 = (float)(v23 - 10.0) - (float)(*((float *)this + 183) * 0.5);
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v23));
v26 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v25));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v72, v24, (float)(v26 - 50.0) - (float)(*((float *)this + 184) * 0.5));
cocos2d::CCPoint::operator=((char *)this + 744, v72);
if ( *((_BYTE *)this + 758) )
{
EditorWindowPopup::contentCenter((EditorWindowPopup *)v72);
cocos2d::CCPoint::operator=((char *)this + 744, v72);
}
v27 = (*(int (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 240))(*((_DWORD *)this + 115), 1);
v28 = *((float *)this + 184);
v29 = *((float *)this + 183);
*((_DWORD *)this + 179) = v27;
v30 = v27;
v31 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v27 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v72, v29, v28);
v31(v30, v72);
v32 = *((_DWORD *)this + 179);
v33 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v32 + 480);
memset(v72, 150, 3);
v33(v32, v72);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 179) + 456))(*((_DWORD *)this + 179), 200);
v35 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_deleteIcon_001.png", v34);
*((_DWORD *)this + 180) = v35;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v35 + 80))(v35, 1051931443);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
*((_DWORD *)this + 180),
10);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v70, *((float *)this + 183), *((float *)this + 184) - 4.0);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v72, (const cocos2d::CCSize *)v70);
v39 = ScrollableContentLayer::create((const cocos2d::CCSize *)v72, v36, v37, v38);
*((_DWORD *)this + 181) = v39;
v40 = (cocos2d::CCMenu *)(*(int (__fastcall **)(_DWORD, int *))(**((_DWORD **)this + 115) + 228))(
*((_DWORD *)this + 115),
v39);
v41 = cocos2d::CCMenu::create(v40);
*((_DWORD *)this + 182) = v41;
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v41 + 500))(v41, 0);
(*(void (__fastcall **)(_DWORD, void *))(**((_DWORD **)this + 182) + 148))(*((_DWORD *)this + 182), &unk_D2E448);
(*(void (__fastcall **)(_DWORD, void *))(**((_DWORD **)this + 182) + 160))(*((_DWORD *)this + 182), &unk_D2E450);
(*(void (__fastcall **)(_DWORD, void *))(**((_DWORD **)this + 182) + 92))(*((_DWORD *)this + 182), &unk_D2E448);
v42 = (GameManager *)(*(int (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 181) + 320) + 228))(
*(_DWORD *)(*((_DWORD *)this + 181) + 320),
*((_DWORD *)this + 182));
if ( !*((_DWORD *)this + 207) )
{
v52 = 0.0;
LABEL_35:
v55 = 0;
goto LABEL_30;
}
v43 = GameManager::sharedState(v42);
v44 = *((_DWORD *)this + 207);
v45 = *(_DWORD **)(v43 + 896);
v46 = v43 + 896;
v47 = (_DWORD *)v46;
while ( v45 )
{
if ( v45[4] >= v44 )
{
v48 = (_DWORD *)*v45;
}
else
{
v48 = (_DWORD *)v45[1];
v45 = v47;
}
v47 = v45;
v45 = v48;
}
if ( v47 != (_DWORD *)v46 && v44 >= v47[4] )
{
v49 = *((float *)v47 + 5);
v50 = *((float *)v47 + 6);
v51 = *((float *)v47 + 7);
v52 = *((float *)v47 + 10);
v53 = *((float *)v47 + 8);
v54 = *((float *)v47 + 9);
if ( v47[11] == *((_DWORD *)this + 208) )
{
v58 = *((_DWORD *)this + 198);
if ( v58 == 1 )
{
if ( v51 > 0.0 )
{
v59 = *((float *)this + 203);
v60 = *((float *)this + 201);
if ( v59 > v51 )
v61 = v51;
else
v61 = *((float *)this + 203);
if ( v60 < v61 )
{
if ( v59 > v51 )
v60 = v51;
else
v60 = *((float *)this + 203);
}
*((float *)this + 183) = v60;
}
if ( v53 > 0.0 )
{
v62 = *((float *)this + 204);
v63 = *((float *)this + 202);
if ( v62 > v53 )
v64 = v53;
else
v64 = *((float *)this + 204);
if ( v63 < v64 )
{
if ( v62 > v53 )
v63 = v53;
else
v63 = *((float *)this + 204);
}
*((float *)this + 184) = v63;
}
}
else if ( v58 == 2 && v54 > 0.0 )
{
v65 = *((float *)this + 206);
v66 = *((float *)this + 205);
if ( v65 > v54 )
v67 = v54;
else
v67 = *((float *)this + 206);
if ( v66 < v67 )
{
if ( v65 > v54 )
v66 = v54;
else
v66 = *((float *)this + 206);
}
*((float *)this + 185) = v66;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v72, v49, v50);
cocos2d::CCPoint::operator=((char *)this + 744, v72);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, (EditorWindowPopup *)((char *)this + 744));
EditorWindowPopup::clampWindowCenter((cocos2d::CCDirector *)v72, (int)this, v71);
v55 = 1;
cocos2d::CCPoint::operator=((char *)this + 744, v72);
goto LABEL_30;
}
goto LABEL_35;
}
v52 = 0.0;
v55 = 0;
LABEL_30:
EditorWindowPopup::applyWindowSize(this);
(*(void (__fastcall **)(_DWORD, void *))(**((_DWORD **)this + 115) + 92))(*((_DWORD *)this + 115), &unk_D2E448);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 80))(*((_DWORD *)this + 115), 1065353216);
SetupTriggerPopup::preSetup(this);
(*(void (__fastcall **)(EditorWindowPopup *))(*(_DWORD *)this + 756))(this);
SetupTriggerPopup::postSetup(this);
EditorWindowPopup::layoutWindow(this);
if ( v55 )
{
v56 = *((ScrollableContentLayer **)this + 181);
if ( v56 )
ScrollableContentLayer::scrollTo(v56, v52);
}
return v10;
}