//
// SetTextPopup::addPathLabel from 0x1403a8150 to 0x1403a83ba (618 bytes)
//
// 2 xrefs:
// > SFXBrowser::cellPerformedAction @ 0x140620146
// > ??> @ 0x140923864
//
// 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:19 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall SetTextPopup::addPathLabel(__int64 a1, __int64 *a2)
{
__int64 v4; // rax
const char *v5; // rcx
cocos2d::CCLabelBMFont *v6; // r14
__int64 v7; // rdx
void (__fastcall *v8)(char *, __int64); // r8
unsigned __int64 v9; // rax
int v10; // ebp
__int64 v11; // rsi
unsigned __int64 v12; // rbx
__int64 v13; // rax
__int64 i; // rax
unsigned __int64 v15; // rdx
__int64 v16; // rsi
unsigned __int64 v17; // rcx
unsigned __int64 v18; // rbx
__int64 v19; // rax
int j; // ebx
_QWORD *PathSegments; // rax
_QWORD *v22; // rdx
__int64 v23; // rbx
__int64 v24; // rax
float v26[2]; // [rsp+20h] [rbp-88h] BYREF
char v27[8]; // [rsp+28h] [rbp-80h] BYREF
_BYTE v28[32]; // [rsp+30h] [rbp-78h] BYREF
v4 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v4, v26);
v5 = (const char *)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v5 = (const char *)*a2;
v6 = cocos2d::CCLabelBMFont::create(v5, "chatFont.fnt");
v7 = *((_QWORD *)v6 + 46);
v8 = *(void (__fastcall **)(char *, __int64))(v7 + 40);
LOBYTE(v7) = -56;
v8((char *)v6 + 368, v7);
(**((void (__fastcall ***)(__int64, void *))v6 + 46))((__int64)v6 + 368, &unk_1407034A8);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)v6 + 160LL))(v6);
v9 = a2[2];
if ( v9 )
{
v10 = 1;
v11 = (__int64)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v11 = *a2;
if ( v9 >= 3 )
{
v12 = v9 + v11;
v13 = sub_1406774C0(v11, v9 + v11, " / ", 3);
if ( v13 != v12 )
{
for ( i = v13 - v11; i != -1; i = v19 - v16 )
{
++v10;
v15 = i + 3;
v16 = (__int64)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v16 = *a2;
v17 = a2[2];
if ( v17 < 3 )
break;
if ( v15 > v17 - 3 )
break;
v18 = v17 + v16;
v19 = sub_1406774C0(v16 + v15, v17 + v16, " / ", 3);
if ( v19 == v18 )
break;
}
}
}
for ( j = v10 - 1; j >= 1; --j )
{
if ( (float)(*(float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)v6 + 320LL))(v6)
* 0.60000002) <= 280.0 )
break;
PathSegments = (_QWORD *)GameToolbox::keepLastPathSegments((__int64)v28, a2, " / ", j);
v22 = PathSegments;
if ( PathSegments[3] > 0xFu )
v22 = (_QWORD *)*PathSegments;
(**((void (__fastcall ***)(__int64, _QWORD *))v6 + 45))((__int64)v6 + 360, v22);
sub_14003D310((__int64)v28);
}
}
cocos2d::CCLabelBMFont::limitLabelWidth(v6, 280.0, 0.60000002, 0.30000001);
v23 = *(_QWORD *)v6;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v27,
v26[0] * 0.5,
(float)((float)(v26[1] * 0.5) - 22.0) + *(float *)(a1 + 684));
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64))(v23 + 184))(v6, v24);
return (*(__int64 (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v6);
}