//
// GJMessagePopup::loadFromGJMessage from 0x8cdd54 to 0x8ce390 (1596 bytes)
//
// 3 xrefs:
// > GJMessagePopup::init @ 0x8ceb68
// > GJMessagePopup::downloadMessageFinished @ 0x8cef8c
// > ??> @ 0x684f0
//
// 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; // x0
GJUserMessage *v4; // x1
cocos2d::CCDirector *v5; // x0
void *v6; // x0
__int64 v7; // x21
__int64 v8; // x25
void *v9; // x0
void (__fastcall *v10)(__int64, cocos2d::CCPoint *); // x27
void (__fastcall *v11)(__int64, cocos2d::CCPoint *); // x27
void (__fastcall *v12)(__int64, cocos2d::CCPoint *); // x27
const char *v13; // x6
cocos2d::CCNode *v14; // x0
CCMenuItemSpriteExtra *v15; // x27
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
const char *v17; // x6
cocos2d::CCNode *v18; // x0
CCMenuItemSpriteExtra *v19; // x27
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCNode *v21; // x0
CCMenuItemSpriteExtra *v22; // x21
cocos2d::CCMenu *v23; // x0
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
char *v25; // x21
void *v26; // x0
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x20
int v34; // w0
cocos2d::CCMenu *m_buttonMenu; // [xsp+78h] [xbp+78h]
cocos2d::CCMenu *v37; // [xsp+78h] [xbp+78h]
float v38; // [xsp+90h] [xbp+90h]
float v39; // [xsp+94h] [xbp+94h]
char *v40; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v41; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v42; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v43; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v44; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v45; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v46; // 0:kr08_8.8
cocos2d::CCPoint v47; // 0:kr10_8.8
cocos2d::CCPoint v48; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v49; // 0:x2.16
cocos2d::SEL_MenuHandler v50; // 0:x2.16
cocos2d::SEL_MenuHandler v51; // 0:x2.16
if ( !a2 )
return;
cocos2d::CCObject::retain(a2);
m_message = a1->m_message;
v4 = a2;
if ( m_message )
{
cocos2d::CCObject::release(m_message);
v4 = a2;
}
a1->m_message = v4;
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
sub_D153B8((int)&v40, "No message");
sub_D18D28(&v43);
v6 = (void *)(*(_QWORD *)&v43 - 24LL);
v7 = *(_QWORD *)(*(_QWORD *)&v43 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v43 - 24LL) == &qword_124B6B0 )
goto LABEL_5;
if ( &pthread_create )
{
v29 = (unsigned int *)(*(_QWORD *)&v43 - 8LL);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(*(_QWORD *)&v43 - 8LL);
*(_DWORD *)(*(_QWORD *)&v43 - 8LL) = v30 - 1;
}
if ( v30 > 0 )
{
LABEL_5:
if ( v7 )
{
LABEL_11:
sub_D18D28(&v44);
sub_D163D4(&v40, &v44);
v26 = (void *)(*(_QWORD *)&v44 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v44 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(*(_QWORD *)&v44 - 8LL);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(*(_QWORD *)&v44 - 8LL);
*(_DWORD *)(*(_QWORD *)&v44 - 8LL) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v26);
}
}
}
else
{
operator delete(v6);
if ( v7 )
goto LABEL_11;
}
cocos2d::CCPoint::CCPoint(&v41, v38 * 0.5, (float)(v39 * 0.5) + -4.0);
sub_D153B8((int)&v45, v40);
cocos2d::CCPoint::CCPoint(&v44, 0.0, 0.5);
v8 = TextArea::create((__int64)&v45, "chatFont.fnt", &v44, 1, 1.0, 290.0, 20.0);
v9 = (void *)(*(_QWORD *)&v45 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v45 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(*(_QWORD *)&v45 - 8LL);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(*(_QWORD *)&v45 - 8LL);
*(_DWORD *)(*(_QWORD *)&v45 - 8LL) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v9);
}
a1->m_mainLayer->addChild_0(a1->m_mainLayer, (cocos2d::CCNode *)v8, 6);
v10 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v8 + 184LL);
cocos2d::CCPoint::CCPoint(&v44, 0.0, 2.0);
cocos2d::CCPoint::operator+(&v45, &v41, &v44);
v10(v8, &v45);
v11 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v8 + 280LL);
cocos2d::CCPoint::CCPoint(&v45, 0.0, 0.5);
v11(v8, &v45);
v12 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v8 + 184LL);
cocos2d::CCPoint::CCPoint(&v44, (float)((float)(370.0 - *(float *)(v8 + 656)) * 0.5) + -185.0, 4.0);
cocos2d::CCPoint::operator+(&v45, &v41, &v44);
v12(v8, &v45);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v8 + 160LL))(v8, 1.0);
cocos2d::CCPoint::CCPoint(&v42, v38 * 0.5, (float)((float)(v39 * 0.5) + -120.0) + 22.0);
if ( !a1->m_message->m_outgoing )
{
v14 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"Reply",
(const char *)&dword_40 + 1,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_01.png",
v13,
26.0);
v49.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v49.adj = (size_t)GJMessagePopup::onReply;
v15 = CCMenuItemSpriteExtra::create(v14, nullptr, v49);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v15);
m_buttonMenu = a1->m_buttonMenu;
setPosition = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v43, -140.0, 0.0);
cocos2d::CCPoint::operator+(&v44, &v42, &v43);
v46 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))setPosition)(
v15,
&v45,
v46.x,
v46.y);
v18 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"Block",
(const char *)&dword_40 + 1,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_06.png",
v17,
26.0);
v50.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v50.adj = (size_t)GJMessagePopup::onBlock;
v19 = CCMenuItemSpriteExtra::create(v18, nullptr, v50);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v19);
v37 = a1->m_buttonMenu;
v20 = v19->setPosition;
cocos2d::CCPoint::CCPoint(&v43, 140.0, 0.0);
cocos2d::CCPoint::operator+(&v44, &v42, &v43);
v47 = cocos2d::CCNode::convertToNodeSpace(v37, &v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v20)(v19, &v45, v47.x, v47.y);
}
v21 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40 + 1,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_04.png",
v13,
26.0);
v51.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v51.adj = (size_t)GJMessagePopup::onRemove;
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, v51);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v22);
v23 = a1->m_buttonMenu;
v24 = v22->setPosition;
v48 = cocos2d::CCNode::convertToNodeSpace(v23, &v42);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v24)(v22, &v45, v48.x, v48.y);
v25 = v40 - 24;
if ( v40 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v40 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v40 - 2);
*((_DWORD *)v40 - 2) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v25);
}
}