//
// GameLevelManager::updateDescription from 0x7285a8 to 0x728ab8 (1296 bytes)
//
// 2 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x6e309c
// > ??> @ 0xbfcb8
//
// 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
//
__int64 __fastcall GameLevelManager::updateDescription(GameLevelManager *a1, unsigned int a2, __int64 *a3)
{
char *DescKey; // x24
cocos2d::CCDictionary *m_friendReqAndUserBlocks; // x21
__int64 v8; // x27
char *v9; // x0
__int64 result; // x0
cocos2d::CCDictionary *v11; // x28
cocos2d::CCNode *v12; // x27
char *v13; // x0
char *v14; // x0
__int64 v15; // x25
cocos2d::CCString *v16; // x0
const char *CString; // x0
cocos2d::CCString *v18; // x0
size_t v19; // x0
char *v20; // x0
char *v21; // x0
char *v22; // x0
char *v23; // x0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
const char *v38; // [xsp+68h] [xbp+68h]
char *v39; // [xsp+98h] [xbp+98h] BYREF
const char *v40; // [xsp+A0h] [xbp+A0h] BYREF
const char *v41; // [xsp+A8h] [xbp+A8h] BYREF
std::string v42; // [xsp+B0h] [xbp+B0h] BYREF
DescKey = (char *)GameLevelManager::getDescKey(a1, a2);
m_friendReqAndUserBlocks = a1->m_friendReqAndUserBlocks;
sub_D153B8((int)&v42, DescKey);
v8 = cocos2d::CCDictionary::objectForKey(m_friendReqAndUserBlocks, &v42);
v9 = (char *)v42.m_data.m_data - 24;
if ( (__int64 *)v42.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)((char *)v42.m_data.m_data - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v42.m_data.m_data - 2);
*((_DWORD *)v42.m_data.m_data - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v9);
}
result = 0;
if ( !v8 )
{
v11 = a1->m_friendReqAndUserBlocks;
v12 = cocos2d::CCNode::create();
sub_D153B8((int)&v42, DescKey);
cocos2d::CCDictionary::setObject((int)v11, v12);
v13 = (char *)v42.m_data.m_data - 24;
if ( (__int64 *)v42.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)((char *)v42.m_data.m_data - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v42.m_data.m_data - 2);
*((_DWORD *)v42.m_data.m_data - 2) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v13);
}
sub_D18D28(&v42);
GameLevelManager::removeDelimiterChars((__int64)a1, (unsigned __int8 **)&v42, 0);
v14 = (char *)v42.m_data.m_data - 24;
if ( (__int64 *)v42.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)((char *)v42.m_data.m_data - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *((_DWORD *)v42.m_data.m_data - 2);
*((_DWORD *)v42.m_data.m_data - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v14);
}
GameLevelManager::getBasePostString(a1, (__int64)&v39);
v15 = *a3;
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
CString = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&levelID=%i&levelDesc=%s&secret=%s",
(const char *)a2,
v15,
CString);
v38 = cocos2d::CCString::getCString(v18);
v19 = strlen(v38);
sub_D15FD4(&v39, v38, v19);
sub_D153B8((int)&v40, "https://www.boomlings.com/database/updateGJDesc20.php");
sub_D153B8((int)&v41, v39);
sub_D153B8((int)&v42, DescKey);
GameLevelManager::ProcessHttpRequest(a1, &v40, &v41, (cocos2d::extension::CCHttpClient **)&v42, 24);
v20 = (char *)v42.m_data.m_data - 24;
if ( (__int64 *)v42.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)((char *)v42.m_data.m_data - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v42.m_data.m_data - 2);
*((_DWORD *)v42.m_data.m_data - 2) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v20);
}
v21 = (char *)(v41 - 24);
if ( v41 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v41 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v21);
}
v22 = (char *)(v40 - 24);
if ( v40 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v40 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v40 - 2);
*((_DWORD *)v40 - 2) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v22);
}
v23 = v39 - 24;
if ( v39 - 24 == (char *)&qword_124B6B0 )
return 1;
if ( &pthread_create )
{
v26 = (unsigned int *)(v39 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v39 - 2);
*((_DWORD *)v39 - 2) = v27 - 1;
}
if ( v27 > 0 )
{
return 1;
}
else
{
operator delete(v23);
return 1;
}
}
return result;
}