//
// KeybindingsSettingsPopup::onImport from 0xcf06b4 to 0xcf0ab0 (1020 bytes)
//
// 2 xrefs:
// > ??> @ 0x95c20
// > ??> @ 0x1548378
//
// This function is hookable on this platform (idp: arm, 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 13:06:45 +0000
//
__int64 __fastcall KeybindingsSettingsPopup::onImport(KeybindingsSettingsPopup *this, cocos2d::CCObject *a2)
{
GJKeybindManager *v3; // x0
int v4; // w0
char *v5; // x7
size_t v6; // x6
unsigned __int64 v7; // x1
char *v8; // x3
size_t v9; // x2
char *v10; // x1
size_t v11; // x2
char *v12; // x1
char *v13; // x19
__int64 v14; // x19
__int64 v16; // x3
__int64 v17; // x0
size_t v18; // [xsp+38h] [xbp+38h]
int v19; // [xsp+4Ch] [xbp+4Ch] BYREF
int v20; // [xsp+50h] [xbp+50h] BYREF
int v21; // [xsp+54h] [xbp+54h] BYREF
__int64 v22; // [xsp+58h] [xbp+58h] BYREF
size_t v23; // [xsp+60h] [xbp+60h]
void *v24; // [xsp+68h] [xbp+68h]
__int64 v25[2]; // [xsp+70h] [xbp+70h] BYREF
void *v26; // [xsp+80h] [xbp+80h]
__int64 v27; // [xsp+88h] [xbp+88h] BYREF
size_t v28; // [xsp+90h] [xbp+90h]
void *v29; // [xsp+98h] [xbp+98h]
void *v30[2]; // [xsp+A0h] [xbp+A0h] BYREF
void *v31; // [xsp+B0h] [xbp+B0h]
void *v32[2]; // [xsp+B8h] [xbp+B8h] BYREF
void *v33; // [xsp+C8h] [xbp+C8h]
__int64 v34; // [xsp+D0h] [xbp+D0h] BYREF
size_t v35; // [xsp+D8h] [xbp+D8h]
void *v36; // [xsp+E0h] [xbp+E0h]
v22 = 0;
v23 = 0;
v24 = nullptr;
v19 = 0;
v20 = 0;
v21 = 0;
v3 = (GJKeybindManager *)GJKeybindManager::sharedState(_stack_chk_guard);
v4 = GJKeybindManager::parseImportFile(v3, (__int64)&v22, &v19, &v20, &v21);
if ( v4 < 0 )
goto LABEL_29;
if ( v4 )
{
*((_DWORD *)this + 176) = 2;
if ( (__int64 *)((char *)this + 712) != &v22 )
{
if ( (v22 & 1) != 0 )
{
v5 = (char *)v24;
v6 = v23;
}
else
{
v6 = (unsigned __int8)v22 >> 1;
v5 = (char *)&v22 + 1;
}
if ( (*((_BYTE *)this + 712) & 1) != 0 )
{
v7 = (*((_QWORD *)this + 89) & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v6 <= v7 )
{
v8 = *((char **)this + 91);
LABEL_9:
if ( v6 )
{
v18 = v6;
v8 = (char *)memmove(v8, v5, v6);
v6 = v18;
}
v8[v6] = 0;
if ( (*((_BYTE *)this + 712) & 1) != 0 )
*((_QWORD *)this + 90) = v6;
else
*((_BYTE *)this + 712) = 2 * v6;
goto LABEL_13;
}
v16 = *((_QWORD *)this + 90);
}
else
{
if ( v6 <= 0x16 )
{
v8 = (char *)this + 713;
goto LABEL_9;
}
v16 = *((_BYTE *)this + 712) >> 1;
v7 = 22;
}
std::string::__grow_by_and_replace((__int64)this + 712, v7, v6 - v7, v16, 0, v16, v6, v5);
}
LABEL_13:
*((_DWORD *)this + 184) = v21;
v27 = 0;
v28 = 0;
v29 = nullptr;
std::string::__init(&v27, "Replace current keybinds with ", 0x22u);
std::to_string(v30, v19);
if ( ((__int64)v30[0] & 1) != 0 )
{
v10 = (char *)v31;
v9 = (size_t)v30[1];
}
else
{
v9 = LOBYTE(v30[0]) >> 1;
v10 = (char *)v30 + 1;
}
std::string::append((__int64)&v27, v10, v9);
if ( ((__int64)v30[0] & 1) != 0 )
operator delete(v31);
std::string::append((__int64)&v27, " actions from file?");
if ( v20 > 0 )
{
std::string::append((__int64)&v27, " (");
std::to_string(v32, v20);
if ( ((__int64)v32[0] & 1) != 0 )
{
v12 = (char *)v33;
v11 = (size_t)v32[1];
}
else
{
v11 = LOBYTE(v32[0]) >> 1;
v12 = (char *)v32 + 1;
}
std::string::append((__int64)&v27, v12, v11);
if ( ((__int64)v32[0] & 1) != 0 )
operator delete(v33);
std::string::append((__int64)&v27, " unknown skipped)");
}
v13 = (char *)this + 664;
v34 = 0;
v35 = 0;
v36 = nullptr;
if ( (v27 & 1) != 0 )
{
std::string::__init(&v34, v29, v28);
}
else
{
v36 = v29;
v34 = v27;
v35 = v28;
}
v14 = FLAlertLayer::create(
(__int64)v13,
(cocos2d::CCLabelBMFont *)"Import Keybinds",
(char *)&v34,
(ButtonSprite *)"Cancel",
(ButtonSprite *)"Replace",
380.0);
if ( (v34 & 1) != 0 )
operator delete(v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 1312LL))(v14);
if ( (v27 & 1) != 0 )
operator delete(v29);
goto LABEL_29;
}
v25[0] = 0;
v25[1] = 0;
v26 = nullptr;
std::string::__init(v25, "File is invalid, empty, or from a newer version.", 0x30u);
v17 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Import Failed",
(char *)v25,
(ButtonSprite *)"OK",
nullptr,
380.0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1312LL))(v17);
if ( (v25[0] & 1) != 0 )
operator delete(v26);
LABEL_29:
if ( (v22 & 1) != 0 )
operator delete(v24);
return _stack_chk_guard;
}