//
// GameLevelManager::onRestoreItemsCompleted from 0x140169b40 to 0x140169e36 (758 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x1401434e8
// > ??> @ 0x1406cad1c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=5
void __fastcall GameLevelManager::onRestoreItemsCompleted(__int64 a1, const void **a2, __int64 a3)
{
void *v5; // rcx
const void *v6; // rcx
unsigned __int64 v7; // rbx
size_t v8; // r8
__int64 v9; // rax
FLAlertLayer *v10; // rbx
__int64 v11; // rax
__int64 v12; // rax
FLAlertLayer *v13; // rbx
_BYTE v14[32]; // [rsp+60h] [rbp-19h] BYREF
const void **v15; // [rsp+80h] [rbp+7h]
__int64 v16; // [rsp+88h] [rbp+Fh]
void *Block[2]; // [rsp+90h] [rbp+17h] BYREF
__int64 v18; // [rsp+A0h] [rbp+27h]
unsigned __int64 v19; // [rsp+A8h] [rbp+2Fh]
v15 = a2;
v16 = a3;
Block[1] = (void *)31077;
v18 = 10;
v19 = 15;
Block[0] = (void *)0x4B65726F74736572LL;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 584), Block);
if ( v19 > 0xF )
{
v5 = Block[0];
if ( v19 + 1 >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
*(_OWORD *)Block = 0;
v18 = 2;
v19 = 15;
strcpy((char *)Block, "-1");
v6 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v6 = *a2;
v7 = (unsigned __int64)a2[2];
v8 = v7;
if ( v7 > 2 )
v8 = 2;
if ( !memcmp(v6, Block, v8) && v7 == 2 )
{
*(_OWORD *)Block = 0;
v18 = 0;
v19 = 15;
Block[0] = sub_14003AA10(0x20u);
v18 = 22;
v19 = 31;
strcpy((char *)Block[0], "No restore data found.");
v12 = sub_14003BDB0((__int64)v14, (__int64)Block);
v13 = FLAlertLayer::create(0, (int)"Error", v12, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v13->show(v13);
}
else
{
*(_OWORD *)Block = 0;
v18 = 0;
v19 = 15;
Block[0] = sub_14003AA10(0x20u);
v18 = 28;
v19 = 31;
strcpy((char *)Block[0], "Your data has been restored.");
v9 = sub_14003BDB0((__int64)v14, (__int64)Block);
v10 = FLAlertLayer::create(0, (int)"Data restored", v9, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)Block);
v10->show(v10);
v11 = sub_14003BDB0((__int64)v14, (__int64)a2);
sub_14003A830(v11);
}
sub_14003A830((__int64)a2);
sub_14003A830(a3);
}