//
// LevelBrowserLayer::getSearchTitle from 0x1403e5750 to 0x1403e6001 (2225 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::setupLevelBrowser @ 0x1403e55d6
// > ??> @ 0x140924ef0
//
// 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 11:31:43 +0000
//
// Hidden C++ exception states: #wind=13
__int64 __fastcall LevelBrowserLayer::getSearchTitle(__int64 a1, __int64 a2)
{
__int64 v4; // rcx
size_t v5; // rdi
int v6; // eax
size_t v7; // r8
char *v8; // rdx
__int64 v9; // rax
int v10; // esi
__int64 v11; // rcx
int v12; // edx
cocos2d::CCString *v13; // rax
char *CString; // rax
size_t v15; // r8
void **v16; // r8
cocos2d::CCString *v17; // rax
__int64 v18; // rdx
char v19; // si
const char *v20; // rcx
__int64 v21; // r12
__int64 v22; // rdx
__int64 v23; // r14
cocos2d::CCString *v24; // rax
const char *v25; // rax
size_t v26; // r8
__int64 v27; // r14
void *v28; // r8
char **v29; // rdx
size_t v30; // r8
void *v31; // rcx
__int64 v32; // rax
__int64 v33; // rcx
__int64 v34; // rcx
unsigned __int64 v35; // r15
bool v36; // cc
__int64 v37; // rcx
__int64 v38; // r14
cocos2d::CCString *v39; // rax
unsigned int v40; // eax
__int64 Username; // r14
void *v42; // rax
unsigned __int64 v43; // xmm1_8
__int64 v44; // rcx
const char *v45; // rax
cocos2d::CCString *v46; // rax
char *v47; // rax
size_t v48; // r8
char v49; // si
int v50; // eax
unsigned int v51; // eax
int v52; // ecx
bool v53; // r14
const char *v54; // r8
const char *v55; // rdx
cocos2d::CCString *v56; // rax
char *v57; // rax
void *v59; // [rsp+38h] [rbp-51h]
void *v60; // [rsp+38h] [rbp-51h]
void *v61; // [rsp+38h] [rbp-51h]
void *v62; // [rsp+38h] [rbp-51h]
void *v63; // [rsp+38h] [rbp-51h]
void *v64; // [rsp+38h] [rbp-51h]
void *v65; // [rsp+38h] [rbp-51h]
char *String[3]; // [rsp+48h] [rbp-41h] BYREF
unsigned __int64 v67; // [rsp+60h] [rbp-29h]
void *Block[2]; // [rsp+68h] [rbp-21h] BYREF
__int64 v69; // [rsp+78h] [rbp-11h]
unsigned __int64 v70; // [rsp+80h] [rbp-9h]
void *v71[2]; // [rsp+88h] [rbp-1h] BYREF
__int128 v72; // [rsp+98h] [rbp+Fh]
*(_OWORD *)a2 = 0;
*(_QWORD *)(a2 + 16) = 13;
*(_QWORD *)(a2 + 24) = 15;
strcpy((char *)a2, "Online Levels");
v4 = *(_QWORD *)(a1 + 664);
v5 = -1;
if ( !v4 )
goto LABEL_26;
v6 = *(_DWORD *)(v4 + 320);
switch ( v6 )
{
case 'c':
v7 = 12;
v8 = "Saved Levels";
break;
case 'd':
v7 = 15;
v8 = "Favorite Levels";
break;
case 'b':
v7 = 9;
v8 = "My Levels";
break;
case 'f':
v7 = 8;
v8 = "My Lists";
break;
case 'g':
v7 = 14;
v8 = "Favorite Lists";
break;
default:
if ( *(_DWORD *)(v4 + 464) == 1 )
sub_1400405A0((void **)a2, "Online Lists", 0xCu);
goto LABEL_26;
}
sub_1400405A0((void **)a2, v8, v7);
v9 = *(_QWORD *)(a1 + 664);
if ( *(int *)(v9 + 452) > 0 )
{
v10 = *(_DWORD *)(v9 + 320);
v11 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v59 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v59);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v11 = *(_QWORD *)&qword_14090BFB0;
}
GameLevelManager::getFolderName(v11, Block, *(_DWORD *)(*(_QWORD *)(a1 + 664) + 452LL), v10 == 98);
v12 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 452LL);
if ( v69 )
{
v16 = Block;
if ( v70 > 0xF )
v16 = (void **)Block[0];
v17 = cocos2d::CCString::createWithFormat(" (%i: %s)", v12, (const char *)v16);
CString = (char *)cocos2d::CCString::getCString(v17);
v15 = -1;
do
++v15;
while ( CString[v15] );
}
else
{
v13 = cocos2d::CCString::createWithFormat(" (%i)", v12);
CString = (char *)cocos2d::CCString::getCString(v13);
v15 = -1;
do
++v15;
while ( CString[v15] );
}
sub_140044D80((_QWORD *)a2, CString, v15);
sub_14003D310((__int64)Block);
}
LABEL_26:
v18 = *(_QWORD *)(a1 + 664);
if ( v18 )
{
sub_14003F4F0((__int64)String, v18 + 328);
v19 = 5;
v20 = (const char *)String;
if ( v67 > 0xF )
v20 = String[0];
v21 = atoi(v20);
sub_14003D310((__int64)String);
v22 = *(_QWORD *)(a1 + 664);
switch ( *(_DWORD *)(v22 + 320) )
{
case 5:
if ( *(_DWORD *)(v22 + 464) == 1
&& (v32 = GJAccountManager::sharedState(), (_DWORD)v21 == *(_DWORD *)(v32 + 360) - *(_DWORD *)(v32 + 364)) )
{
sub_1400405A0((void **)a2, "My Online Lists", 0xFu);
}
else
{
v33 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v33 = qword_14090BFD0;
}
if ( (_DWORD)v21 != *(_DWORD *)(v33 + 692) - *(_DWORD *)(v33 + 696) )
{
v34 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v62 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v62);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v34 = *(_QWORD *)&qword_14090BFB0;
}
GameLevelManager::userNameForUserID(v34, v71, v21);
v35 = v72;
v36 = (unsigned __int64)v72 <= 2;
if ( (unsigned __int64)v72 < 2 )
{
v37 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v63 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v63);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v37 = *(_QWORD *)&qword_14090BFB0;
}
v38 = v37;
if ( !v37 )
{
v64 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v64);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v37 = *(_QWORD *)&qword_14090BFB0;
}
v39 = cocos2d::CCDictionary::valueForKey(*(cocos2d::CCDictionary **)(v37 + 1080), v21);
v40 = cocos2d::CCString::intValue(v39);
Username = GameLevelManager::tryGetUsername(v38, (__int64)String, v40);
if ( v71 != (void **)Username )
{
if ( *((_QWORD *)&v72 + 1) > 0xFu )
{
v42 = v71[0];
if ( (unsigned __int64)(*((_QWORD *)&v72 + 1) + 1LL) >= 0x1000 )
{
v42 = *((void **)v71[0] - 1);
if ( (unsigned __int64)((char *)v71[0] - (char *)v42 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v42);
}
*(_OWORD *)v71 = *(_OWORD *)Username;
v72 = *(_OWORD *)(Username + 16);
v43 = v72;
*(_QWORD *)(Username + 16) = 0;
*(_QWORD *)(Username + 24) = 15;
*(_BYTE *)Username = 0;
v35 = v43;
}
sub_14003D310((__int64)String);
v36 = v35 <= 2;
}
if ( !v36 )
{
v44 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v65);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v44 = *(_QWORD *)&qword_14090BFB0;
}
v45 = (const char *)GameLevelManager::userNameForUserID(v44, Block, v21);
if ( *((_QWORD *)v45 + 3) > 0xFu )
v45 = *(const char **)v45;
v46 = cocos2d::CCString::createWithFormat("%ss Levels", v45);
v47 = (char *)cocos2d::CCString::getCString(v46);
v48 = -1;
do
++v48;
while ( v47[v48] );
sub_1400405A0((void **)a2, v47, v48);
sub_14003D310((__int64)Block);
}
v31 = v71;
goto LABEL_81;
}
sub_1400405A0((void **)a2, "My Online Levels", 0x10u);
}
break;
case 6:
case 0x10:
case 0x11:
case 0x15:
case 0x16:
case 0x17:
case 0x19:
case 0x1A:
case 0x1C:
case 0x1D:
case 0x20:
case 0x21:
case 0x22:
sub_1400405A0((void **)a2, " ", 1u);
break;
case 9:
sub_1400405A0((void **)a2, "Map Packs", 9u);
break;
case 0xA:
v23 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v60 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v60);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v23 = *(_QWORD *)&qword_14090BFB0;
}
v24 = cocos2d::CCString::createWithFormat("pack_%i", *(_DWORD *)(v23 + 1612));
v25 = cocos2d::CCString::getCString(v24);
*(_OWORD *)Block = 0;
v69 = 0;
v70 = 0;
v26 = -1;
do
++v26;
while ( v25[v26] );
sub_14003D230(Block, v25, v26);
v27 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v23 + 1176), Block);
if ( v70 > 0xF )
{
v28 = Block[0];
if ( v70 + 1 >= 0x1000 )
{
v28 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v28 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v28);
}
v69 = 0;
v70 = 15;
LOBYTE(Block[0]) = 0;
if ( v27 )
{
sub_14003F4F0((__int64)String, v27 + 344);
v19 = 37;
v29 = String;
if ( v67 > 0xF )
v29 = (char **)String[0];
v30 = -1;
do
++v30;
while ( *((_BYTE *)v29 + v30) );
sub_1400405A0((void **)a2, v29, v30);
v31 = String;
LABEL_81:
sub_14003D310((__int64)v31);
}
break;
case 0xE:
sub_1400405A0((void **)a2, "Find Users", 0xAu);
break;
case 0x1F:
sub_1400405A0((void **)a2, "Hyped", 5u);
break;
case 0x65:
sub_1400405A0((void **)a2, "Smart Templates", 0xFu);
break;
default:
break;
}
sub_14003F4F0((__int64)String, *(_QWORD *)(a1 + 664) + 328LL);
v49 = v19 | 0xA;
v53 = false;
if ( String[2] )
{
v50 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 320LL);
if ( v50 == 99 || (v51 = v50 - 98, v51 <= 5) && (v52 = 53, _bittest(&v52, v51)) )
v53 = true;
}
if ( (v49 & 2) != 0 )
sub_14003D310((__int64)String);
if ( v53 )
{
sub_14003F4F0((__int64)String, *(_QWORD *)(a1 + 664) + 328LL);
v54 = (const char *)String;
if ( v67 > 0xF )
v54 = String[0];
v55 = (const char *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v55 = *(const char **)a2;
v56 = cocos2d::CCString::createWithFormat("%s (%s)", v55, v54);
v57 = (char *)cocos2d::CCString::getCString(v56);
do
++v5;
while ( v57[v5] );
sub_1400405A0((void **)a2, v57, v5);
sub_14003D310((__int64)String);
}
}
return a2;
}