//
// sub_1006196A0 from 0x1006196a0 to 0x100619c19 (1401 bytes)
//
// 1 xrefs:
// > sub_10091E4F0 @ 0x10091e53b
//
// 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:34:38 +0000
//
__int64 __fastcall sub_1006196A0(_QWORD *a1, std::string *a2, int *a3, _DWORD *a4, int *a5)
{
bool v8; // r14
unsigned int v9; // r12d
char *v10; // rdi
__int64 v11; // rax
const char *CString; // r14
size_t v13; // rax
std::string::size_type v14; // r15
char *data; // r12
unsigned int v16; // eax
size_t v17; // r13
std::string::size_type v18; // rax
char *v19; // rsi
std::string::size_type size; // r15
char *v21; // r13
size_t v22; // r14
std::string::pointer v23; // r15
int v24; // r14d
std::string::size_type v25; // r14
void *v26; // r15
std::string::size_type v27; // rax
std::string::size_type v28; // rdx
std::string::size_type v29; // r12
std::string::size_type v30; // r12
char *v31; // r14
std::string::pointer v32; // rsi
size_t v33; // r15
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 v34; // rax
std::string::size_type v35; // rax
int v36; // edx
int v37; // edx
__int64 v38; // rcx
std::string::size_type v39; // rax
_DWORD *v40; // r13
int *v41; // r15
int v42; // eax
char *v43; // r14
int v44; // eax
char *v46[2]; // [rsp+8h] [rbp-C8h] BYREF
char *v47; // [rsp+18h] [rbp-B8h]
_QWORD *v48; // [rsp+20h] [rbp-B0h]
int *v49; // [rsp+28h] [rbp-A8h]
int *v50; // [rsp+30h] [rbp-A0h]
_DWORD *v51; // [rsp+38h] [rbp-98h]
__int128 v52; // [rsp+40h] [rbp-90h] BYREF
void *v53; // [rsp+50h] [rbp-80h]
std::string::pointer v54; // [rsp+60h] [rbp-70h]
void *__src; // [rsp+68h] [rbp-68h]
std::string::size_type v56; // [rsp+70h] [rbp-60h]
std::string __str; // [rsp+78h] [rbp-58h] BYREF
std::string __dst[2]; // [rsp+90h] [rbp-40h] BYREF
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
*a2->__r_.__value_.__l.__data_ = 0;
a2->__r_.__value_.__l.__size_ = 0;
}
else
{
*(_WORD *)&a2->__r_.__value_.__l.0 = 0;
}
*a3 = 0;
*a4 = 0;
v49 = a5;
*a5 = 0;
v52 = 0;
v53 = nullptr;
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)26;
strcpy(__dst[0].__r_.__value_.__s.__data_, "keybinds.gdkb");
v8 = GameToolbox::showOpenFileDialog(
(void (__fastcall *)(_QWORD))"Import Keybinds",
(void (__fastcall *)(_QWORD))"GD Keybind Files (*.gdkb)",
0.0,
(__int64)__dst,
(__int64)&v52);
v48 = a1;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
v9 = -1;
if ( v8 )
{
if ( (v52 & 1) != 0 )
v10 = (char *)v53;
else
v10 = (char *)&v52 + 1;
v11 = cocos2d::CCString::createWithContentsOfFile(v10);
if ( !v11 )
{
v9 = 0;
goto LABEL_86;
}
v51 = a4;
v50 = a3;
CString = (const char *)cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
if ( v13 >= 0x17 )
{
v17 = 26;
if ( (v13 | 7) != 0x17 )
v17 = (v13 | 7) + 1;
data = (char *)operator new(v17);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v17 | 1;
__dst[0].__r_.__value_.__l.__size_ = v14;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v13);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v13 )
{
__dst[0].__r_.__value_.__s.__data_[0] = 0;
v16 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_15;
goto LABEL_22;
}
}
memmove(data, CString, v14);
data[v14] = 0;
v16 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_15:
v9 = 0;
if ( !__dst[0].__r_.__value_.__l.__size_ )
goto LABEL_84;
LABEL_23:
v18 = std::string::find(__dst, 59, 0);
if ( v18 == -1 )
goto LABEL_84;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v19 = __dst[0].__r_.__value_.__l.__data_;
size = __dst[0].__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
v19 = __dst[0].__r_.__value_.__s.__data_;
}
if ( size >= v18 )
size = v18;
if ( size >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v54 = __dst[0].__r_.__value_.__s.__data_;
v56 = v18;
if ( size >= 0x17 )
{
__src = v19;
v22 = 26;
if ( (size | 7) != 0x17 )
v22 = (size | 7) + 1;
v21 = (char *)operator new(v22);
__str.__r_.__value_.__r.__words[2] = (std::string::size_type)v21;
__str.__r_.__value_.__r.__words[0] = v22 | 1;
__str.__r_.__value_.__l.__size_ = size;
v19 = (char *)__src;
}
else
{
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * size);
v21 = __str.__r_.__value_.__s.__data_;
if ( !size )
{
__str.__r_.__value_.__s.__data_[0] = 0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_33;
goto LABEL_39;
}
}
memmove(v21, v19, size);
v21[size] = 0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_33:
if ( atoi(__str.__r_.__value_.__s.__data_) != 1 )
{
LABEL_84:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
goto LABEL_86;
}
LABEL_40:
v25 = v56;
v26 = (void *)(v56 + 1);
v27 = std::string::find(__dst, 59, v56 + 1);
if ( v27 == -1 )
{
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v27 = __dst[0].__r_.__value_.__l.__size_;
v28 = __dst[0].__r_.__value_.__l.__size_ + ~v25;
goto LABEL_48;
}
v27 = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
v28 = v27 + ~v25;
}
else
{
v28 = v27 + ~v25;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_48:
v29 = __dst[0].__r_.__value_.__l.__size_;
if ( __dst[0].__r_.__value_.__l.__size_ > v25 )
{
v54 = __dst[0].__r_.__value_.__l.__data_;
LABEL_50:
v30 = v29 - (_QWORD)v26;
if ( v30 >= v28 )
v30 = v28;
if ( v30 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v56 = v27;
if ( v30 >= 0x17 )
{
__src = v26;
v33 = 26;
if ( (v30 | 7) != 0x17 )
v33 = (v30 | 7) + 1;
v31 = (char *)operator new(v33);
__str.__r_.__value_.__r.__words[2] = (std::string::size_type)v31;
__str.__r_.__value_.__r.__words[0] = v33 | 1;
__str.__r_.__value_.__l.__size_ = v30;
v32 = v54;
v26 = __src;
}
else
{
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v30);
v31 = __str.__r_.__value_.__s.__data_;
v32 = v54;
if ( !v30 )
goto LABEL_60;
}
memmove(v31, &v32[(_QWORD)v26], v30);
LABEL_60:
v31[v30] = 0;
v34 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&__str.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_63;
LABEL_67:
while ( 1 )
{
v9 = 0;
if ( !*(_QWORD *)&v34 )
break;
v37 = *((unsigned __int8 *)&__str.__r_.__value_.__l.0 + (*(_DWORD *)&v34 >> 1));
if ( v37 != 10 && v37 != 13 )
{
LABEL_73:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v39 = __dst[0].__r_.__value_.__l.__size_;
else
v39 = *(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1;
v40 = v51;
v41 = v50;
if ( v56 < v39 )
{
sub_1004CC210(v46, (unsigned __int8 *)__dst, v56 + 1, 0xFFFFFFFFFFFFFFFFLL);
if ( ((__int64)v46[0] & 1) != 0 )
{
v43 = v47;
v44 = atoi(v47);
*v49 = v44;
operator delete(v43);
}
else
{
v42 = atoi((const char *)v46 + 1);
*v49 = v42;
}
}
v9 = 0;
GJKeybindManager::parseBindsBlob(v48, &__str, 0, v41, v40);
if ( *v50 > 0 )
{
v9 = 1;
std::string::operator=(a2, &__str);
}
break;
}
v38 = (*(_DWORD *)&v34 >> 1) - 1LL;
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v38);
*((_BYTE *)&__str.__r_.__value_.__l.0 + v38 + 1) = 0;
v34 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&__str.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_63:
while ( 1 )
{
v35 = __str.__r_.__value_.__l.__size_;
if ( !__str.__r_.__value_.__l.__size_ )
break;
v36 = *(unsigned __int8 *)(__str.__r_.__value_.__r.__words[2] + __str.__r_.__value_.__l.__size_ - 1);
if ( v36 != 13 && v36 != 10 )
goto LABEL_73;
--__str.__r_.__value_.__l.__size_;
*(_BYTE *)(__str.__r_.__value_.__r.__words[2] + v35 - 1) = 0;
v34 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&__str.__r_.__value_.__l.0;
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_67;
}
v9 = 0;
break;
}
}
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
goto LABEL_84;
}
LABEL_91:
sub_100056810();
}
}
v29 = *(_BYTE *)&__dst[0].__r_.__value_.__s.0 >> 1;
if ( v25 < v29 )
goto LABEL_50;
goto LABEL_91;
}
LABEL_39:
v23 = __str.__r_.__value_.__l.__data_;
v24 = atoi(__str.__r_.__value_.__l.__data_);
operator delete(v23);
if ( v24 != 1 )
goto LABEL_84;
goto LABEL_40;
}
LABEL_22:
v9 = 0;
if ( !(v16 >> 1) )
goto LABEL_84;
goto LABEL_23;
}
LABEL_86:
if ( (v52 & 1) != 0 )
operator delete(v53);
return v9;
}