//
// GJWriteMessagePopup::init from 0x5df6f0 to 0x5e0082 (2450 bytes)
//
// 1 xrefs:
// > GJWriteMessagePopup::create @ 0x5e0184
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:54:15 +0000
//
int __fastcall GJWriteMessagePopup::init(GJWriteMessagePopup *this, int a2, int a3)
{
GameLevelManager *StoredUserMessageReply; // r0
cocos2d::CCDictionary **v7; // r0
GameLevelManager *v8; // r5
cocos2d::CCLayer *WinSize; // r0
int v10; // r0
int v11; // r3
int v12; // r7
void (__fastcall *v13)(int, _DWORD *); // r9
const char *v14; // r2
char *v15; // r0
int v16; // r9
void (__fastcall *v17)(int, _DWORD *); // r7
GameLevelManager *v18; // r0
cocos2d::CCDictionary **v19; // r0
char *v20; // r1
size_t v21; // r2
const char *v22; // r2
cocos2d::CCLabelBMFont *v23; // r0
int v24; // r7
void (__fastcall *v25)(int, _DWORD *); // r10
int v26; // r11
cocos2d::CCMenu *v27; // r0
int v28; // r0
cocos2d::CCArray *v29; // r0
cocos2d::CCArray *v30; // r9
char *v31; // r0
ButtonSprite *v32; // r0
cocos2d::CCObject *v33; // r7
ButtonSprite *v34; // r0
cocos2d::CCObject *v35; // r7
const cocos2d::CCPoint *v36; // r10
float v37; // r11
float v38; // s16
int v39; // r0
int v40; // r6
void (__fastcall *v41)(int, _DWORD *); // r2
int *v42; // r0
int v43; // r9
TextArea *v44; // r6
cocos2d::CCString *v45; // r0
cocos2d::CCLabelBMFont *CString; // r0
const char *v47; // r2
int v48; // r0
int v49; // r6
void (__fastcall *v50)(int, _DWORD *); // r9
int v51; // r9
int v52; // r2
int v53; // r3
int v54; // r7
void (__fastcall *v55)(int, _DWORD *); // r2
int *v56; // r0
int v57; // r9
int v58; // r7
void (__fastcall *v59)(int, _DWORD *); // r9
TextArea *v60; // r9
cocos2d::CCString *v61; // r0
cocos2d::CCLabelBMFont *v62; // r0
const char *v63; // r2
int v64; // r0
int v65; // r7
void (__fastcall *v66)(int, _DWORD *); // r9
int v67; // r2
int v68; // r3
const char *v69; // r1
int v70; // r0
int v71; // r6
const cocos2d::CCPoint *v72; // r11
void (__fastcall *v73)(int, _BYTE *); // r10
int v74; // r7
int v75; // r6
char *v77; // [sp+8h] [bp-114h]
char *v78; // [sp+8h] [bp-114h]
float v79; // [sp+10h] [bp-10Ch]
float v80; // [sp+10h] [bp-10Ch]
int v81; // [sp+14h] [bp-108h]
void (__fastcall *v82)(int, _DWORD *); // [sp+20h] [bp-FCh]
float v83; // [sp+2Ch] [bp-F0h] BYREF
float v84; // [sp+30h] [bp-ECh]
float v85; // [sp+34h] [bp-E8h] BYREF
float v86; // [sp+38h] [bp-E4h]
_BYTE v87[8]; // [sp+3Ch] [bp-E0h] BYREF
_BYTE v88[8]; // [sp+44h] [bp-D8h] BYREF
_BYTE v89[8]; // [sp+4Ch] [bp-D0h] BYREF
_BYTE v90[8]; // [sp+54h] [bp-C8h] BYREF
_BYTE v91[8]; // [sp+5Ch] [bp-C0h] BYREF
_BYTE v92[8]; // [sp+64h] [bp-B8h] BYREF
_DWORD (*v93)(GJWriteMessagePopup *__hidden, cocos2d::CCObject *); // [sp+6Ch] [bp-B0h]
int v94; // [sp+70h] [bp-ACh]
int (__fastcall *v95)(GJWriteMessagePopup *, cocos2d::CCObject *); // [sp+74h] [bp-A8h]
int v96; // [sp+78h] [bp-A4h]
int v97[2]; // [sp+7Ch] [bp-A0h] BYREF
cocos2d::CCLabelBMFont *v98; // [sp+84h] [bp-98h]
unsigned __int8 v99; // [sp+88h] [bp-94h] BYREF
char v100; // [sp+89h] [bp-93h] BYREF
size_t v101; // [sp+8Ch] [bp-90h]
char *v102; // [sp+90h] [bp-8Ch]
int v103[3]; // [sp+94h] [bp-88h] BYREF
int v104[3]; // [sp+A0h] [bp-7Ch] BYREF
int v105[3]; // [sp+ACh] [bp-70h] BYREF
int v106[3]; // [sp+B8h] [bp-64h] BYREF
int v107[3]; // [sp+C4h] [bp-58h] BYREF
int v108[3]; // [sp+D0h] [bp-4Ch] BYREF
int v109[3]; // [sp+DCh] [bp-40h] BYREF
int v110[3]; // [sp+E8h] [bp-34h] BYREF
_BYTE v111[16]; // [sp+F4h] [bp-28h] BYREF
_DWORD v112[4]; // [sp+104h] [bp-18h] BYREF
v112[0] = -1778384896;
v81 = cocos2d::CCLayerColor::initWithColor(this, v112);
if ( v81 )
{
FLAlertLayer::incrementForcePrio(this);
(*(void (__fastcall **)(GJWriteMessagePopup *, int))(*(_DWORD *)this + 500))(this, 1);
StoredUserMessageReply = (GameLevelManager *)(*(int (__fastcall **)(GJWriteMessagePopup *, int))(*(_DWORD *)this + 536))(
this,
1);
*((_DWORD *)this + 134) = a2;
*((_DWORD *)this + 135) = a3;
if ( a3 <= 0 )
{
v8 = nullptr;
}
else
{
v7 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(StoredUserMessageReply);
StoredUserMessageReply = (GameLevelManager *)GameLevelManager::getStoredUserMessageReply(
v7,
*((_DWORD *)this + 135));
v8 = StoredUserMessageReply;
}
cocos2d::CCDirector::sharedDirector(StoredUserMessageReply);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v83);
v10 = cocos2d::CCLayer::create(WinSize);
v11 = *(_DWORD *)this;
*((_DWORD *)this + 115) = v10;
(*(void (__fastcall **)(GJWriteMessagePopup *, int))(v11 + 228))(this, v10);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v112, 0.0, 0.0, 80.0, 80.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v112);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v12 + 456))(v12, 255);
v13 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v12 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v112, 420.0, 240.0);
v13(v12, v112);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v12, -1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v83 * 0.5, v84 * 0.5);
(*(void (__fastcall **)(int, float *))(*(_DWORD *)v12 + 92))(v12, &v85);
if ( *((_DWORD *)this + 135) )
v15 = "Send Reply";
else
v15 = "Send Message";
v16 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v15, "bigFont.fnt", v14);
v17 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v16 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, v83 * 0.5, (float)((float)(v84 * 0.5) + 120.0) - 16.0);
v17(v16, v112);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v16);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v16 + 80))(v16, 1058642330);
v97[0] = 0;
v97[1] = 0;
v98 = nullptr;
v18 = (GameLevelManager *)std::string::__init(v97, "To: ", 4u);
v19 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(v18);
GameLevelManager::tryGetUsername((GameLevelManager *)&v99, v19, *((_DWORD *)this + 134));
if ( (v99 & 1) != 0 )
{
v20 = v102;
v21 = v101;
}
else
{
v21 = (int)v99 >> 1;
v20 = &v100;
}
std::string::append(v97, v20, v21);
if ( (v97[0] & 1) != 0 )
v23 = v98;
else
v23 = (cocos2d::CCLabelBMFont *)((char *)v97 + 1);
v24 = cocos2d::CCLabelBMFont::create(v23, "goldFont.fnt", v22);
v25 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v24 + 92);
v26 = (*(int (__fastcall **)(int))(*(_DWORD *)v16 + 96))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v111, 0.0, -20.0);
cocos2d::CCPoint::operator+(v112, v26, v111);
v25(v24, v112);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v24);
v27 = (cocos2d::CCMenu *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v24 + 80))(v24, 1058642330);
*((_DWORD *)this + 125) = -1;
v28 = cocos2d::CCMenu::create(v27);
*((_DWORD *)this + 111) = v28;
v29 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v28,
10);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
if ( *((_DWORD *)this + 135) )
v31 = "Back";
else
v31 = "Cancel";
v32 = ButtonSprite::create(
(ButtonSprite *)v31,
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_05.png",
(const char *)0x41D00000,
v79);
v94 = 0;
v93 = GJWriteMessagePopup::onClose;
v33 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v32,
0,
(int)this,
(int)GJWriteMessagePopup::onClose,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
v33);
cocos2d::CCArray::addObject(v30, v33);
v34 = ButtonSprite::create(
(ButtonSprite *)"Send",
(const char *)&dword_40 + 1,
0,
0.55,
1,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x41D00000,
v80);
v96 = 0;
v95 = GJWriteMessagePopup::onSend;
v35 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v34,
0,
(int)this,
(int)GJWriteMessagePopup::onSend,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(
*((_DWORD *)this + 111),
v35);
cocos2d::CCArray::addObject(v30, v35);
v36 = *((const cocos2d::CCPoint **)this + 111);
v37 = v85;
v38 = (float)(v86 - 120.0) + 22.0;
v39 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 115) + 96))(*((_DWORD *)this + 115));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v111, v37, v38 + *(float *)(v39 + 4));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v112, v36);
GameToolbox::alignItemsHorisontally(*(float *)&v30, 15.0, (int)v112, 0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v111, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v87, v85, v86 + 53.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v112, 0.0, 0.0, 40.0, 40.0);
v40 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v112);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v40 + 456))(v40, 100);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v40 + 480))(v40, &unk_BEE20E);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v88, 370.0, 28.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v40 + 160))(v40, v88);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v40, 1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v40 + 92))(v40, v87);
v41 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v40 + 480);
LOWORD(v112[0]) = 0;
BYTE2(v112[0]) = 0;
v41(v40, v112);
v42 = CCTextInputNode::create(
(CCTextInputNode *)0x43B90000,
50.0,
"Subject",
"Thonburi",
(const char *)&dword_18,
nullptr,
v77);
*((_DWORD *)this + 137) = v42;
*((_BYTE *)v42 + 432) = 0;
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
*((_DWORD *)this + 137),
20);
*(_DWORD *)(*((_DWORD *)this + 137) + 420) = (char *)this + 440;
(*(void (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 137) + 92))(*((_DWORD *)this + 137), v87);
memset(v103, 0, sizeof(v103));
v43 = *((_DWORD *)this + 137);
std::string::__init(
v103,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~",
0x61u);
CCTextInputNode::setAllowedChars(v43, (unsigned __int8 *)v103);
std::string::~string((int)v103);
*(_DWORD *)(*((_DWORD *)this + 137) + 424) = 35;
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 137) + 416) + 172))(
*(_DWORD *)(*((_DWORD *)this + 137) + 416),
0);
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 137) + 36))(*((_DWORD *)this + 137), 0);
memset(v104, 0, sizeof(v104));
std::string::__init(v104, &unk_B6B226, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, 0.5, 0.5);
v44 = (TextArea *)TextArea::create(
(int)v104,
"chatFont.fnt",
1065353216,
1134067712,
(const cocos2d::CCPoint *)v112,
1101004800,
(char)&dword_0 + 1,
0);
std::string::~string((int)v104);
CCTextInputNode::addTextArea(*((int **)this + 137), v44);
v45 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)&dword_C8);
CString = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v45);
v48 = cocos2d::CCLabelBMFont::create(CString, "chatFont.fnt", v47);
*((_DWORD *)this + 145) = v48;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v48, 2);
v49 = *((_DWORD *)this + 145);
v50 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v49 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, 1.0, 0.5);
v50(v49, v112);
v51 = *((_DWORD *)this + 145);
v82 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v51 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92, 175.0, 0.0);
cocos2d::CCPoint::operator+(v112, v87, v92);
v82(v51, v112);
memset(v105, 0, sizeof(v105));
std::string::__init(v105, &unk_B6B226, 0);
GJWriteMessagePopup::updateSubject((int)this, (int)v105, v52, v53);
std::string::~string((int)v105);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v89, v85, v86 - 25.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v112, (const cocos2d::CCRect *)v111);
v54 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v112);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v54 + 456))(v54, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v90, 370.0, 106.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v54 + 160))(v54, v90);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v54, 1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v54 + 92))(v54, v89);
v55 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v54 + 480);
LOWORD(v112[0]) = 0;
BYTE2(v112[0]) = 0;
v55(v54, v112);
v56 = CCTextInputNode::create(
(CCTextInputNode *)0x43B90000,
50.0,
"Message",
"Thonburi",
(const char *)&dword_18,
nullptr,
v78);
*((_DWORD *)this + 136) = v56;
*((_BYTE *)v56 + 432) = 0;
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
*((_DWORD *)this + 136),
20);
*(_DWORD *)(*((_DWORD *)this + 136) + 420) = (char *)this + 440;
(*(void (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 136) + 92))(*((_DWORD *)this + 136), v89);
memset(v106, 0, sizeof(v106));
v57 = *((_DWORD *)this + 136);
std::string::__init(
v106,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~",
0x61u);
CCTextInputNode::setAllowedChars(v57, (unsigned __int8 *)v106);
std::string::~string((int)v106);
*(_DWORD *)(*((_DWORD *)this + 136) + 424) = 200;
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 136) + 416) + 172))(
*(_DWORD *)(*((_DWORD *)this + 136) + 416),
0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 136) + 36))(*((_DWORD *)this + 136), 1);
v58 = *((_DWORD *)this + 136);
v59 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v58 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v112, 370.0, 96.0);
v59(v58, v112);
*(_BYTE *)(*((_DWORD *)this + 136) + 434) = 1;
memset(v107, 0, sizeof(v107));
std::string::__init(v107, &unk_B6B226, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, 0.5, 0.5);
v60 = (TextArea *)TextArea::create(
(int)v107,
"chatFont.fnt",
1065353216,
1134067712,
(const cocos2d::CCPoint *)v112,
COERCE_INT(20.0),
1,
0);
std::string::~string((int)v107);
CCTextInputNode::addTextArea(*((int **)this + 136), v60);
v61 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)&dword_C8);
v62 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v61);
v64 = cocos2d::CCLabelBMFont::create(v62, "chatFont.fnt", v63);
*((_DWORD *)this + 144) = v64;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v64, 2);
v65 = *((_DWORD *)this + 144);
v66 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v65 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, 1.0, 0.5);
v66(v65, v112);
(*(void (__fastcall **)(_DWORD, _DWORD, _DWORD))(**((_DWORD **)this + 144) + 100))(
*((_DWORD *)this + 144),
(float)(v85 + 210.0) - 10.0,
(float)(v86 + 120.0) - 14.0);
memset(v108, 0, sizeof(v108));
std::string::__init(v108, &unk_B6B226, 0);
GJWriteMessagePopup::updateBody((int)this, (int)v108, v67, v68);
std::string::~string((int)v108);
v70 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_resetBtn_001.png", v69);
v112[1] = 0;
v112[0] = GJWriteMessagePopup::onClearBody;
v71 = CCMenuItemSpriteExtra::create(v70, 0, (int)this, (int)GJWriteMessagePopup::onClearBody, 0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v71);
v72 = *((const cocos2d::CCPoint **)this + 111);
v73 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v71 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v91,
(float)((float)(v83 * 0.5) + 210.0) - 18.0,
(float)((float)(v84 * 0.5) - 120.0) + 20.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v92, v72);
v73(v71, v92);
if ( v8 )
{
v74 = *((_DWORD *)this + 137);
std::string::basic_string(v109, (int)v8 + 276);
CCTextInputNode::setString(v74, (int)v109);
std::string::~string((int)v109);
v75 = *((_DWORD *)this + 136);
std::string::basic_string(v110, (int)v8 + 288);
CCTextInputNode::setString(v75, (int)v110);
std::string::~string((int)v110);
}
std::string::~string((int)&v99);
std::string::~string((int)v97);
}
return v81;
}