//
// GManager::waitForSave from 0x1002e7bcc to 0x1002e7c4c (128 bytes)
//
// 8 xrefs:
// > GManager::save @ 0x1002e7b30
// > AppDelegate::applicationWillTerminate @ 0x10030717c
// > AppDelegate::applicationWillTerminate @ 0x10030718c
// > AppDelegate::trySaveGame @ 0x100307494
// > AppDelegate::trySaveGame @ 0x1003074a0
// > sub_1003074F8 @ 0x10030752c
// > sub_1003074F8 @ 0x100307538
// > EditorPauseLayer::saveLevel @ 0x1004449f0
//
// 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 11:02:51 +0000
//
std::chrono::steady_clock::time_point __fastcall GManager::waitForSave(__int64 a1, double a2)
{
std::chrono::duration>::rep rep; // x19
double v5; // d8
unsigned __int8 *v6; // x20
unsigned __int8 v7; // w8
std::chrono::nanoseconds __ns; // [xsp+8h] [xbp-38h] BYREF
std::chrono::steady_clock::time_point result; // 0:x0.8
result.__d_.__rep_ = std::chrono::steady_clock::now().__d_.__rep_;
rep = result.__d_.__rep_;
v5 = a2 * 1000000000.0;
v6 = (unsigned __int8 *)(a1 + 345);
do
{
v7 = atomic_load(v6);
if ( (v7 & 1) == 0 )
break;
__ns.__rep_ = 10000000;
std::this_thread::sleep_for(&__ns);
result.__d_.__rep_ = std::chrono::steady_clock::now().__d_.__rep_;
}
while ( v5 >= (double)(result.__d_.__rep_ - rep) );
return result;
}