//
// PlatformToolbox::saveAndEncryptStringToFile from 0x4ec8a8 to 0x4ecacc (548 bytes)
//
// 1 xrefs:
// > ??> @ 0x99630
//
// 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 PlatformToolbox::saveAndEncryptStringToFile(_QWORD *a1, const char *a2, const char *a3)
{
size_t v6; // x0
size_t v7; // x0
__int64 v8; // x20
__int64 v9; // x2
void *v10; // x0
__int64 v12; // x21
__int64 v13; // x20
unsigned int *v14; // x2
int v15; // w1
__int64 v16; // [xsp+48h] [xbp+48h] BYREF
__int64 v17; // [xsp+50h] [xbp+50h] BYREF
__int64 v18; // [xsp+58h] [xbp+58h]
__int64 v19; // [xsp+60h] [xbp+60h]
sub_D153B8((int)&v16, &byte_F288A0);
v6 = strlen(a3);
sub_D15FD4(&v16, a3, v6);
v7 = strlen(a2);
sub_D15FD4(&v16, a2, v7);
v8 = v16;
if ( (unsigned __int8)cocos2d::JniHelper::getStaticMethodInfo(
&v17,
"com/customRobTop/SimpleCrypto",
"saveAndEncryptStringToFile",
"(Ljava/lang/String;Ljava/lang/String;)V") )
{
v12 = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 1336LL))(v17, *a1);
sub_D174B8(a1, 0, *(_QWORD *)(*a1 - 24LL), 0);
v13 = (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 1336LL))(v17, v8);
_JNIEnv::CallStaticVoidMethod(v17, v18, v19, v12, v13);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 184LL))(v17, v12);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 184LL))(v17, v13);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 184LL))(v17, v18);
v9 = v16;
v10 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) == &qword_124B6B0 )
return _stack_chk_guard;
}
else
{
v9 = v16;
v10 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) == &qword_124B6B0 )
return _stack_chk_guard;
}
if ( &pthread_create )
{
v14 = (unsigned int *)(v9 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v10);
return _stack_chk_guard;
}