//
// GJKeybindManager::exportBindingsToFile from 0x100619240 to 0x10061955a (794 bytes)
//
// 1 xrefs:
// > sub_10091E3E0 @ 0x10091e3f3
//
// 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 GJKeybindManager::exportBindingsToFile(__int64 a1)
{
std::string *v1; // rax
const std::string::value_type *data; // rsi
std::string::size_type size; // rdx
std::string *v4; // rax
std::string *v5; // rax
const std::string::value_type *v6; // rsi
std::string::size_type v7; // rdx
std::string *v8; // rax
bool v9; // r14
unsigned int v10; // ebx
const char *v11; // rdi
FILE *v12; // rax
FILE *v13; // rbx
char *v14; // rdi
size_t v15; // rdx
size_t v17; // rax
__int64 v18; // rcx
_BOOL4 v19; // r14d
std::string v20; // [rsp+8h] [rbp-D8h] BYREF
std::string v21; // [rsp+20h] [rbp-C0h] BYREF
std::string v22; // [rsp+40h] [rbp-A0h] BYREF
std::string v23; // [rsp+58h] [rbp-88h] BYREF
__int128 __ptr; // [rsp+70h] [rbp-70h] BYREF
void *v25; // [rsp+80h] [rbp-60h]
std::string v26; // [rsp+90h] [rbp-50h] BYREF
std::string v27; // [rsp+B0h] [rbp-30h] BYREF
std::to_string(&v20, 1);
v1 = std::string::append(&v20, ";");
v21 = *v1;
*(_OWORD *)&v1->__r_.__value_.__l.0 = 0;
v1->__r_.__value_.__r.__words[2] = 0;
GJKeybindManager::buildBindsBlob(&v22, a1);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) != 0 )
{
data = v22.__r_.__value_.__l.__data_;
size = v22.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v22.__r_.__value_.__l.0 >> 1;
data = v22.__r_.__value_.__s.__data_;
}
v4 = std::string::append(&v21, data, size);
v26 = *v4;
*(_OWORD *)&v4->__r_.__value_.__l.0 = 0;
v4->__r_.__value_.__r.__words[2] = 0;
v5 = std::string::append(&v26, ";");
v27 = *v5;
*(_OWORD *)&v5->__r_.__value_.__l.0 = 0;
v5->__r_.__value_.__r.__words[2] = 0;
std::to_string(&v23, 2);
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
{
v6 = v23.__r_.__value_.__l.__data_;
v7 = v23.__r_.__value_.__l.__size_;
}
else
{
v7 = *(_BYTE *)&v23.__r_.__value_.__l.0 >> 1;
v6 = v23.__r_.__value_.__s.__data_;
}
v8 = std::string::append(&v27, v6, v7);
v25 = v8->__r_.__value_.__l.__data_;
__ptr = *(_OWORD *)&v8->__r_.__value_.__l.0;
*(_OWORD *)&v8->__r_.__value_.__l.0 = 0;
v8->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v23.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v23.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_9:
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_10;
goto LABEL_21;
}
}
else if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_9;
}
operator delete(v27.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_10:
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_11;
goto LABEL_22;
}
LABEL_21:
operator delete(v26.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_11:
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_12;
goto LABEL_23;
}
LABEL_22:
operator delete(v22.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v21.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_12:
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_14;
goto LABEL_13;
}
LABEL_23:
operator delete(v21.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
LABEL_13:
operator delete(v20.__r_.__value_.__l.__data_);
LABEL_14:
memset(&v27, 0, sizeof(v27));
v26.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)26;
strcpy(v26.__r_.__value_.__s.__data_, "keybinds.gdkb");
v9 = GameToolbox::showSaveFileDialog(
(__int64)"Export Keybinds",
(__int64)"GD Keybind Files (*.gdkb)",
(__int64)"gdkb",
(__int64)&v26,
(unsigned __int8 *)&v27);
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v26.__r_.__value_.__l.__data_);
v10 = 0;
if ( !v9 )
{
LABEL_30:
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_32;
goto LABEL_31;
}
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
v11 = v27.__r_.__value_.__l.__data_;
else
v11 = v27.__r_.__value_.__s.__data_;
v12 = fopen(v11, "w");
v13 = v12;
if ( !v12 )
{
v10 = -1;
goto LABEL_30;
}
if ( (__ptr & 1) != 0 )
{
v14 = (char *)v25;
v15 = *((_QWORD *)&__ptr + 1);
}
else
{
v15 = (unsigned __int8)__ptr >> 1;
v14 = (char *)&__ptr + 1;
}
v17 = fwrite(v14, 1u, v15, v12);
if ( (__ptr & 1) != 0 )
v18 = *((_QWORD *)&__ptr + 1);
else
v18 = (unsigned __int8)__ptr >> 1;
v19 = v17 == v18;
fclose(v13);
v10 = 2 * v19 - 1;
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_32;
LABEL_31:
operator delete(v27.__r_.__value_.__l.__data_);
LABEL_32:
if ( (__ptr & 1) != 0 )
operator delete(v25);
return v10;
}