//
// AccountLayer::backupAccountFailed from 0x1400943f0 to 0x1400946f6 (774 bytes)
//
// 2 xrefs:
// > ??> @ 0x140718b58
// > ??> @ 0x140912be4
//
// 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:26:01 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall AccountLayer::backupAccountFailed(__int64 a1, __int64 a2, int a3)
{
int v4; // esi
__int64 v6; // rdx
__int64 v7; // rcx
float v8; // xmm7_4
__int64 v9; // rcx
float v10; // xmm1_4
size_t v11; // rbx
cocos2d::CCString *v12; // rax
char *CString; // rax
size_t v14; // r8
char *v15; // rax
void **v16; // rdx
cocos2d::CCString *v17; // rax
const char *v18; // rax
void **v19; // r8
cocos2d::CCString *v20; // rax
void *v21; // rcx
__int16 v22; // [rsp+30h] [rbp-39h] BYREF
char v23; // [rsp+32h] [rbp-37h]
__int128 v24; // [rsp+40h] [rbp-29h] BYREF
__int64 v25; // [rsp+50h] [rbp-19h]
__int64 v26; // [rsp+58h] [rbp-11h]
void *Block[2]; // [rsp+68h] [rbp-1h] BYREF
__int64 v28; // [rsp+78h] [rbp+Fh]
unsigned __int64 v29; // [rsp+80h] [rbp+17h]
v4 = a2;
LOBYTE(a2) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 - 56) + 1040LL))(*(_QWORD *)(a1 - 56), a2);
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(a1 - 616) + 992LL))(a1 - 616, v6);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 88) + 336LL))(*(_QWORD *)(a1 + 88), 0);
v8 = (float)*(int *)(GJAccountManager::sharedState(v7) + 456) * 0.00000095367432;
v10 = (float)*(int *)(GJAccountManager::sharedState(v9) + 460) * 0.00000095367432;
*(_OWORD *)Block = 0;
v28 = 0;
v29 = 15;
LOBYTE(Block[0]) = 0;
v11 = -1;
if ( (float)(v10 + v8) <= 32.0 )
{
v15 = (char *)sub_14003D460(0x20u);
v28 = 27;
v29 = 31;
strcpy(v15, "Save size is within limits.");
Block[0] = v15;
}
else
{
v12 = cocos2d::CCString::createWithFormat(
"Size: %.2f/32MB. (Profile: %.2f, Levels: %.2f)",
(float)(v10 + v8),
v8,
v10);
CString = (char *)cocos2d::CCString::getCString(v12);
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_1400405A0(Block, CString, v14);
v15 = (char *)Block[0];
}
if ( v4 == -3 )
{
v19 = Block;
if ( v29 > 0xF )
v19 = (void **)v15;
v20 = cocos2d::CCString::createWithFormat("Backup failed. Error code: %i\n%s", a3, (const char *)v19);
v18 = cocos2d::CCString::getCString(v20);
v24 = 0;
v25 = 0;
v26 = 0;
do
++v11;
while ( v18[v11] );
}
else
{
if ( v4 == -2 )
{
v24 = 0;
*(_QWORD *)&v24 = sub_14003D460(0x40u);
v25 = 50;
v26 = 63;
strcpy((char *)v24, "Login failed. Please login to verify your account.");
goto LABEL_19;
}
v16 = Block;
if ( v29 > 0xF )
v16 = (void **)v15;
v17 = cocos2d::CCString::createWithFormat("Backup failed. Please try again later.\n%s", (const char *)v16);
v18 = cocos2d::CCString::getCString(v17);
v24 = 0;
v25 = 0;
v26 = 0;
do
++v11;
while ( v18[v11] );
}
sub_14003D230(&v24, v18, v11);
LABEL_19:
TextArea::setString(*(__int64 **)(a1 + 32), (__int64)&v24);
v22 = 19455;
v23 = 0;
TextArea::colorAllCharactersTo(*(_QWORD *)(a1 + 32), (__int64)&v22);
if ( v29 > 0xF )
{
v21 = Block[0];
if ( v29 + 1 >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
}