//
// GJMessagePopup::loadFromGJMessage from 0x140297dc0 to 0x140298405 (1605 bytes)
//
// 3 xrefs:
// > GJMessagePopup::init @ 0x140297cca
// > GJMessagePopup::downloadMessageFinished @ 0x140298b37
// > ??> @ 0x1406d1c64
//
// 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=6
void GJMessagePopup::loadFromGJMessage(GJMessagePopup *a1, GJUserMessage *a2)
{
GJUserMessage *m_message; // rcx
__int64 v5; // rax
cocos2d::CCDirector *v6; // rax
unsigned __int64 v7; // rdi
float v8; // xmm0_4
bool v9; // bl
__m128i v10; // xmm6
void **v11; // rdx
size_t v12; // r8
const struct cocos2d::CCPoint *v13; // rax
float *v14; // rdi
float v15; // xmm0_4
float v16; // xmm0_4
__int64 v17; // rbx
__int64 v18; // rax
float v19; // xmm0_4
float v20; // xmm0_4
ButtonSprite *v21; // rbx
CCMenuItemSpriteExtra *v22; // rdi
float v23; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v24; // rbx
struct cocos2d::CCPoint v25; // rax
ButtonSprite *v26; // rbx
CCMenuItemSpriteExtra *v27; // rdi
float v28; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v29; // rbx
struct cocos2d::CCPoint v30; // rax
ButtonSprite *v31; // rbx
CCMenuItemSpriteExtra *v32; // rdi
CCMenuItemSpriteExtra_vtbl *v33; // rbx
struct cocos2d::CCPoint v34; // rax
void *v35; // rcx
__int128 *v36; // [rsp+50h] [rbp-69h] BYREF
ButtonSprite *v37; // [rsp+58h] [rbp-61h] BYREF
float v38; // [rsp+60h] [rbp-59h]
char v39[8]; // [rsp+68h] [rbp-51h] BYREF
char v40[8]; // [rsp+70h] [rbp-49h] BYREF
struct cocos2d::CCPoint v41; // [rsp+78h] [rbp-41h] BYREF
__int128 v42; // [rsp+80h] [rbp-39h] BYREF
__m128i v43; // [rsp+90h] [rbp-29h]
void *Block[2]; // [rsp+A0h] [rbp-19h] BYREF
__m128i v45; // [rsp+B0h] [rbp-9h]
if ( a2 )
{
cocos2d::CCObject::retain(a2);
m_message = a1->m_message;
if ( m_message )
cocos2d::CCObject::release(m_message);
a1->m_message = a2;
v5 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = (__int128 *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v5 = qword_1406C2EC0;
}
*(_QWORD *)(v5 + 808) = &a1->UploadActionDelegate;
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(m_message);
cocos2d::CCDirector::getWinSize(v6);
Block[1] = (void *)25959;
v45.m128i_i64[0] = 10;
v7 = 15;
v45.m128i_i64[1] = 15;
v8 = 3.10326e27;
Block[0] = (void *)0x617373656D206F4ELL;
sub_14003BDB0((__int64)&v42, (__int64)&a1->m_message->m_content);
v9 = v43.m128i_i64[0] != 0;
sub_14003A830((__int64)&v42);
if ( v9 )
{
sub_14003BDB0((__int64)&v42, (__int64)&a1->m_message->m_content);
v8 = *(float *)&v42;
*(_OWORD *)Block = v42;
v10 = v43;
v45 = v43;
v43.m128i_i64[0] = 0;
v43.m128i_i64[1] = 15;
LOBYTE(v42) = 0;
sub_14003A830((__int64)&v42);
v7 = _mm_srli_si128(v10, 8).m128i_u64[0];
}
cocos2d::CCPoint::CCPoint(v8, v38 * 0.5);
v36 = &v42;
v11 = Block;
if ( v7 > 0xF )
v11 = (void **)Block[0];
v42 = 0;
v43 = 0u;
v12 = -1;
do
++v12;
while ( *((_BYTE *)v11 + v12) );
sub_14003A930(&v42, v11, v12);
cocos2d::CCPoint::CCPoint(0.0, 0.0);
v14 = (float *)TextArea::create((__int64)&v42, "chatFont.fnt", 1.0, 290.0, v13, 1101004800, 1);
v15 = ((float (__fastcall *)(cocos2d::CCLayer *, float *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v14,
6);
cocos2d::CCPoint::CCPoint(v15, 0.0);
cocos2d::CCPoint::operator+(v40, &v36);
v16 = (*(float (__fastcall **)(float *, __int128 **))(*(_QWORD *)v14 + 184LL))(v14, &v36);
v17 = *(_QWORD *)v14;
cocos2d::CCPoint::CCPoint(v16, 0.0);
v19 = (*(float (__fastcall **)(float *, __int64))(v17 + 272))(v14, v18);
cocos2d::CCPoint::CCPoint(v19, (float)((float)(370.0 - v14[172]) * 0.5) - 185.0);
cocos2d::CCPoint::operator+(v40, &v36);
(*(void (__fastcall **)(float *, __int128 **))(*(_QWORD *)v14 + 184LL))(v14, &v36);
v20 = (*(float (__fastcall **)(float *))(*(_QWORD *)v14 + 160LL))(v14);
cocos2d::CCPoint::CCPoint(v20, v38 * 0.5);
if ( !a1->m_message->m_outgoing )
{
v37 = (ButtonSprite *)operator new(0x2C0u);
v21 = ButtonSprite::ButtonSprite(v37);
if ( v21 )
{
if ( ButtonSprite::init_1(
v21,
"Reply",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
26.0) )
{
cocos2d::CCObject::autorelease(v21);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v21->~ButtonSprite)(v21, 1);
v21 = nullptr;
}
}
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessagePopup::onReply);
v23 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v22);
cocos2d::CCPoint::CCPoint(v23, -140.0);
cocos2d::CCPoint::operator+(v39, &v36);
v24 = v22->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v25 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v41);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v24->setPosition_0)(v22, v25);
v37 = (ButtonSprite *)operator new(0x2C0u);
v26 = ButtonSprite::ButtonSprite(v37);
if ( v26 )
{
if ( ButtonSprite::init_1(
v26,
"Block",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_06.png",
26.0) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v26->~ButtonSprite)(v26, 1);
v26 = nullptr;
}
}
v27 = CCMenuItemSpriteExtra::create(v26, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessagePopup::onBlock);
v28 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v27);
cocos2d::CCPoint::CCPoint(v28, 140.0);
cocos2d::CCPoint::operator+(v39, &v36);
v29 = v27->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v30 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v41);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v29->setPosition_0)(v27, v30);
}
v37 = (ButtonSprite *)operator new(0x2C0u);
v31 = ButtonSprite::ButtonSprite(v37);
if ( v31 )
{
if ( ButtonSprite::init_1(
v31,
"Remove",
65,
0,
0.55000001,
1,
(const char *)&qword_14052A4D8,
"GJ_button_04.png",
26.0) )
{
cocos2d::CCObject::autorelease(v31);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v31->~ButtonSprite)(v31, 1);
v31 = nullptr;
}
}
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJMessagePopup::onRemove);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v32);
v33 = v32->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v34 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v37);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v33->setPosition_0)(v32, v34);
if ( v45.m128i_i64[1] > 0xFuLL )
{
v35 = Block[0];
if ( (unsigned __int64)(v45.m128i_i64[1] + 1) >= 0x1000 )
{
v35 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v35 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v35);
}
}
}