//
// GJMessagePopup::loadFromGJMessage from 0x1002dabe0 to 0x1002db080 (1184 bytes)
//
// 2 xrefs:
// > GJMessagePopup::init @ 0x1002daaac
// > GJMessagePopup::downloadMessageFinished @ 0x1002db75c
//
// 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 __fastcall GJMessagePopup::loadFromGJMessage(GJMessagePopup *a1, GJUserMessage *a2)
{
GJUserMessage *m_message; // x0
cocos2d::CCDirector *v5; // x0
__n128 v6; // q1
GJUserMessage *v7; // x8
__n128 v8; // q0
__n128 v9; // kr20_16
GJUserMessage *v10; // x8
char *v11; // x1
__n128 v12; // q0
__n128 v13; // q1
float *v14; // x20
__n128 v15; // q0
__n128 v16; // q1
double v17; // d0
__n128 v18; // q0
__n128 v19; // q1
__n128 v20; // q0
__n128 v21; // q1
double v22; // d0
__n128 v23; // q0
__n128 v24; // q1
ButtonSprite *v25; // x0
CCMenuItemSpriteExtra *v26; // x20
__n128 v27; // q0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v29; // q1
ButtonSprite *v30; // x0
CCMenuItemSpriteExtra *v31; // x20
__n128 v32; // q0
cocos2d::CCMenu *v33; // x21
__n128 v34; // q1
ButtonSprite *v35; // x0
CCMenuItemSpriteExtra *v36; // x20
float32x2_t v37; // [xsp+8h] [xbp-A8h] BYREF
float32x2_t v38; // [xsp+10h] [xbp-A0h] BYREF
float32x2_t v39; // [xsp+18h] [xbp-98h] BYREF
float32x2_t v40; // [xsp+20h] [xbp-90h] BYREF
void *__p[2]; // [xsp+28h] [xbp-88h] BYREF
char v42; // [xsp+3Fh] [xbp-71h]
__n128 __dst; // [xsp+40h] [xbp-70h] BYREF
char *longStorage; // [xsp+50h] [xbp-60h]
__n128 v45; // [xsp+60h] [xbp-50h] BYREF
char *v46; // [xsp+70h] [xbp-40h]
float v47; // [xsp+78h] [xbp-38h]
float v48; // [xsp+7Ch] [xbp-34h]
cocos2d::CCPoint v49; // 0:kr08_8.8
cocos2d::CCPoint v50; // 0:kr10_8.8
cocos2d::CCPoint v51; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v52; // 0:x3.16
cocos2d::SEL_MenuHandler v53; // 0:x3.16
cocos2d::SEL_MenuHandler v54; // 0:x3.16
if ( !a2 )
return;
cocos2d::CCObject::retain(a2);
m_message = a1->m_message;
if ( m_message )
{
cocos2d::CCObject::release(m_message);
a1->m_message = nullptr;
}
a1->m_message = a2;
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
sub_100009900(&v45, "No message");
v7 = a1->m_message;
if ( v7->m_content.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v7->m_content.m_data.m_long.capacitym1, v7->m_content.m_data.m_long.size);
}
else
{
v8 = *(__n128 *)&v7->m_content.m_data.m_short.sizex2;
__dst = v8;
longStorage = v7->m_content.m_data.m_long.longStorage;
}
if ( (SHIBYTE(longStorage) & 0x80000000) == 0 )
{
if ( !HIBYTE(longStorage) )
goto LABEL_17;
LABEL_11:
v10 = a1->m_message;
if ( v10->m_content.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&__dst, (void *)v10->m_content.m_data.m_long.capacitym1, v10->m_content.m_data.m_long.size);
}
else
{
__dst = *(__n128 *)&v10->m_content.m_data.m_short.sizex2;
longStorage = v10->m_content.m_data.m_long.longStorage;
}
if ( SHIBYTE(v46) < 0 )
operator delete((void *)v45.n128_u64[0]);
v8 = __dst;
v45 = __dst;
v46 = longStorage;
goto LABEL_17;
}
v9 = __dst;
operator delete((void *)__dst.n128_u64[0]);
if ( v9.n128_u64[1] )
goto LABEL_11;
LABEL_17:
v8.n128_f32[0] = v47 * 0.5;
v6.n128_f32[0] = (float)(v48 * 0.5) + -4.0;
sub_100022980(v8, v6, &__dst);
if ( SHIBYTE(v46) >= 0 )
v11 = (char *)&v45;
else
v11 = (char *)v45.n128_u64[0];
sub_100009900(__p, v11);
v12.n128_u32[0] = 0;
v13.n128_u32[0] = 0.5;
sub_100022980(v12, v13, &v40);
v14 = (float *)TextArea::create((__int64)__p, (__int64)"chatFont.fnt", (__int64 *)&v40, 1, 1.0, 290.0, 20.0);
if ( v42 < 0 )
operator delete(__p[0]);
v15 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, float *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v14,
6);
v15.n128_u32[0] = 0;
v16.n128_u32[0] = 2.0;
sub_100022980(v15, v16, &v39);
*(float32x2_t *)&v17 = sub_1000229DC((float32x2_t *)&__dst, &v39, &v40);
v18 = ((__n128 (__fastcall *)(float *, float32x2_t *, double))*(_QWORD *)(*(_QWORD *)v14 + 184LL))(v14, &v40, v17);
v18.n128_u32[0] = 0;
v19.n128_u32[0] = 0.5;
sub_100022980(v18, v19, &v40);
v20 = ((__n128 (__fastcall *)(float *, float32x2_t *))*(_QWORD *)(*(_QWORD *)v14 + 280LL))(v14, &v40);
v20.n128_f32[0] = (float)((float)(370.0 - v14[168]) * 0.5) + -185.0;
v21.n128_u32[0] = 4.0;
sub_100022980(v20, v21, &v39);
*(float32x2_t *)&v22 = sub_1000229DC((float32x2_t *)&__dst, &v39, &v40);
(*(void (__fastcall **)(float *, float32x2_t *, double))(*(_QWORD *)v14 + 184LL))(v14, &v40, v22);
v23 = ((__n128 (__fastcall *)(float *, float))*(_QWORD *)(*(_QWORD *)v14 + 160LL))(v14, 1.0);
v23.n128_f32[0] = v47 * 0.5;
v24.n128_f32[0] = (float)((float)(v48 * 0.5) + -120.0) + 22.0;
sub_100022980(v23, v24, &v40);
if ( !a1->m_message->m_outgoing )
{
v25 = ButtonSprite::create_1("Reply", 65, 0, 0.55, 1, "bigFont.fnt", "GJ_button_01.png", 26.0);
v52.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJMessagePopup::onReply;
v52.adj = 0;
v26 = CCMenuItemSpriteExtra::create(v25, nullptr, a1, v52);
v27 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v26);
m_buttonMenu = a1->m_buttonMenu;
v27.n128_u32[0] = -1022623744;
v29.n128_u32[0] = 0;
sub_100022980(v27, v29, &v37);
sub_1000229DC(&v40, &v37, &v38);
v49 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)&v38);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v26->setPosition)(
v26,
&v39,
v49.x,
v49.y);
v30 = ButtonSprite::create_1("Block", 65, 0, 0.55, 1, "bigFont.fnt", "GJ_button_06.png", 26.0);
v53.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJMessagePopup::onBlock;
v53.adj = 0;
v31 = CCMenuItemSpriteExtra::create(v30, nullptr, a1, v53);
v32 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v31);
v33 = a1->m_buttonMenu;
v32.n128_u32[0] = 1124859904;
v34.n128_u32[0] = 0;
sub_100022980(v32, v34, &v37);
sub_1000229DC(&v40, &v37, &v38);
v50 = cocos2d::CCNode::convertToNodeSpace(v33, (const cocos2d::CCPoint *)&v38);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v31->setPosition)(
v31,
&v39,
v50.x,
v50.y);
}
v35 = ButtonSprite::create_1("Remove", 65, 0, 0.55, 1, "bigFont.fnt", "GJ_button_04.png", 26.0);
v54.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJMessagePopup::onRemove;
v54.adj = 0;
v36 = CCMenuItemSpriteExtra::create(v35, nullptr, a1, v54);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v36);
v51 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v40);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v36->setPosition)(v36, &v39, v51.x, v51.y);
if ( SHIBYTE(v46) < 0 )
operator delete((void *)v45.n128_u64[0]);
}