//
// AutoSaveSettingsLayer::getCustomBackupDirectory from 0x1005bd6e0 to 0x1005bd805 (293 bytes)
//
// 4 xrefs:
// > sub_1000D5780 @ 0x1000d5931
// > AutoSaveSettingsLayer::init @ 0x1005bd1a3
// > sub_1005BD5B0 @ 0x1005bd5c0
// > sub_1005BDF10 @ 0x1005bdf20
//
// This function is hookable on this platform (idp: pc, 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 12:32:45 +0000
//
_QWORD *__fastcall AutoSaveSettingsLayer::getCustomBackupDirectory(_QWORD *a1)
{
__int64 v2; // rdi
__int64 v3; // r14
const char *CString; // r14
size_t v5; // rax
size_t v6; // r15
char *v7; // r12
char *v8; // r12
size_t v9; // r13
char v11; // [rsp+0h] [rbp-40h] BYREF
void *v12[7]; // [rsp+1h] [rbp-3Fh] BYREF
v2 = *(_QWORD *)(GameManager::sharedState() + 432);
if ( v2 )
{
v11 = 26;
strcpy((char *)v12, "autoBackupDir");
v3 = cocos2d::CCDictionary::objectForKey(v2, &v11);
if ( (v11 & 1) != 0 )
operator delete(*(void **)((char *)&v12[1] + 7));
if ( v3 )
{
CString = (const char *)cocos2d::CCString::getCString(v3);
v5 = strlen(CString);
if ( v5 < 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_6;
}
else
{
CString = "";
v5 = strlen("");
if ( v5 < 0xFFFFFFFFFFFFFFF8LL )
{
LABEL_6:
v6 = v5;
if ( v5 >= 0x17 )
{
v9 = 26;
if ( (v5 | 7) != 0x17 )
v9 = (v5 | 7) + 1;
v7 = (char *)operator new(v9);
a1[2] = v7;
*a1 = v9 + 1;
a1[1] = v6;
}
else
{
*(_BYTE *)a1 = 2 * v5;
v7 = (char *)a1 + 1;
if ( !v5 )
goto LABEL_14;
}
memmove(v7, CString, v6);
LABEL_14:
v8 = &v7[v6];
goto LABEL_15;
}
}
sub_100003630();
}
*(_BYTE *)a1 = 0;
v8 = (char *)a1 + 1;
LABEL_15:
*v8 = 0;
return a1;
}