//
// GJLevelScoreCell::loadFromScore from 0x61a9dc to 0x61b548 (2924 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x6205ac
// > ??> @ 0x89dc0
//
// 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
//
void GJLevelScoreCell::loadFromScore(GJLevelScoreCell *a1, GJUserScore *a2)
{
SimplePlayer *v4; // x19
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
void (__fastcall *setColor)(SimplePlayer *__hidden, const cocos2d::ccColor3B *); // x20
GameManager *v7; // x0
GameManager *v8; // x0
GJUserScore *m_userScore; // x1
char v10; // w3
IconType m_iconType; // w2
int m_iconID; // w1
cocos2d::CCMenuItem *v13; // x1
cocos2d::CCNode *v14; // x21
const char *m_playerRank; // x1
cocos2d::CCSprite *v16; // x20
cocos2d::CCArray **p_m_pTargetArray; // x0
cocos2d::CCLabelBMFont *v18; // x20
cocos2d::CCArray **v19; // x0
CCMenuItemSpriteExtra *v20; // x27
float width; // s11
float v22; // s10
__int64 v23; // x19
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
float v25; // s8
float v26; // s0
unsigned int m_stars; // w20
GJUserScore *v28; // x0
cocos2d::CCArray **v29; // x0
cocos2d::CCLabelBMFont *v30; // x23
void (__fastcall *v31)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
GJUserScore *v33; // x1
int m_secretCoins; // w28
int v35; // w21
int i; // w20
cocos2d::CCSprite *v37; // x19
void (__fastcall *v38)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
__int64 v39; // x27
double v40; // d0
cocos2d::CCString *v41; // x0
cocos2d::CCLabelBMFont *v42; // x19
void (__fastcall *v43)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x20
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
char *v45; // x1
char *v46; // x0
cocos2d::CCArray **v47; // x20
cocos2d::CCString *v48; // x0
size_t v49; // x0
cocos2d::CCLayerColor *m_backgroundLayer; // x0
void (__fastcall *v51)(cocos2d::CCLayerColor *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCString *v52; // x0
cocos2d::CCLabelBMFont *v53; // x24
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19
void (__fastcall *v55)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x19
int v61; // w0
unsigned int *v62; // x1
int v63; // w2
unsigned int *p_m_nExtraKerning; // x1
int m_nExtraKerning; // w2
unsigned int *v66; // x1
int v67; // w2
const char *CString; // [xsp+88h] [xbp+88h]
cocos2d::CCPoint v69; // [xsp+98h] [xbp+98h] BYREF
__int64 v70; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCLabelBMFont *v71; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v72; // [xsp+B0h] [xbp+B0h] BYREF
char *v73; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCLabelBMFont *v74; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v75; // 0:kr00_8.8
cocos2d::SEL_MenuHandler v76; // 0:x2.16
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
a1->m_userScore = a2;
v4 = SimplePlayer::create((int)&dword_0 + 1);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v4, 1);
v4->setScale(v4, 0.8);
setPosition = v4->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, 60.0, (float)(a1->m_height * 0.5) + 0.0);
setPosition(v4, (const cocos2d::CCPoint *)&v74);
setColor = v4->setColor;
v7 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v74 = GameManager::colorForIdx(v7, a1->m_userScore->m_color1);
setColor(v4, (const cocos2d::ccColor3B *)&v74);
v8 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v74 = GameManager::colorForIdx(v8, a1->m_userScore->m_color2);
SimplePlayer::setSecondColor(v4, (const cocos2d::ccColor3B *)&v74);
SimplePlayer::tryEnableCustomGlowColor(v4, a1->m_userScore->m_color3);
m_userScore = a1->m_userScore;
v10 = m_userScore->m_special == 2 || m_userScore->m_glowEnabled;
m_iconType = m_userScore->m_iconType;
m_iconID = m_userScore->m_iconID;
v4->m_hasGlowOutline = v10;
SimplePlayer::updatePlayerFrame(v4, m_iconID, m_iconType);
SimplePlayer::updateColors(v4);
v14 = (cocos2d::CCNode *)cocos2d::CCMenu::create(nullptr, v13);
a1->m_mainLayer->addChild(a1->m_mainLayer, v14);
cocos2d::CCPoint::CCPoint(&v69, 22.0, a1->m_height * 0.5);
m_playerRank = (const char *)(unsigned int)a1->m_userScore->m_playerRank;
if ( (int)m_playerRank > 3 )
{
v52 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", m_playerRank);
cocos2d::CCString::getCString(v52);
v53 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v53);
v53->setPosition(v53, &v69);
cocos2d::CCLabelBMFont::limitLabelWidth(v53, 20.0, 0.75, 0.0);
}
else
{
v74 = (cocos2d::CCLabelBMFont *)&byte_124B6C8;
if ( (_DWORD)m_playerRank == 1 )
{
sub_D1798C(&v74, "rankIcon_top10_001.png", 22);
}
else if ( (_DWORD)m_playerRank == 2 )
{
sub_D1798C(&v74, "rankIcon_top50_001.png", 22);
}
else
{
sub_D1798C(&v74, "rankIcon_top100_001.png", 23);
}
v16 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v74);
a1->m_mainLayer->addChild(a1->m_mainLayer, v16);
v16->setPosition(v16, &v69);
v16->setScale(v16, 0.8);
p_m_pTargetArray = &v74[-1].m_pTargetArray;
if ( &v74[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v74[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v74[-1].m_nExtraKerning;
v74[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
}
sub_D18D28(&v74, &a1->m_userScore->m_userName);
v18 = cocos2d::CCLabelBMFont::create();
v19 = &v74[-1].m_pTargetArray;
if ( &v74[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)&v74[-1].m_nExtraKerning;
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = v74[-1].m_nExtraKerning;
v74[-1].m_nExtraKerning = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v19);
}
if ( a1->m_userScore->m_levelMode == 1 )
cocos2d::CCLabelBMFont::limitLabelWidth(v18, 100.0, 0.7, 0.0);
else
cocos2d::CCLabelBMFont::limitLabelWidth(v18, 130.0, 0.8, 0.0);
v76.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v76.adj = (size_t)GJLevelScoreCell::onViewProfile;
v20 = CCMenuItemSpriteExtra::create(v18, nullptr, v76);
v14->addChild(v14, v20);
width = v18->getContentSize(v18)->width;
v22 = v18->getScale(v18);
v23 = (__int64)v4->getPosition(v4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, 30.0, 0.0);
cocos2d::CCPoint::operator+(&v70, v23, &v74);
v24 = v20->setPosition;
v25 = v18->getContentSize(v18)->width * 0.5;
v26 = v18->getScale(v18);
cocos2d::CCPoint::CCPoint(&v72, v25 * v26, 0.0);
cocos2d::CCPoint::operator+(&v73, &v70, &v72);
v75 = cocos2d::CCNode::convertToNodeSpace(v14, (const cocos2d::CCPoint *)&v73);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCLabelBMFont **, float, float))v24)(v20, &v74, v75.x, v75.y);
if ( GJUserScore::isCurrentUser(a1->m_userScore) )
{
m_backgroundLayer = a1->m_backgroundLayer;
v51 = m_backgroundLayer->setColor;
LOWORD(v74) = -26906;
BYTE2(v74) = 10;
v51(m_backgroundLayer, (const cocos2d::ccColor3B *)&v74);
}
m_stars = a1->m_userScore->m_stars;
sub_D153B8((int)&v71, &byte_F288A0);
v28 = a1->m_userScore;
if ( v28->m_levelMode != 1 )
{
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i%%", (const char *)m_stars);
CString = cocos2d::CCString::getCString(v48);
v49 = strlen(CString);
sub_D1798C(&v71, CString, v49);
goto LABEL_16;
}
if ( v28->m_leaderboardMode )
{
GameToolbox::pointsToString((GameToolbox *)m_stars, (__int64 *)&v74);
sub_D163D4(&v71, &v74);
v29 = &v74[-1].m_pTargetArray;
if ( &v74[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)&v74[-1].m_nExtraKerning;
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = v74[-1].m_nExtraKerning;
v74[-1].m_nExtraKerning = v57 - 1;
}
if ( v57 <= 0 )
goto LABEL_35;
}
}
else
{
GameToolbox::msToTimeString((GameToolbox *)m_stars, 1, &v72);
sub_D163D4(&v71, &v72);
v29 = (cocos2d::CCArray **)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v66 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v67 = __ldaxr(v66);
while ( __stlxr(v67 - 1, v66) );
}
else
{
v67 = *(_DWORD *)(*(_QWORD *)&v72 - 8LL);
*(_DWORD *)(*(_QWORD *)&v72 - 8LL) = v67 - 1;
}
if ( v67 <= 0 )
LABEL_35:
operator delete(v29);
}
}
LABEL_16:
v30 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v30, 2);
if ( a1->m_userScore->m_levelMode == 1 )
{
setAnchorPoint = v30->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, 1.0, 0.5);
setAnchorPoint(v30, (const cocos2d::CCPoint *)&v74);
cocos2d::CCLabelBMFont::limitLabelWidth(v30, 85.0, 0.5, 0.0);
v55 = v30->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, a1->m_width - 60.0, a1->m_height * 0.5);
v55(v30, (const cocos2d::CCPoint *)&v74);
}
else
{
v31 = v30->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, 0.0, 0.5);
v31(v30, (const cocos2d::CCPoint *)&v74);
cocos2d::CCLabelBMFont::limitLabelWidth(v30, 200.0, 0.6, 0.0);
v32 = v30->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, (float)(width * v22) + 6.0, -1.0);
cocos2d::CCPoint::operator+(&v74, &v70, &v73);
v32(v30, (const cocos2d::CCPoint *)&v74);
v33 = a1->m_userScore;
m_secretCoins = v33->m_secretCoins;
if ( m_secretCoins <= 0 )
goto LABEL_21;
v35 = 65;
for ( i = 0; i != m_secretCoins; ++i )
{
v37 = cocos2d::CCSprite::createWithSpriteFrameName("usercoin_small01_001.png");
a1->m_mainLayer->addChild(a1->m_mainLayer, v37);
v37->setScale(v37, 0.9);
v38 = v37->setPosition;
v39 = (__int64)v30->getPosition(v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, (float)v35, 5.0);
cocos2d::CCPoint::operator+(&v74, v39, &v73);
v38(v37, (const cocos2d::CCPoint *)&v74);
v35 += 8;
}
}
v33 = a1->m_userScore;
LABEL_21:
*(_QWORD *)&v40 = sub_D18D28(&v73, &v33->m_unkString).n128_u64[0];
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s ago", v73, v40);
cocos2d::CCString::getCString(v41);
v42 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v42, 1);
v43 = v42->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, 1.0, 0.5);
v43(v42, (const cocos2d::CCPoint *)&v74);
v42->setScale(v42, 0.5);
v42->setColor(v42, (const cocos2d::ccColor3B *)&unk_EBE230);
v42->setOpacity(v42, 125);
v44 = v42->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v74, a1->m_width - 11.0, 10.0);
v44(v42, (const cocos2d::CCPoint *)&v74);
if ( a1->m_userScore->m_levelMode == 1 )
{
cocos2d::CCLabelBMFont::limitLabelWidth(v42, 35.0, 0.5, 0.0);
v45 = v73;
v46 = v73 - 24;
if ( v73 - 24 == (char *)&qword_124B6B0 )
goto LABEL_23;
}
else
{
v45 = v73;
v46 = v73 - 24;
if ( v73 - 24 == (char *)&qword_124B6B0 )
goto LABEL_23;
}
if ( &pthread_create )
{
v58 = (unsigned int *)(v45 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *((_DWORD *)v45 - 2);
*((_DWORD *)v45 - 2) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v46);
LABEL_23:
v47 = &v71[-1].m_pTargetArray;
if ( &v71[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)&v71[-1].m_nExtraKerning;
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = v71[-1].m_nExtraKerning;
v71[-1].m_nExtraKerning = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v47);
}
}