//
// GJKeybindManager::exportBindingsToFile from 0x7168e0 to 0x716ad2 (498 bytes)
//
// 1 xrefs:
// > KeybindingsSettingsPopup::onExport @ 0x797022
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:57:48 +0000
//
int __fastcall GJKeybindManager::exportBindingsToFile(GJKeybindManager *this)
{
_DWORD *v2; // r0
int v3; // r1
int v4; // r2
char *v5; // r1
size_t v6; // r2
_DWORD *v7; // r0
int v8; // r1
int v9; // r2
int *v10; // r0
int v11; // r1
char *v12; // r2
char *v13; // r1
size_t v14; // r2
int *v15; // r0
size_t v16; // r1
void *v17; // r2
int v18; // r7
char *v19; // r0
FILE *v20; // r8
char *v21; // r0
size_t v22; // r2
size_t v23; // r5
size_t v24; // r7
int v26; // [sp+10h] [bp-5Ch] BYREF
size_t n; // [sp+14h] [bp-58h]
void *ptr; // [sp+18h] [bp-54h]
_DWORD v29[3]; // [sp+1Ch] [bp-50h] BYREF
_DWORD v30[3]; // [sp+28h] [bp-44h] BYREF
unsigned __int8 v31; // [sp+34h] [bp-38h] BYREF
char v32; // [sp+35h] [bp-37h] BYREF
size_t v33; // [sp+38h] [bp-34h]
char *v34; // [sp+3Ch] [bp-30h]
_DWORD v35[3]; // [sp+40h] [bp-2Ch] BYREF
int v36; // [sp+4Ch] [bp-20h] BYREF
int v37; // [sp+50h] [bp-1Ch]
char *filename; // [sp+54h] [bp-18h]
int v39; // [sp+58h] [bp-14h] BYREF
size_t v40; // [sp+5Ch] [bp-10h]
char *v41; // [sp+60h] [bp-Ch]
std::to_string((int)v29);
v2 = std::string::append(v29, ";");
v3 = v2[1];
v4 = v2[2];
v30[0] = *v2;
v30[1] = v3;
v30[2] = v4;
*v2 = 0;
v2[1] = 0;
v2[2] = 0;
GJKeybindManager::buildBindsBlob((GJKeybindManager *)&v31, (int)this);
if ( (v31 & 1) != 0 )
{
v5 = v34;
v6 = v33;
}
else
{
v6 = (int)v31 >> 1;
v5 = &v32;
}
v7 = std::string::append(v30, v5, v6);
v8 = v7[1];
v9 = v7[2];
v35[0] = *v7;
v35[1] = v8;
v35[2] = v9;
*v7 = 0;
v7[1] = 0;
v7[2] = 0;
v10 = std::string::append(v35, ";");
v11 = v10[1];
v12 = (char *)v10[2];
v36 = *v10;
v37 = v11;
filename = v12;
*v10 = 0;
v10[1] = 0;
v10[2] = 0;
std::to_string((int)&v39);
if ( (v39 & 1) != 0 )
{
v13 = v41;
v14 = v40;
}
else
{
v14 = (int)(unsigned __int8)v39 >> 1;
v13 = (char *)&v39 + 1;
}
v15 = std::string::append(&v36, v13, v14);
v16 = v15[1];
v17 = (void *)v15[2];
v26 = *v15;
n = v16;
ptr = v17;
*v15 = 0;
v15[1] = 0;
v15[2] = 0;
std::string::~string((int)&v39);
std::string::~string((int)&v36);
std::string::~string((int)v35);
std::string::~string((int)&v31);
std::string::~string((int)v30);
std::string::~string((int)v29);
v36 = 0;
v37 = 0;
filename = nullptr;
v39 = 0;
v40 = 0;
v41 = nullptr;
std::string::__init(&v39, "keybinds.gdkb", 0xDu);
v18 = GameToolbox::showSaveFileDialog(
(cocos2d::CCFileUtils *)"Export Keybinds",
(int)"GD Keybind Files (*.gdkb)",
"gdkb",
(unsigned __int8 *)&v39,
(int)&v36);
std::string::~string((int)&v39);
if ( v18 )
{
if ( (v36 & 1) != 0 )
v19 = filename;
else
v19 = (char *)&v36 + 1;
v20 = fopen(v19, "w");
if ( v20 )
{
if ( (v26 & 1) != 0 )
{
v21 = (char *)ptr;
v22 = n;
}
else
{
v22 = (int)(unsigned __int8)v26 >> 1;
v21 = (char *)&v26 + 1;
}
v23 = fwrite(v21, 1u, v22, v20);
if ( (v26 & 1) != 0 )
v24 = n;
else
v24 = (int)(unsigned __int8)v26 >> 1;
fclose(v20);
if ( v23 == v24 )
v18 = 1;
else
v18 = -1;
}
else
{
v18 = -1;
}
}
std::string::~string((int)&v36);
std::string::~string((int)&v26);
return v18;
}