//
// AutoSaveSettingsLayer::getCustomBackupDirectory from 0x14009cf80 to 0x14009d11c (412 bytes)
//
// 6 xrefs:
// > AutoSaveSettingsLayer::init @ 0x14009bd08
// > AutoSaveSettingsLayer::onOpenBackupDir @ 0x14009c85c
// > AutoSaveSettingsLayer::getBackupDirectory @ 0x14009d3ee
// > LevelEditorLayer::doAutoBackup @ 0x1404096c9
// > ??> @ 0x140912f2c
// > ??> @ 0x140912f38
//
// 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 11:26:05 +0000
//
// Hidden C++ exception states: #wind=2
_QWORD *__fastcall AutoSaveSettingsLayer::getCustomBackupDirectory(_QWORD *a1)
{
__int64 v2; // rax
__int64 v3; // rcx
cocos2d::CCString *v4; // rdi
void *v5; // r8
char *CString; // rax
size_t v7; // r8
void *v9; // [rsp+38h] [rbp-40h]
void *Block[2]; // [rsp+40h] [rbp-38h] BYREF
__int64 v11; // [rsp+50h] [rbp-28h]
unsigned __int64 v12; // [rsp+58h] [rbp-20h]
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v9 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
v3 = *(_QWORD *)(v2 + 440);
if ( v3 )
{
HIWORD(Block[1]) = 0;
v11 = 13;
v12 = 15;
strcpy((char *)Block, "autoBackupDir");
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v3, Block);
if ( v12 > 0xF )
{
v5 = Block[0];
if ( v12 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v5);
}
v11 = 0;
v12 = 15;
LOBYTE(Block[0]) = 0;
if ( v4 )
CString = (char *)cocos2d::CCString::getCString(v4);
else
CString = &byte_1406ED6E0;
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003D230(a1, CString, v7);
}
else
{
*(_OWORD *)a1 = 0;
a1[2] = 0;
a1[3] = 15;
*(_BYTE *)a1 = 0;
}
return a1;
}