//
// AutoSaveSettingsLayer::onSelectBackupDir from 0x14009c610 to 0x14009c828 (536 bytes)
//
// 2 xrefs:
// > AutoSaveSettingsLayer::init @ 0x14009bb0f
// > ??> @ 0x140912f14
//
// 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=4
void __fastcall AutoSaveSettingsLayer::onSelectBackupDir(__int64 a1)
{
void **v2; // rdx
__int64 v3; // rbx
__int64 v4; // rax
__int64 v5; // rdi
__int64 v6; // rax
void *v7; // rcx
void *v8; // rcx
void *v9; // [rsp+38h] [rbp-21h]
_BYTE v10[32]; // [rsp+40h] [rbp-19h] BYREF
void *Src[2]; // [rsp+60h] [rbp+7h] BYREF
size_t Size; // [rsp+70h] [rbp+17h]
unsigned __int64 v13; // [rsp+78h] [rbp+1Fh]
void *Block[2]; // [rsp+80h] [rbp+27h] BYREF
__int64 v15; // [rsp+90h] [rbp+37h]
unsigned __int64 v16; // [rsp+98h] [rbp+3Fh]
*(_OWORD *)Src = 0;
Size = 0;
v13 = 15;
LOBYTE(Src[0]) = 0;
if ( GameToolbox::showFolderDialog("Select Backup Directory", (LPSTR *)Src) )
{
if ( (void **)(a1 + 1016) != Src )
{
v2 = Src;
if ( v13 > 0xF )
v2 = (void **)Src[0];
sub_1400405A0((void **)(a1 + 1016), v2, Size);
}
v3 = sub_14003F4F0((__int64)v10, a1 + 1016);
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v9 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
v5 = *(_QWORD *)(v4 + 440);
if ( v5 )
{
v15 = 13;
v16 = 15;
strcpy((char *)Block, "autoBackupDir");
HIWORD(Block[1]) = 0;
v6 = cocos2d::CCString::create(v3);
cocos2d::CCDictionary::setObject(v5, v6, Block);
if ( v16 > 0xF )
{
v7 = Block[0];
if ( v16 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
}
sub_14003D310(v3);
AutoSaveSettingsLayer::updateBackupDirLabel(a1);
}
if ( v13 > 0xF )
{
v8 = Src[0];
if ( v13 + 1 >= 0x1000 )
{
v8 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v8 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v8);
}
}