//
// sub_100982F10 from 0x100982f10 to 0x100983358 (1096 bytes)
//
// 1 xrefs:
// > sub_100982340 @ 0x1009827f8
//
// 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:39:01 +0000
//
void __fastcall sub_100982F10(__int64 a1)
{
char v1; // al
char *v2; // rax
_BYTE *v3; // rcx
__int64 v4; // rcx
unsigned __int8 *v5; // rax
int v6; // r14d
__int64 v7; // rsi
unsigned int v8; // edx
const char *v9; // rdx
const char *v10; // rcx
char *v11; // rax
std::string::pointer v12; // rdi
char *v13; // rax
char *v14; // rax
const char *CString; // r14
size_t v16; // rax
std::string::size_type v17; // r15
char *data; // r12
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v19; // r14
size_t v20; // r13
char *v21; // rbx
char *v22; // r15
char *v23; // rbx
void *v24; // rdi
__int128 v25; // [rsp+0h] [rbp-F0h] BYREF
void *v26; // [rsp+10h] [rbp-E0h]
__int128 v27; // [rsp+18h] [rbp-D8h] BYREF
void *v28; // [rsp+28h] [rbp-C8h]
__int128 v29; // [rsp+30h] [rbp-C0h] BYREF
void *v30; // [rsp+40h] [rbp-B0h]
__int128 v31; // [rsp+50h] [rbp-A0h] BYREF
char *v32; // [rsp+60h] [rbp-90h]
__int128 v33; // [rsp+68h] [rbp-88h] BYREF
char *v34; // [rsp+78h] [rbp-78h]
void *v35[2]; // [rsp+80h] [rbp-70h] BYREF
__int64 v36; // [rsp+90h] [rbp-60h]
unsigned __int8 v37[16]; // [rsp+98h] [rbp-58h] BYREF
void *__p; // [rsp+A8h] [rbp-48h]
std::string __dst; // [rsp+B0h] [rbp-40h] BYREF
*(_OWORD *)v35 = 0;
v36 = 0;
sub_1005BDF10((__int64)&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
if ( !__dst.__r_.__value_.__l.__size_ )
goto LABEL_9;
v1 = *(_BYTE *)(__dst.__r_.__value_.__r.__words[2] + __dst.__r_.__value_.__l.__size_ - 1);
if ( v1 == 47 )
goto LABEL_9;
}
else
{
if ( !*(_BYTE *)&__dst.__r_.__value_.__s.0 )
goto LABEL_9;
v1 = *((_BYTE *)&__dst.__r_.__value_.__l.0 + (*(_BYTE *)&__dst.__r_.__value_.__l.0 >> 1));
if ( v1 == 47 )
goto LABEL_9;
}
if ( v1 != 92 )
std::string::append(&__dst, "/");
LABEL_9:
*(_WORD *)v37 = 0;
sub_10097F2B0(&__dst, v35, v37);
if ( (v37[0] & 1) == 0 )
{
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_11;
LABEL_25:
operator delete(__dst.__r_.__value_.__l.__data_);
v2 = (char *)v35[0];
v3 = v35[1];
if ( v35[0] != v35[1] )
goto LABEL_12;
LABEL_26:
LOBYTE(v31) = 20;
strcpy((char *)&v31 + 1, "No backups");
LOWORD(v25) = 0;
v11 = TextAlertPopup::create(&v31, 0x96u, &v25, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v11, 100);
if ( (v25 & 1) != 0 )
operator delete(v26);
if ( (v31 & 1) != 0 )
{
v12 = v32;
goto LABEL_52;
}
goto LABEL_53;
}
operator delete(__p);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_25;
LABEL_11:
v2 = (char *)v35[0];
v3 = v35[1];
if ( v35[0] == v35[1] )
goto LABEL_26;
LABEL_12:
v4 = ((v3 - v2) >> 7 == 0) + ((v3 - v2) >> 7);
v5 = (unsigned __int8 *)(v2 + 24);
v6 = 0;
v7 = 0;
do
{
v8 = *v5;
if ( (v8 & 1) != 0 )
{
if ( !*((_QWORD *)v5 + 1) )
goto LABEL_15;
LABEL_14:
v7 += *((_QWORD *)v5 + 12);
++v6;
goto LABEL_15;
}
if ( v8 >> 1 )
goto LABEL_14;
LABEL_15:
v5 += 128;
--v4;
}
while ( v4 );
if ( v6 )
{
sub_1006494B0(v37);
v9 = "s";
if ( v6 == 1 )
v9 = "";
if ( (v37[0] & 1) != 0 )
v10 = (const char *)__p;
else
v10 = (const char *)&v37[1];
v14 = sub_10088E820("Delete all %i backup%s (%s)?\nThis cannot be undone.", v6, v9, v10);
CString = (const char *)cocos2d::CCString::getCString((__int64)v14);
v16 = strlen(CString);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v17 = v16;
if ( v16 >= 0x17 )
{
v20 = 26;
if ( (v16 | 7) != 0x17 )
v20 = (v16 | 7) + 1;
data = (char *)operator new(v20);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v20 | 1;
__dst.__r_.__value_.__l.__size_ = v17;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v16);
data = __dst.__r_.__value_.__s.__data_;
if ( !v16 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
if ( (v37[0] & 1) != 0 )
goto LABEL_39;
goto LABEL_40;
}
}
memmove(data, CString, v17);
data[v17] = 0;
if ( (v37[0] & 1) != 0 )
LABEL_39:
operator delete(__p);
LABEL_40:
v19 = __dst.__r_.__value_.__s.0;
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v29, __dst.__r_.__value_.__l.__data_, __dst.__r_.__value_.__l.__size_);
}
else
{
v30 = __dst.__r_.__value_.__l.__data_;
v29 = *(_OWORD *)&__dst.__r_.__value_.__l.0;
}
v21 = FLAlertLayer::create((int)a1 + 1016, (int)"Delete All", &v29, (int)"Back", (int)"Delete", 0, 380.0, 0.0, 1.0);
if ( (v29 & 1) != 0 )
operator delete(v30);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v21 + 72LL))(v21, 2);
(*(void (__fastcall **)(char *))(*(_QWORD *)v21 + 1312LL))(v21);
if ( (*(_BYTE *)&v19 & 1) != 0 )
{
v12 = __dst.__r_.__value_.__l.__data_;
LABEL_52:
operator delete(v12);
}
}
else
{
LOBYTE(v33) = 20;
strcpy((char *)&v33 + 1, "No backups");
LOWORD(v27) = 0;
v13 = TextAlertPopup::create(&v33, 0x96u, &v27, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v13, 100);
if ( (v27 & 1) != 0 )
operator delete(v28);
if ( (v33 & 1) != 0 )
{
v12 = v34;
goto LABEL_52;
}
}
LABEL_53:
v22 = (char *)v35[0];
if ( v35[0] )
{
v23 = (char *)v35[1];
v24 = v35[0];
if ( v35[1] != v35[0] )
{
do
{
v23 -= 128;
sub_1009865F0(v35, v23);
}
while ( v23 != v22 );
v24 = v35[0];
}
v35[1] = v22;
operator delete(v24);
}
}