//
// NewThreadPopup::onSend from 0xc7b10c to 0xc7be38 (3372 bytes)
//
// 4 xrefs:
// > NewThreadPopup::keyDown @ 0xc7bea8
// > ??> @ 0x61078
// > NewThreadPopup::init @ 0xc7e378
// > ??> @ 0x15424e0
//
// 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 13:05:36 +0000
//
__int64 __fastcall NewThreadPopup::onSend(NewThreadPopup *this, cocos2d::CCObject *a2)
{
int v3; // w25
cocos2d::CCArray *v4; // x0
int v5; // w26
_BOOL4 v6; // w1
unsigned __int8 v7; // w0
char *v8; // x22
__int64 v9; // x0
char *v10; // x3
unsigned __int64 v11; // x2
char *v12; // x1
__int64 v13; // x0
char *v14; // x0
int v15; // w2
char *v16; // x0
int v17; // t1
unsigned __int64 v18; // x1
CCTextInputNode *v19; // x0
size_t v20; // x23
char *v21; // x23
char *v22; // x28
int v23; // w0
int v24; // w23
char *v25; // x1
size_t v26; // x0
__int64 v27; // x0
__int64 v28; // x1
__int64 v29; // x0
char *v31; // x19
__int64 v32; // x0
CCTextInputNode *v33; // x0
char *v34; // x0
char *v35; // x2
__int64 v36; // x0
int v37; // w0
const char *v38; // x1
unsigned int v39; // w22
size_t v40; // x1
__int64 v41; // x0
cocos2d::CCString *v42; // x0
char *v43; // x0
int v44; // w22
char *v45; // x1
size_t v46; // x2
__int64 v47; // x0
__int64 v48; // x5
__int64 v49; // x0
__int64 v50; // x3
char *v51; // x1
size_t v52; // x2
__int64 v53; // x0
size_t v54; // x3
char v55; // w1
__int64 *v56; // x23
int v57; // w3
size_t v58; // x2
unsigned __int8 v59; // w0
int v60; // w4
__int64 v61; // x1
time_t v62; // x25
unsigned __int64 v63; // x0
char *v64; // x1
size_t v65; // x2
__int64 v66; // x0
unsigned __int8 v67; // w23
__int64 v68; // x27
const char *v69; // x25
char v70; // w0
__int64 v71; // x0
__int64 v72; // x1
GameLevelManager *v73; // x0
int v74; // w22
char *v75; // x1
size_t v76; // x2
__int64 v77; // x0
__int64 v78; // x5
__int64 v79; // x0
__int64 v80; // x3
char *v81; // x1
size_t v82; // x2
__int64 v83; // x0
size_t v84; // x3
cocos2d::CCString *v85; // x0
size_t v86; // x0
cocos2d::CCString *v87; // x0
char *CString; // x0
unsigned __int8 *v89; // x1
unsigned __int8 *v90; // x3
unsigned __int8 *v91; // x2
unsigned int v92; // t1
char *v93; // [xsp+78h] [xbp+68h]
__int64 v94; // [xsp+80h] [xbp+70h] BYREF
__int64 v95; // [xsp+88h] [xbp+78h]
char *v96; // [xsp+90h] [xbp+80h]
__int64 v97; // [xsp+98h] [xbp+88h] BYREF
size_t v98; // [xsp+A0h] [xbp+90h]
char *v99; // [xsp+A8h] [xbp+98h]
__int64 v100; // [xsp+B0h] [xbp+A0h] BYREF
size_t v101; // [xsp+B8h] [xbp+A8h]
void *v102; // [xsp+C0h] [xbp+B0h]
__int64 v103; // [xsp+C8h] [xbp+B8h] BYREF
size_t v104; // [xsp+D0h] [xbp+C0h]
void *v105; // [xsp+D8h] [xbp+C8h]
__int64 v106; // [xsp+E0h] [xbp+D0h] BYREF
size_t v107; // [xsp+E8h] [xbp+D8h]
void *v108; // [xsp+F0h] [xbp+E0h]
unsigned __int64 v109[3]; // [xsp+F8h] [xbp+E8h] BYREF
__int64 v110; // [xsp+110h] [xbp+100h] BYREF
size_t v111; // [xsp+118h] [xbp+108h]
void *v112; // [xsp+120h] [xbp+110h]
__int64 v113; // [xsp+128h] [xbp+118h] BYREF
__int64 v114; // [xsp+130h] [xbp+120h]
void *v115; // [xsp+138h] [xbp+128h]
unsigned __int64 v116[3]; // [xsp+140h] [xbp+130h] BYREF
_QWORD v117[2]; // [xsp+158h] [xbp+148h] BYREF
void *v118; // [xsp+168h] [xbp+158h]
_QWORD v119[2]; // [xsp+170h] [xbp+160h] BYREF
void *v120; // [xsp+180h] [xbp+170h]
__int64 v121; // [xsp+188h] [xbp+178h] BYREF
size_t v122; // [xsp+190h] [xbp+180h]
void *v123; // [xsp+198h] [xbp+188h]
__int64 v124; // [xsp+1A0h] [xbp+190h] BYREF
__int64 v125; // [xsp+1A8h] [xbp+198h]
void *v126; // [xsp+1B0h] [xbp+1A0h]
v3 = *((unsigned __int8 *)this + 736);
if ( *((_BYTE *)this + 736) )
return _stack_chk_guard;
v4 = *((cocos2d::CCArray **)this + 91);
if ( v4 )
{
v5 = cocos2d::CCArray::count(v4);
v6 = v5 == 0;
}
else
{
v6 = 1;
v5 = 0;
}
if ( *((_BYTE *)this + 737) )
{
if ( !v6 || *((int *)this + 174) > 0 )
{
v94 = 0;
v95 = 0;
v96 = nullptr;
std::string::__init(&v94, &byte_11B8890, 0);
v7 = v94;
v8 = "New Direct Message";
if ( (v94 & 1) == 0 )
goto LABEL_8;
goto LABEL_51;
}
v31 = "New Direct Message";
}
else
{
if ( !v6 || *((int *)this + 174) > 0 )
{
v33 = *((CCTextInputNode **)this + 110);
if ( v33 )
{
v8 = "New Group Chat";
CCTextInputNode::getString(v33, &v94);
}
else
{
v94 = 0;
v95 = 0;
v8 = "New Group Chat";
v96 = nullptr;
std::string::__init(&v94, &byte_11B8890, 0);
}
v7 = v94;
if ( (v94 & 1) == 0 )
{
LABEL_8:
v9 = v7 >> 1;
v10 = (char *)&v94 + 1;
v11 = -1;
if ( !v9 )
goto LABEL_9;
LABEL_52:
v34 = &v10[v9];
if ( v34 != v10 )
{
v35 = v10;
if ( *v10 == 32 )
{
do
{
if ( v34 == ++v35 )
{
v11 = -1;
goto LABEL_9;
}
}
while ( *v35 == 32 );
v11 = v35 - v10;
}
else
{
v11 = 0;
}
}
LABEL_9:
std::string::erase((char *)&v94, 0, v11);
if ( (v94 & 1) != 0 )
{
v12 = v96;
v13 = v95;
}
else
{
v13 = (unsigned __int8)v94 >> 1;
v12 = (char *)&v94 + 1;
}
v14 = &v12[v13];
if ( v14 != v12 )
{
v15 = (unsigned __int8)*(v14 - 1);
v16 = v14 - 1;
if ( v15 != 32 )
{
LABEL_59:
v18 = v16 - v12 + 1;
LABEL_17:
std::string::erase((char *)&v94, v18, 0xFFFFFFFFFFFFFFFFLL);
v19 = *((CCTextInputNode **)this + 111);
if ( v19 )
{
CCTextInputNode::getString(v19, &v97);
}
else
{
v97 = 0;
v98 = 0;
v99 = nullptr;
std::string::__init(&v97, &byte_11B8890, 0);
}
if ( *((_BYTE *)this + 737) )
{
if ( (v97 & 1) != 0 )
{
v20 = v98;
v93 = v99;
}
else
{
v20 = (unsigned __int8)v97 >> 1;
v93 = (char *)&v97 + 1;
}
if ( !v20 )
goto LABEL_62;
v21 = &v93[v20];
if ( v21 == v93 )
goto LABEL_62;
v22 = v93;
while ( memchr(" \n", (unsigned __int8)*v22, 2u) )
{
if ( v21 == ++v22 )
goto LABEL_62;
}
if ( v22 - v93 == -1 )
{
LABEL_62:
v106 = 0;
v107 = 0;
v108 = nullptr;
std::string::__init(&v106, "Please enter a message.", 0x17u);
v36 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)v8,
(char *)&v106,
(ButtonSprite *)"OK",
nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v36 + 1312LL))(v36);
if ( (v106 & 1) != 0 )
operator delete(v108);
goto LABEL_38;
}
}
else
{
v28 = (unsigned __int8)v94 >> 1;
if ( (v94 & 1) != 0 )
v28 = v95;
if ( !v28 )
{
v103 = 0;
v104 = 0;
v105 = nullptr;
std::string::__init(&v103, "Please enter a subject.", 0x17u);
v29 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)v8,
(char *)&v103,
(ButtonSprite *)"OK",
nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v29 + 1312LL))(v29);
if ( (v103 & 1) != 0 )
operator delete(v105);
goto LABEL_38;
}
}
v23 = NewThreadPopup::bodyEmoteCap(this);
v24 = EmoteSprite::effectiveLength((char *)&v97, v23);
if ( v24 > (int)NewThreadPopup::bodyCharLimit(this) )
{
if ( *((_BYTE *)this + 737) )
v25 = "Message is too long.";
else
v25 = "Description is too long.";
v93 = v25;
v113 = 0;
v114 = 0;
v115 = nullptr;
v26 = strlen(v25);
std::string::__init(&v113, v93, v26);
v27 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v8, (char *)&v113, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v27 + 1312LL))(v27);
if ( (v113 & 1) != 0 )
operator delete(v115);
LABEL_38:
if ( (v97 & 1) != 0 )
operator delete(v99);
if ( (v94 & 1) != 0 )
operator delete(v96);
return _stack_chk_guard;
}
if ( *((_BYTE *)this + 737) )
{
v100 = 0;
v101 = 0;
v102 = nullptr;
std::string::__init(&v100, &byte_11B8890, 0);
}
else
{
v102 = nullptr;
v100 = 0;
v101 = 0;
if ( (v97 & 1) == 0 )
{
v100 = v97;
v101 = v98;
v102 = v99;
goto LABEL_68;
}
std::string::__init(&v100, v99, v98);
}
if ( *((_BYTE *)this + 737) )
{
v103 = 0;
v104 = 0;
v105 = nullptr;
goto LABEL_133;
}
LABEL_68:
std::string::assign(&v97, &byte_11B8890);
v37 = *((unsigned __int8 *)this + 737);
v103 = 0;
v104 = 0;
v105 = nullptr;
if ( !v37 )
{
v38 = (const char *)*((unsigned int *)this + 174);
if ( (int)v38 > 0 )
{
v87 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v38);
CString = (char *)cocos2d::CCString::getCString(v87);
std::string::assign(&v103, CString);
}
else if ( v5 > 0 )
{
v39 = 0;
v93 = &byte_1169BE0;
do
{
v40 = (unsigned __int8)v103 >> 1;
if ( (v103 & 1) != 0 )
v40 = v104;
if ( v40 )
std::string::append((__int64)&v103, v93);
v41 = cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 91), v39);
v42 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)*(unsigned int *)(v41 + 376));
v43 = (char *)cocos2d::CCString::getCString(v42);
std::string::append((__int64)&v103, v43);
++v39;
}
while ( v39 != v5 );
}
v44 = 0;
goto LABEL_78;
}
LABEL_133:
v44 = *((_DWORD *)this + 174);
if ( v44 <= 0 )
v44 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 91), 0) + 376);
LABEL_78:
std::operator+("|", (__int64)&v97, v109);
if ( *((_BYTE *)this + 737) )
{
v85 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)v44);
v93 = (char *)cocos2d::CCString::getCString(v85);
v110 = 0;
v111 = 0;
v112 = nullptr;
v86 = strlen(v93);
std::string::__init(&v110, v93, v86);
}
else
{
v110 = 0;
v111 = 0;
v112 = nullptr;
if ( (v103 & 1) != 0 )
{
std::string::__init(&v110, v105, v104);
}
else
{
v112 = v105;
v110 = v103;
v111 = v104;
}
}
if ( (v110 & 1) != 0 )
{
v45 = (char *)v112;
v46 = v111;
}
else
{
v46 = (unsigned __int8)v110 >> 1;
v45 = (char *)&v110 + 1;
}
v47 = std::string::append((__int64)v109, v45, v46);
v48 = *(_QWORD *)(v47 + 8);
v113 = *(_QWORD *)v47;
v114 = v48;
v115 = *(void **)(v47 + 16);
*(_QWORD *)v47 = 0;
*(_QWORD *)(v47 + 8) = 0;
*(_QWORD *)(v47 + 16) = 0;
v49 = std::string::append((__int64)&v113, "|");
v50 = *(_QWORD *)(v49 + 8);
v124 = *(_QWORD *)v49;
v125 = v50;
v126 = *(void **)(v49 + 16);
*(_QWORD *)v49 = 0;
*(_QWORD *)(v49 + 8) = 0;
*(_QWORD *)(v49 + 16) = 0;
if ( *((_BYTE *)this + 737) )
{
v121 = 0;
v122 = 0;
v123 = nullptr;
std::string::__init(&v121, "m", 1u);
}
else
{
std::operator+("|", (__int64)&v94, v116);
if ( (v100 & 1) != 0 )
{
v75 = (char *)v102;
v76 = v101;
}
else
{
v76 = (unsigned __int8)v100 >> 1;
v75 = (char *)&v100 + 1;
}
v77 = std::string::append((__int64)v116, v75, v76);
v78 = *(_QWORD *)(v77 + 8);
v117[0] = *(_QWORD *)v77;
v117[1] = v78;
v118 = *(void **)(v77 + 16);
*(_QWORD *)v77 = 0;
*(_QWORD *)(v77 + 8) = 0;
*(_QWORD *)(v77 + 16) = 0;
v79 = std::string::append((__int64)v117, "|");
v80 = *(_QWORD *)(v79 + 8);
v119[0] = *(_QWORD *)v79;
v119[1] = v80;
v120 = *(void **)(v79 + 16);
*(_QWORD *)v79 = 0;
*(_QWORD *)(v79 + 8) = 0;
*(_QWORD *)(v79 + 16) = 0;
if ( (*((_BYTE *)this + 784) & 1) != 0 )
{
v81 = *((char **)this + 100);
v82 = *((_QWORD *)this + 99);
}
else
{
v81 = (char *)this + 785;
v82 = *((_BYTE *)this + 784) >> 1;
}
v83 = std::string::append((__int64)v119, v81, v82);
v3 = 1;
v84 = *(_QWORD *)(v83 + 8);
v121 = *(_QWORD *)v83;
v122 = v84;
v123 = *(void **)(v83 + 16);
*(_QWORD *)v83 = 0;
*(_QWORD *)(v83 + 8) = 0;
*(_QWORD *)(v83 + 16) = 0;
}
if ( (v121 & 1) != 0 )
{
v51 = (char *)v123;
v52 = v122;
}
else
{
v52 = (unsigned __int8)v121 >> 1;
v51 = (char *)&v121 + 1;
}
v53 = std::string::append((__int64)&v124, v51, v52);
v54 = *(_QWORD *)(v53 + 8);
v106 = *(_QWORD *)v53;
v107 = v54;
v108 = *(void **)(v53 + 16);
*(_QWORD *)v53 = 0;
*(_QWORD *)(v53 + 8) = 0;
v55 = v121;
*(_QWORD *)(v53 + 16) = 0;
if ( (v55 & 1) != 0 )
operator delete(v123);
if ( v3 )
{
if ( (v119[0] & 1) != 0 )
operator delete(v120);
if ( (v117[0] & 1) != 0 )
operator delete(v118);
if ( (v116[0] & 1) != 0 )
operator delete((void *)v116[2]);
}
if ( (v124 & 1) != 0 )
operator delete(v126);
if ( (v113 & 1) != 0 )
operator delete(v115);
if ( (v110 & 1) != 0 )
operator delete(v112);
if ( (v109[0] & 1) != 0 )
operator delete((void *)v109[2]);
v56 = (__int64 *)((char *)this + 912);
if ( !*((_QWORD *)this + 113) )
goto LABEL_110;
v57 = v106 & 1;
v58 = (unsigned __int8)v106 >> 1;
if ( v57 )
v58 = v107;
v59 = *((_BYTE *)this + 912);
v56 = (__int64 *)((char *)this + 912);
v60 = v59 & 1;
v61 = v59 >> 1;
if ( (v59 & 1) != 0 )
v61 = *((_QWORD *)this + 115);
if ( v58 != v61 )
goto LABEL_110;
v63 = (unsigned __int64)&v106 + 1;
if ( v57 )
v63 = (unsigned __int64)v108;
v89 = (unsigned __int8 *)this + 913;
if ( v60 )
v89 = *((unsigned __int8 **)this + 116);
if ( v57 )
{
if ( v58 )
{
v63 = memcmp((const void *)v63, v89, v58);
if ( (_DWORD)v63 )
{
LABEL_110:
v62 = time(nullptr);
v63 = rand() & 0xFFFFF;
*((_QWORD *)this + 113) = v63 | (v62 << 20);
if ( v56 != &v106 )
{
if ( (v106 & 1) != 0 )
{
v64 = (char *)v108;
v65 = v107;
}
else
{
v65 = (unsigned __int8)v106 >> 1;
v64 = (char *)&v106 + 1;
}
v63 = (unsigned __int64)std::string::assign(v56, v64, v65);
}
}
}
}
else if ( v58 )
{
if ( *(unsigned __int8 *)v63 == *v89 )
{
v90 = (unsigned __int8 *)(v63 + 1);
v91 = (unsigned __int8 *)(v63 + v58);
while ( 1 )
{
++v89;
if ( v90 == v91 )
goto LABEL_114;
v92 = *v90++;
v63 = v92;
if ( *v89 != v92 )
goto LABEL_110;
}
}
goto LABEL_110;
}
LABEL_114:
v66 = GameLevelManager::sharedState((GameLevelManager *)v63);
v67 = *((_BYTE *)this + 737);
v68 = v66;
v69 = *((const char **)this + 113);
if ( v67 )
{
v124 = 0;
v125 = 0;
v126 = nullptr;
std::string::__init(&v124, &byte_11B8890, 0);
}
else
{
v70 = *((_BYTE *)this + 784);
v124 = 0;
v125 = 0;
v126 = nullptr;
if ( (v70 & 1) != 0 )
{
std::string::__init(&v124, *((void **)this + 100), *((_QWORD *)this + 99));
}
else
{
v71 = *((_QWORD *)this + 98);
v72 = *((_QWORD *)this + 99);
v126 = *((void **)this + 100);
v124 = v71;
v125 = v72;
}
}
v73 = (GameLevelManager *)GameLevelManager::sendThreadMessage(
v68,
0,
v44,
(char *)&v94,
(char *)&v97,
v69,
(char *)&v103,
v67,
(char *)&v100,
(char *)&v124);
v74 = (unsigned __int8)v73;
if ( (v124 & 1) != 0 )
operator delete(v126);
if ( v74 )
{
*(_QWORD *)(GameLevelManager::sharedState(v73) + 1264) = (char *)this + 664;
NewThreadPopup::setSendPending((__int64)this, 1u);
}
if ( (v106 & 1) != 0 )
operator delete(v108);
if ( (v103 & 1) != 0 )
operator delete(v105);
if ( (v100 & 1) != 0 )
operator delete(v102);
goto LABEL_38;
}
while ( v16 != v12 )
{
v17 = (unsigned __int8)*--v16;
if ( v17 != 32 )
goto LABEL_59;
}
}
v18 = 0;
goto LABEL_17;
}
LABEL_51:
v9 = v95;
v11 = -1;
v10 = v96;
if ( !v95 )
goto LABEL_9;
goto LABEL_52;
}
v31 = "New Group Chat";
}
v124 = 0;
v125 = 0;
v126 = nullptr;
std::string::__init(&v124, "Please select a recipient.", 0x1Au);
v32 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)v31, (char *)&v124, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v32 + 1312LL))(v32);
if ( (v124 & 1) != 0 )
operator delete(v126);
return _stack_chk_guard;
}