//
// GJKeybindManager::exportBindingsToFile from 0x10018db3c to 0x10018ddc8 (652 bytes)
//
// 1 xrefs:
// > sub_1004EE760 @ 0x1004ee774
//
// 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::exportBindingsToFile(__int64 a1)
{
std::string *v2; // x0
__int128 v3; // q0
std::string *p_p; // x1
std::string::size_type size; // x2
std::string *v6; // x0
__int128 v7; // q0
std::string *v8; // x0
__int128 v9; // q0
std::string *v10; // x1
std::string::size_type v11; // x2
std::string *v12; // x0
__int128 v13; // q0
char v14; // w0
char v15; // w19
std::string *v16; // x0
FILE *v17; // x19
__int128 *v18; // x0
size_t v19; // x2
size_t v20; // x20
__int64 v21; // x22
__int64 v22; // x19
std::string v24; // [xsp+8h] [xbp-F8h] BYREF
std::string __p; // [xsp+20h] [xbp-E0h] BYREF
std::string v26; // [xsp+38h] [xbp-C8h] BYREF
std::string v27; // [xsp+50h] [xbp-B0h] BYREF
std::string v28; // [xsp+70h] [xbp-90h] BYREF
std::string v29; // [xsp+90h] [xbp-70h] BYREF
__int128 v30; // [xsp+B0h] [xbp-50h] BYREF
signed __int64 v31; // [xsp+C0h] [xbp-40h]
std::to_string(&v26, 1);
v2 = std::string::append(&v26, ";");
v3 = *(_OWORD *)&v2->__r_.__value_.__l.__data_;
v27.__r_.__value_.__r.__words[2] = v2->__r_.__value_.__r.__words[2];
*(_OWORD *)&v27.__r_.__value_.__l.__data_ = v3;
v2->__r_.__value_.__l.__size_ = 0;
v2->__r_.__value_.__r.__words[2] = 0;
v2->__r_.__value_.__r.__words[0] = 0;
GJKeybindManager::buildBindsBlob(a1, &__p);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(__p.__r_.__value_.__r.__words[2]);
else
size = __p.__r_.__value_.__l.__size_;
v6 = std::string::append(&v27, (const std::string::value_type *)p_p, size);
v7 = *(_OWORD *)&v6->__r_.__value_.__l.__data_;
v28.__r_.__value_.__r.__words[2] = v6->__r_.__value_.__r.__words[2];
*(_OWORD *)&v28.__r_.__value_.__l.__data_ = v7;
v6->__r_.__value_.__l.__size_ = 0;
v6->__r_.__value_.__r.__words[2] = 0;
v6->__r_.__value_.__r.__words[0] = 0;
v8 = std::string::append(&v28, ";");
v9 = *(_OWORD *)&v8->__r_.__value_.__l.__data_;
v29.__r_.__value_.__r.__words[2] = v8->__r_.__value_.__r.__words[2];
*(_OWORD *)&v29.__r_.__value_.__l.__data_ = v9;
v8->__r_.__value_.__l.__size_ = 0;
v8->__r_.__value_.__r.__words[2] = 0;
v8->__r_.__value_.__r.__words[0] = 0;
std::to_string(&v24, 2);
if ( (v24.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v10 = &v24;
else
v10 = (std::string *)v24.__r_.__value_.__r.__words[0];
if ( (v24.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v11 = HIBYTE(v24.__r_.__value_.__r.__words[2]);
else
v11 = v24.__r_.__value_.__l.__size_;
v12 = std::string::append(&v29, (const std::string::value_type *)v10, v11);
v13 = *(_OWORD *)&v12->__r_.__value_.__l.__data_;
v31 = v12->__r_.__value_.__r.__words[2];
v30 = v13;
v12->__r_.__value_.__l.__size_ = 0;
v12->__r_.__value_.__r.__words[2] = 0;
v12->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v24.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v24.__r_.__value_.__l.__data_);
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
if ( SHIBYTE(v28.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v28.__r_.__value_.__l.__data_);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( SHIBYTE(v27.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v27.__r_.__value_.__l.__data_);
if ( SHIBYTE(v26.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v26.__r_.__value_.__l.__data_);
memset(&v29, 0, sizeof(v29));
sub_100009900(&v28, "keybinds.gdkb");
v14 = sub_10004F6F8(
(__int64)"Export Keybinds",
(__int64)"GD Keybind Files (*.gdkb)",
(__int64)"gdkb",
(__int64)&v28,
(__int64)&v29);
v15 = v14;
if ( SHIBYTE(v28.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v28.__r_.__value_.__l.__data_);
if ( (v15 & 1) != 0 )
goto LABEL_27;
LABEL_44:
v22 = 0;
goto LABEL_46;
}
if ( (v14 & 1) == 0 )
goto LABEL_44;
LABEL_27:
if ( (v29.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v16 = &v29;
else
v16 = (std::string *)v29.__r_.__value_.__r.__words[0];
v17 = fopen((const char *)v16, "w");
if ( v17 )
{
if ( v31 >= 0 )
v18 = &v30;
else
v18 = (__int128 *)v30;
if ( v31 >= 0 )
v19 = HIBYTE(v31);
else
v19 = *((_QWORD *)&v30 + 1);
v20 = fwrite(v18, 1u, v19, v17);
if ( v31 >= 0 )
v21 = HIBYTE(v31);
else
v21 = *((_QWORD *)&v30 + 1);
fclose(v17);
if ( v20 == v21 )
v22 = 1;
else
v22 = 0xFFFFFFFFLL;
}
else
{
v22 = 0xFFFFFFFFLL;
}
LABEL_46:
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
if ( SHIBYTE(v31) < 0 )
operator delete((void *)v30);
return v22;
}