//
// GJMessagePopup::loadFromGJMessage from 0x4ad914 to 0x4adc64 (848 bytes)
//
// 2 xrefs:
// > GJMessagePopup::init @ 0x4ae27a
// > GJMessagePopup::downloadMessageFinished @ 0x4ae3be
//
// 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 GJMessagePopup::loadFromGJMessage(GJMessagePopup *a1, GJUserMessage *a2)
{
GJUserMessage *m_message; // r0
cocos2d::CCDirector *v5; // r0
int v6; // r7
int v7; // r9
void (__fastcall *v8)(int, cocos2d::CCPoint *); // r11
void (__fastcall *v9)(int, cocos2d::CCPoint *); // r11
void (__fastcall *v10)(int, cocos2d::CCPoint *); // r11
GJUserMessage *v11; // r3
ButtonSprite *v12; // r0
CCMenuItemSpriteExtra *v13; // r10
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
ButtonSprite *v15; // r0
CCMenuItemSpriteExtra *v16; // r7
void (__fastcall *v17)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
ButtonSprite *v18; // r0
CCMenuItemSpriteExtra *v19; // r5
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCMenu *v21; // [sp+10h] [bp-5Ch]
cocos2d::CCMenu *m_buttonMenu; // [sp+10h] [bp-5Ch]
char *v23; // [sp+1Ch] [bp-50h] BYREF
int v24; // [sp+20h] [bp-4Ch] BYREF
cocos2d::CCSize v25; // [sp+24h] [bp-48h] BYREF
cocos2d::CCPoint v26; // [sp+2Ch] [bp-40h] BYREF
cocos2d::CCPoint v27; // [sp+34h] [bp-38h] BYREF
cocos2d::CCPoint v28; // [sp+3Ch] [bp-30h] BYREF
cocos2d::CCPoint v29; // [sp+44h] [bp-28h] BYREF
void (*v30)(GJMessagePopup *, cocos2d::CCObject *); // [sp+4Ch] [bp-20h]
int v31; // [sp+50h] [bp-1Ch]
cocos2d::CCPoint v32; // [sp+54h] [bp-18h] BYREF
cocos2d::CCPoint v33; // [sp+5Ch] [bp-10h] BYREF
if ( a2 )
{
cocos2d::CCObject::retain(a2);
m_message = a1->m_message;
if ( m_message )
cocos2d::CCObject::release(m_message);
a1->m_message = a2;
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v25, v5);
sub_776584((int)&v23, "No message");
sub_775C20(&v24);
v6 = *(_DWORD *)(v24 - 12);
sub_774008(&v24);
if ( v6 )
{
sub_775C20(&v28);
sub_774794(&v23, &v28);
sub_774008(&v28);
}
cocos2d::CCPoint::CCPoint(&v26, v25.width * 0.5, (float)(v25.height * 0.5) - 4.0);
sub_776584((int)&v29, v23);
cocos2d::CCPoint::CCPoint(&v33, 0.0, 0.5);
v7 = TextArea::create(
(TextArea *)&v29,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
1133576192,
&v33,
(cocos2d::CCPoint)0x141A00000LL);
sub_774008(&v29);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, (cocos2d::CCNode *)v7, 6);
v8 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v7 + 92);
cocos2d::CCPoint::CCPoint(&v32, 0.0, 2.0);
cocos2d::CCPoint::operator+(&v33, &v26, &v32);
v8(v7, &v33);
v9 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v7 + 140);
cocos2d::CCPoint::CCPoint(&v33, 0.0, 0.5);
v9(v7, &v33);
v10 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v7 + 92);
cocos2d::CCPoint::CCPoint(&v32, (float)((float)(370.0 - *(float *)(v7 + 560)) * 0.5) - 185.0, 4.0);
cocos2d::CCPoint::operator+(&v33, &v26, &v32);
v10(v7, &v33);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v7 + 80))(v7, 1065353216);
cocos2d::CCPoint::CCPoint(&v27, v25.width * 0.5, (float)((float)(v25.height * 0.5) - 120.0) + 22.0);
v11 = a1->m_message;
if ( !v11->m_outgoing )
{
v12 = ButtonSprite::create(
(ButtonSprite *)"Reply",
(const char *)&dword_40 + 1,
v11->m_outgoing,
0.55,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41D00000,
*(float *)&v21);
v31 = 0;
v30 = GJMessagePopup::onReply;
v13 = CCMenuItemSpriteExtra::create(
v12,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessagePopup::onReply, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v13);
setPosition = v13->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v29, -140.0, 0.0);
cocos2d::CCPoint::operator+(&v32, &v27, &v29);
cocos2d::CCNode::convertToNodeSpace(&v33, m_buttonMenu, &v32);
setPosition(v13, &v33);
v15 = ButtonSprite::create(
(ButtonSprite *)"Block",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41D00000,
*(float *)&m_buttonMenu);
v32.y = 0.0;
LODWORD(v32.x) = GJMessagePopup::onBlock;
v16 = CCMenuItemSpriteExtra::create(
v15,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessagePopup::onBlock, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v16);
v17 = v16->setPosition;
v21 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v28, 140.0, 0.0);
cocos2d::CCPoint::operator+(&v29, &v27, &v28);
cocos2d::CCNode::convertToNodeSpace(&v33, v21, &v29);
v17(v16, &v33);
}
v18 = ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_04.png",
(const char *)0x41D00000,
*(float *)&v21);
v33.y = 0.0;
LODWORD(v33.x) = GJMessagePopup::onRemove;
v19 = CCMenuItemSpriteExtra::create(
v18,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJMessagePopup::onRemove, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v19);
v20 = v19->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v29, a1->m_buttonMenu, &v27);
v20(v19, &v29);
sub_774008(&v23);
}
}