//
// GJLocalLevelScoreCell::loadFromScore from 0x61a450 to 0x61a854 (1028 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x620440
// > ??> @ 0xbc9e8
//
// 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 GJLocalLevelScoreCell::loadFromScore(GJLocalLevelScoreCell *a1, GJLocalScore *a2)
{
GJLocalScore *m_localScore; // x0
void *v5; // x0
char *v6; // x1
cocos2d::CCSprite *v7; // x22
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCLabelBMFont *v9; // x22
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x24
float v11; // s1
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
char *p_m_fBrVertexMod; // x0
cocos2d::CCArray **p_m_pTargetArray; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
unsigned int *p_m_nExtraKerning; // x20
int m_nExtraKerning; // w1
unsigned int *p_m_fTextureTop; // x1
int m_fTextureTop_low; // w2
cocos2d::CCLabelBMFont *v23; // [xsp+48h] [xbp+48h] BYREF
__int64 v24; // [xsp+50h] [xbp+50h] BYREF
cocos2d::CCSprite *v25; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v26; // [xsp+60h] [xbp+60h] BYREF
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
a1->m_localScore = a2;
sub_D153B8((int)&v23, &byte_F288A0);
m_localScore = a1->m_localScore;
if ( m_localScore->m_type )
{
GameToolbox::pointsToString((GameToolbox *)(unsigned int)m_localScore->m_points, (__int64 *)&v26);
sub_D163D4(&v23, &v26);
v5 = (void *)(*(_QWORD *)&v26 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v26 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(*(_QWORD *)&v26 - 8LL);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(*(_QWORD *)&v26 - 8LL);
*(_DWORD *)(*(_QWORD *)&v26 - 8LL) = v16 - 1;
}
if ( v16 <= 0 )
goto LABEL_13;
}
}
else
{
GameToolbox::msToTimeString((GameToolbox *)(unsigned int)m_localScore->m_points, 1, &v24);
sub_D163D4(&v23, &v24);
v5 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v24 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v18 - 1;
}
if ( v18 <= 0 )
LABEL_13:
operator delete(v5);
}
}
if ( a1->m_localScore->m_type == 1 )
v6 = "GJ_pointsIcon_001.png";
else
v6 = "GJ_timeIcon_001.png";
sub_D153B8((int)&v25, v6);
v7 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v25);
v7->setScale(v7, 0.55);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, 20);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v26, 20.0, a1->m_height * 0.5);
setPosition(v7, &v26);
v9 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v9, 2);
setAnchorPoint = v9->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v26, 0.0, 0.5);
setAnchorPoint(v9, &v26);
cocos2d::CCLabelBMFont::limitLabelWidth(v9, 200.0, 0.46, 0.0);
v11 = (float)(a1->m_height * 0.5) + 0.5;
v12 = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v26, 40.0, v11);
v12(v9, &v26);
p_m_fBrVertexMod = (char *)&v25[-1].m_fBrVertexMod;
if ( (__int64 *)&v25[-1].m_fBrVertexMod != &qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_fTextureTop = (unsigned int *)&v25[-1].m_fTextureTop;
do
m_fTextureTop_low = __ldaxr(p_m_fTextureTop);
while ( __stlxr(m_fTextureTop_low - 1, p_m_fTextureTop) );
}
else
{
m_fTextureTop_low = LODWORD(v25[-1].m_fTextureTop);
LODWORD(v25[-1].m_fTextureTop) = m_fTextureTop_low - 1;
}
if ( m_fTextureTop_low <= 0 )
operator delete(p_m_fBrVertexMod);
}
p_m_pTargetArray = &v23[-1].m_pTargetArray;
if ( &v23[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v23[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v23[-1].m_nExtraKerning;
v23[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
}