//
// SFXBrowser::fitFolderPath from 0xb91454 to 0xb91b48 (1780 bytes)
//
// 3 xrefs:
// > SFXBrowser::updateSelectionUI @ 0xb91e40
// > SFXBrowser::setupList @ 0xb924b0
// > ??> @ 0x43ba0
//
// 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 13:02:38 +0000
//
__int64 __fastcall SFXBrowser::fitFolderPath(SFXBrowser *this)
{
__int64 v2; // x0
__int64 v3; // x19
void (__fastcall *v4)(__int64, __int64 *); // x21
__int64 v5; // x23
float v6; // s8
float v7; // s0
cocos2d::CCDirector *v9; // x0
__int64 v10; // x1
cocos2d::CCDirector *v11; // x0
__int64 v12; // x26
__int64 v13; // x3
__int64 v14; // x2
__int64 v15; // x1
float v16; // s8
__int64 v17; // x0
cocos2d::CCNode *v18; // x19
float v19; // s0
char v20; // w2
float v21; // s8
__int64 v22; // x0
unsigned __int64 v23; // x1
unsigned __int8 v24; // w19
unsigned __int64 v25; // x1
__int64 v26; // x23
size_t v27; // x20
void (__fastcall *v28)(__int64, char *); // x25
size_t v29; // x21
char *v30; // x24
unsigned __int64 v31; // x19
char *v32; // x3
char *v33; // x1
char *v34; // x1
int v35; // w20
float v36; // s0
float v37; // s9
__int64 v38; // x1
cocos2d::CCNode *v39; // x0
cocos2d::CCNode *v40; // x19
float v41; // s0
float v42; // s9
float v43; // s0
unsigned __int64 v44; // x2
unsigned __int64 v45; // x0
char *v46; // x1
__int64 v47; // x23
void (__fastcall *v48)(__int64, char *); // x25
char *v49; // x1
size_t v50; // x2
__int64 v51; // x0
size_t v52; // x3
char *v53; // x1
unsigned __int64 v54; // x19
unsigned __int64 v55; // x19
cocos2d::CCNode *v56; // [xsp+78h] [xbp+78h]
__int64 v57; // [xsp+80h] [xbp+80h] BYREF
__int64 v58; // [xsp+88h] [xbp+88h] BYREF
char v59[8]; // [xsp+90h] [xbp+90h] BYREF
__int64 v60; // [xsp+98h] [xbp+98h] BYREF
__int64 v61[2]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v62; // [xsp+B0h] [xbp+B0h] BYREF
unsigned __int64 v63; // [xsp+B8h] [xbp+B8h]
void *v64; // [xsp+C0h] [xbp+C0h]
__int64 v65; // [xsp+C8h] [xbp+C8h] BYREF
size_t v66; // [xsp+D0h] [xbp+D0h]
void *v67; // [xsp+D8h] [xbp+D8h]
__int64 v68[3]; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v69; // [xsp+F8h] [xbp+F8h] BYREF
size_t v70; // [xsp+100h] [xbp+100h]
void *v71; // [xsp+108h] [xbp+108h]
_QWORD v72[5]; // [xsp+110h] [xbp+110h]
v2 = *((_QWORD *)this + 93);
if ( !v2 || !*((_QWORD *)this + 92) )
return _stack_chk_guard;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v2 + 344LL))(v2, *((unsigned __int8 *)this + 872) ^ 1u);
v3 = *((_QWORD *)this + 93);
v4 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v3 + 184LL);
v5 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 92) + 192LL))(*((_QWORD *)this + 92));
v6 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 92) + 328LL))(*((_QWORD *)this + 92));
v7 = (*(float (__fastcall **)(_QWORD))(**((_QWORD **)this + 92) + 168LL))(*((_QWORD *)this + 92));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, (float)((float)-v6 * v7) + -2.0, 0.0);
cocos2d::CCPoint::operator+(v61, v5);
v4(v3, v61);
if ( *((_BYTE *)this + 872) )
goto LABEL_4;
v9 = (cocos2d::CCDirector *)*((unsigned __int8 *)this + 760);
v10 = (unsigned __int8)v9 >> 1;
if ( ((unsigned __int8)v9 & 1) != 0 )
v10 = *((_QWORD *)this + 96);
if ( !v10 )
{
LABEL_4:
(*(void (__fastcall **)(_QWORD, char *))(**((_QWORD **)this + 93) + 928LL))(*((_QWORD *)this + 93), &byte_11B8890);
return _stack_chk_guard;
}
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
v12 = 0;
cocos2d::CCDirector::getWinSize(&v57, v11);
v13 = *((_QWORD *)this + 121);
v14 = *((_QWORD *)this + 122);
v15 = *((_QWORD *)this + 123);
v16 = (float)(*(float *)&v57 * 0.5) + -170.0;
v17 = *((_QWORD *)this + 124);
v72[0] = *((_QWORD *)this + 114);
v72[1] = v13;
v72[2] = v14;
v72[3] = v15;
v72[4] = v17;
do
{
v18 = (cocos2d::CCNode *)v72[v12];
if ( v18 )
{
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(*(_QWORD *)v18 + 352LL))(v72[v12]) )
{
if ( (*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v18 + 512LL))(v18) )
{
cocos2d::CCNode::boundingBox(v61, v18);
v38 = *(_QWORD *)v18;
v39 = v18;
v40 = *((cocos2d::CCNode **)this + 73);
v56 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(v38 + 512))(v39);
cocos2d::CCRect::getMaxX((cocos2d::CCRect *)v61);
v42 = v41;
cocos2d::CCRect::getMidY((cocos2d::CCRect *)v61);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v42, v43);
cocos2d::CCNode::convertToWorldSpace(&v60, v56, (const cocos2d::CCPoint *)v59);
cocos2d::CCNode::convertToNodeSpace(&v58, v40, (const cocos2d::CCPoint *)&v60);
if ( *(float *)&v58 > v16 )
v16 = *(float *)&v58;
}
}
}
++v12;
}
while ( v12 != 5 );
v19 = (*(float (__fastcall **)(_QWORD))(**((_QWORD **)this + 93) + 224LL))(*((_QWORD *)this + 93));
v62 = 0;
v20 = *((_BYTE *)this + 760);
v63 = 0;
v64 = nullptr;
v21 = (float)(v19 - v16) - 10.0;
if ( (v20 & 1) != 0 )
{
std::string::__init(&v62, *((void **)this + 97), *((_QWORD *)this + 96));
}
else
{
v22 = *((_QWORD *)this + 95);
v23 = *((_QWORD *)this + 96);
v64 = *((void **)this + 97);
v62 = v22;
v63 = v23;
}
v24 = v62;
v65 = 0;
v66 = 0;
v67 = nullptr;
if ( (v62 & 1) == 0 )
{
v25 = (int)(unsigned __int8)v62 >> 1;
if ( (int)(unsigned __int8)v62 >> 1 <= 2 )
goto LABEL_17;
LABEL_48:
v44 = v25 - 3;
if ( v25 < v25 - 3 )
sub_62F5BC();
if ( (v62 & 1) != 0 )
{
if ( memcmp((char *)v64 + v44, " \\ ", 3u) )
goto LABEL_17;
v45 = v63 - 3;
if ( v63 >= v63 - 3 )
{
v46 = (char *)v64;
v63 -= 3LL;
LABEL_53:
v46[v45] = 0;
std::string::assign(&v65, " \\ ");
goto LABEL_17;
}
}
else
{
if ( memcmp((char *)&v62 + v44 + 1, " \\ ", 3u) )
goto LABEL_17;
v55 = v24 >> 1;
v45 = v55 - 3;
if ( v55 >= v55 - 3 )
{
v46 = (char *)&v62 + 1;
LOBYTE(v62) = 2 * v45;
goto LABEL_53;
}
}
sub_62F5BC();
}
v25 = v63;
if ( v63 > 2 )
goto LABEL_48;
LABEL_17:
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 93) + 160LL))(*((_QWORD *)this + 93), 0.6);
v26 = *((_QWORD *)this + 93);
v27 = (unsigned __int8)v62 >> 1;
v28 = *(void (__fastcall **)(__int64, char *))(*(_QWORD *)v26 + 928LL);
v69 = 0;
v70 = 0;
v71 = nullptr;
if ( (v62 & 1) != 0 )
v27 = v63;
v29 = (unsigned __int8)v65 >> 1;
if ( (v65 & 1) != 0 )
v29 = v66;
v30 = (char *)&v62 + 1;
if ( (v62 & 1) != 0 )
v30 = (char *)v64;
v31 = v29 + v27;
if ( v29 + v27 > 0xFFFFFFFFFFFFFFEFLL )
sub_62F61C();
if ( v31 > 0x16 )
{
v54 = (v31 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v32 = (char *)operator new(v54);
v69 = v54 | 1;
v71 = v32;
v70 = v27;
}
else
{
v32 = (char *)&v69 + 1;
LOBYTE(v69) = 2 * v27;
}
if ( v27 )
v32 = (char *)memcpy(v32, v30, v27);
v32[v27] = 0;
v33 = (char *)&v65 + 1;
if ( (v65 & 1) != 0 )
v33 = (char *)v67;
std::string::append((__int64)&v69, v33, v29);
v34 = (char *)&v69 + 1;
if ( (v69 & 1) != 0 )
v34 = (char *)v71;
v28(v26, v34);
if ( (v69 & 1) != 0 )
operator delete(v71);
v35 = GameToolbox::pathSegmentCount((unsigned __int8 *)&v62, " \\ ") - 1;
if ( v35 > 0 )
{
do
{
if ( v21 >= (float)(*(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 93) + 328LL))(*((_QWORD *)this + 93))
* 0.6) )
break;
v47 = *((_QWORD *)this + 93);
v48 = *(void (__fastcall **)(__int64, char *))(*(_QWORD *)v47 + 928LL);
GameToolbox::keepLastPathSegments(" \\ ", (__int64)&v62, v35, v68);
if ( (v65 & 1) != 0 )
{
v49 = (char *)v67;
v50 = v66;
}
else
{
v50 = (unsigned __int8)v65 >> 1;
v49 = (char *)&v65 + 1;
}
v51 = std::string::append((__int64)v68, v49, v50);
v52 = *(_QWORD *)(v51 + 8);
v69 = *(_QWORD *)v51;
v70 = v52;
v71 = *(void **)(v51 + 16);
*(_QWORD *)v51 = 0;
*(_QWORD *)(v51 + 8) = 0;
*(_QWORD *)(v51 + 16) = 0;
v53 = (char *)&v69 + 1;
if ( (v69 & 1) != 0 )
v53 = (char *)v71;
v48(v47, v53);
if ( (v69 & 1) != 0 )
operator delete(v71);
if ( (v68[0] & 1) != 0 )
operator delete((void *)v68[2]);
--v35;
}
while ( v35 );
}
v36 = 1.0;
if ( v21 >= 1.0 )
v36 = v21;
cocos2d::CCLabelBMFont::limitLabelWidth(*((cocos2d::CCLabelBMFont **)this + 93), v36, 0.6, 0.45);
v37 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 93) + 328LL))(*((_QWORD *)this + 93));
if ( v21 < (float)(v37 * (*(float (__fastcall **)(_QWORD))(**((_QWORD **)this + 93) + 168LL))(*((_QWORD *)this + 93))) )
(*(void (__fastcall **)(_QWORD, char *))(**((_QWORD **)this + 93) + 928LL))(*((_QWORD *)this + 93), &byte_11B8890);
if ( (v65 & 1) != 0 )
operator delete(v67);
if ( (v62 & 1) != 0 )
operator delete(v64);
return _stack_chk_guard;
}