//
// GJLevelScoreCell::loadFromScore from 0x1400ba0a0 to 0x1400bab11 (2673 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x1400ab9c3
// > ??> @ 0x1406c7d10
//
// 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
//
// Hidden C++ exception states: #wind=5
void GJLevelScoreCell::loadFromScore(GJLevelScoreCell *a1, GJUserScore *a2)
{
GJUserScore *v2; // rbx
SimplePlayer *v4; // r14
SimplePlayer_vtbl *v5; // rbx
const cocos2d::CCPoint *v6; // rax
cocos2d::ccColor3B *v7; // rcx
cocos2d::CCRGBAProtocol_vtbl *v8; // rdi
cocos2d::ccColor3B *v9; // rax
cocos2d::ccColor3B *v10; // rcx
cocos2d::ccColor3B *v11; // rax
GJUserScore *m_userScore; // rax
bool v13; // al
struct cocos2d::CCMenu *v14; // r12
int m_playerRank; // edx
cocos2d::CCString *v16; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v18; // rbx
char *v19; // rdx
__m128i *v20; // rcx
struct cocos2d::CCSprite *v21; // rbx
__m128i *v22; // rcx
cocos2d::CCLabelBMFont *v23; // r15
float v24; // xmm2_4
float v25; // xmm1_4
CCMenuItemSpriteExtra *v26; // rdi
float *v27; // rbx
double v28; // xmm0_8
float v29; // xmm9_4
__int64 v30; // rax
float v31; // xmm6_4
double v32; // xmm0_8
CCMenuItemSpriteExtra_vtbl *v33; // rbx
struct cocos2d::CCPoint v34; // rax
GJUserScore *v35; // rax
signed int m_stars; // edx
void **v37; // rbx
void *v38; // rcx
cocos2d::CCString *v39; // rax
char *v40; // rax
size_t v41; // r8
void **v42; // rcx
struct cocos2d::CCLabelBMFont *v43; // r14
cocos2d::CCLabelBMFont_vtbl *v44; // rbx
const cocos2d::CCPoint *v45; // rax
cocos2d::CCLabelBMFont_vtbl *v46; // rbx
const cocos2d::CCPoint *v47; // rax
const cocos2d::CCPoint *v48; // rax
int m_secretCoins; // ecx
int v50; // r15d
__int64 v51; // r12
struct cocos2d::CCSprite *v52; // rdi
__int64 v53; // rax
const char *v54; // rdx
cocos2d::CCString *v55; // rax
const char *v56; // rax
struct cocos2d::CCLabelBMFont *v57; // rdi
cocos2d::CCLabelBMFont_vtbl *v58; // rbx
const cocos2d::CCPoint *v59; // rax
__int64 v60; // rdx
cocos2d::CCLabelBMFont_vtbl *v61; // rbx
const cocos2d::CCPoint *v62; // rax
__int16 v63; // [rsp+28h] [rbp-A9h] BYREF
char v64; // [rsp+2Ah] [rbp-A7h]
cocos2d::CCPoint v65; // [rsp+2Ch] [rbp-A5h] BYREF
cocos2d::CCPoint v66; // [rsp+34h] [rbp-9Dh] BYREF
cocos2d::CCPoint v67; // [rsp+40h] [rbp-91h] BYREF
cocos2d::CCPoint v68; // [rsp+48h] [rbp-89h] BYREF
char v69[8]; // [rsp+50h] [rbp-81h] BYREF
void *Block[2]; // [rsp+58h] [rbp-79h] BYREF
__int128 v71; // [rsp+68h] [rbp-69h]
__m128i v72; // [rsp+78h] [rbp-59h] BYREF
__int64 v73; // [rsp+88h] [rbp-49h]
unsigned __int64 v74; // [rsp+90h] [rbp-41h]
_QWORD v75[4]; // [rsp+98h] [rbp-39h] BYREF
v2 = a2;
LOBYTE(a2) = 1;
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, (bool)a2);
a1->m_userScore = v2;
v4 = SimplePlayer::create(1);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v4, 1);
((void (__fastcall *)(SimplePlayer *))v4->setScale_0)(v4);
v5 = v4->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v65, 60.0, (float)(a1->m_height * 0.5) + 0.0);
v5->setPosition_0(v4, v6);
v7 = (cocos2d::ccColor3B *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v67 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v67);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = (cocos2d::ccColor3B *)qword_1406C2ED8;
}
v8 = v4->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCRGBAProtocol::__vftable;
v9 = GameManager::colorForIdx(v7, (GameManager *)&v63, a1->m_userScore->m_color1);
v8->setColor(&v4->cocos2d::CCRGBAProtocol, v9);
v10 = (cocos2d::ccColor3B *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v67 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v67);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = (cocos2d::ccColor3B *)qword_1406C2ED8;
}
v11 = GameManager::colorForIdx(v10, (GameManager *)&v65, a1->m_userScore->m_color2);
v4->m_secondLayer->setColor(&v4->m_secondLayer->cocos2d::CCRGBAProtocol, v11);
SimplePlayer::updateColors(v4);
SimplePlayer::tryEnableCustomGlowColor(v4, a1->m_userScore->m_color3);
m_userScore = a1->m_userScore;
v13 = m_userScore->m_special == 2 || m_userScore->m_glowEnabled;
v4->m_hasGlowOutline = v13;
SimplePlayer::updatePlayerFrame(v4, a1->m_userScore->m_iconID, a1->m_userScore->m_iconType);
SimplePlayer::updateColors(v4);
v14 = cocos2d::CCMenu::create(nullptr);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v14);
cocos2d::CCPoint::CCPoint(&v68, 22.0, a1->m_height * 0.5);
m_playerRank = a1->m_userScore->m_playerRank;
if ( m_playerRank <= 3 )
{
v72 = 0;
v73 = 0;
v74 = 15;
v72.m128i_i8[0] = 0;
if ( m_playerRank == 1 )
{
v19 = (char *)sub_14003AA10(0x20u);
v73 = 22;
v74 = 31;
strcpy(v19, "rankIcon_top10_001.png");
v72.m128i_i64[0] = (__int64)v19;
}
else
{
if ( m_playerRank == 2 )
{
v19 = (char *)sub_14003AA10(0x20u);
v73 = 22;
v74 = 31;
strcpy(v19, "rankIcon_top50_001.png");
}
else
{
v19 = (char *)sub_14003AA10(0x20u);
v73 = 23;
v74 = 31;
strcpy(v19, "rankIcon_top100_001.png");
}
v72.m128i_i64[0] = (__int64)v19;
}
v20 = &v72;
if ( v74 > 0xF )
v20 = (__m128i *)v19;
v21 = cocos2d::CCSprite::createWithSpriteFrameName(v20->m128i_i8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v21);
v21->setPosition_0(v21, &v68);
((void (__fastcall *)(struct cocos2d::CCSprite *))v21->setScale_0)(v21);
sub_14003A830((__int64)&v72);
}
else
{
v16 = cocos2d::CCString::createWithFormat("%i", m_playerRank);
CString = cocos2d::CCString::getCString(v16);
v18 = cocos2d::CCLabelBMFont::create(CString, "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v18);
v18->setPosition_0(v18, &v68);
cocos2d::CCLabelBMFont::limitLabelWidth(v18, 20.0, 0.75, 0.0);
}
sub_14003BDB0((__int64)&v72, (__int64)&a1->m_userScore->m_userName);
v22 = &v72;
if ( v74 > 0xF )
v22 = (__m128i *)v72.m128i_i64[0];
v23 = cocos2d::CCLabelBMFont::create(v22->m128i_i8, "goldFont.fnt");
sub_14003A830((__int64)&v72);
if ( a1->m_userScore->m_levelMode == 1 )
{
v24 = 0.69999999;
v25 = 100.0;
}
else
{
v24 = 0.80000001;
v25 = 130.0;
}
cocos2d::CCLabelBMFont::limitLabelWidth(v23, v25, v24, 0.0);
v26 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJLevelScoreCell::onViewProfile);
v14->addChild_1(v14, v26);
v27 = (float *)v23->getContentSize(v23);
v28 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v23->getScale)(v23);
v29 = *(float *)&v28 * *v27;
cocos2d::CCPoint::CCPoint(&v67, 30.0, 0.0);
v30 = (__int64)v4->getPosition_0(v4);
cocos2d::CCPoint::operator+(v30, v69);
v31 = v23->getContentSize(v23)->width * 0.5;
v32 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v23->getScale)(v23);
cocos2d::CCPoint::CCPoint(&v67, *(float *)&v32 * v31, 0.0);
cocos2d::CCPoint::operator+(v69, &v65);
v33 = v26->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v34 = cocos2d::CCNode::convertToNodeSpace(v14, &v66);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v33->setPosition_0)(v26, v34);
if ( GJUserScore::isCurrentUser(a1->m_userScore) )
{
v63 = -26906;
v64 = 10;
a1->m_backgroundLayer->setColor(&a1->m_backgroundLayer->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v63);
}
v35 = a1->m_userScore;
m_stars = v35->m_stars;
*(_OWORD *)Block = 0;
*(_QWORD *)&v71 = 0;
*((_QWORD *)&v71 + 1) = 15;
LOBYTE(Block[0]) = 0;
if ( v35->m_levelMode == 1 )
{
if ( v35->m_leaderboardMode )
{
v37 = (void **)GameToolbox::pointsToString(&v72, m_stars);
if ( Block != v37 )
{
if ( *((_QWORD *)&v71 + 1) > 0xFu )
{
v38 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v71 + 1) + 1LL) >= 0x1000 )
{
v38 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v38 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
goto LABEL_39;
}
LABEL_40:
*(_QWORD *)&v71 = 0;
*((_QWORD *)&v71 + 1) = 15;
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)v37;
v71 = *((_OWORD *)v37 + 1);
v37[2] = nullptr;
v37[3] = (void *)15;
*(_BYTE *)v37 = 0;
}
}
else
{
v37 = GameToolbox::msToTimeString((void **)&v72, m_stars);
if ( Block != v37 )
{
if ( *((_QWORD *)&v71 + 1) > 0xFu )
{
v38 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v71 + 1) + 1LL) >= 0x1000 )
{
v38 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v38 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
LABEL_39:
j_j_free(v38);
goto LABEL_40;
}
goto LABEL_40;
}
}
sub_14003A830((__int64)&v72);
goto LABEL_45;
}
v39 = cocos2d::CCString::createWithFormat("%i%%", m_stars);
v40 = (char *)cocos2d::CCString::getCString(v39);
v41 = -1;
do
++v41;
while ( v40[v41] );
sub_14003CCE0(Block, v40, v41);
LABEL_45:
v42 = Block;
if ( *((_QWORD *)&v71 + 1) > 0xFu )
v42 = (void **)Block[0];
v43 = cocos2d::CCLabelBMFont::create((const char *)v42, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v43, 2);
v44 = v43->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a1->m_userScore->m_levelMode == 1 )
{
cocos2d::CCPoint::CCPoint(&v66, 1.0, 0.5);
v44->setAnchorPoint(v43, v45);
cocos2d::CCLabelBMFont::limitLabelWidth(v43, 85.0, 0.5, 0.0);
v46 = v43->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v66, a1->m_width - 60.0, a1->m_height * 0.5);
v46->setPosition_0(v43, v47);
}
else
{
cocos2d::CCPoint::CCPoint(&v66, 0.0, 0.5);
v44->setAnchorPoint(v43, v48);
cocos2d::CCLabelBMFont::limitLabelWidth(v43, 200.0, 0.60000002, 0.0);
cocos2d::CCPoint::CCPoint(&v66, v29 + 6.0, -1.0);
cocos2d::CCPoint::operator+(v69, &v65);
v43->setPosition_0(v43, &v65);
m_secretCoins = a1->m_userScore->m_secretCoins;
if ( m_secretCoins > 0 )
{
v50 = 65;
v51 = (unsigned int)m_secretCoins;
do
{
v52 = cocos2d::CCSprite::createWithSpriteFrameName("usercoin_small01_001.png");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v52);
((void (__fastcall *)(struct cocos2d::CCSprite *))v52->setScale_0)(v52);
cocos2d::CCPoint::CCPoint(&v66, (float)v50, 5.0);
v53 = (__int64)v43->getPosition_0(v43);
cocos2d::CCPoint::operator+(v53, &v65);
v52->setPosition_0(v52, &v65);
v50 += 8;
--v51;
}
while ( v51 );
}
}
sub_14003BDB0((__int64)v75, (__int64)&a1->m_userScore->m_unkString);
v54 = (const char *)v75;
if ( v75[3] > 0xFu )
v54 = (const char *)v75[0];
v55 = cocos2d::CCString::createWithFormat("%s ago", v54);
v56 = cocos2d::CCString::getCString(v55);
v57 = cocos2d::CCLabelBMFont::create(v56, "chatFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v57, 1);
v58 = v57->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v66, 1.0, 0.5);
v58->setAnchorPoint(v57, v59);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v57->setScale_0)(v57);
v57->setColor(&v57->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&word_140529A10);
LOBYTE(v60) = 125;
v57->setOpacity(&v57->cocos2d::CCRGBAProtocol, v60);
v61 = v57->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v66, a1->m_width - 11.0, 10.0);
v61->setPosition_0(v57, v62);
if ( a1->m_userScore->m_levelMode == 1 )
cocos2d::CCLabelBMFont::limitLabelWidth(v57, 35.0, 0.5, 0.0);
sub_14003A830((__int64)v75);
sub_14003A830((__int64)Block);
}