//
// EditorPauseLayer::init from 0x78b3dc to 0x78bbbc (2016 bytes)
//
// 2 xrefs:
// > EditorPauseLayer::create @ 0x78bc58
// > ??> @ 0x81a68
//
// 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 EditorPauseLayer::init(EditorPauseLayer *a1, LevelEditorLayer *a2)
{
bool v3; // w23
GJLevelType m_levelType; // w25
cocos2d::CCDirector *v6; // x0
LevelEditorLayer *m_editorLayer; // x2
GJGameLevel *m_level; // x1
int v9; // w0
cocos2d::CCString *v10; // x0
size_t v11; // x0
LevelEditorLayer *v12; // x0
unsigned __int8 *v13; // x19
__int64 v14; // x0
unsigned __int8 *v15; // x1
unsigned __int8 *v16; // x1
int v17; // w27
int v18; // t1
unsigned __int8 *v19; // x19
unsigned int v20; // w27
__int64 v21; // x0
cocos2d::CCLabelBMFont *v22; // x24
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v25; // x0
float v26; // s0
float v27; // s8
cocos2d::CCDirector *v28; // x0
float v29; // s0
float LastObjectX; // s0
DrawGridLayer *m_drawGridLayer; // x26
float v32; // s0
LevelEditorLayer *v33; // x1
float v34; // s9
int m_timestamp; // w0
float v36; // s8
GJGameLevel *LengthKey; // x0
char *v38; // x0
const char *v39; // x1
unsigned int v40; // w4
cocos2d::CCString *v41; // x0
cocos2d::CCLabelBMFont *v42; // x25
void (__fastcall *v43)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x27
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
__int64 v45; // x24
void *v46; // x0
unsigned __int8 *v47; // x0
unsigned __int8 *v48; // x0
cocos2d::CCArray **p_m_pTargetArray; // x0
unsigned int *p_m_nExtraKerning; // x20
int m_nExtraKerning; // w1
unsigned __int8 *v52; // x3
unsigned __int8 *v53; // x3
unsigned __int8 *v54; // x0
int v55; // w2
int v56; // t1
cocos2d::CCString *v57; // x0
size_t v58; // x0
bool v59; // cc
int seed; // w1
int random; // w0
int v62; // w19
__int64 v63; // x2
const char *v64; // x1
cocos2d::CCString *v65; // x0
size_t v66; // x0
unsigned int *v67; // x1
int v68; // w2
unsigned int *v69; // x1
int v70; // w2
unsigned int *v71; // x1
int v72; // w2
unsigned int *v73; // x1
int v74; // w2
double v75; // d0
double v76; // d1
__int64 v77; // [xsp+0h] [xbp+0h] BYREF
const char *CString; // [xsp+78h] [xbp+78h]
bool v79; // [xsp+8Fh] [xbp+8Fh] BYREF
cocos2d::CCLabelBMFont *v80; // [xsp+98h] [xbp+98h] BYREF
unsigned __int8 *v81; // [xsp+A0h] [xbp+A0h] BYREF
unsigned __int8 *v82; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v83; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v84; // [xsp+B8h] [xbp+B8h] BYREF
char *v85; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
cocos2d::CCPoint v87; // 0:s0.4,4:s1.4
a1->m_editorLayer = a2;
v3 = CCBlockLayer::init(a1);
if ( !v3 )
return v3;
m_levelType = a1->m_editorLayer->m_level->m_levelType;
v6 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v6);
*(float *)&v75 = WinSize.width;
*(float *)&v76 = WinSize.height;
m_editorLayer = a1->m_editorLayer;
m_level = m_editorLayer->m_level;
v80 = (cocos2d::CCLabelBMFont *)&byte_124B6C8;
v9 = m_level->m_highObjectsEnabled + m_level->m_unlimitedObjectsEnabled;
if ( v9 == 2 )
{
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Objects: %i (Unlimited)",
(const char *)(unsigned int)(m_editorLayer->m_objectCount.random
- m_editorLayer->m_objectCount.seed),
v75,
v76);
CString = cocos2d::CCString::getCString(v10);
v11 = strlen(CString);
sub_D1798C(&v80, CString, v11);
}
else
{
v59 = v9 <= 0;
seed = m_editorLayer->m_objectCount.seed;
random = m_editorLayer->m_objectCount.random;
v62 = !v59;
v63 = 40000;
v64 = (const char *)(unsigned int)(random - seed);
if ( v62 )
v63 = 80000;
v65 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Objects: %i/%i",
v64,
v63,
v75,
v76);
CString = cocos2d::CCString::getCString(v65);
v66 = strlen(CString);
sub_D1798C(&v80, CString, v66);
if ( v62 )
sub_D15FD4(&v80, " (high)", 7);
}
v12 = a1->m_editorLayer;
v79 = 0;
LevelEditorLayer::getSongIDs(v12, &v79, (__int64)&v81);
LevelEditorLayer::getSFXIDs(a1->m_editorLayer, (__int64)&v82);
v13 = v81;
v14 = *((_QWORD *)v81 - 3);
if ( !v14
|| ((*((_DWORD *)v81 - 2) & 0x80000000) != 0
? (v15 = v81)
: (sub_D176A8(&v81), v13 = v81, (*((_DWORD *)v81 - 2) & 0x80000000) != 0)
? (v14 = *((_QWORD *)v81 - 3), v15 = v81)
: (unsigned __int8 *)(sub_D176A8(&v81), v15 = v81, v14 = *((_QWORD *)v81 - 3)),
v16 = &v15[v14],
v13 == v16) )
{
v19 = v82;
v20 = 1;
v21 = *((_QWORD *)v82 - 3);
if ( !v21 )
goto LABEL_15;
LABEL_36:
if ( (*((_DWORD *)v19 - 2) & 0x80000000) != 0 )
{
v52 = v19;
}
else
{
sub_D176A8(&v82);
v19 = v82;
if ( (*((_DWORD *)v82 - 2) & 0x80000000) != 0 )
{
v21 = *((_QWORD *)v82 - 3);
v52 = v82;
}
else
{
sub_D176A8(&v82);
v52 = v82;
v21 = *((_QWORD *)v82 - 3);
}
}
v53 = &v52[v21];
if ( v19 != v53 )
{
v54 = v19;
v55 = 0;
do
{
v56 = *v54++;
if ( v56 == 44 )
++v55;
}
while ( v54 != v53 );
if ( v55 + 1 <= 0 && !v79 )
goto LABEL_16;
}
goto LABEL_46;
}
v17 = 0;
do
{
v18 = *v13++;
if ( v18 == 44 )
++v17;
}
while ( v13 != v16 );
v19 = v82;
v20 = v17 + 1;
v21 = *((_QWORD *)v82 - 3);
if ( v21 )
goto LABEL_36;
LABEL_15:
if ( v79 )
{
LABEL_46:
v57 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)", Songs: %i, SFX: %i",
(const char *)v20);
CString = cocos2d::CCString::getCString(v57);
v58 = strlen(CString);
sub_D15FD4(&v80, CString, v58);
}
LABEL_16:
if ( m_levelType != Editor )
sub_D15FD4(&v80, " (Read-Only)", 12);
v22 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v22->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, 0.0, 1.0);
setAnchorPoint(v22, (const cocos2d::CCPoint *)&v85);
a1->addChild(a1, v22);
setPosition = v22->setPosition;
v25 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v25);
v27 = (float)(v26 + 10.0) + 0.0;
v28 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v28);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v27, v29 - 5.0);
setPosition(v22, (const cocos2d::CCPoint *)&v85);
v22->setScale(v22, 0.5);
LastObjectX = LevelEditorLayer::getLastObjectX(a1->m_editorLayer);
m_drawGridLayer = a1->m_editorLayer->m_drawGridLayer;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, LastObjectX + 340.0, 0.0);
v32 = DrawGridLayer::timeForPos(m_drawGridLayer, v87, (unsigned int)&v77 + 192, 0, 0, 0, 0, 0);
v33 = a1->m_editorLayer;
v34 = v32;
m_timestamp = v33->m_level->GJBaseGameLayer::m_timestamp;
if ( m_timestamp > 0 && v32 < (float)((float)m_timestamp / 240.0) )
v34 = (float)m_timestamp / 240.0;
v36 = floorf(v34 / 60.0);
LengthKey = (GJGameLevel *)GJGameLevel::getLengthKey((int)v34, v33->m_levelSettings->m_platformerMode);
GJGameLevel::lengthKeyToString((__int64 *)&v85, LengthKey);
sub_D153B8((int)&v83, v85);
v38 = v85 - 24;
if ( v85 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v71 = (unsigned int *)(v85 - 8);
do
v72 = __ldaxr(v71);
while ( __stlxr(v72 - 1, v71) );
}
else
{
v72 = *((_DWORD *)v85 - 2);
*((_DWORD *)v85 - 2) = v72 - 1;
}
if ( v72 <= 0 )
operator delete(v38);
}
if ( !a1->m_editorLayer->m_levelSettings->m_platformerMode )
{
v39 = (const char *)(unsigned int)(int)v36;
v40 = (int)(float)(v34 - (float)(60 * (int)v39));
if ( (int)v39 <= 0 )
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Length: %i seconds (%s)",
(const char *)v40,
v83);
else
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Length: %imin %is (%s)",
v39,
v40,
v83);
cocos2d::CCString::getCString(v41);
}
v42 = cocos2d::CCLabelBMFont::create();
v43 = v42->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, 0.0, 1.0);
v43(v42, (const cocos2d::CCPoint *)&v85);
a1->addChild(a1, v42);
v44 = v42->setPosition;
v45 = (__int64)v22->getPosition(v22);
cocos2d::CCPoint::CCPoint(&v84, 0.0, -20.0);
cocos2d::CCPoint::operator+(&v85, v45, &v84);
v44(v42, (const cocos2d::CCPoint *)&v85);
v42->setScale(v42, 0.5);
v46 = (void *)(v83 - 24);
if ( (__int64 *)(v83 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v73 = (unsigned int *)(v83 - 8);
do
v74 = __ldaxr(v73);
while ( __stlxr(v74 - 1, v73) );
}
else
{
v74 = *(_DWORD *)(v83 - 8);
*(_DWORD *)(v83 - 8) = v74 - 1;
}
if ( v74 <= 0 )
operator delete(v46);
}
v47 = v82 - 24;
if ( v82 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(v82 - 8);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *((_DWORD *)v82 - 2);
*((_DWORD *)v82 - 2) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v47);
}
v48 = v81 - 24;
if ( v81 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v67 = (unsigned int *)(v81 - 8);
do
v68 = __ldaxr(v67);
while ( __stlxr(v68 - 1, v67) );
}
else
{
v68 = *((_DWORD *)v81 - 2);
*((_DWORD *)v81 - 2) = v68 - 1;
}
if ( v68 <= 0 )
operator delete(v48);
}
p_m_pTargetArray = &v80[-1].m_pTargetArray;
if ( &v80[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v80[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v80[-1].m_nExtraKerning;
v80[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
return v3;
}