//
// ThreadViewPopup::onSend from 0x75db40 to 0x75dec2 (898 bytes)
//
// 1 xrefs:
// > ThreadViewPopup::keyDown @ 0x75df26
//
// 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:59:01 +0000
//
int __fastcall ThreadViewPopup::onSend(ThreadViewPopup *this, cocos2d::CCObject *a2)
{
int result; // r0
int v4; // r1
unsigned __int8 *v5; // r7
int v6; // r3
unsigned __int8 *v7; // r6
unsigned __int8 *v8; // r8
unsigned __int8 *v9; // r9
int v10; // r1
int v11; // r0
int v12; // r2
int v13; // r3
int *v14; // r0
__int64 *v15; // r8
int v16; // r3
int v17; // r6
size_t v18; // r2
int v19; // r1
int v20; // r3
char *v21; // r0
unsigned __int8 *v22; // r1
unsigned __int8 *v23; // r0
unsigned __int8 *v24; // r2
int v25; // r11
const char *v26; // r10
int v27; // t1
time_t v28; // r6
int v29; // r0
__int64 v30; // r2
__int64 v31; // r2
int v32; // r10
GameLevelManager *v33; // r0
int v34; // r6
GJAccountManager *v35; // r0
int v36; // r0
int v37; // r7
__int64 v38; // [sp+20h] [bp-6Ch]
int v39; // [sp+30h] [bp-5Ch] BYREF
int v40; // [sp+34h] [bp-58h]
char *v41; // [sp+38h] [bp-54h]
int v42[3]; // [sp+3Ch] [bp-50h] BYREF
int v43[3]; // [sp+48h] [bp-44h] BYREF
int v44[3]; // [sp+54h] [bp-38h] BYREF
int v45[3]; // [sp+60h] [bp-2Ch] BYREF
int v46[3]; // [sp+6Ch] [bp-20h] BYREF
int v47[3]; // [sp+78h] [bp-14h] BYREF
result = ThreadViewPopup::dmSendBlocked(this);
if ( !result
&& !*((_BYTE *)this + 598)
&& !*((_BYTE *)this + 808)
&& !*((_BYTE *)this + 856)
&& !*(_BYTE *)(*((_DWORD *)this + 141) + 176)
&& !*((_BYTE *)this + 599) )
{
result = ThreadViewPopup::removedView(this);
if ( !result && *((_BYTE *)this + 597) && !*((_QWORD *)this + 108) )
{
v4 = *((_DWORD *)this + 171);
if ( v4 )
{
CCTextInputNode::getString((CCTextInputNode *)&v39, v4);
}
else
{
v39 = 0;
v40 = 0;
v41 = nullptr;
std::string::__init(&v39, &unk_B6B226, 0);
}
if ( (v39 & 1) != 0 )
{
v5 = (unsigned __int8 *)v41;
v6 = v40;
}
else
{
v6 = (int)(unsigned __int8)v39 >> 1;
v5 = (unsigned __int8 *)&v39 + 1;
}
if ( v6 )
{
v7 = &v5[v6];
v8 = v5;
do
{
v9 = v8;
if ( v8 == v7 )
return std::string::~string((int)&v39);
v10 = *v8++;
}
while ( memchr(" \n", v10, 2u) );
if ( v9 - v5 == -1 )
return std::string::~string((int)&v39);
v11 = EmoteSprite::maxEmotesMessage(nullptr);
if ( EmoteSprite::effectiveLength((unsigned __int8 *)&v39, v11, v12, v13) > 500 )
{
memset(v42, 0, sizeof(v42));
std::string::__init(v42, "Message is too long.", 0x14u);
v14 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Message", (int)v42, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v14 + 656))(v14);
std::string::~string((int)v42);
return std::string::~string((int)&v39);
}
v15 = (__int64 *)((char *)this + 720);
if ( !*((_QWORD *)this + 90) )
goto LABEL_44;
v16 = *((unsigned __int8 *)this + 728);
v17 = v39 & 1;
v18 = v17 ? v40 : (int)(unsigned __int8)v39 >> 1;
v19 = v16 & 1;
v20 = (v16 & 1) != 0 ? *((_DWORD *)this + 183) : v16 >> 1;
if ( v18 != v20 )
goto LABEL_44;
if ( v17 )
v21 = v41;
else
v21 = (char *)&v39 + 1;
if ( v19 )
v22 = *((unsigned __int8 **)this + 184);
else
v22 = (unsigned __int8 *)this + 729;
if ( !v17 )
{
v23 = (unsigned __int8 *)(v21 - 1);
v24 = &v22[v18];
while ( v22 != v24 )
{
v27 = *++v23;
if ( v27 != *v22 )
goto LABEL_44;
++v22;
}
goto LABEL_39;
}
v23 = (unsigned __int8 *)std::char_traits::compare(v21, v22, v18);
if ( v23 )
{
LABEL_44:
v28 = time(nullptr);
v29 = rand();
v30 = (__int64)v28 << 20;
LODWORD(v30) = v30 | v29 & 0xFFFFF;
*v15 = v30;
v23 = std::string::operator=((unsigned __int8 *)this + 728, (unsigned __int8 *)&v39);
}
LABEL_39:
v25 = GameLevelManager::sharedState((GameLevelManager *)v23);
v26 = *(const char **)(*((_DWORD *)this + 141) + 52);
memset(v43, 0, sizeof(v43));
std::string::__init(v43, &unk_B6B226, 0);
v31 = *v15;
memset(v44, 0, sizeof(v44));
v38 = v31;
std::string::__init(v44, &unk_B6B226, 0);
memset(v45, 0, sizeof(v45));
std::string::__init(v45, &unk_B6B226, 0);
memset(v46, 0, sizeof(v46));
std::string::__init(v46, &unk_B6B226, 0);
v32 = GameLevelManager::sendThreadMessage(
v25,
v26,
nullptr,
(char *)v43,
(unsigned __int8 *)&v39,
v38,
(unsigned __int8 *)v44,
0,
(unsigned __int8 *)v45,
(unsigned __int8 *)v46);
std::string::~string((int)v46);
std::string::~string((int)v45);
std::string::~string((int)v44);
v33 = (GameLevelManager *)std::string::~string((int)v43);
if ( v32 )
{
*(_DWORD *)(GameLevelManager::sharedState(v33) + 840) = (char *)this + 524;
ThreadViewPopup::setSendPending(this, 1);
v34 = operator new(0x60u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v34);
*(_QWORD *)(v34 + 56) = 0;
*(_QWORD *)(v34 + 80) = 0;
*(_DWORD *)v34 = &off_C99560;
*(_DWORD *)(v34 + 64) = 0;
*(_DWORD *)(v34 + 68) = 0;
*(_DWORD *)(v34 + 72) = 0;
*(_DWORD *)(v34 + 76) = 0;
*(_BYTE *)(v34 + 88) = 0;
v35 = (GJAccountManager *)cocos2d::CCObject::autorelease((cocos2d::CCObject *)v34);
v36 = GJAccountManager::sharedState(v35);
*(_DWORD *)(v34 + 64) = *(_DWORD *)(v36 + 280) - *(_DWORD *)(v36 + 284);
std::string::operator=((unsigned __int8 *)(v34 + 68), (unsigned __int8 *)&v39);
*(_QWORD *)(v34 + 80) = time(nullptr);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 142), (cocos2d::CCObject *)v34);
v37 = *((_DWORD *)this + 171);
*((_DWORD *)this + 190) = v34;
if ( v37 )
{
memset(v47, 0, sizeof(v47));
std::string::__init(v47, &unk_B6B226, 0);
CCTextInputNode::setString(v37, (int)v47);
std::string::~string((int)v47);
}
ThreadViewPopup::buildRows(this, 1);
ThreadViewPopup::setUnseenBelow(this, 0);
}
}
return std::string::~string((int)&v39);
}
}
return result;
}