//
// AccountLayer::backupAccountFailed from 0x10009b8f0 to 0x10009bc28 (824 bytes)
//
// 2 xrefs:
// > sub_10009BC90 @ 0x10009bc9c
// > ??> @ 0x100abbf08
//
// 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 12:20:12 +0000
//
void __fastcall AccountLayer::backupAccountFailed(__int64 a1, int a2)
{
__int64 v3; // rdi
float v4; // xmm2_4
__int64 v5; // rax
const std::string::value_type *CString; // rax
__int64 v7; // r14
void **v8; // rax
__int64 v9; // rax
const char *v10; // r15
size_t v11; // rax
size_t v12; // r12
char *v13; // r13
__int64 v14; // r14
__int64 v15; // rax
const char *v16; // r15
size_t v17; // rax
size_t v18; // r12
char *v19; // r13
__int64 v20; // r14
size_t v21; // r14
size_t v22; // r14
_QWORD v23[2]; // [rsp+0h] [rbp-90h] BYREF
char *v24; // [rsp+10h] [rbp-80h] BYREF
_QWORD __dst[2]; // [rsp+18h] [rbp-78h] BYREF
char *v26; // [rsp+28h] [rbp-68h] BYREF
_QWORD v27[2]; // [rsp+30h] [rbp-60h] BYREF
char *v28; // [rsp+40h] [rbp-50h] BYREF
std::string v29; // [rsp+48h] [rbp-48h] BYREF
float v30[12]; // [rsp+60h] [rbp-30h]
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 560) + 1272LL))(*(_QWORD *)(a1 + 560), 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v3 = *(_QWORD *)(a1 + 704);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v3 + 344LL))(v3, 0);
v30[0] = (float)*(int *)(GJAccountManager::sharedState(v3) + 440) * 0.00000095367432;
v4 = (float)*(int *)(GJAccountManager::sharedState(v3) + 444) * 0.00000095367432;
*(_WORD *)&v29.__r_.__value_.__l.0 = 0;
if ( (float)(v30[0] + v4) <= 32.0 )
{
std::string::assign(&v29, "Save size is within limits.");
}
else
{
v5 = sub_10088E820("Size: %.2f/32MB. (Profile: %.2f, Levels: %.2f)", v23[0]);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v5);
std::string::assign(&v29, CString);
}
v7 = *(_QWORD *)(a1 + 648);
if ( a2 == -3 )
{
*(_QWORD *)v30 = *(_QWORD *)(a1 + 648);
v9 = sub_10088E820("Backup failed. Error code: %i\n%s", v23[0]);
v10 = (const char *)cocos2d::CCString::getCString(v9);
v11 = strlen(v10);
if ( v11 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_32;
v12 = v11;
if ( v11 >= 0x17 )
{
v21 = 26;
if ( (v11 | 7) != 0x17 )
v21 = (v11 | 7) + 1;
v13 = (char *)operator new(v21);
v26 = v13;
__dst[0] = v21 | 1;
__dst[1] = v12;
v14 = *(_QWORD *)v30;
}
else
{
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
v14 = *(_QWORD *)v30;
if ( !v11 )
goto LABEL_20;
}
memmove(v13, v10, v12);
LABEL_20:
v13[v12] = 0;
TextArea::setString(v14, __dst);
if ( (__dst[0] & 1) == 0 )
goto LABEL_29;
v8 = (void **)&v26;
goto LABEL_28;
}
if ( a2 == -2 )
{
v24 = (char *)operator new(0x38u);
v23[0] = 57;
v23[1] = 50;
strcpy(v24, "Login failed. Please login to verify your account.");
TextArea::setString(v7, v23);
if ( (v23[0] & 1) == 0 )
goto LABEL_29;
v8 = (void **)&v24;
goto LABEL_28;
}
*(_QWORD *)v30 = *(_QWORD *)(a1 + 648);
v15 = sub_10088E820("Backup failed. Please try again later.\n%s", v23[0]);
v16 = (const char *)cocos2d::CCString::getCString(v15);
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_32:
sub_100003630();
v18 = v17;
if ( v17 >= 0x17 )
{
v22 = 26;
if ( (v17 | 7) != 0x17 )
v22 = (v17 | 7) + 1;
v19 = (char *)operator new(v22);
v28 = v19;
v27[0] = v22 | 1;
v27[1] = v18;
v20 = *(_QWORD *)v30;
}
else
{
LOBYTE(v27[0]) = 2 * v17;
v19 = (char *)v27 + 1;
v20 = *(_QWORD *)v30;
if ( !v17 )
goto LABEL_26;
}
memmove(v19, v16, v18);
LABEL_26:
v19[v18] = 0;
TextArea::setString(v20, v27);
if ( (v27[0] & 1) == 0 )
goto LABEL_29;
v8 = (void **)&v28;
LABEL_28:
operator delete(*v8);
LABEL_29:
TextArea::colorAllCharactersTo(*(_QWORD *)(a1 + 648), 19455);
if ( (*(_BYTE *)&v29.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v29.__r_.__value_.__l.__data_);
}