//
// AutoSaveSettingsLayer::init from 0x14009afa0 to 0x14009be5a (3770 bytes)
//
// 4 xrefs:
// > AutoSaveSettingsLayer::create @ 0x14009af66
// > AutoSaveSettingsLayer::create @ 0x14009af57
// > ??> @ 0x14071b3b0
// > ??> @ 0x140912ed8
//
// 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:05 +0000
//
// Hidden C++ exception states: #wind=7
char __fastcall AutoSaveSettingsLayer::init(__int64 a1, __int64 a2, __int64 a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rax
__int64 *v9; // rsi
__int64 v10; // rdi
__int64 v11; // rbx
__int64 v12; // rax
__int64 v13; // rax
cocos2d::CCObject *v14; // rbx
cocos2d::CCObject *v15; // rsi
__int64 v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rax
float v20; // xmm10_4
float v21; // xmm1_4
float v22; // xmm13_4
float v23; // xmm14_4
float v24; // xmm11_4
struct cocos2d::CCLabelBMFont *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // rax
__int64 v29; // rdi
__int64 v30; // rbx
__int64 v31; // rax
__int64 v32; // rbx
__int64 v33; // rax
__int64 v34; // rdx
int v35; // eax
__int64 v36; // rax
struct cocos2d::CCLabelBMFont *v37; // rdi
__int64 v38; // rbx
__int64 v39; // rax
__int64 v40; // rax
__int64 v41; // rdi
__int64 v42; // rbx
__int64 v43; // rax
__int64 v44; // rbx
float v45; // xmm10_4
float v46; // xmm6_4
float v47; // xmm11_4
__int64 v48; // rax
__int64 v49; // rdx
int v50; // eax
__int64 v51; // rbx
__int64 v52; // rax
struct cocos2d::CCSprite *v53; // rax
cocos2d::CCObject *v54; // rsi
__int64 v55; // rdi
__int64 v56; // rbx
__int64 v57; // rax
__int64 v58; // rax
float v59; // xmm10_4
cocos2d::CCObject *v60; // rbx
cocos2d::CCObject *v61; // rsi
__int64 v62; // rdi
__int64 v63; // rbx
__int64 v64; // rax
__int64 v65; // rax
cocos2d::CCObject *v66; // rbx
cocos2d::CCObject *v67; // rsi
__int64 v68; // rdi
__int64 v69; // rbx
__int64 v70; // rax
__int64 v71; // rax
float v72; // xmm7_4
struct cocos2d::CCLabelBMFont *v73; // rax
__int64 v74; // rdi
__int64 v75; // rbx
__int64 v76; // rax
__int64 CustomBackupDirectory; // rax
struct cocos2d::CCLabelBMFont *v78; // rax
__int64 v79; // rdi
__int64 v80; // rbx
__int64 v81; // rax
__int64 v82; // rdi
__int64 v83; // rbx
__int64 v84; // rax
__int64 v85[2]; // [rsp+58h] [rbp-B0h] BYREF
float v86; // [rsp+68h] [rbp-A0h] BYREF
float v87; // [rsp+6Ch] [rbp-9Ch]
float v88; // [rsp+70h] [rbp-98h]
_QWORD v89[3]; // [rsp+78h] [rbp-90h] BYREF
__int64 v90; // [rsp+90h] [rbp-78h]
__int64 v91; // [rsp+98h] [rbp-70h]
__int128 v92; // [rsp+A0h] [rbp-68h] BYREF
__int64 v93; // [rsp+B0h] [rbp-58h]
__int64 v94; // [rsp+B8h] [rbp-50h]
int v95; // [rsp+C8h] [rbp-40h] BYREF
void *v96[4]; // [rsp+D0h] [rbp-38h] BYREF
_BYTE v97[8]; // [rsp+F0h] [rbp-18h] BYREF
int v98; // [rsp+F8h] [rbp-10h]
char v99; // [rsp+FCh] [rbp-Ch]
int v100; // [rsp+100h] [rbp-8h]
int v101; // [rsp+104h] [rbp-4h]
char v102; // [rsp+108h] [rbp+0h]
int v103; // [rsp+10Ch] [rbp+4h]
int v104; // [rsp+110h] [rbp+8h]
int v105; // [rsp+114h] [rbp+Ch]
int v106; // [rsp+118h] [rbp+10h]
int v107; // [rsp+11Ch] [rbp+14h]
int v108; // [rsp+120h] [rbp+18h]
char v109; // [rsp+124h] [rbp+1Ch]
char v110; // [rsp+125h] [rbp+1Dh]
int v111; // [rsp+128h] [rbp+20h]
_BYTE v112[32]; // [rsp+130h] [rbp+28h] BYREF
int v113; // [rsp+150h] [rbp+48h]
_BYTE v114[32]; // [rsp+158h] [rbp+50h] BYREF
_BYTE v115[176]; // [rsp+178h] [rbp+70h] BYREF
result = SetupTriggerPopup::init(a1, 0, 0, a4, 1133248512, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
*(_BYTE *)(a1 + 596) = 1;
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v86);
v8 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v8;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v8, 10);
v85[0] = (__int64)&v92;
v92 = 0;
v93 = 0;
v94 = 0;
*(_QWORD *)&v92 = sub_14003D460(0x100u);
v93 = 251;
v94 = 255;
strcpy(
(char *)v92,
"Auto-Save: saves your level at a set interval while editing.\n"
"Auto-Backup: keeps timestamped copies of your level based on active editing time, so you can go back to an"
" older version. The options button sets how many are kept per level.");
*(_OWORD *)&v89[1] = 0;
v90 = 0;
v91 = 0;
v89[1] = sub_14003D460(0x20u);
v90 = 18;
v91 = 31;
strcpy((char *)v89[1], "Auto-Save Settings");
v9 = (__int64 *)InfoAlertButton::create(&v89[1], &v92);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v9);
v10 = *v9;
v11 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)((float)(*(float *)(a1 + 732) * 0.5) + (float)(v86 * 0.5)) - 2.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v87 * 0.5)) - 2.0);
cocos2d::CCNode::convertToNodeSpace(v11, v89, v12);
(*(void (__fastcall **)(__int64 *, __int64))(v10 + 184))(v9, v13);
v85[0] = (__int64)operator new(0x2C8u);
v14 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v85[0]);
if ( v14 )
{
if ( ButtonSprite::init_1(
(__int64)v14,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v14);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v14 + 8LL))(v14, 1);
LODWORD(v14) = 0;
}
}
v15 = CCMenuItemSpriteExtra::create((int)v14, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v15);
v16 = *(_QWORD *)v15;
v17 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
v86 * 0.5,
(float)((float)(v87 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v17, v89, v18);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v16 + 184))(v15, v19);
v20 = v86 * 0.5;
v88 = v86 * 0.5;
v21 = (float)((float)(v87 * 0.5) + (float)(*(float *)(a1 + 736) * 0.5)) - 12.0;
v22 = (float)(v86 * 0.5) - 100.0;
v23 = (float)(v86 * 0.5) + 60.0;
*(float *)v89 = v21 - 133.0;
v24 = *(float *)(a1 + 732) - 30.0;
v25 = cocos2d::CCLabelBMFont::create("Auto-Save", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v25 + 160LL))(v25);
v26 = *(_QWORD *)v25;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v85, v20, (float)(v21 - 50.0) + 47.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v26 + 184))(v25, v27);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v25);
v28 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v89[1], 0.0, 0.0, 40.0, 40.0);
v29 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v28);
v30 = *(_QWORD *)v29;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v85, v24, 50.0);
(*(void (__fastcall **)(__int64, __int64))(v30 + 312))(v29, v31);
v32 = *(_QWORD *)v29;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v85, v88, (float)(v21 - 50.0) + 6.0);
(*(void (__fastcall **)(__int64, __int64))(v32 + 184))(v29, v33);
(**(void (__fastcall ***)(__int64, void *))(v29 + 320))(v29 + 320, &unk_140702D14);
LOBYTE(v34) = 50;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v29 + 320) + 40LL))(v29 + 320, v34);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v29,
0xFFFFFFFFLL);
v85[0] = (__int64)&v92;
v93 = 7;
v94 = 15;
v92 = 0x64656C62616E45uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v22, v21 - 50.0);
SetupTriggerPopup::createToggleValueControl(a1, -1, (unsigned int)&v92, v35, 1, 0, 0, 1065353216);
sub_14009BE60(&v95);
v95 = -2;
sub_1400405A0(v96, "Interval (min):", 0xFu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v23, v21 - 50.0);
cocos2d::CCPoint::operator=(v97, v36);
v98 = 1058642330;
v99 = 1;
v102 = 1;
v110 = 1;
v113 = 1057803469;
v100 = 3;
v101 = 4;
v103 = 1065353216;
v104 = 1114636288;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v95);
LODWORD(v85[0]) = -2;
*(_BYTE *)sub_14016EE40(a1 + 872, v85) = 1;
LODWORD(v85[0]) = -2;
*(_BYTE *)sub_14016EE40(a1 + 856, v85) = 1;
v37 = cocos2d::CCLabelBMFont::create("Auto-Backup", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v37 + 160LL))(v37);
v38 = *(_QWORD *)v37;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v88, *(float *)v89 + 47.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v38 + 184))(v37, v39);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v37);
v40 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v85, 0.0, 0.0, 40.0, 40.0);
v41 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v40);
v42 = *(_QWORD *)v41;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v89[1], v24, 50.0);
(*(void (__fastcall **)(__int64, __int64))(v42 + 312))(v41, v43);
v44 = *(_QWORD *)v41;
v45 = *(float *)v89;
v46 = *(float *)v89 + 6.0;
v47 = v88;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v88, *(float *)v89 + 6.0);
(*(void (__fastcall **)(__int64, __int64))(v44 + 184))(v41, v48);
(**(void (__fastcall ***)(__int64, void *))(v41 + 320))(v41 + 320, &unk_140702D14);
LOBYTE(v49) = 50;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v41 + 320) + 40LL))(v41 + 320, v49);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v41,
0xFFFFFFFFLL);
v89[1] = &v92;
v93 = 7;
v94 = 15;
v92 = 0x64656C62616E45uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v85, v22, v45);
SetupTriggerPopup::createToggleValueControl(a1, -3, (unsigned int)&v92, v50, 1, 0, 0, 1065353216);
memset(v115, 0, sizeof(v115));
v51 = sub_14009BE60(v115);
v95 = *(_DWORD *)v51;
sub_140059C40((__int64)v96, v51 + 8);
cocos2d::CCPoint::operator=(v97, v51 + 40);
v98 = *(_DWORD *)(v51 + 48);
v99 = *(_BYTE *)(v51 + 52);
v100 = *(_DWORD *)(v51 + 56);
v101 = *(_DWORD *)(v51 + 60);
v102 = *(_BYTE *)(v51 + 64);
v103 = *(_DWORD *)(v51 + 68);
v104 = *(_DWORD *)(v51 + 72);
v105 = *(_DWORD *)(v51 + 76);
v106 = *(_DWORD *)(v51 + 80);
v107 = *(_DWORD *)(v51 + 84);
v108 = *(_DWORD *)(v51 + 88);
v109 = *(_BYTE *)(v51 + 92);
v110 = *(_BYTE *)(v51 + 93);
v111 = *(_DWORD *)(v51 + 96);
sub_140059C40((__int64)v112, v51 + 104);
v113 = *(_DWORD *)(v51 + 136);
sub_140059C40((__int64)v114, v51 + 144);
sub_14003D310((__int64)&v115[144]);
sub_14003D310((__int64)&v115[104]);
sub_14003D310((__int64)&v115[8]);
v95 = -4;
sub_1400405A0(v96, "Interval (min):", 0xFu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v23, v45);
cocos2d::CCPoint::operator=(v97, v52);
v98 = 1058642330;
v99 = 1;
v102 = 1;
v110 = 1;
v113 = 1057803469;
v100 = 3;
v101 = 4;
v103 = 1092616192;
v104 = 1133903872;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v95);
LODWORD(v85[0]) = -4;
*(_BYTE *)sub_14016EE40(a1 + 872, v85) = 1;
LODWORD(v85[0]) = -4;
*(_BYTE *)sub_14016EE40(a1 + 856, v85) = 1;
v53 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_optionsBtn_001.png");
LODWORD(v51) = (_DWORD)v53;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v53 + 160LL))(v53);
v54 = CCMenuItemSpriteExtra::create(v51, 0, a1, (__int64)AutoSaveSettingsLayer::onAdvanced);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v54);
v55 = *(_QWORD *)v54;
v56 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v47 + 150.0, v46);
cocos2d::CCNode::convertToNodeSpace(v56, v85, v57);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v55 + 184))(v54, v58);
v59 = v45 - 45.0;
v89[1] = operator new(0x2C8u);
v60 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v89[1]);
if ( v60 )
{
if ( ButtonSprite::init_1(
(__int64)v60,
(__int64)"Select Folder",
90,
0,
1055286886,
1,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1101004800) )
{
cocos2d::CCObject::autorelease(v60);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v60 + 8LL))(v60, 1);
LODWORD(v60) = 0;
}
}
v61 = CCMenuItemSpriteExtra::create((int)v60, 0, a1, (__int64)AutoSaveSettingsLayer::onSelectBackupDir);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v61);
v62 = *(_QWORD *)v61;
v63 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], (float)(v86 * 0.5) - 62.0, v59);
cocos2d::CCNode::convertToNodeSpace(v63, v85, v64);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v62 + 184))(v61, v65);
v89[1] = operator new(0x2C8u);
v66 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v89[1]);
if ( v66 )
{
if ( ButtonSprite::init_1(
(__int64)v66,
(__int64)"Open Folder",
90,
0,
1055286886,
1,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1101004800) )
{
cocos2d::CCObject::autorelease(v66);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v66 + 8LL))(v66, 1);
LODWORD(v66) = 0;
}
}
v67 = CCMenuItemSpriteExtra::create((int)v66, 0, a1, (__int64)AutoSaveSettingsLayer::onOpenBackupDir);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v67);
v68 = *(_QWORD *)v67;
v69 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], (float)(v86 * 0.5) + 62.0, v59);
cocos2d::CCNode::convertToNodeSpace(v69, v85, v70);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v68 + 184))(v67, v71);
v72 = (float)(v87 * 0.5) - 80.0;
v73 = cocos2d::CCLabelBMFont::create("Backup Directory:", "goldFont.fnt");
*(_QWORD *)(a1 + 1000) = v73;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v73 + 160LL))(v73);
v74 = **(_QWORD **)(a1 + 1000);
v75 = *(_QWORD *)(a1 + 1000);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v47, v72 + 8.0);
(*(void (__fastcall **)(__int64, __int64))(v74 + 184))(v75, v76);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1000));
CustomBackupDirectory = AutoSaveSettingsLayer::getCustomBackupDirectory(&v92);
sub_140059C40(a1 + 1016, CustomBackupDirectory);
sub_14003D310((__int64)&v92);
v78 = cocos2d::CCLabelBMFont::create(&byte_1406ED6E0, "chatFont.fnt");
*(_QWORD *)(a1 + 1008) = v78;
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v78 + 160LL))(v78);
v79 = **(_QWORD **)(a1 + 1008);
v80 = *(_QWORD *)(a1 + 1008);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], 0.5, 0.5);
(*(void (__fastcall **)(__int64, __int64))(v79 + 288))(v80, v81);
v82 = **(_QWORD **)(a1 + 1008);
v83 = *(_QWORD *)(a1 + 1008);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v89[1], v47, v72 - 8.0);
(*(void (__fastcall **)(__int64, __int64))(v82 + 184))(v83, v84);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1008));
AutoSaveSettingsLayer::updateBackupDirLabel(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
sub_14003D310((__int64)v114);
sub_14003D310((__int64)v112);
sub_14003D310((__int64)v96);
return 1;
}
return result;
}