//
// PlatformToolbox::saveAndEncryptStringToFile from 0x1004c3ec0 to 0x1004c409a (474 bytes)
//
// 2 xrefs:
// > GManager::saveGMTo @ 0x1004ac397
// > GManager::saveData @ 0x1004ac4a1
//
// 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
//
id __fastcall PlatformToolbox::saveAndEncryptStringToFile(unsigned __int8 *a1, __int64 a2)
{
unsigned int v2; // ecx
NSData *v3; // rax
NSArray *v4; // rax
id v5; // rax
id v6; // r12
NSFileManager *v7; // rax
NSFileManager *v8; // rax
NSString *v9; // rax
id v10; // rbx
NSString *v11; // rax
NSString *v12; // rax
NSData *v13; // rax
id v14; // rax
NSData *v16; // [rsp+8h] [rbp-38h]
v2 = *a1;
if ( (v2 & 1) != 0 )
v3 = +[NSData dataWithBytes:length:](
&OBJC_CLASS___NSData,
"dataWithBytes:length:",
*((_QWORD *)a1 + 2),
*((_QWORD *)a1 + 1));
else
v3 = +[NSData dataWithBytes:length:](&OBJC_CLASS___NSData, "dataWithBytes:length:", a1 + 1, v2 >> 1);
v16 = v3;
if ( (*a1 & 1) != 0 )
{
**((_BYTE **)a1 + 2) = 0;
*((_QWORD *)a1 + 1) = 0;
}
else
{
*(_WORD *)a1 = 0;
}
v4 = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 1u, 1);
v5 = -[NSArray objectAtIndex:](v4, "objectAtIndex:", 0);
v6 = objc_msgSend(v5, "stringByAppendingPathComponent:", CFSTR("/GeometryDash"));
v7 = +[NSFileManager defaultManager](&OBJC_CLASS___NSFileManager, "defaultManager");
if ( !-[NSFileManager fileExistsAtPath:](v7, "fileExistsAtPath:", v6) )
{
v8 = +[NSFileManager defaultManager](&OBJC_CLASS___NSFileManager, "defaultManager");
-[NSFileManager createDirectoryAtPath:withIntermediateDirectories:attributes:error:](
v8,
"createDirectoryAtPath:withIntermediateDirectories:attributes:error:",
v6,
0,
0,
0);
}
v9 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:", a2);
v10 = objc_msgSend(v6, "stringByAppendingPathComponent:", v9);
v11 = +[NSString stringWithFormat:](
&OBJC_CLASS___NSString,
"stringWithFormat:",
CFSTR("%c%c%s%@%c%s%c%s%@%s"),
105,
112,
"u9TUv54y",
CFSTR("v]isFM"),
104,
"5@;t.5w3",
52,
"E2Ry@{",
CFSTR("lXrRCGEN"),
"IiB@");
v12 = +[NSString stringWithString:](&OBJC_CLASS___NSString, "stringWithString:", v11);
v13 = -[NSString dataUsingEncoding:](v12, "dataUsingEncoding:", 4);
v14 = -[NSData encryptedWithKey:](v16, "encryptedWithKey:", v13);
return objc_msgSend(v14, "writeToFile:atomically:", v10, 1);
}