//
// AppDelegate::trySaveGame from 0x3f6c28 to 0x3f6d14 (236 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:47:17 +0000
//
void __fastcall AppDelegate::trySaveGame(AppDelegate *this, int a2, int a3, int a4)
{
AppDelegate *v4; // r4
GManager *v6; // r0
LocalLevelManager *v7; // r8
LocalLevelManager *v8; // r0
GManager *v9; // r0
GManager *v10; // r0
LocalLevelManager *v11; // r0
GManager *v12; // r0
int v13; // [sp+4h] [bp-Ch] BYREF
int v14; // [sp+8h] [bp-8h]
int v15; // [sp+Ch] [bp-4h]
v13 = a2;
v14 = a3;
v15 = a4;
v4 = this;
if ( a2 )
*((_QWORD *)this + 3) = 0;
if ( *((double *)this + 3) == 0.0
|| (this = (AppDelegate *)clock_gettime(0, (struct timespec *)&v13),
(double)v13 + (double)v14 / 1000000000.0 - *((double *)v4 + 3) >= 10.0) )
{
if ( *((_BYTE *)v4 + 16) )
{
v6 = (GManager *)GameManager::sharedState(this);
v7 = (LocalLevelManager *)GManager::save(v6, a2 ^ 1);
v8 = (LocalLevelManager *)LocalLevelManager::sharedState(v7);
*((_BYTE *)v8 + 376) = a2 ^ 1;
v9 = (GManager *)LocalLevelManager::sharedState(v8);
this = (AppDelegate *)GManager::save(v9, a2 ^ 1);
if ( this || v7 )
{
this = (AppDelegate *)clock_gettime(0, (struct timespec *)&v13);
*((double *)v4 + 3) = (double)v13 + (double)v14 / 1000000000.0;
}
if ( a2 )
{
v10 = (GManager *)GameManager::sharedState(this);
v11 = (LocalLevelManager *)GManager::waitForSave(v10, 30.0);
v12 = (GManager *)LocalLevelManager::sharedState(v11);
this = (AppDelegate *)GManager::waitForSave(v12, 30.0);
}
}
PlatformToolbox::gameDidSave(this);
}
}