//
// EditorPauseLayer::init from 0x1400d9ec0 to 0x1400da544 (1668 bytes)
//
// 2 xrefs:
// > EditorUI::onPause @ 0x1400e1d51
// > ??> @ 0x1406c88e0
//
// 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
//
// Hidden C++ exception states: #wind=6
bool EditorPauseLayer::init(EditorPauseLayer *a1, LevelEditorLayer *a2)
{
bool result; // al
GJGameLevel *m_level; // rcx
GJLevelType m_levelType; // edi
cocos2d::CCDirector *v6; // rax
LevelEditorLayer *m_editorLayer; // rcx
unsigned int v8; // ebx
int v9; // edx
cocos2d::CCString *v10; // rax
char *v11; // rax
size_t v12; // rsi
size_t v13; // r8
int v14; // r8d
cocos2d::CCString *v15; // rax
char *CString; // rax
size_t v17; // r8
__int64 v18; // r8
int v19; // ebx
_QWORD *v20; // rcx
char *v21; // rdx
_QWORD *v22; // rcx
unsigned int v23; // r14d
int v24; // r8d
_QWORD *v25; // rcx
char *v26; // rdx
_QWORD *v27; // rcx
cocos2d::CCString *v28; // rax
char *v29; // rax
size_t v30; // r8
void **v31; // rcx
struct cocos2d::CCLabelBMFont *v32; // r12
cocos2d::CCLabelBMFont_vtbl *v33; // rbx
const cocos2d::CCPoint *v34; // rax
cocos2d::CCLabelBMFont_vtbl *v35; // rbx
__int64 v36; // rcx
cocos2d::CCDirector *v37; // rax
float v38; // xmm6_4
__int64 v39; // rcx
cocos2d::CCDirector *v40; // rax
float v41; // xmm0_4
const cocos2d::CCPoint *v42; // rax
float LastObjectX; // xmm0_4
DrawGridLayer *m_drawGridLayer; // rdi
LevelSettingsObject *m_levelSettings; // rbx
const struct cocos2d::CCPoint *v46; // rax
cocos2d::CCPoint v47; // rax
float v48; // xmm0_4
float v49; // xmm6_4
LevelEditorLayer *v50; // r13
int m_timestamp; // ecx
int v52; // ebx
int v53; // edi
int v54; // ecx
_QWORD *v55; // rax
const char *v56; // rax
const char *v57; // r9
cocos2d::CCString *v58; // rax
const char *v59; // r8
struct cocos2d::CCLabelBMFont *v60; // rdi
cocos2d::CCLabelBMFont_vtbl *v61; // rbx
const cocos2d::CCPoint *v62; // rax
__int64 v63; // rax
void *v64; // rcx
void *v65; // rcx
char v66[8]; // [rsp+58h] [rbp-B0h] BYREF
cocos2d::CCPoint v67; // [rsp+60h] [rbp-A8h] BYREF
cocos2d::CCPoint v68; // [rsp+68h] [rbp-A0h] BYREF
_QWORD Block[3]; // [rsp+70h] [rbp-98h] BYREF
__m128i v70; // [rsp+88h] [rbp-80h]
void *Src[2]; // [rsp+98h] [rbp-70h] BYREF
__m128i si128; // [rsp+A8h] [rbp-60h]
_QWORD v73[2]; // [rsp+B8h] [rbp-50h] BYREF
__int64 v74; // [rsp+C8h] [rbp-40h]
unsigned __int64 v75; // [rsp+D0h] [rbp-38h]
_QWORD v76[2]; // [rsp+D8h] [rbp-30h] BYREF
__int64 v77; // [rsp+E8h] [rbp-20h]
unsigned __int64 v78; // [rsp+F0h] [rbp-18h]
_BYTE v79[32]; // [rsp+F8h] [rbp-10h] BYREF
a1->m_editorLayer = a2;
result = CCBlockLayer::init(a1);
if ( result )
{
m_level = a1->m_editorLayer->m_level;
m_levelType = m_level->m_levelType;
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(m_level);
cocos2d::CCDirector::getWinSize(v6);
m_editorLayer = a1->m_editorLayer;
v8 = m_editorLayer->m_level->m_highObjectsEnabled + m_editorLayer->m_level->m_unlimitedObjectsEnabled;
*(_OWORD *)Src = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Src[0]) = 0;
v9 = m_editorLayer->m_objectCount.random - m_editorLayer->m_objectCount.seed;
if ( v8 < 2 )
{
v14 = 40000;
if ( v8 )
v14 = 80000;
v15 = cocos2d::CCString::createWithFormat("Objects: %i/%i", v9, v14);
CString = (char *)cocos2d::CCString::getCString(v15);
v12 = -1;
v17 = -1;
do
++v17;
while ( CString[v17] );
sub_14003CCE0(Src, CString, v17);
if ( v8 )
sub_140041270(Src, " (high)", 7u);
}
else
{
v10 = cocos2d::CCString::createWithFormat("Objects: %i (Unlimited)", v9);
v11 = (char *)cocos2d::CCString::getCString(v10);
v12 = -1;
v13 = -1;
do
++v13;
while ( v11[v13] );
sub_14003CCE0(Src, v11, v13);
}
v66[0] = 0;
LevelEditorLayer::getSongIDs(a1->m_editorLayer, v76, v66);
LevelEditorLayer::getSFXIDs(a1->m_editorLayer, v73);
if ( v77 )
{
v20 = v76;
if ( v78 > 0xF )
v20 = (_QWORD *)v76[0];
v21 = (char *)v20 + v77;
v22 = v76;
if ( v78 > 0xF )
v22 = (_QWORD *)v76[0];
LOBYTE(v18) = 44;
v19 = _std_count_trivial_1(v22, v21, v18) + 1;
}
else
{
v19 = 1;
}
v23 = 0;
if ( v74 )
{
v25 = v73;
if ( v75 > 0xF )
v25 = (_QWORD *)v73[0];
v26 = (char *)v25 + v74;
v27 = v73;
if ( v75 > 0xF )
v27 = (_QWORD *)v73[0];
LOBYTE(v18) = 44;
v24 = _std_count_trivial_1(v27, v26, v18) + 1;
}
else
{
v24 = 0;
}
if ( v66[0] || v24 > 0 )
{
v28 = cocos2d::CCString::createWithFormat(", Songs: %i, SFX: %i", v19, v24);
v29 = (char *)cocos2d::CCString::getCString(v28);
v30 = -1;
do
++v30;
while ( v29[v30] );
sub_140041270(Src, v29, v30);
}
if ( m_levelType != Editor )
sub_140041270(Src, " (Read-Only)", 0xCu);
v31 = Src;
if ( si128.m128i_i64[1] > 0xFuLL )
v31 = (void **)Src[0];
v32 = cocos2d::CCLabelBMFont::create((const char *)v31, "goldFont.fnt");
v33 = v32->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v67, 0.0, 1.0);
v33->setAnchorPoint(v32, v34);
a1->addChild_1(a1, v32);
v35 = v32->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v37 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v36);
v38 = cocos2d::CCDirector::getScreenTop(v37) - 5.0;
v40 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v39);
v41 = (float)(cocos2d::CCDirector::getScreenLeft(v40) + 10.0) + 0.0;
cocos2d::CCPoint::CCPoint(&v67, v41, v38);
v35->setPosition_0(v32, v42);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v32->setScale_0)(v32);
LastObjectX = LevelEditorLayer::getLastObjectX(a1->m_editorLayer);
m_drawGridLayer = a1->m_editorLayer->m_drawGridLayer;
cocos2d::CCPoint::CCPoint(&v67, LastObjectX + 340.0, 0.0);
m_levelSettings = m_drawGridLayer->m_editorLayer->m_levelSettings;
cocos2d::CCPoint::CCPoint(&v68, v46);
v48 = LevelTools::timeForPos(
v47,
m_drawGridLayer->m_speedObjects,
m_levelSettings->m_startSpeed,
0,
0,
0,
m_levelSettings->m_platformerMode,
0,
0,
0);
v49 = v48;
v50 = a1->m_editorLayer;
m_timestamp = v50->m_level->GJBaseGameLayer::m_timestamp;
if ( m_timestamp > 0 )
v49 = fmaxf((float)m_timestamp / 240.0, v48);
v52 = (int)floorf(v49 / 60.0);
v53 = (int)(float)(v49 - (float)(60 * v52));
v54 = (int)v49;
if ( v50->m_levelSettings->m_platformerMode )
{
v23 = 5;
}
else if ( v54 >= 10 )
{
if ( v54 >= 30 )
{
if ( v54 >= 60 )
{
LOBYTE(v23) = v54 >= 120;
v23 += 3;
}
else
{
v23 = 2;
}
}
else
{
v23 = 1;
}
}
v55 = (_QWORD *)GJGameLevel::lengthKeyToString(v79, v23);
if ( v55[3] > 0xFu )
v55 = (_QWORD *)*v55;
*(_OWORD *)&Block[1] = 0;
v70 = 0;
do
++v12;
while ( *((_BYTE *)v55 + v12) );
sub_14003A930(&Block[1], v55, v12);
sub_14003A830((__int64)v79);
if ( a1->m_editorLayer->m_levelSettings->m_platformerMode )
{
v56 = "Length: Platformer";
}
else
{
if ( v52 <= 0 )
{
v59 = (const char *)&Block[1];
if ( v70.m128i_i64[1] > 0xFuLL )
v59 = (const char *)Block[1];
v58 = cocos2d::CCString::createWithFormat("Length: %i seconds (%s)", v53, v59);
}
else
{
v57 = (const char *)&Block[1];
if ( v70.m128i_i64[1] > 0xFuLL )
v57 = (const char *)Block[1];
v58 = cocos2d::CCString::createWithFormat("Length: %imin %is (%s)", v52, v53, v57);
}
v56 = cocos2d::CCString::getCString(v58);
}
v60 = cocos2d::CCLabelBMFont::create(v56, "goldFont.fnt");
v61 = v60->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v68, 0.0, 1.0);
v61->setAnchorPoint(v60, v62);
a1->addChild_1(a1, v60);
cocos2d::CCPoint::CCPoint(&v68, 0.0, -20.0);
v63 = (__int64)v32->getPosition_0(v32);
cocos2d::CCPoint::operator+(v63, &v67);
v60->setPosition_0(v60, &v67);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v60->setScale_0)(v60);
if ( v70.m128i_i64[1] > 0xFuLL )
{
v64 = (void *)Block[1];
if ( (unsigned __int64)(v70.m128i_i64[1] + 1) >= 0x1000 )
{
v64 = *(void **)(Block[1] - 8LL);
if ( (unsigned __int64)(Block[1] - (_QWORD)v64 - 8LL) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v64);
}
v70 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[1]) = 0;
sub_14003A830((__int64)v73);
sub_14003A830((__int64)v76);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v65 = Src[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v65 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v65 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v65);
}
return 1;
}
return result;
}