//
// GJMessageCell::loadFromMessage from 0x33990c to 0x339efa (1518 bytes)
//
// 1 xrefs:
// > CustomListView::loadCell @ 0x33bd5e
//
// 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; // r0
cocos2d::CCLabelBMFont *v5; // r5
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
ButtonSprite *v8; // r10
CCMenuItemSpriteExtra *v9; // r6
cocos2d::CCNode *v10; // r6
float m_width; // s17
float *v12; // r0
ButtonSprite *v13; // r10
cocos2d::CCLabelBMFont_vtbl *v14; // r3
CCMenuItemSpriteExtra *v15; // r8
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
char *v17; // r1
const char *v18; // r8
cocos2d::CCString *v19; // r0
cocos2d::CCLabelBMFont *v20; // r7
int v21; // r10
float v22; // s17
float v23; // r0
CCMenuItemSpriteExtra *v24; // r7
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v26; // r7
cocos2d::CCString *v27; // r0
cocos2d::CCLabelBMFont *v28; // r7
float *v29; // r0
cocos2d::CCSprite *v30; // r7
cocos2d::CCSprite *v31; // r9
CCMenuItemToggler *v32; // r0
GJUserMessage *v33; // r3
CCMenuItemToggler *m_toggler; // r7
void (__fastcall *v35)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
GJUserMessage *v36; // r3
cocos2d::CCLabelBMFont *v37; // r6
void (__fastcall *v38)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
int v40; // r7
float width; // s16
float v42; // r0
float v43; // [sp+10h] [bp-5Ch]
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+10h] [bp-5Ch]
void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+10h] [bp-5Ch]
int v46; // [sp+14h] [bp-58h]
void (__fastcall *v47)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-58h]
void (__fastcall *v48)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-58h]
cocos2d::CCLabelBMFont *m_label; // [sp+1Ch] [bp-50h]
const char *v50; // [sp+24h] [bp-48h] BYREF
int v51; // [sp+28h] [bp-44h] BYREF
cocos2d::CCPoint v52; // [sp+2Ch] [bp-40h] BYREF
cocos2d::CCPoint v53; // [sp+34h] [bp-38h] BYREF
cocos2d::CCPoint v54; // [sp+3Ch] [bp-30h] BYREF
void (*v55)(GJMessageCell *, cocos2d::CCObject *); // [sp+44h] [bp-28h]
int v56; // [sp+48h] [bp-24h]
void (*v57)(GJMessageCell *, cocos2d::CCObject *); // [sp+4Ch] [bp-20h]
int v58; // [sp+50h] [bp-1Ch]
cocos2d::CCPoint v59; // [sp+54h] [bp-18h] BYREF
cocos2d::CCPoint v60; // [sp+5Ch] [bp-10h] BYREF
cocos2d::SEL_MenuHandler v61; // 0:r3.4,4:^0.4
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_775C20(&v60, &a1->m_message->m_title);
v5 = cocos2d::CCLabelBMFont::create();
sub_774008(&v60);
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
setAnchorPoint = v5->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v60, 0.0, 0.5);
setAnchorPoint(v5, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v5->setScale)(v5, 1065353216);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(&v60, 38.0, (float)(a1->m_height * 0.5) + 14.0);
setPosition(v5, &v60);
cocos2d::CCLabelBMFont::limitLabelWidth(v5, 180.0, 0.5, 0.0);
v56 = 0;
v55 = GJMessageCell::onViewMessage;
v8 = ButtonSprite::create(
(ButtonSprite *)"View",
(const char *)&word_32,
0,
0.6,
0,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41C80000,
v43);
v9 = CCMenuItemSpriteExtra::create(
v8,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessageCell::onViewMessage, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v9, 1.1);
v10 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v9, nullptr);
a1->m_mainLayer->addChild(a1->m_mainLayer, v10);
m_width = a1->m_width;
v44 = v10->setPosition;
v12 = (float *)v8->getContentSize(v8);
cocos2d::CCPoint::CCPoint(&v60, (float)(m_width - (float)(*v12 * 0.5)) - 45.0, a1->m_height * 0.5);
v44(v10, &v60);
v13 = ButtonSprite::create(
(ButtonSprite *)"X",
(const char *)&word_32,
0,
0.6,
0,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41FA0000,
*(float *)&v44);
((void (__fastcall *)(ButtonSprite *, int))v13->setScale)(v13, 1061997773);
v14 = v13->m_label->__vftable;
m_label = v13->m_label;
v45 = v14->setPosition;
v46 = (int)v14->getPosition(m_label);
cocos2d::CCPoint::CCPoint(&v59, 1.5, -0.5);
cocos2d::CCPoint::operator+(&v60, v46, &v59);
v45(m_label, &v60);
v58 = 0;
v57 = GJMessageCell::onDeleteMessage;
v15 = CCMenuItemSpriteExtra::create(
v13,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessageCell::onDeleteMessage, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v15, 1.1);
v10->addChild(v10, v15);
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v59, a1->m_width - 22.0, a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v60, v10, &v59);
v16(v15, &v60);
if ( a1->m_message->m_outgoing )
v17 = "To:";
else
v17 = "From:";
sub_776584((int)&v50, v17);
v18 = v50;
sub_775C20(&v51, &a1->m_message->m_username);
v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s %s", v18, v51);
cocos2d::CCString::getCString(v19);
sub_774008(&v51);
v20 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v20->setScale)(v20, 1065353216);
cocos2d::CCLabelBMFont::limitLabelWidth(v20, 140.0, 0.5, 0.0);
v21 = (int)v5->getPosition(v5);
v22 = v20->getContentSize(v20)->width * 0.5;
v23 = v20->getScale(v20);
cocos2d::CCPoint::CCPoint(&v60, (float)(v22 * v23) + 1.0, -15.0);
cocos2d::CCPoint::operator+(&v52, v21, &v60);
v59.y = 0.0;
LODWORD(v59.x) = GJMessageCell::onViewProfile;
v24 = CCMenuItemSpriteExtra::create(
v20,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessageCell::onViewProfile, (unsigned int)a1));
v10->addChild(v10, v24);
v25 = v24->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v60, v10, &v52);
v25(v24, &v60);
sub_775C20(&v53, &a1->m_message->m_uploadDate);
v26 = *(_DWORD *)(LODWORD(v53.x) - 12);
sub_774008(&v53);
if ( v26 )
{
sub_775C20(&v54, &a1->m_message->m_uploadDate);
v27 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s ago",
(const char *)LODWORD(v54.x));
cocos2d::CCString::getCString(v27);
v28 = cocos2d::CCLabelBMFont::create();
sub_774008(&v54);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v28, 1);
v47 = v28->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v60, 0.0, 0.5);
v47(v28, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v28->setScale)(v28, 1056964608);
v28->setColor(v28, &stru_9AA43F);
v28->setOpacity(v28, 125);
v48 = v28->setPosition;
v29 = (float *)v5->getPosition(v5);
cocos2d::CCPoint::CCPoint(&v60, *v29 + 3.0, 10.0);
v48(v28, &v60);
}
v30 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v30->setScale)(v30, 1060320051);
((void (__fastcall *)(cocos2d::CCSprite *, int))v31->setScale)(v31, 1060320051);
v61.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJMessageCell::onToggle;
v60.y = 0.0;
v61.adj = 0;
LODWORD(v60.x) = GJMessageCell::onToggle;
v32 = CCMenuItemToggler::create(v31, v30, a1, v61);
v33 = a1->m_message;
a1->m_toggler = v32;
CCMenuItemToggler::toggle(v32, v33->m_toggled);
v10->addChild(v10, a1->m_toggler);
m_toggler = a1->m_toggler;
v35 = m_toggler->setPosition;
cocos2d::CCPoint::CCPoint(&v53, 20.0, a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v54, v10, &v53);
v35(m_toggler, &v54);
CCMenuItemToggler::setSizeMult(a1->m_toggler, 1.2);
v36 = a1->m_message;
if ( !v36->m_read && !v36->m_outgoing )
{
v37 = cocos2d::CCLabelBMFont::create();
v37->setColor(v37, (const cocos2d::ccColor3B *)&unk_9AA442);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v37->setScale)(v37, 1056964608);
v38 = v37->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v54, 0.0, 0.5);
v38(v37, &v54);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v37, 10);
v39 = v37->setPosition;
v40 = (int)v5->getPosition(v5);
width = v5->getContentSize(v5)->width;
v42 = v5->getScale(v5);
cocos2d::CCPoint::CCPoint(&v53, (float)(width * v42) + 5.0, 0.0);
cocos2d::CCPoint::operator+(&v54, v40, &v53);
v39(v37, &v54);
v37->setTag(v37, 100);
}
sub_774008(&v50);
}
}