//
// AccountLayer::backupAccountFailed from 0x1000cd4a0 to 0x1000cd7d8 (824 bytes)
//
// 2 xrefs:
// > sub_1000CD840 @ 0x1000cd84c
// > ??> @ 0x1008b8920
//
// 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
//
void __fastcall AccountLayer::backupAccountFailed(AccountLayer *a1, BackupAccountError a2, int a3)
{
float v4; // xmm2_4
double v5; // xmm0_8
cocos2d::CCString *v6; // rax
const char *CString; // rax
TextArea *m_textArea; // r14
void **v9; // rax
cocos2d::CCString *v10; // rax
const char *v11; // r15
size_t v12; // rax
size_t v13; // r12
char *v14; // r13
TextArea *v15; // r14
cocos2d::CCString *v16; // rax
const char *v17; // r15
size_t v18; // rax
size_t v19; // r12
char *v20; // r13
TextArea *v21; // r14
size_t v22; // r14
size_t v23; // r14
_QWORD v24[2]; // [rsp+0h] [rbp-90h] BYREF
char *v25; // [rsp+10h] [rbp-80h] BYREF
_QWORD __dst[2]; // [rsp+18h] [rbp-78h] BYREF
char *v27; // [rsp+28h] [rbp-68h] BYREF
_QWORD v28[2]; // [rsp+30h] [rbp-60h] BYREF
char *v29; // [rsp+40h] [rbp-50h] BYREF
std::string v30; // [rsp+48h] [rbp-48h] BYREF
TextArea *v31; // [rsp+60h] [rbp-30h]
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_buttonMenu->setEnabled)(a1->m_buttonMenu, 1);
((void (__fastcall *)(AccountLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 0);
*(float *)&v31 = (float)GJAccountManager::sharedState()->m_gameManagerSize * 0.00000095367432;
v4 = (float)GJAccountManager::sharedState()->m_localLevelsSize * 0.00000095367432;
*(_WORD *)&v30.__r_.__value_.__l.0 = 0;
*(_QWORD *)&v5 = (unsigned int)v31;
*(float *)&v5 = *(float *)&v31 + v4;
if ( (float)(*(float *)&v31 + v4) <= 32.0 )
{
std::string::assign(&v30, "Save size is within limits.");
}
else
{
v5 = *(float *)&v5;
v6 = (cocos2d::CCString *)sub_1007AB580("Size: %.2f/32MB. (Profile: %.2f, Levels: %.2f)", v24[0]);
CString = cocos2d::CCString::getCString(v6);
std::string::assign(&v30, CString);
}
m_textArea = a1->m_textArea;
if ( a2 == BackupOrSyncFailed )
{
v31 = a1->m_textArea;
v10 = (cocos2d::CCString *)sub_1007AB580("Backup failed. Error code: %i\n%s", v24[0]);
v11 = cocos2d::CCString::getCString(v10);
v12 = strlen(v11);
if ( v12 > 0xFFFFFFFFFFFFFFF7LL )
goto LABEL_32;
v13 = v12;
if ( v12 >= 0x17 )
{
v22 = 26;
if ( (v12 | 7) != 0x17 )
v22 = (v12 | 7) + 1;
v14 = (char *)operator new(v22);
v27 = v14;
__dst[0] = v22 | 1;
__dst[1] = v13;
v15 = v31;
}
else
{
LOBYTE(__dst[0]) = 2 * v12;
v14 = (char *)__dst + 1;
v15 = v31;
if ( !v12 )
goto LABEL_20;
}
memmove(v14, v11, v13);
LABEL_20:
v14[v13] = 0;
TextArea::setString(v15, __dst);
if ( (__dst[0] & 1) == 0 )
goto LABEL_29;
v9 = (void **)&v27;
goto LABEL_28;
}
if ( a2 == LoginFailed )
{
v25 = (char *)operator new(0x38u);
v24[0] = 57;
v24[1] = 50;
strcpy(v25, "Login failed. Please login to verify your account.");
TextArea::setString(m_textArea, v24);
if ( (v24[0] & 1) == 0 )
goto LABEL_29;
v9 = (void **)&v25;
goto LABEL_28;
}
v31 = a1->m_textArea;
v16 = (cocos2d::CCString *)sub_1007AB580("Backup failed. Please try again later.\n%s", v24[0]);
v17 = cocos2d::CCString::getCString(v16);
v18 = strlen(v17);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_32:
sub_100006BF0(v5);
v19 = v18;
if ( v18 >= 0x17 )
{
v23 = 26;
if ( (v18 | 7) != 0x17 )
v23 = (v18 | 7) + 1;
v20 = (char *)operator new(v23);
v29 = v20;
v28[0] = v23 | 1;
v28[1] = v19;
v21 = v31;
}
else
{
LOBYTE(v28[0]) = 2 * v18;
v20 = (char *)v28 + 1;
v21 = v31;
if ( !v18 )
goto LABEL_26;
}
memmove(v20, v17, v19);
LABEL_26:
v20[v19] = 0;
TextArea::setString(v21, v28);
if ( (v28[0] & 1) == 0 )
goto LABEL_29;
v9 = (void **)&v29;
LABEL_28:
operator delete(*v9);
LABEL_29:
TextArea::colorAllCharactersTo(a1->m_textArea, (cocos2d::ccColor3B)19455);
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v30.__r_.__value_.__l.__data_);
}