//
// GJMessageCell::loadFromMessage from 0x61cd80 to 0x61d778 (2552 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x6205c4
// > ??> @ 0xaa9b8
//
// 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 GJMessageCell::loadFromMessage(GJMessageCell *a1, GJUserMessage *a2)
{
GJUserMessage *m_message; // x0
cocos2d::CCLabelBMFont *v5; // x21
cocos2d::CCArray **p_m_pTargetArray; // x0
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
const char *v9; // x6
cocos2d::CCNode *v10; // x27
CCMenuItemSpriteExtra *v11; // x22
cocos2d::CCNode *v12; // x22
cocos2d::CCNode *v13; // x0
float m_width; // s11
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
float *v17; // x0
const char *v18; // x6
cocos2d::CCNode *v19; // x24
cocos2d::CCComponentContainer *m_pComponentContainer; // x27
void (__fastcall *visit)(cocos2d::CCComponentContainer *__hidden, float); // x28
CCMenuItemSpriteExtra *v22; // x24
void (__fastcall *v23)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
char *v24; // x1
const char *v25; // x24
double v26; // d0
cocos2d::CCString *v27; // x0
void *v28; // x0
cocos2d::CCLabelBMFont *v29; // x24
__int64 v30; // x28
float v31; // s8
float v32; // s0
CCMenuItemSpriteExtra *v33; // x24
void (__fastcall *v34)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
void *v35; // x0
__int64 v36; // x24
double v37; // d0
cocos2d::CCString *v38; // x0
cocos2d::CCLabelBMFont *v39; // x24
cocos2d::CCArray **v40; // x0
void (__fastcall *v41)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x27
void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
float *v43; // x0
cocos2d::CCSprite *v44; // x24
cocos2d::CCSprite *v45; // x27
CCMenuItemToggler *v46; // x0
GJUserMessage *v47; // x1
CCMenuItemToggler *m_toggler; // x24
void (__fastcall *v49)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
GJUserMessage *v50; // x0
cocos2d::CCLabelBMFont *v51; // x22
void (__fastcall *v52)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
__int64 v54; // x24
float width; // s8
float v56; // s0
char *v57; // x21
unsigned int *v58; // x19
int v59; // w0
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *p_m_nExtraKerning; // x1
int m_nExtraKerning; // w2
unsigned int *v66; // x1
int v67; // w2
__int64 v68; // [xsp+88h] [xbp+88h]
const char *v69; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v70; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v71; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v72; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCLabelBMFont *v73; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v74; // 0:kr00_8.8
cocos2d::CCPoint v75; // 0:kr08_8.8
cocos2d::CCPoint v76; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v77; // 0:x2.16
cocos2d::SEL_MenuHandler v78; // 0:x2.16
cocos2d::SEL_MenuHandler v79; // 0:x2.16
cocos2d::SEL_MenuHandler v80; // 0:x3.16
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
if ( a2 )
{
m_message = a1->m_message;
if ( m_message )
cocos2d::CCObject::release(m_message);
a1->m_message = a2;
cocos2d::CCObject::retain(a2);
sub_D18D28(&v73, &a1->m_message->m_title);
v5 = cocos2d::CCLabelBMFont::create();
p_m_pTargetArray = &v73[-1].m_pTargetArray;
if ( &v73[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v73[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v73[-1].m_nExtraKerning;
v73[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
setAnchorPoint = v5->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, 0.0, 0.5);
setAnchorPoint(v5, (const cocos2d::CCPoint *)&v73);
v5->setScale(v5, 1.0);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, 38.0, (float)(a1->m_height * 0.5) + 14.0);
setPosition(v5, (const cocos2d::CCPoint *)&v73);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 180.0, 0.5, 0.0);
v10 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"View",
(const char *)&dword_30 + 2,
0,
0,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v9,
25.0);
v77.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v77.adj = (size_t)GJMessageCell::onViewMessage;
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, v77);
CCMenuItemSpriteExtra::setSizeMult(v11, 1.1);
v12 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v11, nullptr);
a1->m_mainLayer->addChild(a1->m_mainLayer, v12);
v13 = v10;
m_width = a1->m_width;
getContentSize = v10->getContentSize;
v16 = v12->setPosition;
v17 = (float *)getContentSize(v13);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v73,
(float)(m_width - (float)(*v17 * 0.5)) - 45.0,
a1->m_height * 0.5);
v16(v12, (const cocos2d::CCPoint *)&v73);
v19 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"X",
(const char *)&dword_30 + 2,
0,
0,
0.6,
"bigFont.fnt",
"GJ_button_06.png",
v18,
31.25);
v19->setScale(v19, 0.8);
m_pComponentContainer = v19[1].m_pComponentContainer;
visit = m_pComponentContainer->__vftable[2].visit;
v68 = ((__int64 (__fastcall *)(cocos2d::CCComponentContainer *))m_pComponentContainer->__vftable[3].~CCComponentContainer)(m_pComponentContainer);
cocos2d::CCPoint::CCPoint(&v72, 1.5, -0.5);
cocos2d::CCPoint::operator+(&v73, v68, &v72);
((void (__fastcall *)(cocos2d::CCComponentContainer *, cocos2d::CCLabelBMFont **))visit)(
m_pComponentContainer,
&v73);
v78.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v78.adj = (size_t)GJMessageCell::onDeleteMessage;
v22 = CCMenuItemSpriteExtra::create(v19, nullptr, v78);
CCMenuItemSpriteExtra::setSizeMult(v22, 1.1);
v12->addChild(v12, v22);
v23 = v22->setPosition;
cocos2d::CCPoint::CCPoint(&v72, a1->m_width - 22.0, a1->m_height * 0.5);
v74 = cocos2d::CCNode::convertToNodeSpace(v12, &v72);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCLabelBMFont **, float, float))v23)(
v22,
&v73,
v74.x,
v74.y);
if ( a1->m_message->m_outgoing )
v24 = "To:";
else
v24 = "From:";
sub_D153B8((int)&v69, v24);
v25 = v69;
*(_QWORD *)&v26 = sub_D18D28(&v70, &a1->m_message->m_username).n128_u64[0];
v27 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s %s", v25, v70, v26);
cocos2d::CCString::getCString(v27);
v28 = (void *)(v70 - 24);
if ( (__int64 *)(v70 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(v70 - 8);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(v70 - 8);
*(_DWORD *)(v70 - 8) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v28);
}
v29 = cocos2d::CCLabelBMFont::create();
v29->setScale(v29, 1.0);
cocos2d::CCLabelBMFont::limitLabelWidth(v29, 140.0, 0.5, 0.0);
v30 = (__int64)v5->getPosition(v5);
v31 = v29->getContentSize(v29)->width * 0.5;
v32 = v29->getScale(v29);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, (float)(v31 * v32) + 1.0, -15.0);
cocos2d::CCPoint::operator+(&v71, v30, &v73);
v79.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v79.adj = (size_t)GJMessageCell::onViewProfile;
v33 = CCMenuItemSpriteExtra::create(v29, nullptr, v79);
v12->addChild(v12, v33);
v34 = v33->setPosition;
v75 = cocos2d::CCNode::convertToNodeSpace(v12, &v71);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCLabelBMFont **, float, float))v34)(
v33,
&v73,
v75.x,
v75.y);
sub_D18D28(&v72, &a1->m_message->m_uploadDate);
v35 = (void *)(*(_QWORD *)&v72 - 24LL);
v36 = *(_QWORD *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v72 - 8LL);
*(_DWORD *)(*(_QWORD *)&v72 - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v35);
}
if ( v36 )
{
*(_QWORD *)&v37 = sub_D18D28(&v73, &a1->m_message->m_uploadDate).n128_u64[0];
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s ago",
(const char *)v73,
v37);
cocos2d::CCString::getCString(v38);
v39 = cocos2d::CCLabelBMFont::create();
v40 = &v73[-1].m_pTargetArray;
if ( &v73[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v66 = (unsigned int *)&v73[-1].m_nExtraKerning;
do
v67 = __ldaxr(v66);
while ( __stlxr(v67 - 1, v66) );
}
else
{
v67 = v73[-1].m_nExtraKerning;
v73[-1].m_nExtraKerning = v67 - 1;
}
if ( v67 <= 0 )
operator delete(v40);
}
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v39, 1);
v41 = v39->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, 0.0, 0.5);
v41(v39, (const cocos2d::CCPoint *)&v73);
v39->setScale(v39, 0.5);
v39->setColor(v39, (const cocos2d::ccColor3B *)&unk_EBE230);
v39->setOpacity(v39, 125);
v42 = v39->setPosition;
v43 = (float *)v5->getPosition(v5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, *v43 + 3.0, 10.0);
v42(v39, (const cocos2d::CCPoint *)&v73);
}
v44 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
v44->setScale(v44, 0.7);
v45->setScale(v45, 0.7);
v80.adj = 0;
v80.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJMessageCell::onToggle;
v46 = CCMenuItemToggler::create(v45, v44, a1, v80);
v47 = a1->m_message;
a1->m_toggler = v46;
CCMenuItemToggler::toggle(v46, v47->m_toggled);
v12->addChild(v12, a1->m_toggler);
m_toggler = a1->m_toggler;
v49 = m_toggler->setPosition;
cocos2d::CCPoint::CCPoint(&v72, 20.0, a1->m_height * 0.5);
v76 = cocos2d::CCNode::convertToNodeSpace(v12, &v72);
((void (__fastcall *)(CCMenuItemToggler *, cocos2d::CCLabelBMFont **, float, float))v49)(
m_toggler,
&v73,
v76.x,
v76.y);
CCMenuItemToggler::setSizeMult(a1->m_toggler, 1.2);
v50 = a1->m_message;
if ( !v50->m_read && !v50->m_outgoing )
{
v51 = cocos2d::CCLabelBMFont::create();
v51->setColor(v51, (const cocos2d::ccColor3B *)&unk_EBE238);
v51->setScale(v51, 0.5);
v52 = v51->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v73, 0.0, 0.5);
v52(v51, (const cocos2d::CCPoint *)&v73);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v51, 10);
v53 = v51->setPosition;
v54 = (__int64)v5->getPosition(v5);
width = v5->getContentSize(v5)->width;
v56 = v5->getScale(v5);
cocos2d::CCPoint::CCPoint(&v72, (float)(width * v56) + 5.0, 0.0);
cocos2d::CCPoint::operator+(&v73, v54, &v72);
v53(v51, (const cocos2d::CCPoint *)&v73);
v51->setTag(v51, 100);
}
v57 = (char *)(v69 - 24);
if ( v69 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(v69 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *((_DWORD *)v69 - 2);
*((_DWORD *)v69 - 2) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v57);
}
}
}