//
// GJKeybindManager::parseImportFile from 0x10018dea0 to 0x10018e1b8 (792 bytes)
//
// 1 xrefs:
// > KeybindingsSettingsPopup::onImport @ 0x1004ee8a0
//
// 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 10:59:53 +0000
//
__int64 __fastcall GJKeybindManager::parseImportFile(__int64 a1, __int64 a2, int *a3, _DWORD *a4, int *a5)
{
char v10; // w0
char v11; // w24
void **v12; // x0
__int64 v13; // x0
char *CString; // x0
std::string::size_type size; // x8
std::string::size_type v16; // x0
std::string::size_type v17; // x25
int v18; // w24
__int64 v19; // x19
void *v20; // x26
std::string::size_type v21; // x24
std::string::size_type v22; // x9
int v23; // w10
__int64 v25; // x9
std::string *v26; // x10
int v27; // w9
std::string::size_type v30; // x8
void *v31; // x24
std::string __a; // [xsp+8h] [xbp-A8h] BYREF
std::string v33; // [xsp+20h] [xbp-90h] BYREF
std::string __str; // [xsp+38h] [xbp-78h] BYREF
void *__p[2]; // [xsp+50h] [xbp-60h] BYREF
__int64 v36; // [xsp+60h] [xbp-50h]
std::allocator v37; // [xsp+6Fh] [xbp-41h] BYREF
if ( *(char *)(a2 + 23) < 0 )
{
**(_BYTE **)a2 = 0;
*(_QWORD *)(a2 + 8) = 0;
}
else
{
*(_BYTE *)a2 = 0;
*(_BYTE *)(a2 + 23) = 0;
}
*a3 = 0;
*a4 = 0;
*a5 = 0;
__p[0] = nullptr;
__p[1] = nullptr;
v36 = 0;
sub_100009900(&__str, "keybinds.gdkb");
v10 = sub_10004F820((__int64)"Import Keybinds", (__int64)"GD Keybind Files (*.gdkb)", (__int64)&__str, (__int64)__p);
v11 = v10;
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v11 & 1) != 0 )
goto LABEL_6;
LABEL_17:
v19 = 0xFFFFFFFFLL;
goto LABEL_44;
}
if ( (v10 & 1) == 0 )
goto LABEL_17;
LABEL_6:
if ( v36 >= 0 )
v12 = __p;
else
v12 = (void **)__p[0];
v13 = cocos2d::CCString::createWithContentsOfFile(v12);
if ( !v13 )
{
v19 = 0;
goto LABEL_44;
}
CString = (char *)cocos2d::CCString::getCString(v13);
sub_100009900(&__str, CString);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( !size )
goto LABEL_41;
v16 = std::string::find(&__str, 59, 0);
if ( v16 == -1 )
goto LABEL_41;
v17 = v16;
std::string::basic_string(&v33, &__str, 0, v16, (std::allocator *)&__a);
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
{
v20 = (void *)v33.__r_.__value_.__r.__words[0];
v18 = atoi(v33.__r_.__value_.__l.__data_);
operator delete(v20);
}
else
{
v18 = atoi((const char *)&v33);
}
if ( v18 != 1 )
{
LABEL_41:
v19 = 0;
goto LABEL_42;
}
v21 = std::string::find(&__str, 59, v17 + 1);
if ( v21 == -1 )
{
v21 = SHIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (SHIBYTE(__str.__r_.__value_.__r.__words[2]) & 0x8000000000000000LL) != 0 )
v21 = __str.__r_.__value_.__l.__size_;
}
std::string::basic_string(&v33, &__str, v17 + 1, v21 + ~v17, (std::allocator *)&__a);
while ( 1 )
{
v22 = SHIBYTE(v33.__r_.__value_.__r.__words[2]);
if ( (SHIBYTE(v33.__r_.__value_.__r.__words[2]) & 0x8000000000000000LL) != 0 )
break;
if ( !*((_BYTE *)&v33.__r_.__value_.__s + 23) )
goto LABEL_48;
v23 = *((unsigned __int8 *)&__a.__r_.__value_.__r.__words[2] + SHIBYTE(v33.__r_.__value_.__r.__words[2]) + 7);
if ( v23 != 10 && v23 != 13 )
goto LABEL_48;
v25 = SHIBYTE(v33.__r_.__value_.__r.__words[2]) - 1LL;
--*((_BYTE *)&v33.__r_.__value_.__s + 23);
v26 = &v33;
LABEL_40:
v26->__r_.__value_.__s.__data_[v25] = 0;
}
if ( v33.__r_.__value_.__l.__size_ )
{
v27 = *(unsigned __int8 *)(v33.__r_.__value_.__r.__words[0] + v33.__r_.__value_.__l.__size_ - 1);
if ( v27 == 10 || v27 == 13 )
{
v26 = (std::string *)v33.__r_.__value_.__r.__words[0];
v25 = --v33.__r_.__value_.__l.__size_;
goto LABEL_40;
}
}
v22 = v33.__r_.__value_.__l.__size_;
LABEL_48:
if ( !v22 )
goto LABEL_57;
v30 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v30 = __str.__r_.__value_.__l.__size_;
if ( v21 < v30 )
{
std::string::basic_string(&__a, &__str, v21 + 1, 0xFFFFFFFFFFFFFFFFLL, &v37);
if ( SHIBYTE(__a.__r_.__value_.__r.__words[2]) < 0 )
{
v31 = (void *)__a.__r_.__value_.__r.__words[0];
*a5 = atoi(__a.__r_.__value_.__l.__data_);
operator delete(v31);
}
else
{
*a5 = atoi((const char *)&__a);
}
}
GJKeybindManager::parseBindsBlob(a1, &v33, 0, a3, a4);
if ( *a3 >= 1 )
{
std::string::operator=((std::string *)a2, &v33);
v19 = 1;
}
else
{
LABEL_57:
v19 = 0;
}
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v33.__r_.__value_.__l.__data_);
LABEL_42:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
LABEL_44:
if ( SHIBYTE(v36) < 0 )
operator delete(__p[0]);
return v19;
}