//
// EditorPauseLayer::init from 0x140180e80 to 0x140181543 (1731 bytes)
//
// 3 xrefs:
// > EditorUI::onPause @ 0x1401ad0d6
// > ??> @ 0x140918bb4
// > ??> @ 0x140918bc0
//
// This function is hookable on this platform (idp: pc, 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 11:27:37 +0000
//
// Hidden C++ exception states: #wind=6
bool __fastcall EditorPauseLayer::init(cocos2d::CCLayerColor *a1, __int64 a2)
{
bool result; // al
__int64 v4; // rcx
int v5; // edi
__int64 v6; // rax
__int64 v7; // rdx
unsigned int v8; // ebx
int v9; // eax
int v10; // ecx
cocos2d::CCString *v11; // rax
char *v12; // rax
size_t v13; // r14
size_t v14; // r8
int v15; // r8d
cocos2d::CCString *v16; // rax
char *CString; // rax
size_t v18; // r8
__int64 v19; // r8
unsigned int v20; // r15d
int v21; // ebx
_QWORD *v22; // rcx
char *v23; // rdx
_QWORD *v24; // rcx
int v25; // r8d
_QWORD *v26; // rcx
char *v27; // rdx
_QWORD *v28; // rcx
cocos2d::CCString *v29; // rax
char *v30; // rax
size_t v31; // r8
void **v32; // rcx
struct cocos2d::CCLabelBMFont *v33; // r13
__int64 v34; // rbx
__int64 v35; // rax
__int64 v36; // rbx
__int64 v37; // rcx
cocos2d::CCDirector *v38; // rax
float v39; // xmm6_4
__int64 v40; // rcx
cocos2d::CCDirector *v41; // rax
float v42; // xmm0_4
__int64 v43; // rax
float LastObjectX; // xmm0_4
__int64 v45; // rbx
__int64 v46; // rdx
char v47; // di
int v48; // esi
__int64 v49; // rbx
const struct cocos2d::CCPoint *v50; // rax
int v51; // eax
double v52; // xmm0_8
float v53; // xmm6_4
__int64 v54; // rsi
int v55; // ecx
int v56; // ebx
int v57; // edi
int v58; // eax
_QWORD *v59; // rax
const char *v60; // rax
const char *v61; // r9
cocos2d::CCString *v62; // rax
const char *v63; // r8
struct cocos2d::CCLabelBMFont *v64; // rdi
__int64 v65; // rbx
__int64 v66; // rax
__int64 v67; // rax
__int64 v68; // rbx
__int64 v69; // rax
void *v70; // rcx
void *v71; // rcx
_BYTE v72[8]; // [rsp+58h] [rbp-B0h] BYREF
_BYTE v73[8]; // [rsp+60h] [rbp-A8h] BYREF
_BYTE v74[8]; // [rsp+68h] [rbp-A0h] BYREF
_QWORD Block[3]; // [rsp+70h] [rbp-98h] BYREF
__m128i v76; // [rsp+88h] [rbp-80h]
void *Src[2]; // [rsp+98h] [rbp-70h] BYREF
__m128i si128; // [rsp+A8h] [rbp-60h]
_QWORD v79[2]; // [rsp+B8h] [rbp-50h] BYREF
__int64 v80; // [rsp+C8h] [rbp-40h]
unsigned __int64 v81; // [rsp+D0h] [rbp-38h]
_QWORD v82[2]; // [rsp+D8h] [rbp-30h] BYREF
__int64 v83; // [rsp+E8h] [rbp-20h]
unsigned __int64 v84; // [rsp+F0h] [rbp-18h]
_BYTE v85[32]; // [rsp+F8h] [rbp-10h] BYREF
*((_QWORD *)a1 + 72) = a2;
result = CCBlockLayer::init(a1);
if ( result )
{
v4 = *(_QWORD *)(*((_QWORD *)a1 + 72) + 2168LL);
v5 = *(_DWORD *)(v4 + 1220);
v6 = cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(v6, Block);
v7 = *((_QWORD *)a1 + 72);
v8 = *(unsigned __int8 *)(*(_QWORD *)(v7 + 2168) + 1296LL) + *(unsigned __int8 *)(*(_QWORD *)(v7 + 2168) + 1297LL);
*(_OWORD *)Src = 0;
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Src[0]) = 0;
v9 = *(_DWORD *)(v7 + 14928);
v10 = *(_DWORD *)(v7 + 14932);
if ( v8 < 2 )
{
v15 = 40000;
if ( v8 )
v15 = 80000;
v16 = cocos2d::CCString::createWithFormat("Objects: %i/%i", v9 - v10, v15);
CString = (char *)cocos2d::CCString::getCString(v16);
v13 = -1;
v18 = -1;
do
++v18;
while ( CString[v18] );
sub_1400405A0(Src, CString, v18);
if ( v8 )
sub_140044D80(Src, " (high)", 7u);
}
else
{
v11 = cocos2d::CCString::createWithFormat("Objects: %i (Unlimited)", v9 - v10);
v12 = (char *)cocos2d::CCString::getCString(v11);
v13 = -1;
v14 = -1;
do
++v14;
while ( v12[v14] );
sub_1400405A0(Src, v12, v14);
}
v72[0] = 0;
LevelEditorLayer::getSongIDs(*((_QWORD *)a1 + 72), v82, v72);
LevelEditorLayer::getSFXIDs(*((_QWORD *)a1 + 72), v79);
v20 = 1;
if ( v83 )
{
v22 = v82;
if ( v84 > 0xF )
v22 = (_QWORD *)v82[0];
v23 = (char *)v22 + v83;
v24 = v82;
if ( v84 > 0xF )
v24 = (_QWORD *)v82[0];
LOBYTE(v19) = 44;
v21 = sub_140677040(v24, v23, v19) + 1;
}
else
{
v21 = 1;
}
if ( v80 )
{
v26 = v79;
if ( v81 > 0xF )
v26 = (_QWORD *)v79[0];
v27 = (char *)v26 + v80;
v28 = v79;
if ( v81 > 0xF )
v28 = (_QWORD *)v79[0];
LOBYTE(v19) = 44;
v25 = sub_140677040(v28, v27, v19) + 1;
}
else
{
v25 = 0;
}
if ( v72[0] || v25 > 0 )
{
v29 = cocos2d::CCString::createWithFormat(", Songs: %i, SFX: %i", v21, v25);
v30 = (char *)cocos2d::CCString::getCString(v29);
v31 = -1;
do
++v31;
while ( v30[v31] );
sub_140044D80(Src, v30, v31);
}
if ( v5 != 2 )
sub_140044D80(Src, " (Read-Only)", 0xCu);
v32 = Src;
if ( si128.m128i_i64[1] > 0xFuLL )
v32 = (void **)Src[0];
v33 = cocos2d::CCLabelBMFont::create((const char *)v32, "goldFont.fnt");
v34 = *(_QWORD *)v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 0.0, 1.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v34 + 288))(v33, v35);
(*(void (__fastcall **)(cocos2d::CCLayerColor *, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1 + 464LL))(a1, v33);
v36 = *(_QWORD *)v33;
v38 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v37);
v39 = cocos2d::CCDirector::getScreenTop(v38) - 5.0;
v41 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v40);
v42 = (float)(cocos2d::CCDirector::getScreenLeft(v41) + 10.0) + 0.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v42, v39);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v36 + 184))(v33, v43);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v33 + 160LL))(v33);
LastObjectX = LevelEditorLayer::getLastObjectX(*((_QWORD *)a1 + 72));
v45 = *(_QWORD *)(*((_QWORD *)a1 + 72) + 14944LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, LastObjectX + 340.0, 0.0);
v46 = *(_QWORD *)(*(_QWORD *)(v45 + 520) + 3528LL);
v47 = *(_BYTE *)(v46 + 341);
v48 = *(_DWORD *)(v46 + 332);
v49 = *(_QWORD *)(v45 + 592);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, v50);
v52 = LevelTools::timeForPos(v51, v49, v48, 0, 0, 0, v47, 0, 0, 0);
v53 = *(float *)&v52;
v54 = *((_QWORD *)a1 + 72);
v55 = *(_DWORD *)(*(_QWORD *)(v54 + 2168) + 1336LL);
if ( v55 > 0 )
v53 = fmaxf((float)v55 / 240.0, *(float *)&v52);
v56 = (int)floorf(v53 / 60.0);
v57 = (int)(float)(v53 - (float)(60 * v56));
if ( *(_BYTE *)(*(_QWORD *)(v54 + 3528) + 341LL) )
{
v20 = 5;
}
else
{
v58 = (int)v53;
if ( (int)v53 >= 10 )
{
if ( v58 >= 30 )
{
if ( v58 >= 60 )
v20 = (v58 >= 120) + 3;
else
v20 = 2;
}
}
else
{
v20 = 0;
}
}
v59 = (_QWORD *)GJGameLevel::lengthKeyToString(v85, v20);
if ( v59[3] > 0xFu )
v59 = (_QWORD *)*v59;
*(_OWORD *)&Block[1] = 0;
v76 = 0;
do
++v13;
while ( *((_BYTE *)v59 + v13) );
sub_14003D230(&Block[1], v59, v13);
sub_14003D310((__int64)v85);
if ( *(_BYTE *)(*(_QWORD *)(*((_QWORD *)a1 + 72) + 3528LL) + 341LL) )
{
v60 = "Length: Platformer";
}
else
{
if ( v56 <= 0 )
{
v63 = (const char *)&Block[1];
if ( v76.m128i_i64[1] > 0xFuLL )
v63 = (const char *)Block[1];
v62 = cocos2d::CCString::createWithFormat("Length: %i seconds (%s)", v57, v63);
}
else
{
v61 = (const char *)&Block[1];
if ( v76.m128i_i64[1] > 0xFuLL )
v61 = (const char *)Block[1];
v62 = cocos2d::CCString::createWithFormat("Length: %imin %is (%s)", v56, v57, v61);
}
v60 = cocos2d::CCString::getCString(v62);
}
v64 = cocos2d::CCLabelBMFont::create(v60, "goldFont.fnt");
v65 = *(_QWORD *)v64;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, 0.0, 1.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v65 + 288))(v64, v66);
(*(void (__fastcall **)(cocos2d::CCLayerColor *, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1 + 464LL))(a1, v64);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, 0.0, -20.0);
v68 = v67;
v69 = (*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v33 + 200LL))(v33);
cocos2d::CCPoint::operator+(v69, v73, v68);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, _BYTE *))(*(_QWORD *)v64 + 184LL))(v64, v73);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v64 + 160LL))(v64);
if ( v76.m128i_i64[1] > 0xFuLL )
{
v70 = (void *)Block[1];
if ( (unsigned __int64)(v76.m128i_i64[1] + 1) >= 0x1000 )
{
v70 = *(void **)(Block[1] - 8LL);
if ( (unsigned __int64)(Block[1] - (_QWORD)v70 - 8LL) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v70);
}
v76 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[1]) = 0;
sub_14003D310((__int64)v79);
sub_14003D310((__int64)v82);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v71 = Src[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v71 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v71 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v71);
}
return 1;
}
return result;
}