//
// GameLevelManager::getFolderName from 0x10053a6f0 to 0x10053a86a (378 bytes)
//
// 3 xrefs:
// > SetFolderPopup::onSetFolderName @ 0x1002ae06a
// > SetFolderPopup::valueChanged @ 0x1002ae25b
// > LevelBrowserLayer::getSearchTitle @ 0x10048ffdd
//
// 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
//
size_t *__fastcall GameLevelManager::getFolderName(size_t *a1, __int64 a2, double a3, __int64 a4, unsigned int a5)
{
size_t *v5; // rbx
__int64 v6; // r14
cocos2d::CCString *v7; // rax
const char *CString; // r12
size_t v9; // rax
size_t v10; // r15
char *v11; // r13
__int64 v12; // rbx
size_t v13; // r14
cocos2d::CCString *v14; // rax
const char *v15; // r14
size_t v16; // rax
size_t v17; // r15
_BYTE *v18; // r12
size_t v20; // r13
char v21; // [rsp+0h] [rbp-50h]
_QWORD __dst[2]; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v5 = a1;
v6 = *(_QWORD *)(a2 + 8LL * a5 + 432);
v7 = (cocos2d::CCString *)sub_1007AB580("%i", v21);
CString = cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a3);
v10 = v9;
if ( v9 >= 0x17 )
{
v12 = v6;
v13 = 26;
if ( (v9 | 7) != 0x17 )
v13 = (v9 | 7) + 1;
v11 = (char *)operator new(v13);
__p = v11;
__dst[0] = v13 + 1;
v6 = v12;
v5 = a1;
__dst[1] = v10;
goto LABEL_8;
}
LOBYTE(__dst[0]) = 2 * v9;
v11 = (char *)__dst + 1;
if ( v9 )
LABEL_8:
memmove(v11, CString, v10);
v11[v10] = 0;
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v6, (__int64)__dst);
v15 = cocos2d::CCString::getCString(v14);
v16 = strlen(v15);
if ( v16 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a3);
v17 = v16;
if ( v16 >= 0x17 )
{
v20 = 26;
if ( (v16 | 7) != 0x17 )
v20 = (v16 | 7) + 1;
v18 = operator new(v20);
v5[2] = (size_t)v18;
*v5 = v20 | 1;
v5[1] = v17;
LABEL_18:
memmove(v18, v15, v17);
v18[v17] = 0;
if ( (__dst[0] & 1) == 0 )
return v5;
goto LABEL_13;
}
*(_BYTE *)v5 = 2 * v16;
v18 = (char *)v5 + 1;
if ( v16 )
goto LABEL_18;
*v18 = 0;
if ( (__dst[0] & 1) != 0 )
LABEL_13:
operator delete(__p);
return v5;
}