//
// UISaveLoadLayer::init from 0x1002a2fc0 to 0x1002a3642 (1666 bytes)
//
// 2 xrefs:
// > sub_1002A2040 @ 0x1002a2109
// > sub_1002A2280 @ 0x1002a2349
//
// 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 12:27:55 +0000
//
__int64 __fastcall UISaveLoadLayer::init(_QWORD *a1, __int64 a2)
{
__int64 v3; // rbx
unsigned int v4; // r14d
__int64 v5; // rax
const char *v6; // rsi
__int64 v7; // r12
char v8; // r15
__int64 v9; // rax
__int64 v10; // rax
__int64 CString; // rax
char *v12; // rax
void *v13; // r15
__int64 v14; // r12
__int64 v15; // rax
__int64 v16; // rax
char *v17; // rax
void *v18; // r15
__int64 v19; // r12
__int64 v20; // rax
__int64 v21; // rax
char *v22; // rax
void *v23; // r15
__int64 v24; // r12
__int64 v25; // rax
__int64 v26; // rax
char *v27; // rax
void *v28; // r15
__int64 v29; // r12
__int64 v30; // rax
__int64 v31; // rax
char *v32; // rax
void *v33; // r15
__int64 v34; // r12
__int64 v35; // rax
__int64 v36; // rax
char *v37; // rax
void *v38; // r15
__int64 v39; // r12
char v41; // [rsp+0h] [rbp-A0h]
char v42; // [rsp+0h] [rbp-A0h]
char v43; // [rsp+0h] [rbp-A0h]
char v44; // [rsp+0h] [rbp-A0h]
char v45; // [rsp+0h] [rbp-A0h]
char v46; // [rsp+0h] [rbp-A0h]
char v47; // [rsp+8h] [rbp-98h] BYREF
_BYTE __p[23]; // [rsp+9h] [rbp-97h]
char v49; // [rsp+20h] [rbp-80h] BYREF
char v50[15]; // [rsp+21h] [rbp-7Fh] BYREF
void *v51; // [rsp+30h] [rbp-70h]
float v52[2]; // [rsp+38h] [rbp-68h] BYREF
unsigned __int64 v53; // [rsp+40h] [rbp-60h] BYREF
double v54; // [rsp+48h] [rbp-58h] BYREF
double v55; // [rsp+50h] [rbp-50h] BYREF
unsigned __int64 v56; // [rsp+58h] [rbp-48h] BYREF
_BYTE __dst[23]; // [rsp+61h] [rbp-3Fh] BYREF
v3 = (__int64)a1;
v4 = SetupTriggerPopup::init((__int64)a1, 0, 0, 1, 240.0, 220.0, 0.0);
if ( (_BYTE)v4 )
{
a1[127] = a2;
SetupTriggerPopup::preSetup(a1);
v5 = *(unsigned __int8 *)(a2 + 1012);
v6 = "Save/Load UI";
if ( *(_BYTE *)(a2 + 1012) )
v6 = "Save/Load Dual UI";
v7 = 5 * v5;
v8 = 5 * v5 + 12;
memcpy(__dst, v6, 5 * v5 + 12);
__dst[v7 + 12] = 0;
v47 = 2 * v8;
*(_OWORD *)__p = *(_OWORD *)__dst;
*(_QWORD *)&__p[15] = *(_QWORD *)&__dst[15];
SetupTriggerPopup::addTitle((__int64)a1, (__int64)&v47);
if ( (v47 & 1) != 0 )
operator delete(*(void **)&__p[15]);
v49 = 4;
strcpy(v50, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (__int64)&v49);
if ( (v49 & 1) != 0 )
{
a1 = v51;
operator delete(v51);
}
v9 = cocos2d::CCDirector::sharedDirector(a1, &v49);
cocos2d::CCDirector::getWinSize(v52, v9);
sub_100278250((float *)&v53, v52[0] * 0.5, (float)(0.5 * v52[1]) + 50.0);
v10 = sub_10088E820("Save %i", v41);
CString = cocos2d::CCString::getCString(v10);
v12 = ButtonSprite::create_1(
CString,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v13 = CCMenuItemSpriteExtra::create((__int64)v12, 0, v3, (__int64)UISaveLoadLayer::onSave, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v13);
v14 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, -40.0, -0.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v14, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v13 + 184LL))(v13, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v13 + 72LL))(v13, 1);
v15 = sub_10088E820("Load %i", v42);
v16 = cocos2d::CCString::getCString(v15);
v17 = ButtonSprite::create_1(
v16,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_02.png",
0.80000001,
30.0);
v18 = CCMenuItemSpriteExtra::create((__int64)v17, 0, v3, (__int64)UISaveLoadLayer::onLoad, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v18);
v19 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, 40.0, -0.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v19, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v18 + 184LL))(v18, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v18 + 72LL))(v18, 1);
v20 = sub_10088E820("Save %i", v43);
v21 = cocos2d::CCString::getCString(v20);
v22 = ButtonSprite::create_1(
v21,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v23 = CCMenuItemSpriteExtra::create((__int64)v22, 0, v3, (__int64)UISaveLoadLayer::onSave, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v23);
v24 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, -40.0, -40.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v24, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v23 + 184LL))(v23, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v23 + 72LL))(v23, 2);
v25 = sub_10088E820("Load %i", v44);
v26 = cocos2d::CCString::getCString(v25);
v27 = ButtonSprite::create_1(
v26,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_02.png",
0.80000001,
30.0);
v28 = CCMenuItemSpriteExtra::create((__int64)v27, 0, v3, (__int64)UISaveLoadLayer::onLoad, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v28);
v29 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, 40.0, -40.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v29, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v28 + 184LL))(v28, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v28 + 72LL))(v28, 2);
v30 = sub_10088E820("Save %i", v45);
v31 = cocos2d::CCString::getCString(v30);
v32 = ButtonSprite::create_1(
v31,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v33 = CCMenuItemSpriteExtra::create((__int64)v32, 0, v3, (__int64)UISaveLoadLayer::onSave, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v33);
v34 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, -40.0, -80.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v34, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v33 + 184LL))(v33, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v33 + 72LL))(v33, 3);
v35 = sub_10088E820("Load %i", v46);
v36 = cocos2d::CCString::getCString(v35);
v37 = ButtonSprite::create_1(
v36,
0x32u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_02.png",
0.80000001,
30.0);
v38 = CCMenuItemSpriteExtra::create((__int64)v37, 0, v3, (__int64)UISaveLoadLayer::onLoad, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v3 + 552) + 456LL))(*(_QWORD *)(v3 + 552), v38);
v39 = *(_QWORD *)(v3 + 552);
sub_100278250((float *)&v56, 40.0, -80.0);
sub_100278350(&v55, &v53, &v56);
cocos2d::CCNode::convertToNodeSpace(&v54, v39, (unsigned int *)&v55);
(*(void (__fastcall **)(void *, double *))(*(_QWORD *)v38 + 184LL))(v38, &v54);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v38 + 72LL))(v38, 3);
SetupTriggerPopup::postSetup((_BYTE *)v3);
}
return v4;
}