//
// GJWriteMessagePopup::updateText from 0x1002aa720 to 0x1002aa94c (556 bytes)
//
// 6 xrefs:
// > GJWriteMessagePopup::init @ 0x1002a9581
// > GJWriteMessagePopup::init @ 0x1002a9900
// > GJWriteMessagePopup::updateSubject @ 0x1002a9fbf
// > GJWriteMessagePopup::updateBody @ 0x1002aa042
// > GJWriteMessagePopup::textChanged @ 0x1002aa5a3
// > GJWriteMessagePopup::textChanged @ 0x1002aa63d
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJWriteMessagePopup::updateText(__int64 a1, const std::string *a2, int a3, double a4)
{
TextArea *m_textArea; // r15
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v5; // al
const char *data; // r12
size_t v7; // rax
size_t v8; // r13
char *v9; // rbx
size_t v10; // r14
__int128 v11; // [rsp+0h] [rbp-80h] BYREF
void *v12; // [rsp+10h] [rbp-70h]
_QWORD __dst[2]; // [rsp+18h] [rbp-68h] BYREF
void *__p; // [rsp+28h] [rbp-58h]
std::string v15; // [rsp+30h] [rbp-50h] BYREF
GJWriteMessagePopup *v16; // [rsp+48h] [rbp-38h]
int v17; // [rsp+54h] [rbp-2Ch]
*(_WORD *)&v15.__r_.__value_.__l.0 = 0;
v17 = a3;
v16 = (GJWriteMessagePopup *)a1;
if ( a3 )
{
std::string::operator=((std::string *)(a1 + 696), a2);
m_textArea = v16->m_messageInput->m_textArea;
std::string::assign(&v15, "Message");
}
else
{
std::string::operator=((std::string *)(a1 + 720), a2);
m_textArea = v16->m_subjectInput->m_textArea;
std::string::assign(&v15, "Subject");
}
v5 = a2->__r_.__value_.__s.0;
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
if ( a2->__r_.__value_.__l.__size_ )
{
LABEL_6:
if ( v17 == 1 )
{
*(_QWORD *)&a4 = 1065353216;
((void (__fastcall *)(TextArea *, float))m_textArea->setScale)(m_textArea, 1.0);
m_textArea->m_width = 290.0;
v5 = a2->__r_.__value_.__s.0;
}
if ( (*(_BYTE *)&v5 & 1) != 0 )
data = a2->__r_.__value_.__l.__data_;
else
data = a2->__r_.__value_.__s.__data_;
v7 = strlen(data);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst[0] = v10 | 1;
__dst[1] = v8;
}
else
{
LOBYTE(__dst[0]) = 2 * v7;
v9 = (char *)__dst + 1;
if ( !v7 )
goto LABEL_22;
}
memmove(v9, data, v8);
LABEL_22:
v9[v8] = 0;
TextArea::setString(m_textArea, __dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
TextArea::colorAllCharactersTo(m_textArea, (cocos2d::ccColor3B)-1);
goto LABEL_30;
}
}
else if ( *(unsigned __int8 *)&v5 >> 1 )
{
goto LABEL_6;
}
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v11, v15.__r_.__value_.__l.__data_, v15.__r_.__value_.__l.__size_, a4);
}
else
{
v12 = v15.__r_.__value_.__l.__data_;
v11 = *(_OWORD *)&v15.__r_.__value_.__l.0;
}
TextArea::setString(m_textArea, &v11);
if ( (v11 & 1) != 0 )
operator delete(v12);
TextArea::colorAllCharactersTo(m_textArea, (cocos2d::ccColor3B)-3618616);
if ( v17 == 1 )
{
((void (__fastcall *)(TextArea *, float))m_textArea->setScale)(m_textArea, 1.0);
m_textArea->m_width = 290.0;
}
LABEL_30:
GJWriteMessagePopup::updateCharCountLabel(v16, v17);
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v15.__r_.__value_.__l.__data_);
}