//
// FontPreviewCell::loadFromIndex from 0x14058d9c0 to 0x14058dd17 (855 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x140146090
// > ??> @ 0x14092cc00
//
// 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:34:30 +0000
//
__int64 __fastcall FontPreviewCell::loadFromIndex(__int64 a1, __int64 a2, int a3)
{
int v4; // ebp
float v6; // xmm8_4
float v7; // xmm6_4
cocos2d::CCString *v8; // rax
const char *CString; // rbx
__int64 v10; // rdx
__int64 v11; // rcx
cocos2d::CCSpriteFrameCache *v12; // rax
struct cocos2d::CCSpriteFrame *v13; // rax
float v14; // xmm7_4
struct cocos2d::CCSprite *v15; // rdi
__int64 v16; // rbx
__int64 v17; // rax
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rbx
void (__fastcall **v21)(__int64, __int16 *); // rax
cocos2d::CCString *v22; // rax
const char *v23; // rax
__int64 v24; // rbx
__int64 v25; // rax
__int64 v26; // rbx
__int64 v27; // rax
const char *v28; // rcx
struct cocos2d::CCSprite *v29; // rbx
cocos2d::CCObject *v30; // rax
struct cocos2d::CCMenuItem *v31; // rdi
struct cocos2d::CCMenu *v32; // r14
__int64 v33; // rcx
__int64 v34; // rax
cocos2d::CCTouchDispatcher *v35; // rax
__int64 v36; // rcx
__int64 v37; // rax
__int64 v38; // rax
__int64 v39; // rbx
__int64 v40; // rax
__int64 v41; // rax
__int64 result; // rax
char v43; // [rsp+90h] [rbp+8h] BYREF
__int16 v44; // [rsp+98h] [rbp+10h] BYREF
char v45; // [rsp+9Ah] [rbp+12h]
char v46; // [rsp+A8h] [rbp+20h] BYREF
v4 = a2;
LOBYTE(a2) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 576LL))(*(_QWORD *)(a1 + 544), a2);
v6 = *(float *)(a1 + 528);
v7 = *(float *)(a1 + 532);
*(_DWORD *)(a1 + 564) = v4;
v8 = cocos2d::CCString::createWithFormat("font%02dPreview.png", v4);
CString = cocos2d::CCString::getCString(v8);
v12 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v11, v10);
v13 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v12, CString);
v14 = v7 * 0.5;
if ( v13 )
{
v15 = cocos2d::CCSprite::createWithSpriteFrame(v13);
v16 = *(_QWORD *)v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, 0.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v16 + 288))(v15, v17);
v18 = *(_QWORD *)v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, 8.0, v14);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v18 + 184))(v15, v19);
if ( *(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v15 + 320LL))(v15) + 4) > (float)(v7 - 4.0) )
{
v20 = *(_QWORD *)v15;
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v15 + 320LL))(v15);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v20 + 160))(v15);
}
if ( v4 == a3 )
{
v44 = -256;
v21 = *((void (__fastcall ***)(__int64, __int16 *))v15 + 40);
v45 = -106;
(*v21)((__int64)v15 + 320, &v44);
}
}
else
{
v22 = cocos2d::CCString::createWithFormat("Font %i", v4 + 1);
v23 = cocos2d::CCString::getCString(v22);
v15 = cocos2d::CCLabelBMFont::create(v23, (const char *)&qword_140704F78);
v24 = *(_QWORD *)v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, 0.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v24 + 288))(v15, v25);
v26 = *(_QWORD *)v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, 8.0, v14);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v26 + 184))(v15, v27);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v15 + 160LL))(v15);
}
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *))(**(_QWORD **)(a1 + 544) + 464LL))(
*(_QWORD *)(a1 + 544),
v15);
v28 = "GJ_selectSongBtn_001.png";
if ( v4 == a3 )
v28 = "GJ_selectSongOnBtn_001.png";
v29 = cocos2d::CCSprite::createWithSpriteFrameName(v28);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v29 + 160LL))(v29);
v30 = CCMenuItemSpriteExtra::create((int)v29, 0, a1, (__int64)FontPreviewCell::onSelectFont);
v31 = v30;
*((_DWORD *)v30 + 93) = 1066192077;
if ( v4 == a3 )
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v30 + 936LL))(v30, 0);
v32 = cocos2d::CCMenu::create(v31, 0);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCMenu *, __int64))(**(_QWORD **)(a1 + 544) + 456LL))(
*(_QWORD *)(a1 + 544),
v32,
3);
v34 = cocos2d::CCDirector::sharedDirector(v33);
v35 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v34 + 144LL))(v34);
if ( cocos2d::CCTouchDispatcher::isUsingForcePrio(v35) )
{
v37 = cocos2d::CCDirector::sharedDirector(v36);
v38 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 144LL))(v37);
(*(void (__fastcall **)(struct cocos2d::CCMenu *, _QWORD))(*(_QWORD *)v32 + 944LL))(
v32,
(unsigned int)(*(_DWORD *)(v38 + 128) - 1));
}
v39 = *(_QWORD *)v31;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v43, v6 - 18.0, v14);
cocos2d::CCNode::convertToNodeSpace(v32, &v46, v40);
(*(void (__fastcall **)(struct cocos2d::CCMenuItem *, __int64))(v39 + 184))(v31, v41);
result = 4281096353LL;
if ( (v4 & 1) != 0 )
result = 4282282690LL;
*(_DWORD *)(a1 + 560) = result;
return result;
}