//
// GameLevelManager::onRestoreItemsCompleted from 0x140260820 to 0x140260b11 (753 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140219d28
// > ??> @ 0x14091c7c0
//
// 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:28:47 +0000
//
// 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
cocos2d::CCObject *v10; // rbx
__int64 v11; // rax
cocos2d::CCObject *v12; // rbx
__int64 v13; // rax
_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
__m128i si128; // [rsp+A0h] [rbp+27h]
v15 = a2;
v16 = a3;
Block[1] = (void *)31077;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
Block[0] = (void *)0x4B65726F74736572LL;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 1192), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v5 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v5);
}
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 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;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 22;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "No restore data found.");
v9 = sub_14003F4F0((__int64)v14, (__int64)Block);
v10 = FLAlertLayer::create(0, (int)"Error", v9, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003D310((__int64)Block);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v10 + 1064LL))(v10);
}
else
{
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 28;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Your data has been restored.");
v11 = sub_14003F4F0((__int64)v14, (__int64)Block);
v12 = FLAlertLayer::create(0, (int)"Data restored", v11, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003D310((__int64)Block);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v12 + 1064LL))(v12);
v13 = sub_14003F4F0((__int64)v14, (__int64)a2);
sub_14003D310(v13);
}
sub_14003D310((__int64)a2);
sub_14003D310(a3);
}