//
// LevelBrowserLayer::getSearchTitle from 0x1004997c8 to 0x100499ccc (1284 bytes)
//
// 1 xrefs:
// > LevelBrowserLayer::setupLevelBrowser @ 0x1004996ac
//
// This function is hookable on this platform (idp: arm, 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:05:58 +0000
//
void __usercall LevelBrowserLayer::getSearchTitle(__int64 a1@, __int64 a2@)
{
__int64 v4; // x8
unsigned int v5; // w9
__int64 v6; // x8
__int64 v7; // x0
void **v8; // x8
void *v9; // x0
const std::string::value_type *CString; // x0
int v11; // w21
void *v12; // x22
__int64 v13; // x9
__int64 v14; // x8
const std::string::value_type *v15; // x1
__int64 v16; // x8
int v17; // w21
const char *v18; // x21
__int64 v19; // x8
void **v20; // x8
void *v21; // x0
const std::string::value_type *v22; // x0
__int64 v23; // x0
__int64 v24; // x0
__int64 v25; // x21
__int64 v26; // x0
__int64 v27; // x0
__int64 v28; // x0
unsigned __int64 v29; // x9
unsigned __int64 v30; // x8
void *v31; // x10
unsigned __int64 v32; // x11
__int64 v33; // x22
__int64 v34; // x0
int v35; // w0
__int64 v36; // x0
void **v37; // x8
void *v38; // x0
const std::string::value_type *v39; // x0
const std::string::value_type *v40; // x1
void *v41[2]; // [xsp+18h] [xbp-58h] BYREF
unsigned __int64 v42; // [xsp+28h] [xbp-48h]
void *__p[2]; // [xsp+30h] [xbp-40h] BYREF
__int64 v44; // [xsp+40h] [xbp-30h]
sub_100009900((_QWORD *)a2, "Online Levels");
v4 = *(_QWORD *)(a1 + 664);
if ( !v4 )
return;
v5 = *(_DWORD *)(v4 + 316) - 98;
if ( v5 < 6 && ((0x37u >> v5) & 1) != 0 )
{
std::string::assign((std::string *)a2, off_10097BF48[v5]);
v6 = *(_QWORD *)(a1 + 664);
if ( *(int *)(v6 + 420) < 1 )
goto LABEL_17;
v7 = GameLevelManager::sharedState();
sub_1000B08CC(v7, *(_DWORD *)(*(_QWORD *)(a1 + 664) + 420LL), *(_DWORD *)(*(_QWORD *)(a1 + 664) + 316LL) == 98, __p);
if ( SHIBYTE(v44) < 0 )
{
if ( __p[1] )
{
v8 = (void **)__p[0];
goto LABEL_12;
}
}
else if ( HIBYTE(v44) )
{
v8 = __p;
LABEL_12:
v9 = sub_1003065B0(" (%i: %s)", *(_DWORD *)(*(_QWORD *)(a1 + 664) + 420LL), (const char *)v8);
goto LABEL_14;
}
v9 = sub_1003065B0(" (%i)", *(_DWORD *)(*(_QWORD *)(a1 + 664) + 420LL));
LABEL_14:
CString = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v9);
std::string::append((std::string *)a2, CString);
if ( SHIBYTE(v44) < 0 )
operator delete(__p[0]);
goto LABEL_16;
}
if ( *(_DWORD *)(v4 + 432) == 1 )
std::string::assign((std::string *)a2, "Online Lists");
LABEL_16:
v6 = *(_QWORD *)(a1 + 664);
if ( !v6 )
return;
LABEL_17:
if ( *(char *)(v6 + 343) < 0 )
{
sub_1000097D0(__p, *(void **)(v6 + 320), *(_QWORD *)(v6 + 328));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v6 + 320);
v44 = *(_QWORD *)(v6 + 336);
}
if ( SHIBYTE(v44) < 0 )
{
v12 = __p[0];
v11 = atoi((const char *)__p[0]);
operator delete(v12);
}
else
{
v11 = atoi((const char *)__p);
}
v13 = *(_QWORD *)(a1 + 664);
v14 = *(unsigned int *)(v13 + 316);
if ( (int)v14 > 9 )
{
if ( (unsigned int)v14 <= 0x22 )
{
if ( ((1LL << v14) & 0x736E30000LL) != 0 )
{
LABEL_26:
v15 = " ";
LABEL_27:
std::string::assign((std::string *)a2, v15);
goto LABEL_28;
}
if ( v14 == 14 )
{
v15 = "Find Users";
goto LABEL_27;
}
if ( v14 == 31 )
{
v15 = "Hyped";
goto LABEL_27;
}
}
if ( (_DWORD)v14 != 10 )
{
if ( (_DWORD)v14 == 101 )
{
v15 = "Smart Templates";
goto LABEL_27;
}
goto LABEL_28;
}
v25 = GameLevelManager::sharedState();
v26 = GameLevelManager::sharedState();
v27 = sub_1000B69E8(v25, *(_DWORD *)(v26 + 1484));
if ( !v27 )
goto LABEL_28;
if ( *(char *)(v27 + 367) < 0 )
{
sub_1000097D0(__p, *(void **)(v27 + 344), *(_QWORD *)(v27 + 352));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v27 + 344);
v44 = *(_QWORD *)(v27 + 360);
}
v40 = v44 >= 0 ? (const std::string::value_type *)__p : (const std::string::value_type *)__p[0];
std::string::assign((std::string *)a2, v40);
if ( (SHIBYTE(v44) & 0x80000000) == 0 )
goto LABEL_28;
LABEL_95:
operator delete(__p[0]);
goto LABEL_28;
}
switch ( (_DWORD)v14 )
{
case 5:
if ( *(_DWORD *)(v13 + 432) == 1 )
{
v23 = GJAccountManager::sharedState();
if ( v11 == *(_DWORD *)(v23 + 352) - *(_DWORD *)(v23 + 356) )
{
v15 = "My Online Lists";
goto LABEL_27;
}
}
v24 = GameManager::sharedState();
if ( v11 == *(_DWORD *)(v24 + 660) - *(_DWORD *)(v24 + 664) )
{
v15 = "My Online Levels";
goto LABEL_27;
}
v28 = GameLevelManager::sharedState();
GameLevelManager::userNameForUserID(v28, v11, __p);
v29 = HIBYTE(v44);
LOBYTE(v30) = HIBYTE(v44);
v31 = __p[1];
if ( v44 >= 0 )
v32 = HIBYTE(v44);
else
v32 = (unsigned __int64)__p[1];
if ( v32 <= 1 )
{
v33 = GameLevelManager::sharedState();
v34 = GameLevelManager::sharedState();
v35 = sub_1000A78EC(v34, v11);
sub_1000A7734(v33, v35, (__int64)v41);
if ( SHIBYTE(v44) < 0 )
operator delete(__p[0]);
v44 = v42;
*(_OWORD *)__p = *(_OWORD *)v41;
v29 = HIBYTE(v42);
v31 = v41[1];
v30 = HIBYTE(v42);
}
if ( (v30 & 0x80u) != 0LL )
v29 = (unsigned __int64)v31;
if ( v29 >= 3 )
{
v36 = GameLevelManager::sharedState();
GameLevelManager::userNameForUserID(v36, v11, v41);
if ( (v42 & 0x8000000000000000LL) == 0LL )
v37 = v41;
else
v37 = (void **)v41[0];
v38 = sub_1003065B0("%ss Levels", (const char *)v37);
v39 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v38);
std::string::assign((std::string *)a2, v39);
if ( SHIBYTE(v42) < 0 )
operator delete(v41[0]);
LOBYTE(v30) = HIBYTE(v44);
}
if ( (v30 & 0x80) == 0 )
break;
goto LABEL_95;
case 6:
goto LABEL_26;
case 9:
v15 = "Map Packs";
goto LABEL_27;
}
LABEL_28:
v16 = *(_QWORD *)(a1 + 664);
if ( *(char *)(v16 + 343) < 0 )
{
sub_1000097D0(__p, *(void **)(v16 + 320), *(_QWORD *)(v16 + 328));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v16 + 320);
v44 = *(_QWORD *)(v16 + 336);
}
if ( SHIBYTE(v44) < 0 )
{
if ( !__p[1] )
{
LABEL_55:
operator delete(__p[0]);
return;
}
}
else if ( !HIBYTE(v44) )
{
return;
}
v17 = *(_DWORD *)(*(_QWORD *)(a1 + 664) + 316LL);
if ( (unsigned int)(v17 - 98) > 4 || v17 == 101 )
{
if ( SHIBYTE(v44) < 0 )
operator delete(__p[0]);
if ( v17 != 103 )
return;
}
else if ( SHIBYTE(v44) < 0 )
{
operator delete(__p[0]);
}
if ( *(char *)(a2 + 23) >= 0 )
v18 = (const char *)a2;
else
v18 = *(const char **)a2;
v19 = *(_QWORD *)(a1 + 664);
if ( *(char *)(v19 + 343) < 0 )
{
sub_1000097D0(__p, *(void **)(v19 + 320), *(_QWORD *)(v19 + 328));
}
else
{
*(_OWORD *)__p = *(_OWORD *)(v19 + 320);
v44 = *(_QWORD *)(v19 + 336);
}
v20 = __p;
if ( v44 < 0 )
v20 = (void **)__p[0];
v21 = sub_1003065B0("%s (%s)", v18, (const char *)v20);
v22 = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v21);
std::string::assign((std::string *)a2, v22);
if ( SHIBYTE(v44) < 0 )
goto LABEL_55;
}