//
// NewThreadPopup::onSend from 0x754b70 to 0x755270 (1792 bytes)
//
// 1 xrefs:
// > NewThreadPopup::keyDown @ 0x75530e
//
// 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:58:54 +0000
//
int __fastcall NewThreadPopup::onSend(int this, cocos2d::CCObject *a2)
{
int v2; // r8
int v3; // r4
cocos2d::CCArray *v4; // r0
signed int v5; // r6
char *v6; // r10
int *v7; // r0
int *v8; // r0
int v9; // r1
unsigned __int8 *v10; // r1
int v11; // r3
unsigned __int8 *v12; // r3
unsigned __int8 *v13; // r0
unsigned __int8 *v14; // r2
int v15; // r7
unsigned int v16; // r2
char *v17; // r1
int v18; // r3
char *v19; // r3
int v20; // t1
int v21; // r1
int v22; // r3
unsigned __int8 *v23; // r9
int v24; // r7
unsigned __int8 *v25; // r7
unsigned __int8 *v26; // r11
const char *v27; // r12
void *v28; // r0
int *v29; // r6
int *v30; // r0
int v31; // r0
int v32; // r2
int v33; // r3
int v34; // r7
const char *v35; // r7
size_t v36; // r0
int *v37; // r0
int *v38; // r0
signed int v39; // r7
const char *v40; // r3
const char *v41; // r7
cocos2d::CCString *v42; // r0
char *v43; // r0
int v44; // r3
int v45; // r0
cocos2d::CCString *v46; // r0
char *CString; // r0
cocos2d::CCString *v48; // r0
const char *v49; // r6
size_t v50; // r0
char *v51; // r1
size_t v52; // r2
int *v53; // r0
int v54; // r1
int v55; // r2
int *v56; // r0
int v57; // r1
int v58; // r2
char *v59; // r1
size_t v60; // r2
_DWORD *v61; // r0
int v62; // r1
int v63; // r2
_DWORD *v64; // r0
int v65; // r1
int v66; // r2
int v67; // r2
const void *v68; // r1
size_t v69; // r2
int *v70; // r0
int v71; // r1
int v72; // r2
char *v73; // r1
size_t v74; // r2
int *v75; // r0
int v76; // r1
char *v77; // r2
int v78; // r3
int v79; // r6
size_t v80; // r2
int v81; // r1
int v82; // r3
char *v83; // r0
unsigned __int8 *v84; // r1
unsigned __int8 *v85; // r0
unsigned __int8 *v86; // r2
int v87; // r0
char v88; // r9
int v89; // r10
int v90; // t1
time_t v91; // r6
int v92; // r0
__int64 v93; // r2
int v94; // r7
GameLevelManager *v95; // r0
int *v96; // r0
unsigned __int8 *v97; // [sp+20h] [bp-CCh]
__int64 v98; // [sp+20h] [bp-CCh]
const char *v99; // [sp+2Ch] [bp-C0h]
int v100; // [sp+30h] [bp-BCh] BYREF
int v101; // [sp+34h] [bp-B8h]
char *v102; // [sp+38h] [bp-B4h]
int v103; // [sp+3Ch] [bp-B0h] BYREF
int v104; // [sp+40h] [bp-ACh]
char *v105; // [sp+44h] [bp-A8h]
int v106[3]; // [sp+48h] [bp-A4h] BYREF
int v107[3]; // [sp+54h] [bp-98h] BYREF
int v108; // [sp+60h] [bp-8Ch] BYREF
size_t v109; // [sp+64h] [bp-88h]
char *v110; // [sp+68h] [bp-84h]
int v111; // [sp+6Ch] [bp-80h] BYREF
int v112; // [sp+70h] [bp-7Ch]
int v113; // [sp+74h] [bp-78h]
int v114; // [sp+78h] [bp-74h] BYREF
int v115; // [sp+7Ch] [bp-70h]
char *v116; // [sp+80h] [bp-6Ch]
unsigned int v117[3]; // [sp+84h] [bp-68h] BYREF
int v118; // [sp+90h] [bp-5Ch] BYREF
size_t v119; // [sp+94h] [bp-58h]
char *v120; // [sp+98h] [bp-54h]
int v121; // [sp+9Ch] [bp-50h] BYREF
int v122; // [sp+A0h] [bp-4Ch]
int v123; // [sp+A4h] [bp-48h]
unsigned int v124[3]; // [sp+A8h] [bp-44h] BYREF
_DWORD v125[3]; // [sp+B4h] [bp-38h] BYREF
_DWORD v126[3]; // [sp+C0h] [bp-2Ch] BYREF
int v127; // [sp+CCh] [bp-20h] BYREF
size_t v128; // [sp+D0h] [bp-1Ch]
char *v129; // [sp+D4h] [bp-18h]
int v130; // [sp+D8h] [bp-14h] BYREF
int v131; // [sp+DCh] [bp-10h]
int v132; // [sp+E0h] [bp-Ch]
v2 = *(unsigned __int8 *)(this + 556);
v3 = this;
if ( !*(_BYTE *)(this + 556) )
{
v4 = *(cocos2d::CCArray **)(this + 552);
if ( v4 )
v5 = cocos2d::CCArray::count(v4);
else
v5 = 0;
if ( *(_BYTE *)(v3 + 557) )
v6 = "New Direct Message";
else
v6 = "New Group Chat";
if ( *(int *)(v3 + 536) <= 0 && !v5 )
{
v130 = 0;
v131 = 0;
v132 = 0;
std::string::__init(&v130, "Please select a recipient.", 0x1Au);
v7 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v6, (int)&v130, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v7 + 656))(v7);
v8 = &v130;
return std::string::~string((int)v8);
}
if ( *(_BYTE *)(v3 + 557) || (v9 = *(_DWORD *)(v3 + 632)) == 0 )
{
v100 = 0;
v101 = 0;
v102 = nullptr;
std::string::__init(&v100, &unk_B6B226, 0);
}
else
{
CCTextInputNode::getString((CCTextInputNode *)&v100, v9);
}
if ( (v100 & 1) != 0 )
{
v10 = (unsigned __int8 *)v102;
v11 = v101;
}
else
{
v11 = (int)(unsigned __int8)v100 >> 1;
v10 = (unsigned __int8 *)&v100 + 1;
}
if ( v11 )
{
v12 = &v10[v11];
v13 = v10;
while ( 1 )
{
v14 = v13;
if ( v13 == v12 )
break;
v15 = *v13++;
if ( v15 != 32 )
{
v16 = v14 - v10;
goto LABEL_23;
}
}
}
v16 = -1;
LABEL_23:
std::string::erase((unsigned __int8 *)&v100, 0, v16);
if ( (v100 & 1) != 0 )
{
v17 = v102;
v18 = v101;
}
else
{
v18 = (int)(unsigned __int8)v100 >> 1;
v17 = (char *)&v100 + 1;
}
v19 = &v17[v18];
while ( v19 != v17 )
{
v20 = (unsigned __int8)*--v19;
if ( v20 != 32 )
{
v21 = v19 - v17;
goto LABEL_30;
}
}
v21 = -1;
LABEL_30:
std::string::erase((unsigned __int8 *)&v100, v21 + 1, 0xFFFFFFFF);
if ( *(_DWORD *)(v3 + 636) )
{
CCTextInputNode::getString((CCTextInputNode *)&v103, *(_DWORD *)(v3 + 636));
}
else
{
v103 = 0;
v104 = 0;
v105 = nullptr;
std::string::__init(&v103, &unk_B6B226, 0);
}
if ( *(_BYTE *)(v3 + 557) )
{
if ( (v103 & 1) != 0 )
{
v23 = (unsigned __int8 *)v105;
v24 = v104;
}
else
{
v24 = (int)(unsigned __int8)v103 >> 1;
v23 = (unsigned __int8 *)&v103 + 1;
}
if ( v24 )
{
v25 = &v23[v24];
v26 = v23;
v27 = " \n";
while ( v26 != v25 )
{
v99 = v27;
v97 = v26;
v28 = memchr(v27, *v26++, 2u);
v27 = v99;
if ( !v28 )
{
if ( v97 - v23 != -1 )
goto LABEL_48;
break;
}
}
}
v29 = v107;
memset(v107, 0, sizeof(v107));
std::string::__init(v107, "Please enter a message.", 0x17u);
v30 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v6, (int)v107, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v30 + 656))(v30);
goto LABEL_53;
}
if ( (v100 & 1) != 0 )
v22 = v101;
else
v22 = (int)(unsigned __int8)v100 >> 1;
if ( !v22 )
{
memset(v106, 0, sizeof(v106));
std::string::__init(v106, "Please enter a subject.", 0x17u);
v96 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v6, (int)v106, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v96 + 656))(v96);
v38 = v106;
goto LABEL_118;
}
LABEL_48:
v31 = NewThreadPopup::bodyEmoteCap((EmoteSprite *)v3);
v34 = EmoteSprite::effectiveLength((unsigned __int8 *)&v103, v31, v32, v33);
if ( v34 > NewThreadPopup::bodyCharLimit((NewThreadPopup *)v3) )
{
if ( *(_BYTE *)(v3 + 557) )
v35 = "Message is too long.";
else
v35 = "Description is too long.";
v121 = 0;
v29 = &v121;
v122 = 0;
v123 = 0;
v36 = strlen(v35);
std::string::__init(&v121, v35, v36);
v37 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v6, (int)&v121, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v37 + 656))(v37);
LABEL_53:
v38 = v29;
goto LABEL_118;
}
if ( *(_BYTE *)(v3 + 557) )
{
v108 = 0;
v109 = 0;
v110 = nullptr;
std::string::__init(&v108, &unk_B6B226, 0);
}
else
{
std::string::basic_string(&v108, (int)&v103);
}
if ( !*(_BYTE *)(v3 + 557) )
std::string::assign(&v103, (char *)&unk_B6B226);
v39 = *(unsigned __int8 *)(v3 + 557);
v40 = *(const char **)(v3 + 536);
v111 = 0;
v112 = 0;
v113 = 0;
if ( v39 )
{
v41 = v40;
if ( (int)v40 <= 0 )
v41 = *(const char **)(cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v3 + 552), 0) + 296);
}
else
{
if ( (int)v40 <= 0 )
{
while ( v39 < v5 )
{
if ( (v111 & 1) != 0 )
v44 = v112;
else
v44 = (int)(unsigned __int8)v111 >> 1;
if ( v44 )
std::string::append(&v111, ",");
v45 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v3 + 552), v39);
v46 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
*(const char **)(v45 + 296));
CString = (char *)cocos2d::CCString::getCString(v46);
std::string::append(&v111, CString);
++v39;
}
}
else
{
v42 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v40);
v43 = (char *)cocos2d::CCString::getCString(v42);
std::string::assign(&v111, v43);
}
v41 = nullptr;
}
std::operator+(v117, (unsigned __int8 *)&v103, "|");
if ( *(_BYTE *)(v3 + 557) )
{
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v41);
v49 = (const char *)cocos2d::CCString::getCString(v48);
v118 = 0;
v119 = 0;
v120 = nullptr;
v50 = strlen(v49);
std::string::__init(&v118, v49, v50);
}
else
{
std::string::basic_string(&v118, (int)&v111);
}
if ( (v118 & 1) != 0 )
{
v51 = v120;
v52 = v119;
}
else
{
v52 = (int)(unsigned __int8)v118 >> 1;
v51 = (char *)&v118 + 1;
}
v53 = std::string::append(v117, v51, v52);
v54 = v53[1];
v55 = v53[2];
v121 = *v53;
v122 = v54;
v123 = v55;
*v53 = 0;
v53[1] = 0;
v53[2] = 0;
v56 = std::string::append(&v121, "|");
v57 = v56[1];
v58 = v56[2];
v130 = *v56;
v131 = v57;
v132 = v58;
*v56 = 0;
v56[1] = 0;
v56[2] = 0;
if ( *(_BYTE *)(v3 + 557) )
{
v127 = 0;
v128 = 0;
v129 = nullptr;
std::string::__init(&v127, "m", 1u);
}
else
{
std::operator+(v124, (unsigned __int8 *)&v100, "|");
if ( (v108 & 1) != 0 )
{
v59 = v110;
v60 = v109;
}
else
{
v60 = (int)(unsigned __int8)v108 >> 1;
v59 = (char *)&v108 + 1;
}
v61 = std::string::append(v124, v59, v60);
v62 = v61[1];
v63 = v61[2];
v125[0] = *v61;
v125[1] = v62;
v125[2] = v63;
*v61 = 0;
v61[1] = 0;
v61[2] = 0;
v64 = std::string::append(v125, "|");
v65 = v64[1];
v66 = v64[2];
v126[0] = *v64;
v126[1] = v65;
v126[2] = v66;
*v64 = 0;
v64[1] = 0;
v64[2] = 0;
v67 = *(unsigned __int8 *)(v3 + 580);
if ( (v67 & 1) != 0 )
{
v68 = *(const void **)(v3 + 588);
v69 = *(_DWORD *)(v3 + 584);
}
else
{
v68 = (const void *)(v3 + 581);
v69 = v67 >> 1;
}
v70 = std::string::append(v126, v68, v69);
v71 = v70[1];
v72 = v70[2];
v2 = 1;
v127 = *v70;
v128 = v71;
v129 = (char *)v72;
*v70 = 0;
v70[1] = 0;
v70[2] = 0;
}
if ( (v127 & 1) != 0 )
{
v73 = v129;
v74 = v128;
}
else
{
v74 = (int)(unsigned __int8)v127 >> 1;
v73 = (char *)&v127 + 1;
}
v75 = std::string::append(&v130, v73, v74);
v76 = v75[1];
v77 = (char *)v75[2];
v114 = *v75;
v115 = v76;
v116 = v77;
*v75 = 0;
v75[1] = 0;
v75[2] = 0;
std::string::~string((int)&v127);
if ( v2 )
{
std::string::~string((int)v126);
std::string::~string((int)v125);
std::string::~string((int)v124);
}
std::string::~string((int)&v130);
std::string::~string((int)&v121);
std::string::~string((int)&v118);
std::string::~string((int)v117);
if ( !*(_QWORD *)(v3 + 648) )
goto LABEL_113;
v78 = *(unsigned __int8 *)(v3 + 656);
v79 = v114 & 1;
v80 = v79 ? v115 : (int)(unsigned __int8)v114 >> 1;
v81 = v78 & 1;
v82 = (v78 & 1) != 0 ? *(_DWORD *)(v3 + 660) : v78 >> 1;
if ( v80 != v82 )
goto LABEL_113;
if ( v79 )
v83 = v116;
else
v83 = (char *)&v114 + 1;
if ( v81 )
v84 = *(unsigned __int8 **)(v3 + 664);
else
v84 = (unsigned __int8 *)(v3 + 657);
if ( !v79 )
{
v85 = (unsigned __int8 *)(v83 - 1);
v86 = &v84[v80];
while ( v84 != v86 )
{
v90 = *++v85;
if ( v90 != *v84 )
goto LABEL_113;
++v84;
}
goto LABEL_107;
}
v85 = (unsigned __int8 *)std::char_traits::compare(v83, v84, v80);
if ( v85 )
{
LABEL_113:
v91 = time(nullptr);
v92 = rand();
v93 = (__int64)v91 << 20;
LODWORD(v93) = v93 | v92 & 0xFFFFF;
*(_QWORD *)(v3 + 648) = v93;
v85 = std::string::operator=((unsigned __int8 *)(v3 + 656), (unsigned __int8 *)&v114);
}
LABEL_107:
v87 = GameLevelManager::sharedState((GameLevelManager *)v85);
v88 = *(_BYTE *)(v3 + 557);
v89 = v87;
v98 = *(_QWORD *)(v3 + 648);
if ( v88 )
{
v130 = 0;
v131 = 0;
v132 = 0;
std::string::__init(&v130, &unk_B6B226, 0);
}
else
{
std::string::basic_string(&v130, v3 + 580);
}
v94 = GameLevelManager::sendThreadMessage(
v89,
nullptr,
v41,
(char *)&v100,
(unsigned __int8 *)&v103,
v98,
(unsigned __int8 *)&v111,
v88,
(unsigned __int8 *)&v108,
(unsigned __int8 *)&v130);
v95 = (GameLevelManager *)std::string::~string((int)&v130);
if ( v94 )
{
*(_DWORD *)(GameLevelManager::sharedState(v95) + 840) = v3 + 520;
NewThreadPopup::setSendPending((NewThreadPopup *)v3, 1);
std::string::~string((int)&v114);
std::string::~string((int)&v111);
std::string::~string((int)&v108);
std::string::~string((int)&v103);
v8 = &v100;
return std::string::~string((int)v8);
}
std::string::~string((int)&v114);
std::string::~string((int)&v111);
v38 = &v108;
LABEL_118:
std::string::~string((int)v38);
std::string::~string((int)&v103);
v8 = &v100;
return std::string::~string((int)v8);
}
return this;
}