//
// GameToolbox::saveStringToFile from 0x1004f7190 to 0x1004f7293 (259 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall GameToolbox::saveStringToFile(unsigned __int8 *a1, unsigned __int8 *a2)
{
cocos2d::CCFileUtils *v3; // rax
unsigned int v4; // edx
std::string::size_type v5; // rdx
const std::string::value_type *v6; // r14
const std::string::value_type *data; // rsi
const char *v8; // rdi
FILE *v9; // rax
FILE *v10; // r14
unsigned int v11; // edx
const void *v12; // rdi
size_t v13; // rdx
size_t v14; // rax
unsigned int v15; // ecx
__int64 v16; // rcx
std::string v18; // [rsp+0h] [rbp-40h] BYREF
std::string v19; // [rsp+18h] [rbp-28h] BYREF
*(_WORD *)&v18.__r_.__value_.__l.0 = 0;
v3 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(std::string *, cocos2d::CCFileUtils *))v3->init)(&v19, v3);
v4 = *a1;
if ( (v4 & 1) != 0 )
{
v5 = *((_QWORD *)a1 + 1);
v6 = *((const std::string::value_type **)a1 + 2);
}
else
{
v6 = (const std::string::value_type *)(a1 + 1);
v5 = v4 >> 1;
}
std::string::append(&v19, v6, v5);
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
data = v19.__r_.__value_.__l.__data_;
else
data = v19.__r_.__value_.__s.__data_;
std::string::assign(&v18, data);
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) != 0 )
v8 = v18.__r_.__value_.__l.__data_;
else
v8 = v18.__r_.__value_.__s.__data_;
v9 = fopen(v8, "w");
v10 = v9;
if ( v9 )
{
v11 = *a2;
if ( (v11 & 1) != 0 )
{
v12 = *((const void **)a2 + 2);
v13 = *((_QWORD *)a2 + 1);
}
else
{
v12 = a2 + 1;
v13 = v11 >> 1;
}
v14 = fwrite(v12, 1u, v13, v9);
v15 = *a2;
if ( (v15 & 1) != 0 )
v16 = *((_QWORD *)a2 + 1);
else
v16 = v15 >> 1;
LOBYTE(a2) = v14 == v16;
fclose(v10);
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_21;
goto LABEL_20;
}
LODWORD(a2) = 0;
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
LABEL_20:
operator delete(v19.__r_.__value_.__l.__data_);
LABEL_21:
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v18.__r_.__value_.__l.__data_);
return (unsigned int)a2;
}