//
// NewThreadPopup::applyMode from 0xc7d25c to 0xc7d690 (1076 bytes)
//
// 3 xrefs:
// > NewThreadPopup::init @ 0xc7e534
// > NewThreadPopup::onToggleMode @ 0xc7eec0
// > ??> @ 0xbf710
//
// 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:37 +0000
//
__int64 __fastcall NewThreadPopup::applyMode(NewThreadPopup *this)
{
__int64 v2; // x0
const char *v3; // x1
__int64 v4; // x0
__int64 v5; // x0
__int64 v6; // x0
int v7; // w21
unsigned int v8; // w19
__int64 v9; // x0
__int64 v10; // x0
long double v11; // q0
float v12; // s8
__int64 v13; // x0
__int64 v14; // x0
__int64 v15; // x0
__int64 *v16; // x0
char *v17; // x1
__int64 v18; // x21
int v19; // w23
CCTextInputNode *v20; // x21
int v21; // w0
unsigned __int8 v22; // w0
unsigned __int64 v23; // x2
int v24; // w1
unsigned __int64 v25; // x3
char *v26; // x4
unsigned __int64 v27; // x0
_QWORD *v28; // x21
char *v29; // x1
size_t v30; // x0
int v32; // w0
int v33; // w23
unsigned __int64 v34; // x1
unsigned __int64 v35; // x1
char *v36; // x2
char *v37; // [xsp+48h] [xbp+48h]
__int64 v38; // [xsp+58h] [xbp+58h] BYREF
unsigned __int64 v39; // [xsp+60h] [xbp+60h]
char *v40; // [xsp+68h] [xbp+68h]
__int64 v41[2]; // [xsp+70h] [xbp+70h] BYREF
void *v42; // [xsp+80h] [xbp+80h]
v2 = *((_QWORD *)this + 95);
if ( v2 )
{
if ( *((_BYTE *)this + 737) )
v3 = "New Direct Message";
else
v3 = "New Group Chat";
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v2 + 928LL))(v2, v3);
cocos2d::CCLabelBMFont::limitLabelWidth(*((cocos2d::CCLabelBMFont **)this + 95), 230.0, 0.7, 0.4);
}
GameToolbox::setOnOffSprite(*((_QWORD *)this + 96), *((_BYTE *)this + 737));
GameToolbox::setOnOffSprite(*((_QWORD *)this + 97), *((_BYTE *)this + 737) ^ 1);
v4 = *((_QWORD *)this + 102);
if ( v4 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v4 + 344LL))(v4, *((unsigned __int8 *)this + 737) ^ 1u);
v5 = *((_QWORD *)this + 103);
if ( v5 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v5 + 344LL))(v5, *((unsigned __int8 *)this + 737));
v6 = *((_QWORD *)this + 104);
v7 = *((unsigned __int8 *)this + 737);
v8 = v7 ^ 1;
if ( v6 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v6 + 344LL))(v6, v8);
v9 = *((_QWORD *)this + 108);
if ( v9 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v9 + 344LL))(v9, v8);
v10 = *((_QWORD *)this + 110);
if ( v10 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v10 + 344LL))(v10, v8);
if ( v8 )
LODWORD(v11) = *((_DWORD *)this + 212);
else
*(float *)&v11 = *((float *)this + 212) + 3000.0;
(*(void (__fastcall **)(_QWORD, long double))(**((_QWORD **)this + 110) + 232LL))(*((_QWORD *)this + 110), v11);
if ( v7 )
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 110) + 1160LL))(*((_QWORD *)this + 110), 0);
}
if ( *((_BYTE *)this + 737) )
v12 = *((float *)this + 213) + 23.0;
else
v12 = *((float *)this + 213);
v13 = *((_QWORD *)this + 105);
if ( v13 )
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 232LL))(v13, v12);
v14 = *((_QWORD *)this + 111);
if ( v14 )
{
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v14 + 232LL))(v14, v12);
v15 = *((_QWORD *)this + 111);
if ( v15 )
{
v16 = (__int64 *)(v15 + 432);
if ( *((_BYTE *)this + 737) )
v17 = "Message";
else
v17 = "Description";
std::string::assign(v16, v17);
v18 = *((_QWORD *)this + 111);
v19 = NewThreadPopup::bodyCharLimit(this);
*(_DWORD *)(v18 + 592) = v19 + 17 * NewThreadPopup::bodyEmoteCap(this);
v20 = *((CCTextInputNode **)this + 111);
v21 = NewThreadPopup::bodyEmoteCap(this);
CCTextInputNode::setParseEmotes(v20, v21);
CCTextInputNode::setAllowNewlines(*((_QWORD *)this + 111), *((_BYTE *)this + 737));
CCTextInputNode::getString(*((CCTextInputNode **)this + 111), &v38);
if ( !*((_BYTE *)this + 737) )
{
v22 = v38;
v23 = 0;
v24 = v38 & 1;
if ( (v38 & 1) == 0 )
goto LABEL_32;
while ( 1 )
{
if ( v23 >= v39 )
goto LABEL_36;
v25 = v23 + 1;
v26 = &v40[v23];
if ( v40[v23] != 10 )
break;
while ( 1 )
{
*v26 = 32;
v23 = v25;
v22 = v38;
v24 = v38 & 1;
LABEL_31:
if ( v24 )
break;
LABEL_32:
if ( v23 >= v22 >> 1 )
goto LABEL_36;
v25 = v23 + 1;
v26 = (char *)&v38 + v23 + 1;
if ( *((_BYTE *)&v38 + v23 + 1) != 10 )
goto LABEL_30;
}
}
LABEL_30:
v23 = v25;
goto LABEL_31;
}
v22 = v38;
for ( LOBYTE(v24) = v38 & 1; ; LOBYTE(v24) = v38 & 1 )
{
LABEL_36:
v24 = (unsigned __int8)v24;
v27 = v22 >> 1;
if ( (_BYTE)v24 )
v27 = v39;
if ( !v27 )
break;
v32 = NewThreadPopup::bodyEmoteCap(this);
v33 = EmoteSprite::effectiveLength((char *)&v38, v32);
if ( v33 <= (int)NewThreadPopup::bodyCharLimit(this) )
{
v24 = v38 & 1;
break;
}
if ( (v38 & 1) != 0 )
v34 = v39;
else
v34 = (unsigned __int8)v38 >> 1;
v35 = v34 - 1;
if ( v35 )
{
v36 = v40;
if ( (v38 & 1) == 0 )
v36 = (char *)&v38 + 1;
do
{
if ( (v36[v35] & 0xC0) != 0x80 )
break;
--v35;
}
while ( v35 );
}
std::string::erase((char *)&v38, v35, 0xFFFFFFFFFFFFFFFFLL);
v22 = v38;
}
v28 = *((_QWORD **)this + 111);
if ( v24 )
v29 = v40;
else
v29 = (char *)&v38 + 1;
v37 = v29;
v41[0] = 0;
v41[1] = 0;
v42 = nullptr;
v30 = strlen(v29);
std::string::__init(v41, v37, v30);
CCTextInputNode::setString(v28, (char *)v41);
if ( (v41[0] & 1) != 0 )
operator delete(v42);
if ( (v38 & 1) != 0 )
operator delete(v40);
}
}
NewThreadPopup::updateRecipientLabel(this);
return _stack_chk_guard;
}