//
// DeathStatsPopup::init from 0x14011e430 to 0x14011ef00 (2768 bytes)
//
// 4 xrefs:
// > EditorPauseLayer::onDeathStats @ 0x140183142
// > ??> @ 0x1408977e0
// > ??> @ 0x1408977f0
// > ??> @ 0x1409164c0
//
// 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:26:55 +0000
//
char __fastcall DeathStatsPopup::init(__int64 a1, __int64 a2, __int64 a3, int a4)
{
char result; // al
__int64 v7; // rcx
__int64 v8; // rax
float v9; // xmm11_4
float v10; // xmm9_4
struct cocos2d::CCSprite *v11; // rax
int v12; // ebx
cocos2d::CCObject *v13; // rsi
__int64 v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rax
struct cocos2d::CCLabelBMFont *v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rbx
__int64 v22; // rax
__int64 v23; // rax
__int64 *v24; // rdi
__int64 v25; // rbx
__int64 v26; // rax
void (__fastcall **v27)(__int64, __int16 *); // rax
__int64 v28; // rdx
__int64 v29; // rbx
__int64 v30; // rax
__int64 v31; // rdx
__int64 v32; // rcx
char *v33; // rax
char *v34; // rdi
__int64 v35; // rbx
__int64 v36; // rax
__int64 v37; // rcx
__int64 v38; // rcx
__int64 v39; // rax
__int64 v40; // rcx
__int64 v41; // rax
__int64 v42; // rax
_QWORD *v43; // rax
__int64 v44; // rsi
struct cocos2d::CCLabelBMFont *v45; // rdi
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // rbx
__int64 v49; // rax
__int64 v50; // rax
__int64 *v51; // rdi
__int64 v52; // rbx
__int64 v53; // rax
void (__fastcall **v54)(__int64, __int16 *); // rax
__int64 v55; // rdx
__int64 v56; // rbx
__int64 v57; // rax
__int64 v58; // rdx
__int64 v59; // rcx
char *v60; // rax
char *v61; // rdi
__int64 v62; // rbx
__int64 v63; // rax
__int64 v64; // rcx
__int64 v65; // rcx
__int64 v66; // rax
__int64 v67; // rcx
cocos2d::CCObject *v68; // rax
cocos2d::CCObject *v69; // rsi
__int64 v70; // rdi
__int64 v71; // rbx
__int64 v72; // rax
__int64 v73; // rax
struct cocos2d::CCLabelBMFont *v74; // rax
__int64 *v75; // rdi
__int64 v76; // rbx
__int64 v77; // rax
__int64 *v78; // rdi
__int64 v79; // rbx
__int64 v80; // rax
cocos2d::CCObject *v81; // rax
cocos2d::CCObject *v82; // rsi
float v83; // xmm9_4
__int64 v84; // rdi
__int64 v85; // rbx
__int64 v86; // rax
__int64 v87; // rax
cocos2d::CCObject *v88; // rax
cocos2d::CCObject *v89; // rsi
__int64 v90; // rdi
__int64 v91; // rbx
__int64 v92; // rax
__int64 v93; // rax
__int128 v94; // [rsp+40h] [rbp-C0h] BYREF
__int64 v95; // [rsp+50h] [rbp-B0h]
__int64 v96; // [rsp+58h] [rbp-A8h]
__int16 v97; // [rsp+150h] [rbp+50h] BYREF
char v98; // [rsp+152h] [rbp+52h]
float v99; // [rsp+158h] [rbp+58h] BYREF
float v100; // [rsp+15Ch] [rbp+5Ch]
result = SetupTriggerPopup::init(a1, 0, 0, a4, 1129447424, 1, 0);
if ( result )
{
*(_QWORD *)(a1 + 1000) = a2;
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v99);
*((_QWORD *)&v94 + 1) = 7566433;
v9 = v99 * 0.5;
v95 = 11;
v96 = 15;
*(_QWORD *)&v94 = 0x7453206874616544LL;
v10 = (float)((float)(v100 * 0.5) + 0.0) + 105.0;
SetupTriggerPopup::addTitle(a1, &v94);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v12 = (int)v11;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v11 + 160LL))(v11);
v13 = CCMenuItemSpriteExtra::create(v12, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v13 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v13);
v14 = *(_QWORD *)v13;
v15 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, (float)(v9 - 170.0) + 8.0, v10 - 12.0);
cocos2d::CCNode::convertToNodeSpace(v15, &v94, v16);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v14 + 184))(v13, v17);
v18 = cocos2d::CCLabelBMFont::create("Level ID:", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v18 + 160LL))(v18);
v19 = *(_QWORD *)v18;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, 1.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v19 + 288))(v18, v20);
v21 = *(_QWORD *)v18;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 78.0, v10 - 56.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v21 + 184))(v18, v22);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v18,
1);
v23 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v94, 0.0, 0.0, 40.0, 40.0);
v24 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v23);
v25 = *v24;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v97, 110.0, 28.0);
(*(void (__fastcall **)(__int64 *, __int64))(v25 + 312))(v24, v26);
v27 = (void (__fastcall **)(__int64, __int16 *))v24[40];
v97 = 0;
v98 = 0;
(*v27)((__int64)(v24 + 40), &v97);
LOBYTE(v28) = 90;
(*(void (__fastcall **)(__int64 *, __int64))(v24[40] + 40))(v24 + 40, v28);
v29 = *v24;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 8.0, v10 - 56.0);
(*(void (__fastcall **)(__int64 *, __int64))(v29 + 184))(v24, v30);
(*(void (__fastcall **)(_QWORD, __int64 *, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v24, 0);
v33 = CCTextInputNode::create(v32, v31, (__int64)"Level ID");
*(_QWORD *)(a1 + 1008) = v33;
v34 = v33;
v35 = *(_QWORD *)v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 8.0, v10 - 56.0);
(*(void (__fastcall **)(char *, __int64))(v35 + 184))(v34, v36);
v37 = *(_QWORD *)(a1 + 1008);
*(_DWORD *)(v37 + 564) = 1060320051;
CCTextInputNode::refreshLabel(v37);
v38 = *(_QWORD *)(a1 + 1008);
*(_DWORD *)(v38 + 560) = 1119617024;
CCTextInputNode::refreshLabel(v38);
v39 = *(_QWORD *)(a1 + 1008);
v95 = 10;
v94 = 0;
v96 = 15;
*(_DWORD *)(v39 + 608) = 12;
v40 = *(_QWORD *)(a1 + 1008);
strcpy((char *)&v94, "0123456789");
CCTextInputNode::setAllowedChars(v40, (void **)&v94);
v41 = *(_QWORD *)(a1 + 1000);
if ( v41 )
{
v42 = *(_QWORD *)(v41 + 2168);
if ( v42 )
{
if ( *(_DWORD *)(v42 + 328) - *(_DWORD *)(v42 + 332) > 0 )
{
v43 = GameToolbox::intToString(&v94, *(_DWORD *)(v42 + 328) - *(_DWORD *)(v42 + 332));
CCTextInputNode::setString(*(_QWORD **)(a1 + 1008), v43);
}
}
}
v44 = a1 + 544;
if ( !a1 )
v44 = 0;
*(_QWORD *)(*(_QWORD *)(a1 + 1008) + 600LL) = v44;
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1008),
5);
v45 = cocos2d::CCLabelBMFont::create("Version:", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v45 + 160LL))(v45);
v46 = *(_QWORD *)v45;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, 1.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v46 + 288))(v45, v47);
v48 = *(_QWORD *)v45;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 78.0, v10 - 92.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v48 + 184))(v45, v49);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v45,
1);
v50 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v94, 0.0, 0.0, 40.0, 40.0);
v51 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v50);
v52 = *v51;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v97, 60.0, 28.0);
(*(void (__fastcall **)(__int64 *, __int64))(v52 + 312))(v51, v53);
v54 = (void (__fastcall **)(__int64, __int16 *))v51[40];
v97 = 0;
v98 = 0;
(*v54)((__int64)(v51 + 40), &v97);
LOBYTE(v55) = 90;
(*(void (__fastcall **)(__int64 *, __int64))(v51[40] + 40))(v51 + 40, v55);
v56 = *v51;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 33.0, v10 - 92.0);
(*(void (__fastcall **)(__int64 *, __int64))(v56 + 184))(v51, v57);
(*(void (__fastcall **)(_QWORD, __int64 *, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v51, 0);
v60 = CCTextInputNode::create(v59, v58, (__int64)"Latest");
*(_QWORD *)(a1 + 1016) = v60;
v61 = v60;
v62 = *(_QWORD *)v60;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 33.0, v10 - 92.0);
(*(void (__fastcall **)(char *, __int64))(v62 + 184))(v61, v63);
v64 = *(_QWORD *)(a1 + 1016);
*(_DWORD *)(v64 + 564) = 1060320051;
CCTextInputNode::refreshLabel(v64);
v65 = *(_QWORD *)(a1 + 1016);
*(_DWORD *)(v65 + 560) = 1110441984;
CCTextInputNode::refreshLabel(v65);
v66 = *(_QWORD *)(a1 + 1016);
v95 = 10;
v94 = 0;
v96 = 15;
*(_DWORD *)(v66 + 608) = 4;
v67 = *(_QWORD *)(a1 + 1016);
strcpy((char *)&v94, "0123456789");
CCTextInputNode::setAllowedChars(v67, (void **)&v94);
*(_QWORD *)(*(_QWORD *)(a1 + 1016) + 600LL) = v44;
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1016),
5);
v68 = ButtonSprite::create_1((int)"Fetch", 60, 0, 1.0, 1, (__int64)"goldFont.fnt", (__int64)"GJ_button_01.png", 0);
LODWORD(v62) = (_DWORD)v68;
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v68 + 160LL))(v68);
v69 = CCMenuItemSpriteExtra::create(v62, 0, a1, (__int64)DeathStatsPopup::onFetch);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v69);
v70 = *(_QWORD *)v69;
v71 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 + 95.0, v10 - 74.0);
cocos2d::CCNode::convertToNodeSpace(v71, &v94, v72);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v70 + 184))(v69, v73);
v74 = cocos2d::CCLabelBMFont::create("Enter a level ID, then Fetch.", (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 1024) = v74;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v74 + 160LL))(v74);
v75 = *(__int64 **)(a1 + 1024);
v76 = *v75;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, 0.5, 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v76 + 288))(v75, v77);
v78 = *(__int64 **)(a1 + 1024);
v79 = *v78;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9, v10 - 128.0);
(*(void (__fastcall **)(__int64 *, __int64))(v79 + 184))(v78, v80);
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 1024), 310.0, 0.44999999, 0.0);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1024),
1);
v81 = ButtonSprite::create_1(
(int)"Clear Local",
110,
0,
1.0,
1,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
LODWORD(v79) = (_DWORD)v81;
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v81 + 160LL))(v81);
v82 = CCMenuItemSpriteExtra::create(v79, 0, a1, (__int64)DeathStatsPopup::onClearLocal);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v82);
v83 = v10 - 168.0;
v84 = *(_QWORD *)v82;
v85 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 - 70.0, v83);
cocos2d::CCNode::convertToNodeSpace(v85, &v94, v86);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v84 + 184))(v82, v87);
v88 = ButtonSprite::create_1(
(int)"Clear Fetched",
110,
0,
1.0,
1,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
LODWORD(v85) = (_DWORD)v88;
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v88 + 160LL))(v88);
v89 = CCMenuItemSpriteExtra::create(v85, 0, a1, (__int64)DeathStatsPopup::onClearFetched);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v89);
v90 = *(_QWORD *)v89;
v91 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v97, v9 + 70.0, v83);
cocos2d::CCNode::convertToNodeSpace(v91, &v94, v92);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v90 + 184))(v89, v93);
return 1;
}
return result;
}