//
// ControlSlotsPopup::onSave from 0x140456e60 to 0x140456fa4 (324 bytes)
//
// 2 xrefs:
// > ControlSlotsPopup::init @ 0x140456a16
// > ??> @ 0x140927b48
//
// 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:32:29 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall ControlSlotsPopup::onSave(__int64 *a1, __int64 a2)
{
int v3; // ebx
__int64 v4; // rcx
__int64 v5; // rcx
cocos2d::CCString *v6; // rax
const char *CString; // rax
size_t v8; // r8
__int64 v9; // rbx
__int64 v10; // rdx
__int64 v11; // r8
cocos2d::CCNode *v12; // rax
__int128 v14; // [rsp+30h] [rbp-48h] BYREF
__int64 v15; // [rsp+40h] [rbp-38h]
__int64 v16; // [rsp+48h] [rbp-30h]
__int128 v17; // [rsp+50h] [rbp-28h] BYREF
__int64 v18; // [rsp+60h] [rbp-18h]
__int64 v19; // [rsp+68h] [rbp-10h]
void *v20; // [rsp+80h] [rbp+8h]
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v4 = a1[125];
if ( v4 )
TouchControlEditLayer::saveTarget(v4);
v5 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v20 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v5 = qword_14090BFD0;
}
GameManager::saveDPadLayout(v5, v3, *((_BYTE *)a1 + 1008));
v14 = 0;
v15 = 0;
v16 = 15;
LOBYTE(v14) = 0;
v6 = cocos2d::CCString::createWithFormat("Slot %i saved", v3);
CString = cocos2d::CCString::getCString(v6);
v17 = 0;
v18 = 0;
v19 = 0;
v8 = -1;
do
++v8;
while ( CString[v8] );
sub_14003D230(&v17, CString, v8);
v9 = *a1;
v12 = TextAlertPopup::create((__int64)&v17, v10, v11, 150, (__int64)&v14);
return (*(__int64 (__fastcall **)(__int64 *, cocos2d::CCNode *, __int64))(v9 + 456))(a1, v12, 100);
}