//
// AppDelegate::trySaveGame from 0x6e65e8 to 0x6e672c (324 bytes)
//
// 2 xrefs:
// > ??> @ 0x72b50
// > ??> @ 0x1425220
//
// This function is hookable on this platform (idp: arm, 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:51:43 +0000
//
__int64 __fastcall AppDelegate::trySaveGame(AppDelegate *this, unsigned __int8 a2)
{
int v3; // w21
__int64 v4; // x0
GManager *v6; // x0
LocalLevelManager *v7; // x0
int v8; // w23
LocalLevelManager *v9; // x0
GManager *v10; // x0
GManager *v11; // x0
LocalLevelManager *v12; // x0
GManager *v13; // x0
__int64 v14; // [xsp+48h] [xbp+48h] BYREF
__int64 v15; // [xsp+50h] [xbp+50h]
v3 = a2;
if ( a2 )
{
*((_QWORD *)this + 5) = 0;
goto LABEL_3;
}
if ( *((double *)this + 5) == 0.0 )
{
LABEL_3:
v4 = *((unsigned __int8 *)this + 32);
if ( !*((_BYTE *)this + 32) )
goto LABEL_4;
LABEL_9:
v6 = (GManager *)GameManager::sharedState((GameManager *)v4);
v7 = (LocalLevelManager *)GManager::save(v6, v3 ^ 1u);
v8 = (unsigned __int8)v7;
v9 = (LocalLevelManager *)LocalLevelManager::sharedState(v7);
*((_BYTE *)v9 + 576) = v3 ^ 1;
v10 = (GManager *)LocalLevelManager::sharedState(v9);
v4 = (unsigned __int8)GManager::save(v10, v3 ^ 1u);
if ( (_BYTE)v4 || v8 )
{
clock_gettime(0, (struct timespec *)&v14);
v4 = v14;
*((double *)this + 5) = (double)v14 + (double)v15 / 1000000000.0;
}
if ( v3 )
{
v11 = (GManager *)GameManager::sharedState((GameManager *)v4);
v12 = (LocalLevelManager *)GManager::waitForSave(v11, 30.0);
v13 = (GManager *)LocalLevelManager::sharedState(v12);
v4 = GManager::waitForSave(v13, 30.0);
}
goto LABEL_4;
}
clock_gettime(0, (struct timespec *)&v14);
if ( (double)v14 + (double)v15 / 1000000000.0 - *((double *)this + 5) < 10.0 )
return _stack_chk_guard;
v4 = *((unsigned __int8 *)this + 32);
if ( *((_BYTE *)this + 32) )
goto LABEL_9;
LABEL_4:
PlatformToolbox::gameDidSave((PlatformToolbox *)v4);
return _stack_chk_guard;
}