//
// UISaveLoadLayer::onLoad from 0x1002b5ad0 to 0x1002b5ca9 (473 bytes)
//
// 3 xrefs:
// > UISaveLoadLayer::init @ 0x1002b5424
// > UISaveLoadLayer::init @ 0x1002b55d1
// > UISaveLoadLayer::init @ 0x1002b5783
//
// 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
//
void __fastcall UISaveLoadLayer::onLoad(UISaveLoadLayer *a1, cocos2d::CCObject *a2)
{
double v2; // xmm0_8
int v4; // r14d
GameManager *v5; // rax
UIOptionsLayer *v6; // rbx
cocos2d::CCString *v7; // rax
const char *CString; // r15
size_t v9; // rax
size_t v10; // r14
char *v11; // r12
char v12; // r14
size_t v13; // r13
cocos2d::CCObject *v14; // rax
char v15; // [rsp+0h] [rbp-80h]
__int128 v16; // [rsp+8h] [rbp-78h] BYREF
__int128 v17; // [rsp+20h] [rbp-60h] BYREF
void *__p; // [rsp+30h] [rbp-50h]
__int128 __dst; // [rsp+40h] [rbp-40h] BYREF
void *v20; // [rsp+50h] [rbp-30h]
v4 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
((void (__fastcall *)(UISaveLoadLayer *, _QWORD))a1->onClose)(a1, 0);
((void (__fastcall *)(UIOptionsLayer *, _QWORD))a1->m_optionsLayer->onClose)(a1->m_optionsLayer, 0);
v5 = GameManager::sharedState();
GameManager::loadDPadLayout(v5, v4, a1->m_optionsLayer->m_dual);
v6 = UIOptionsLayer::create(a1->m_optionsLayer->m_dual);
((void (__fastcall *)(UIOptionsLayer *))v6->show)(v6);
v7 = (cocos2d::CCString *)sub_1007AB580("%sUI %i loaded.", v15);
CString = cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v10 = v9;
if ( v9 >= 0x17 )
{
v13 = 26;
if ( (v9 | 7) != 0x17 )
v13 = (v9 | 7) + 1;
v11 = (char *)operator new(v13);
v20 = v11;
*(_QWORD *)&__dst = v13 + 1;
*((_QWORD *)&__dst + 1) = v10;
LABEL_9:
memmove(v11, CString, v10);
v11[v10] = 0;
v12 = __dst;
if ( (__dst & 1) == 0 )
goto LABEL_5;
goto LABEL_10;
}
LOBYTE(__dst) = 2 * v9;
v11 = (char *)&__dst + 1;
if ( v9 )
goto LABEL_9;
BYTE1(__dst) = 0;
v12 = __dst;
if ( (__dst & 1) == 0 )
{
LABEL_5:
__p = v20;
v17 = __dst;
goto LABEL_11;
}
LABEL_10:
sub_100006B70(&v17, v20, *((unsigned __int64 *)&__dst + 1), v2);
LABEL_11:
LOWORD(v16) = 0;
v14 = TextAlertPopup::create((__int64)&v17, 0x96u, &v16, (__m128)0x3F000000u, 0.60000002);
((void (__fastcall *)(UIOptionsLayer *, cocos2d::CCObject *, __int64))v6->addChild_0)(v6, v14, 100);
if ( (v17 & 1) != 0 )
operator delete(__p);
if ( (v12 & 1) != 0 )
operator delete(v20);
}