//
// GJMessagePopup::loadFromGJMessage from 0xa330fc to 0xa3360c (1296 bytes)
//
// 3 xrefs:
// > GJMessagePopup::init @ 0xa33eb4
// > GJMessagePopup::downloadMessageFinished @ 0xa345a8
// > ??> @ 0x8d658
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:59:48 +0000
//
__int64 __fastcall GJMessagePopup::loadFromGJMessage(GJMessagePopup *this, GJUserMessage *a2)
{
cocos2d::CCObject *v3; // x0
GJUserMessage *v4; // x1
cocos2d::CCDirector *v5; // x0
cocos2d::CCDirector *v6; // x0
__int64 v7; // x0
__int64 v8; // x2
__int64 v9; // x0
__int64 v10; // x1
__int64 v11; // x21
__int64 v12; // x0
__int64 v13; // x2
__int64 v14; // x0
__int64 v15; // x1
const char *v16; // x1
size_t v17; // x0
EmoteSprite *v18; // x0
int v19; // w0
float *v20; // x21
void (__fastcall *v21)(float *, __int64 *); // x25
void (__fastcall *v22)(float *, __int64 *); // x25
void (__fastcall *v23)(float *, __int64 *); // x25
cocos2d::CCArray *v24; // x0
const char *v25; // x6
cocos2d::CCArray *v26; // x21
__int64 v27; // x0
cocos2d::CCObject *v28; // x25
__int64 v29; // x0
cocos2d::CCObject *v30; // x25
const char *v31; // x6
__int64 v32; // x0
cocos2d::CCObject *v33; // x24
char *v36; // [xsp+58h] [xbp+58h]
__int64 v37; // [xsp+68h] [xbp+68h] BYREF
_BYTE v38[8]; // [xsp+70h] [xbp+70h] BYREF
_BYTE v39[8]; // [xsp+78h] [xbp+78h] BYREF
__int64 v40; // [xsp+80h] [xbp+80h] BYREF
__int64 v41; // [xsp+88h] [xbp+88h] BYREF
__int64 v42; // [xsp+90h] [xbp+90h]
void *v43; // [xsp+98h] [xbp+98h]
__int64 v44; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v45; // [xsp+A8h] [xbp+A8h]
void *v46; // [xsp+B0h] [xbp+B0h]
__int64 v47; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v48; // [xsp+C0h] [xbp+C0h]
void *v49; // [xsp+C8h] [xbp+C8h]
__int64 v50[2]; // [xsp+D0h] [xbp+D0h] BYREF
void *v51; // [xsp+E0h] [xbp+E0h]
if ( a2 )
{
cocos2d::CCObject::retain(a2);
v3 = *((cocos2d::CCObject **)this + 89);
v4 = a2;
if ( v3 )
{
v3 = (cocos2d::CCObject *)cocos2d::CCObject::release(v3);
v4 = a2;
}
*((_QWORD *)this + 89) = v4;
v5 = (cocos2d::CCDirector *)GameLevelManager::sharedState(v3);
*((_QWORD *)v5 + 170) = (char *)this + 664;
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(&v37, v6);
v41 = 0;
v42 = 0;
v43 = nullptr;
std::string::__init(&v41, "No message", 0xAu);
v7 = *((_QWORD *)this + 89);
v44 = 0;
v8 = v7 + 352;
v45 = 0;
LOBYTE(v7) = *(_BYTE *)(v7 + 352);
v46 = nullptr;
if ( (v7 & 1) != 0 )
{
std::string::__init(&v44, *(void **)(v8 + 16), *(_QWORD *)(v8 + 8));
}
else
{
v9 = *(_QWORD *)v8;
v10 = *(_QWORD *)(v8 + 8);
v46 = *(void **)(v8 + 16);
v44 = v9;
v45 = v10;
}
v11 = (unsigned __int8)v44 >> 1;
if ( (v44 & 1) != 0 )
{
v11 = v45;
operator delete(v46);
}
if ( v11 )
{
v12 = *((_QWORD *)this + 89);
v47 = 0;
v13 = v12 + 352;
v48 = 0;
LOBYTE(v12) = *(_BYTE *)(v12 + 352);
v49 = nullptr;
if ( (v12 & 1) != 0 )
{
std::string::__init(&v47, *(void **)(v13 + 16), *(_QWORD *)(v13 + 8));
}
else
{
v14 = *(_QWORD *)v13;
v15 = *(_QWORD *)(v13 + 8);
v49 = *(void **)(v13 + 16);
v47 = v14;
v48 = v15;
}
if ( (v41 & 1) != 0 )
{
*(_BYTE *)v43 = 0;
v42 = 0;
}
else
{
LOWORD(v41) = 0;
}
std::string::reserve(&v41, 0);
v43 = v49;
v41 = v47;
v42 = v48;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, *(float *)&v37 * 0.5, (float)(*((float *)&v37 + 1) * 0.5) + -4.0);
v16 = (char *)&v41 + 1;
if ( (v41 & 1) != 0 )
v16 = (const char *)v43;
v36 = (char *)v16;
v50[0] = 0;
v50[1] = 0;
v51 = nullptr;
v17 = strlen(v16);
std::string::__init(v50, v36, v17);
v18 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 0.0, 0.5);
v19 = EmoteSprite::maxEmotesMessage(v18);
v20 = (float *)TextArea::create(
(char *)v50,
"chatFont.fnt",
(const cocos2d::CCPoint *)&v40,
1,
v19,
1.0,
319.0,
20.0);
if ( (v50[0] & 1) != 0 )
operator delete(v51);
(*(void (__fastcall **)(_QWORD, float *, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v20,
6);
v21 = *(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.0, 2.0);
cocos2d::CCPoint::operator+(&v40, v38);
v21(v20, &v40);
v22 = *(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v20 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 0.0, 0.5);
v22(v20, &v40);
v23 = *(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, (float)((float)(370.0 - v20[170]) * 0.5) + -185.0, 4.0);
cocos2d::CCPoint::operator+(&v40, v38);
v23(v20, &v40);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v20 + 160LL))(v20, 1.0);
v24 = (cocos2d::CCArray *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.0, -98.0);
v26 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
if ( !*(_BYTE *)(*((_QWORD *)this + 89) + 425LL) )
{
v27 = ButtonSprite::create(
(ButtonSprite *)"Reply",
(const char *)off_50,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_01.png",
v25,
26.0);
v28 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v27,
0,
(__int64)this,
(__int64)GJMessagePopup::onNewThread,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v28);
cocos2d::CCArray::addObject(v26, v28);
}
v29 = ButtonSprite::create(
(ButtonSprite *)"Remove",
(const char *)&dword_40 + 1,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_04.png",
v25,
26.0);
v30 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v29,
0,
(__int64)this,
(__int64)GJMessagePopup::onRemove,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v30);
cocos2d::CCArray::addObject(v26, v30);
if ( !*(_BYTE *)(*((_QWORD *)this + 89) + 425LL) )
{
v32 = ButtonSprite::create(
(ButtonSprite *)"Block",
(const char *)&dword_40 + 1,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_06.png",
v31,
26.0);
v33 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v32,
0,
(__int64)this,
(__int64)GJMessagePopup::onBlock,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v33);
cocos2d::CCArray::addObject(v26, v33);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, (const cocos2d::CCPoint *)v39);
GameToolbox::alignItemsHorisontally((__int64)v26, (__int64)&v40, 0, 35.0);
if ( (v41 & 1) != 0 )
operator delete(v43);
}
return _stack_chk_guard;
}