//
// ThreadViewPopup::onSend from 0xc89710 to 0xc89d24 (1556 bytes)
//
// 4 xrefs:
// > ThreadViewPopup::keyDown @ 0xc89d94
// > ??> @ 0xc4be8
// > ThreadViewPopup::init @ 0xc87820
// > ??> @ 0x1545be8
//
// 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:43 +0000
//
__int64 __fastcall ThreadViewPopup::onSend(cocos2d::CCArray **this, cocos2d::CCObject *a2)
{
CCTextInputNode *v4; // x0
int v5; // w25
void *v6; // x0
unsigned __int8 *v7; // x26
__int64 *v8; // x23
unsigned __int8 *v9; // x22
int v10; // w0
__int64 *v11; // x22
int v12; // w3
size_t v13; // x2
unsigned __int8 v14; // w0
int v15; // w4
__int64 v16; // x1
time_t v17; // x23
unsigned __int64 v18; // x0
char *v19; // x1
size_t v20; // x2
__int64 v21; // x28
unsigned int v22; // w27
int v23; // w23
GameLevelManager *v24; // x0
int v25; // w0
__int64 v26; // x0
__int64 v27; // x23
GJAccountManager *v28; // x0
__int64 v29; // x0
char *v30; // x1
size_t v31; // x2
_QWORD *v32; // x21
unsigned __int8 *v33; // x1
unsigned __int8 *v34; // x3
unsigned __int8 *v35; // x2
unsigned int v36; // t1
const char *v37; // [xsp+78h] [xbp+68h]
__int64 v38; // [xsp+80h] [xbp+70h] BYREF
size_t v39; // [xsp+88h] [xbp+78h]
void *v40; // [xsp+90h] [xbp+80h]
__int64 v41[2]; // [xsp+98h] [xbp+88h] BYREF
void *v42; // [xsp+A8h] [xbp+98h]
GameLevelManager *v43[2]; // [xsp+B0h] [xbp+A0h] BYREF
void *v44; // [xsp+C0h] [xbp+B0h]
__int64 v45[2]; // [xsp+C8h] [xbp+B8h] BYREF
void *v46; // [xsp+D8h] [xbp+C8h]
__int64 v47[2]; // [xsp+E0h] [xbp+D0h] BYREF
void *v48; // [xsp+F0h] [xbp+E0h]
__int64 v49[2]; // [xsp+F8h] [xbp+E8h] BYREF
void *v50; // [xsp+108h] [xbp+F8h]
__int64 v51[2]; // [xsp+110h] [xbp+100h] BYREF
void *v52; // [xsp+120h] [xbp+110h]
if ( (unsigned __int8)ThreadViewPopup::dmSendBlocked((ThreadViewPopup *)this)
|| *((_BYTE *)this + 790)
|| *((_BYTE *)this + 1104)
|| *((_BYTE *)this + 1168)
|| *((_BYTE *)*(this + 94) + 272)
|| *((_BYTE *)this + 791)
|| ThreadViewPopup::removedView((ThreadViewPopup *)this)
|| !*((_BYTE *)this + 789)
|| *(this + 147) )
{
return _stack_chk_guard;
}
v4 = *(this + 116);
if ( v4 )
{
CCTextInputNode::getString(v4, &v38);
}
else
{
v38 = 0;
v39 = 0;
v40 = nullptr;
std::string::__init(&v38, &byte_11B8890, 0);
}
v5 = v38 & 1;
if ( v5 )
{
v6 = v40;
v7 = (unsigned __int8 *)v40;
if ( !v39 || (v8 = (__int64 *)((char *)v40 + v39), v40 == (char *)v40 + v39) )
{
LABEL_43:
operator delete(v6);
return _stack_chk_guard;
}
}
else
{
v25 = (int)(unsigned __int8)v38 >> 1;
if ( !v25 )
return _stack_chk_guard;
v7 = (unsigned __int8 *)&v38 + 1;
v8 = (__int64 *)((char *)&v38 + v25 + 1);
if ( v8 == (__int64 *)((char *)&v38 + 1) )
return _stack_chk_guard;
}
v9 = v7;
while ( memchr(" \n", *v9, 2u) )
{
if ( v8 == (__int64 *)++v9 )
goto LABEL_41;
}
if ( v9 - v7 == -1 )
{
LABEL_41:
if ( !v5 )
return _stack_chk_guard;
v6 = v40;
goto LABEL_43;
}
v10 = EmoteSprite::maxEmotesMessage(nullptr);
if ( (int)EmoteSprite::effectiveLength((char *)&v38, v10) > 500 )
{
v41[0] = 0;
v41[1] = 0;
v42 = nullptr;
std::string::__init(v41, "Message is too long.", 0x14u);
v26 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Message", (char *)v41, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v26 + 1312LL))(v26);
if ( (v41[0] & 1) != 0 )
operator delete(v42);
goto LABEL_40;
}
v11 = (__int64 *)(this + 122);
if ( !*(this + 121) )
goto LABEL_27;
v12 = v38 & 1;
v13 = (unsigned __int8)v38 >> 1;
if ( v12 )
v13 = v39;
v14 = *((_BYTE *)this + 976);
v11 = (__int64 *)(this + 122);
v15 = v14 & 1;
v16 = v14 >> 1;
if ( (v14 & 1) != 0 )
v16 = (__int64)*(this + 123);
if ( v13 != v16 )
goto LABEL_27;
v18 = (unsigned __int64)&v38 + 1;
if ( v12 )
v18 = (unsigned __int64)v40;
v33 = (unsigned __int8 *)this + 977;
if ( v15 )
v33 = (unsigned __int8 *)*(this + 124);
if ( v12 )
{
if ( v13 )
{
v18 = memcmp((const void *)v18, v33, v13);
if ( (_DWORD)v18 )
{
LABEL_27:
v17 = time(nullptr);
v18 = rand() & 0xFFFFF;
*(this + 121) = (cocos2d::CCArray *)(v18 | (v17 << 20));
if ( v11 != &v38 )
{
if ( (v38 & 1) != 0 )
{
v19 = (char *)v40;
v20 = v39;
}
else
{
v20 = (unsigned __int8)v38 >> 1;
v19 = (char *)&v38 + 1;
}
v18 = (unsigned __int64)std::string::assign(v11, v19, v20);
}
}
}
}
else if ( v13 )
{
if ( *(unsigned __int8 *)v18 == *v33 )
{
v34 = (unsigned __int8 *)(v18 + 1);
v35 = (unsigned __int8 *)(v18 + v13);
while ( 1 )
{
++v33;
if ( v34 == v35 )
goto LABEL_31;
v36 = *v34++;
v18 = v36;
if ( *v33 != v36 )
goto LABEL_27;
}
}
goto LABEL_27;
}
LABEL_31:
v21 = GameLevelManager::sharedState((GameLevelManager *)v18);
v22 = *((_DWORD *)*(this + 94) + 14);
v43[0] = nullptr;
v43[1] = nullptr;
v44 = nullptr;
std::string::__init((__int64 *)v43, &byte_11B8890, 0);
v37 = (const char *)*(this + 121);
v45[0] = 0;
v45[1] = 0;
v46 = nullptr;
std::string::__init(v45, &byte_11B8890, 0);
v47[0] = 0;
v47[1] = 0;
v48 = nullptr;
std::string::__init(v47, &byte_11B8890, 0);
v49[0] = 0;
v49[1] = 0;
v50 = nullptr;
std::string::__init(v49, &byte_11B8890, 0);
v23 = (unsigned __int8)GameLevelManager::sendThreadMessage(
v21,
v22,
0,
(char *)v43,
(char *)&v38,
v37,
(char *)v45,
0,
(char *)v47,
(char *)v49);
if ( (v49[0] & 1) != 0 )
operator delete(v50);
if ( (v47[0] & 1) != 0 )
operator delete(v48);
if ( (v45[0] & 1) != 0 )
operator delete(v46);
v24 = (GameLevelManager *)LOBYTE(v43[0]);
if ( ((__int64)v43[0] & 1) != 0 )
operator delete(v44);
if ( !v23 )
{
LABEL_40:
v5 = v38 & 1;
goto LABEL_41;
}
*(_QWORD *)(GameLevelManager::sharedState(v24) + 1264) = this + 84;
ThreadViewPopup::setSendPending((__int64)this, 1u);
v27 = operator new(0x70u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v27);
*(_QWORD *)(v27 + 56) = 0;
*(_DWORD *)(v27 + 64) = 0;
*(_QWORD *)(v27 + 72) = 0;
*(_QWORD *)v27 = &off_143F400;
*(_QWORD *)(v27 + 80) = 0;
*(_QWORD *)(v27 + 88) = 0;
*(_QWORD *)(v27 + 96) = 0;
*(_BYTE *)(v27 + 104) = 0;
v28 = (GJAccountManager *)cocos2d::CCObject::autorelease((cocos2d::CCObject *)v27);
v29 = GJAccountManager::sharedState(v28);
*(_DWORD *)(v27 + 64) = *(_DWORD *)(v29 + 352) - *(_DWORD *)(v29 + 356);
if ( (__int64 *)(v27 + 72) != &v38 )
{
if ( (v38 & 1) != 0 )
{
v30 = (char *)v40;
v31 = v39;
}
else
{
v31 = (unsigned __int8)v38 >> 1;
v30 = (char *)&v38 + 1;
}
std::string::assign((__int64 *)(v27 + 72), v30, v31);
}
*(_QWORD *)(v27 + 96) = time(nullptr);
cocos2d::CCArray::addObject(*(this + 95), (cocos2d::CCObject *)v27);
v32 = *(this + 116);
*(this + 130) = (cocos2d::CCArray *)v27;
if ( v32 )
{
v51[0] = 0;
v51[1] = 0;
v52 = nullptr;
std::string::__init(v51, &byte_11B8890, 0);
CCTextInputNode::setString(v32, (char *)v51);
if ( (v51[0] & 1) != 0 )
operator delete(v52);
}
ThreadViewPopup::buildRows((ThreadViewPopup *)this, 1u);
ThreadViewPopup::setUnseenBelow((ThreadViewPopup *)this, 0);
if ( (v38 & 1) != 0 )
{
v6 = v40;
goto LABEL_43;
}
return _stack_chk_guard;
}