//
// GJMessageCell::loadFromMessage from 0x1400bd500 to 0x1400bdde4 (2276 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x1400abb96
// > ??> @ 0x1406c7e18
//
// 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 GJMessageCell::loadFromMessage(GJMessageCell *a1, GJUserMessage *a2)
{
GJUserMessage *v2; // rbx
GJUserMessage *m_message; // rcx
const char *v5; // rcx
struct cocos2d::CCLabelBMFont *v6; // r15
cocos2d::CCLabelBMFont_vtbl *v7; // rbx
const cocos2d::CCPoint *v8; // rax
cocos2d::CCLabelBMFont_vtbl *v9; // rbx
const cocos2d::CCPoint *v10; // rax
ButtonSprite *v11; // rdi
CCMenuItemSpriteExtra *v12; // rax
struct cocos2d::CCMenu *v13; // r12
cocos2d::CCMenu_vtbl *v14; // rbx
float m_height; // xmm6_4
float *v16; // rax
const cocos2d::CCPoint *v17; // rax
ButtonSprite *v18; // r14
cocos2d::CCLabelBMFont *m_label; // rdi
__int64 v20; // rax
CCMenuItemSpriteExtra *v21; // rdi
CCMenuItemSpriteExtra_vtbl *v22; // rbx
struct cocos2d::CCPoint v23; // rax
const char *v24; // rdx
size_t v25; // r8
const char *v26; // r8
const char *v27; // rdx
cocos2d::CCString *v28; // rax
const char *CString; // rbx
cocos2d::CCLabelBMFont *v30; // rdi
float v31; // xmm6_4
double v32; // xmm0_8
__int64 v33; // rax
CCMenuItemSpriteExtra *v34; // rdi
CCMenuItemSpriteExtra_vtbl *v35; // rbx
struct cocos2d::CCPoint v36; // rax
const char *v37; // rdx
cocos2d::CCString *v38; // rax
const char *v39; // rax
struct cocos2d::CCLabelBMFont *v40; // rdi
cocos2d::CCLabelBMFont_vtbl *v41; // rbx
const cocos2d::CCPoint *v42; // rax
__int64 v43; // rdx
cocos2d::CCLabelBMFont_vtbl *v44; // rbx
float *v45; // rax
const cocos2d::CCPoint *v46; // rax
struct cocos2d::CCSprite *v47; // rdi
struct cocos2d::CCSprite *v48; // rbx
CCMenuItemToggler *v49; // rax
CCMenuItemToggler_vtbl *v50; // rbx
struct cocos2d::CCPoint v51; // rax
CCMenuItemToggler *m_toggler; // rcx
GJUserMessage *v53; // rax
struct cocos2d::CCLabelBMFont *v54; // rdi
cocos2d::CCLabelBMFont_vtbl *v55; // rbx
const cocos2d::CCPoint *v56; // rax
float *v57; // rbx
double v58; // xmm0_8
__int64 v59; // rax
ButtonSprite *v60; // [rsp+58h] [rbp-79h] BYREF
cocos2d::CCPoint v61; // [rsp+60h] [rbp-71h] BYREF
char v62[8]; // [rsp+68h] [rbp-69h] BYREF
_QWORD v63[3]; // [rsp+70h] [rbp-61h] BYREF
unsigned __int64 v64; // [rsp+88h] [rbp-49h]
__int128 v65; // [rsp+90h] [rbp-41h] BYREF
__int64 v66; // [rsp+A0h] [rbp-31h]
unsigned __int64 v67; // [rsp+A8h] [rbp-29h]
_QWORD v68[4]; // [rsp+B0h] [rbp-21h] BYREF
v2 = a2;
LOBYTE(a2) = 1;
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, (bool)a2);
if ( v2 )
{
m_message = a1->m_message;
if ( m_message )
cocos2d::CCObject::release(m_message);
a1->m_message = v2;
cocos2d::CCObject::retain(v2);
sub_14003BDB0((__int64)v68, (__int64)&a1->m_message->m_title);
v5 = (const char *)v68;
if ( v68[3] > 0xFu )
v5 = (const char *)v68[0];
v6 = cocos2d::CCLabelBMFont::create(v5, (const char *)&qword_14052A4D8);
sub_14003A830((__int64)v68);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v6);
v7 = v6->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, 0.0, 0.5);
v7->setAnchorPoint(v6, v8);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v6->setScale_0)(v6);
v9 = v6->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, 38.0, (float)(a1->m_height * 0.5) + 14.0);
v9->setPosition_0(v6, v10);
cocos2d::CCLabelBMFont::limitLabelWidth(v6, 180.0, 0.5, 0.0);
v60 = (ButtonSprite *)operator new(0x2C0u);
v11 = ButtonSprite::ButtonSprite(v60);
if ( v11 )
{
if ( ButtonSprite::init_1(
v11,
"View",
50,
0,
0.60000002,
0,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
25.0) )
{
cocos2d::CCObject::autorelease(v11);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v11->~ButtonSprite)(v11, 1);
v11 = nullptr;
}
}
v12 = CCMenuItemSpriteExtra::create(v11, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessageCell::onViewMessage);
HIDWORD(v12->m_pfnSelector.adj) = 1066192077;
v13 = cocos2d::CCMenu::create(v12, 0);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v13);
v14 = v13->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_height = a1->m_height;
v16 = (float *)v11->getContentSize(v11);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v60,
(float)(a1->m_width - (float)(*v16 * 0.5)) - 45.0,
m_height * 0.5);
v14->setPosition_0(v13, v17);
v60 = (ButtonSprite *)operator new(0x2C0u);
v18 = ButtonSprite::ButtonSprite(v60);
if ( v18 )
{
if ( ButtonSprite::init_1(
v18,
"X",
50,
0,
0.60000002,
0,
(const char *)&qword_14052A4D8,
"GJ_button_06.png",
31.25) )
{
cocos2d::CCObject::autorelease(v18);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v18->~ButtonSprite)(v18, 1);
v18 = nullptr;
}
}
((void (__fastcall *)(ButtonSprite *))v18->setScale_0)(v18);
m_label = v18->m_label;
cocos2d::CCPoint::CCPoint(&v61, 1.5, -0.5);
v20 = (__int64)m_label->getPosition_0(m_label);
cocos2d::CCPoint::operator+(v20, &v60);
m_label->setPosition_0(m_label, (const cocos2d::CCPoint *)&v60);
v21 = CCMenuItemSpriteExtra::create(v18, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessageCell::onDeleteMessage);
HIDWORD(v21->m_pfnSelector.adj) = 1066192077;
v13->addChild_1(v13, v21);
v22 = v21->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v61, a1->m_width - 22.0, a1->m_height * 0.5);
v23 = cocos2d::CCNode::convertToNodeSpace(v13, (const struct cocos2d::CCPoint *)&v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v22->setPosition_0)(v21, v23);
v24 = "From:";
if ( a1->m_message->m_outgoing )
v24 = (const char *)&unk_1405474A8;
v65 = 0;
v66 = 0;
v67 = 0;
v25 = -1;
do
++v25;
while ( v24[v25] );
sub_14003A930(&v65, v24, v25);
sub_14003BDB0((__int64)v63, (__int64)&a1->m_message->m_username);
v26 = (const char *)v63;
if ( v64 > 0xF )
v26 = (const char *)v63[0];
v27 = (const char *)&v65;
if ( v67 > 0xF )
v27 = (const char *)v65;
v28 = cocos2d::CCString::createWithFormat("%s %s", v27, v26);
CString = cocos2d::CCString::getCString(v28);
sub_14003A830((__int64)v63);
v30 = cocos2d::CCLabelBMFont::create(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v30->setScale_0)(v30);
cocos2d::CCLabelBMFont::limitLabelWidth(v30, 140.0, 0.5, 0.0);
v31 = v30->getContentSize(v30)->width * 0.5;
v32 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v30->getScale)(v30);
cocos2d::CCPoint::CCPoint(&v61, (float)(*(float *)&v32 * v31) + 1.0, -15.0);
v33 = (__int64)v6->getPosition_0(v6);
cocos2d::CCPoint::operator+(v33, v62);
v34 = CCMenuItemSpriteExtra::create(v30, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessageCell::onViewProfile);
v13->addChild_1(v13, v34);
v35 = v34->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v36 = cocos2d::CCNode::convertToNodeSpace(v13, &v61);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v35->setPosition_0)(v34, v36);
sub_14003BDB0((__int64)v63, (__int64)&a1->m_message->m_uploadDate);
LOBYTE(v35) = v63[2] != 0;
sub_14003A830((__int64)v63);
if ( (_BYTE)v35 )
{
sub_14003BDB0((__int64)v63, (__int64)&a1->m_message->m_uploadDate);
v37 = (const char *)v63;
if ( v64 > 0xF )
v37 = (const char *)v63[0];
v38 = cocos2d::CCString::createWithFormat("%s ago", v37);
v39 = cocos2d::CCString::getCString(v38);
v40 = cocos2d::CCLabelBMFont::create(v39, "chatFont.fnt");
sub_14003A830((__int64)v63);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v40, 1);
v41 = v40->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v61, 0.0, 0.5);
v41->setAnchorPoint(v40, v42);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v40->setScale_0)(v40);
v40->setColor(&v40->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&word_140529A10);
LOBYTE(v43) = 125;
v40->setOpacity(&v40->cocos2d::CCRGBAProtocol, v43);
v44 = v40->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v45 = (float *)v6->getPosition_0(v6);
cocos2d::CCPoint::CCPoint(&v61, *v45 + 3.0, 10.0);
v44->setPosition_0(v40, v46);
}
v47 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
v48 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v47->setScale_0)(v47);
((void (__fastcall *)(struct cocos2d::CCSprite *))v48->setScale_0)(v48);
v49 = CCMenuItemToggler::create(v48, v47, a1, (cocos2d::SEL_MenuHandler *)GJMessageCell::onToggle);
a1->m_toggler = v49;
CCMenuItemToggler::toggle(v49, a1->m_message->m_toggled);
v13->addChild_1(v13, a1->m_toggler);
v50 = a1->m_toggler->__vftable;
cocos2d::CCPoint::CCPoint(&v61, 20.0, a1->m_height * 0.5);
v51 = cocos2d::CCNode::convertToNodeSpace(v13, (const struct cocos2d::CCPoint *)&v60);
((void (__fastcall *)(CCMenuItemToggler *, struct cocos2d::CCPoint))v50->setPosition_0)(a1->m_toggler, v51);
m_toggler = a1->m_toggler;
*(_DWORD *)(*(_QWORD *)&m_toggler->m_nScriptTapHandler + 372LL) = 1067030938;
HIDWORD(m_toggler->m_offButton->m_pfnSelector.adj) = 1067030938;
CCMenuItemToggler::toggle(m_toggler, (bool)m_toggler->m_onButton);
v53 = a1->m_message;
if ( !v53->m_read && !v53->m_outgoing )
{
v54 = cocos2d::CCLabelBMFont::create("!", (const char *)&qword_14052A4D8);
v54->setColor(&v54->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&unk_140529A18);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v54->setScale_0)(v54);
v55 = v54->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v61, 0.0, 0.5);
v55->setAnchorPoint(v54, v56);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v54, 10);
v57 = (float *)v6->getContentSize(v6);
v58 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v6->getScale)(v6);
cocos2d::CCPoint::CCPoint(&v61, (float)(*(float *)&v58 * *v57) + 5.0, 0.0);
v59 = (__int64)v6->getPosition_0(v6);
cocos2d::CCPoint::operator+(v59, &v60);
v54->setPosition_0(v54, (const cocos2d::CCPoint *)&v60);
v54->setTag(v54, 100);
}
sub_14003A830((__int64)&v65);
}
}