//
// GameLevelManager::syncFollowing from 0x1005768a0 to 0x100576b95 (757 bytes)
//
// 1 xrefs:
// > GameLevelManager::syncFollowListIfNeeded @ 0x100576fa6
//
// 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:32:17 +0000
//
bool __fastcall GameLevelManager::syncFollowing(__int64 a1)
{
bool isDLActive; // al
__int64 v2; // r14
unsigned int i; // r15d
__int64 v4; // rax
const std::string::value_type *CString; // rax
__int64 v6; // rax
__int64 v7; // rax
const std::string::value_type *v8; // rax
const char *data; // r14
size_t v10; // rax
size_t v11; // r15
char *v12; // r12
size_t v13; // r13
char v15; // [rsp+0h] [rbp-C0h]
std::string v16; // [rsp+10h] [rbp-B0h] BYREF
__int128 v17; // [rsp+28h] [rbp-98h] BYREF
void *__p; // [rsp+38h] [rbp-88h]
std::string v19; // [rsp+40h] [rbp-80h] BYREF
_QWORD __dst[2]; // [rsp+58h] [rbp-68h] BYREF
void *v21; // [rsp+68h] [rbp-58h]
std::string v22; // [rsp+70h] [rbp-50h] BYREF
bool v23; // [rsp+97h] [rbp-29h]
isDLActive = GameLevelManager::isDLActive(a1, "following");
if ( !isDLActive )
{
v23 = 0;
GameLevelManager::addDLToActive(a1, "following");
memset(&v22, 0, sizeof(v22));
v2 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 776));
if ( v2 )
{
for ( i = 0; ; ++i )
{
if ( i >= (unsigned int)sub_1007FEF90(v2) )
goto LABEL_11;
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
break;
if ( v22.__r_.__value_.__l.__size_ )
goto LABEL_9;
LABEL_10:
v4 = sub_1007FEFE0(v2, i);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v4);
std::string::append(&v22, CString);
}
if ( !(*(_BYTE *)&v22.__r_.__value_.__l.0 >> 1) )
goto LABEL_10;
LABEL_9:
std::string::append(&v22, ",");
goto LABEL_10;
}
LABEL_11:
GameLevelManager::getBasePostString(&v19);
v6 = sub_10088E820("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v6);
v7 = sub_10088E820("&follows=%s&ack=1&secret=%s", v15);
v8 = (const std::string::value_type *)cocos2d::CCString::getCString(v7);
std::string::append(&v19, v8);
v16.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v16.__r_.__value_.__r.__words[0] = 57;
v16.__r_.__value_.__l.__size_ = 54;
strcpy(v16.__r_.__value_.__l.__data_, "https://www.boomlings.com/database/syncGJFollowing.php");
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
data = v19.__r_.__value_.__l.__data_;
else
data = v19.__r_.__value_.__s.__data_;
v10 = strlen(data);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
v21 = v12;
__dst[0] = v13 | 1;
__dst[1] = v11;
}
else
{
LOBYTE(__dst[0]) = 2 * v10;
v12 = (char *)__dst + 1;
if ( !v10 )
{
LABEL_22:
v12[v11] = 0;
LOBYTE(v17) = 18;
strcpy((char *)&v17 + 1, "following");
GameLevelManager::ProcessHttpRequest(a1, &v16, (__int64)__dst, &v17, 0x73u);
if ( (v17 & 1) != 0 )
{
operator delete(__p);
if ( (__dst[0] & 1) == 0 )
{
LABEL_24:
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_25;
goto LABEL_32;
}
}
else if ( (__dst[0] & 1) == 0 )
{
goto LABEL_24;
}
operator delete(v21);
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_25:
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_26;
goto LABEL_33;
}
LABEL_32:
operator delete(v16.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_26:
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_28:
isDLActive = v23;
return !isDLActive;
}
LABEL_27:
operator delete(v22.__r_.__value_.__l.__data_);
goto LABEL_28;
}
LABEL_33:
operator delete(v19.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v22.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_28;
goto LABEL_27;
}
}
memmove(v12, data, v11);
goto LABEL_22;
}
return !isDLActive;
}