//
// LevelBrowserLayer::getSearchTitle from 0x4a5dc0 to 0x4a622c (1132 bytes)
//
// 1 xrefs:
// > LevelBrowserLayer::setupLevelBrowser @ 0x4a63a8
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:49:54 +0000
//
LevelBrowserLayer *__fastcall LevelBrowserLayer::getSearchTitle(LevelBrowserLayer *this, int a2)
{
int v4; // r2
int v5; // r3
int *v6; // r0
char *v7; // r1
int *v8; // r0
int v9; // r0
int v10; // r3
cocos2d::CCString *v11; // r0
char *CString; // r0
int v13; // r1
const char *v14; // r0
int v15; // r8
GameLevelManager *v16; // r0
int v17; // r2
unsigned int v18; // r3
unsigned int v19; // r3
int *v20; // r0
char *v21; // r1
GameLevelManager *v22; // r5
int v23; // r0
int SavedMapPack; // r0
int *v25; // r5
char *v26; // r1
int v27; // r0
GameLevelManager *v28; // r0
int v29; // r3
unsigned int v30; // r3
int v31; // r5
int v32; // r5
const char *v33; // r8
char *v34; // r2
cocos2d::CCString *v35; // r0
char *v36; // r0
GameLevelManager *v37; // r0
GameLevelManager *v38; // r10
GameLevelManager *v39; // r0
bool v40; // zf
int v41; // r3
int v42; // r0
unsigned int v43; // r3
unsigned int v44; // r0
char *v45; // r11
int v46; // r10
char *v47; // r0
int v48; // r2
int v49; // r0
unsigned int v50; // r1
char *v51; // r2
int v52; // r0
cocos2d::CCString *v53; // r0
char *v54; // r0
int v56[3]; // [sp+4h] [bp-50h] BYREF
int v57[3]; // [sp+10h] [bp-44h] BYREF
int v58; // [sp+1Ch] [bp-38h] BYREF
unsigned int v59; // [sp+20h] [bp-34h]
char *v60; // [sp+24h] [bp-30h]
char v61; // [sp+28h] [bp-2Ch] BYREF
char v62[7]; // [sp+29h] [bp-2Bh] BYREF
char *v63; // [sp+30h] [bp-24h]
int v64[3]; // [sp+34h] [bp-20h] BYREF
int v65; // [sp+40h] [bp-14h] BYREF
unsigned int v66; // [sp+44h] [bp-10h]
char *v67; // [sp+48h] [bp-Ch]
*(_DWORD *)this = 0;
*((_DWORD *)this + 1) = 0;
*((_DWORD *)this + 2) = 0;
std::string::__init((int *)this, "Online Levels", 0xDu);
v4 = *(_DWORD *)(a2 + 500);
if ( !v4 )
goto LABEL_22;
v5 = *(_DWORD *)(v4 + 264);
switch ( v5 )
{
case 'c':
v6 = (int *)this;
v7 = "Saved Levels";
goto LABEL_9;
case 'd':
v6 = (int *)this;
v7 = "Favorite Levels";
goto LABEL_9;
case 'b':
v6 = (int *)this;
v7 = "My Levels";
LABEL_9:
v8 = std::string::assign(v6, v7);
if ( *(int *)(*(_DWORD *)(a2 + 500) + 332) <= 0 )
goto LABEL_22;
v9 = GameLevelManager::sharedState((GameLevelManager *)v8);
GameLevelManager::getFolderName((GameLevelManager *)&v65, v9, *(_DWORD *)(*(_DWORD *)(a2 + 500) + 332));
v10 = *(_DWORD *)(a2 + 500);
if ( (v65 & 1) != 0 )
{
if ( v66 )
{
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)" (%i: %s)",
*(const char **)(v10 + 332),
v67);
goto LABEL_19;
}
}
else if ( (unsigned __int8)v65 >> 1 )
{
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)" (%i: %s)",
*(const char **)(v10 + 332),
(char *)&v65 + 1);
goto LABEL_19;
}
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)" (%i)",
*(const char **)(v10 + 332));
LABEL_19:
CString = (char *)cocos2d::CCString::getCString(v11);
std::string::append(this, CString);
std::string::~string((int)&v65);
goto LABEL_22;
case 'f':
v6 = (int *)this;
v7 = "My Lists";
goto LABEL_9;
case 'g':
v6 = (int *)this;
v7 = "Favorite Lists";
goto LABEL_9;
}
if ( *(_DWORD *)(v4 + 344) == 1 )
std::string::assign((int *)this, "Online Lists");
LABEL_22:
v13 = *(_DWORD *)(a2 + 500);
if ( !v13 )
return this;
std::string::basic_string(v56, v13 + 268);
if ( (v56[0] & 1) != 0 )
v14 = (const char *)v56[2];
else
v14 = (char *)v56 + 1;
v15 = atoi(v14);
v16 = (GameLevelManager *)std::string::~string((int)v56);
v17 = *(_DWORD *)(a2 + 500);
v18 = *(_DWORD *)(v17 + 264);
if ( v18 > 0x17 )
{
if ( v18 <= 0x1D )
{
if ( v18 >= 0x1C )
goto LABEL_50;
v19 = v18 - 25;
LABEL_40:
if ( v19 > 1 )
goto LABEL_64;
goto LABEL_50;
}
if ( v18 > 0x22 )
{
if ( v18 != 101 )
goto LABEL_64;
v20 = (int *)this;
v21 = "Smart Templates";
}
else
{
if ( v18 >= 0x20 )
goto LABEL_50;
if ( v18 != 31 )
goto LABEL_64;
v20 = (int *)this;
v21 = "Hyped";
}
LABEL_81:
std::string::assign(v20, v21);
goto LABEL_64;
}
if ( v18 >= 0x15 )
{
LABEL_50:
v20 = (int *)this;
v21 = " ";
goto LABEL_81;
}
if ( v18 == 10 )
{
v22 = (GameLevelManager *)GameLevelManager::sharedState(v16);
v23 = GameLevelManager::sharedState(v22);
SavedMapPack = GameLevelManager::getSavedMapPack(v22, *(_DWORD *)(v23 + 952));
if ( SavedMapPack )
{
v25 = v57;
std::string::basic_string(v57, SavedMapPack + 284);
if ( (v57[0] & 1) != 0 )
v26 = (char *)v57[2];
else
v26 = (char *)v57 + 1;
std::string::assign((int *)this, v26);
LABEL_63:
std::string::~string((int)v25);
goto LABEL_64;
}
goto LABEL_64;
}
if ( v18 > 0xA )
{
if ( v18 != 14 )
{
if ( v18 < 0xE )
goto LABEL_64;
v19 = v18 - 16;
goto LABEL_40;
}
v20 = (int *)this;
v21 = "Find Users";
goto LABEL_81;
}
switch ( v18 )
{
case 6u:
goto LABEL_50;
case 9u:
v20 = (int *)this;
v21 = "Map Packs";
goto LABEL_81;
case 5u:
if ( *(_DWORD *)(v17 + 344) == 1 )
{
v16 = (GameLevelManager *)GJAccountManager::sharedState(v16);
if ( v15 == *((_DWORD *)v16 + 70) - *((_DWORD *)v16 + 71) )
{
v20 = (int *)this;
v21 = "My Online Lists";
goto LABEL_81;
}
}
v37 = (GameLevelManager *)GameManager::sharedState(v16);
if ( v15 == *((_DWORD *)v37 + 116) - *((_DWORD *)v37 + 117) )
{
v20 = (int *)this;
v21 = "My Online Levels";
goto LABEL_81;
}
v27 = GameLevelManager::sharedState(v37);
v25 = &v65;
v28 = (GameLevelManager *)GameLevelManager::userNameForUserID((GameLevelManager *)&v65, v27);
v29 = (unsigned __int8)v65;
if ( (v65 & 1) != 0 )
{
if ( v66 > 1 )
{
LABEL_61:
v30 = v66;
goto LABEL_62;
}
}
else if ( (unsigned __int8)v65 > 3u )
{
goto LABEL_105;
}
v38 = (GameLevelManager *)GameLevelManager::sharedState(v28);
v39 = (GameLevelManager *)GameLevelManager::sharedState(v38);
GameLevelManager::accountIDForUserID(v39, v15);
GameLevelManager::tryGetUsername((GameLevelManager *)&v58, v38);
v41 = v65 & 1;
v40 = v41 == 0;
if ( (v65 & 1) != 0 )
{
v41 = 0;
*v67 = 0;
}
else
{
LOBYTE(v65) = v41;
BYTE1(v65) = v41;
}
if ( !v40 )
v66 = v41;
if ( (v65 & 1) != 0 )
{
v42 = v66;
v43 = (v65 & 0xFFFFFFFE) - 1;
if ( v66 <= 0xA )
{
if ( (v65 & 0xFFFFFFFE) == 0xB )
goto LABEL_104;
goto LABEL_95;
}
}
else
{
v42 = (int)(unsigned __int8)v65 >> 1;
if ( v42 <= 10 )
goto LABEL_104;
v43 = 10;
}
v44 = (v42 + 16) & 0xFFFFFFF0;
if ( v44 - 1 == v43 )
goto LABEL_104;
if ( v44 != 11 )
{
v47 = (char *)operator new(v44);
v46 = v65 & 1;
if ( (v65 & 1) != 0 )
v45 = v67;
else
v45 = (char *)&v65 + 1;
goto LABEL_99;
}
LABEL_95:
v45 = v67;
v46 = 1;
v47 = (char *)&v65 + 1;
LABEL_99:
if ( (v65 & 1) != 0 )
v48 = v66;
else
v48 = (int)(unsigned __int8)v65 >> 1;
std::char_traits::copy(v47, v45, v48 + 1);
if ( v46 )
operator delete(v45);
LABEL_104:
v49 = v58;
v50 = v59;
v51 = v60;
v58 = 0;
v59 = 0;
v60 = nullptr;
v65 = v49;
v66 = v50;
v67 = v51;
v28 = (GameLevelManager *)std::string::~string((int)&v58);
v29 = (unsigned __int8)v65;
if ( (v65 & 1) != 0 )
goto LABEL_61;
LABEL_105:
v30 = v29 >> 1;
LABEL_62:
if ( v30 > 2 )
{
v52 = GameLevelManager::sharedState(v28);
GameLevelManager::userNameForUserID((GameLevelManager *)&v61, v52);
if ( (v61 & 1) != 0 )
v53 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%ss Levels", v63);
else
v53 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%ss Levels", v62);
v54 = (char *)cocos2d::CCString::getCString(v53);
std::string::assign((int *)this, v54);
std::string::~string((int)&v61);
}
goto LABEL_63;
}
LABEL_64:
std::string::basic_string(v64, *(_DWORD *)(a2 + 500) + 268);
if ( (v64[0] & 1) != 0 )
v31 = v64[1];
else
v31 = (int)LOBYTE(v64[0]) >> 1;
if ( v31 )
{
v32 = *(_DWORD *)(*(_DWORD *)(a2 + 500) + 264);
v31 = (unsigned int)(v32 - 98) <= 2 || (unsigned int)(v32 - 102) <= 1;
}
std::string::~string((int)v64);
if ( v31 )
{
if ( (*(_BYTE *)this & 1) != 0 )
v33 = *((const char **)this + 2);
else
v33 = (char *)this + 1;
std::string::basic_string(&v65, *(_DWORD *)(a2 + 500) + 268);
if ( (v65 & 1) != 0 )
v34 = v67;
else
v34 = (char *)&v65 + 1;
v35 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%s)",
v33,
v34,
(unsigned __int8)v65 << 31);
v36 = (char *)cocos2d::CCString::getCString(v35);
std::string::assign((int *)this, v36);
std::string::~string((int)&v65);
}
return this;
}