//
// GameLevelManager::getDifficultyStr from 0x6f4964 to 0x6f4cfc (920 bytes)
//
// 2 xrefs:
// > LevelSearchLayer::getSearchDiffKey @ 0x6cee9c
// > ??> @ 0x2c220
//
// 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 **__usercall GameLevelManager::getDifficultyStr@(
GameLevelManager *this@,
char a2@,
unsigned __int8 a3@,
unsigned __int8 a4@,
unsigned __int8 a5@,
unsigned __int8 a6@,
unsigned __int8 a7@,
char a8@,
void **a9@,
bool a10)
{
int v10; // w25
int v12; // w27
int v13; // w19
int v14; // w23
unsigned int v15; // w22
const char *v16; // x2
const char *v17; // x1
int v18; // w0
const char *v19; // kr00_8
cocos2d::CCString *v21; // x0
size_t v22; // x0
_DWORD *v23; // x22
unsigned __int64 v24; // x20
unsigned __int64 v25; // x23
size_t v26; // x2
int v27; // w19
__int64 v28; // x20
char *v29; // x0
char *v30; // x19
char *v31; // x0
unsigned int *v32; // x19
int v33; // w1
cocos2d::CCString *v34; // x0
char *v35; // x0
unsigned int *v36; // x22
int v37; // w1
int v38; // [xsp+74h] [xbp+74h]
int v39; // [xsp+78h] [xbp+78h]
int v40; // [xsp+7Ch] [xbp+7Ch]
const char *CString; // [xsp+88h] [xbp+88h]
void *v42; // [xsp+A8h] [xbp+A8h] BYREF
void *v43; // [xsp+B0h] [xbp+B0h] BYREF
v40 = a4;
v10 = a3;
v39 = a6;
v38 = a7;
v12 = a5;
if ( a2 )
{
sub_D153B8((int)a9, "-1");
return a9;
}
if ( a8 )
{
sub_D153B8((int)a9, "-2");
return a9;
}
if ( a10 )
{
sub_D153B8((int)a9, "-3");
return a9;
}
v13 = 2;
v14 = 0;
v15 = 1;
sub_D153B8((int)&v42, &byte_F288A0);
v17 = nullptr;
v18 = -1;
LABEL_5:
v19 = v16;
v16 = "&levelsInfo=";
switch ( v18 )
{
case 0:
if ( v40 )
goto LABEL_9;
goto LABEL_31;
case 1:
if ( v12 )
goto LABEL_9;
goto LABEL_31;
case 2:
if ( !v39 )
goto LABEL_31;
goto LABEL_9;
case 3:
if ( v38 )
goto LABEL_9;
if ( v14 == 1 )
goto LABEL_40;
goto LABEL_14;
default:
v16 = v19;
break;
}
while ( 1 )
{
if ( v10 )
{
LABEL_9:
if ( v14 )
sub_D15FD4(&v42, &byte_F804F8, 1);
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v15);
CString = cocos2d::CCString::getCString(v21);
v22 = strlen(CString);
sub_D15FD4(&v42, CString, v22);
++v14;
v17 = (const char *)v15;
}
if ( v13 == 6 )
break;
LABEL_31:
v18 = ++v13 - 3;
v15 = v13 - 1;
if ( (unsigned int)(v13 - 3) <= 3 )
goto LABEL_5;
}
if ( v14 == 1 )
{
LABEL_40:
v34 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v17);
v35 = (char *)cocos2d::CCString::getCString(v34);
sub_D153B8((int)a9, v35);
v30 = (char *)v42;
goto LABEL_25;
}
LABEL_14:
sub_D153B8((int)&v43, &byte_F288A0);
v23 = v43;
v24 = *((_QWORD *)v42 - 3);
v25 = *((_QWORD *)v43 - 3);
if ( v25 > v24 )
v26 = *((_QWORD *)v42 - 3);
else
v26 = *((_QWORD *)v43 - 3);
v27 = memcmp(v42, v43, v26);
if ( !v27 )
{
v27 = 0x7FFFFFFF;
v28 = v24 - v25;
if ( v28 <= 0x7FFFFFFF )
{
if ( v28 >= (__int64)0xFFFFFFFF80000000LL )
v27 = v28;
else
v27 = 0x80000000;
}
}
v29 = (char *)(v23 - 6);
if ( v23 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = v23 - 2;
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(v23 - 2);
*(v23 - 2) = v37 - 1;
}
if ( v37 <= 0 )
{
operator delete(v29);
if ( !v27 )
goto LABEL_42;
LABEL_24:
*a9 = v42;
v30 = &byte_124B6C8;
v42 = &byte_124B6C8;
goto LABEL_25;
}
}
if ( v27 )
goto LABEL_24;
LABEL_42:
sub_D153B8((int)a9, &byte_F10E40);
v30 = (char *)v42;
LABEL_25:
v31 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v30 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v31);
}
return a9;
}