//
// GJWriteMessagePopup::updateText from 0x8cf668 to 0x8cf9a8 (832 bytes)
//
// 3 xrefs:
// > GJWriteMessagePopup::updateSubject @ 0x8cf9e8
// > GJWriteMessagePopup::updateBody @ 0x8cfad8
// > ??> @ 0x449a0
//
// 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
//
__int64 __fastcall GJWriteMessagePopup::updateText(GJWriteMessagePopup *a1, char **a2, int a3)
{
TextArea *m_textArea; // x24
char *v7; // x1
char *v8; // x0
void *v9; // x0
char *v11; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
cocos2d::ccColor3B v18; // [xsp+58h] [xbp+58h]
__int64 v19; // [xsp+60h] [xbp+60h] BYREF
_DWORD *v20; // [xsp+68h] [xbp+68h] BYREF
_DWORD *v21; // [xsp+70h] [xbp+70h] BYREF
sub_D153B8((int)&v19, &byte_F288A0);
if ( a3 )
{
sub_D18EA8(&a1->m_messageText, a2);
m_textArea = a1->m_messageInput->m_textArea;
sub_D1798C(&v19, "Message", 7);
v7 = *a2;
if ( *((_QWORD *)*a2 - 3) )
goto LABEL_3;
}
else
{
sub_D18EA8(&a1->m_subjectText, a2);
m_textArea = a1->m_subjectInput->m_textArea;
sub_D1798C(&v19, "Subject", 7);
v7 = *a2;
if ( *((_QWORD *)*a2 - 3) )
{
LABEL_3:
if ( a3 == 1 )
{
m_textArea->setScale(m_textArea, 1.0);
v7 = *a2;
m_textArea->m_width = 290.0;
}
sub_D153B8((int)&v21, v7);
TextArea::setString((__int64)m_textArea, (const void **)&v21);
v8 = (char *)(v21 - 6);
if ( v21 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = v21 - 2;
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(v21 - 2);
*(v21 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v8);
}
TextArea::colorAllCharactersTo(m_textArea, (cocos2d::ccColor3B)&unk_FFFFFF);
goto LABEL_7;
}
}
sub_D18D28(&v20);
TextArea::setString((__int64)m_textArea, (const void **)&v20);
v11 = (char *)(v20 - 6);
if ( v20 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = v20 - 2;
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(v20 - 2);
*(v20 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v11);
}
*(_WORD *)&v18.r = -14136;
v18.b = -56;
TextArea::colorAllCharactersTo(m_textArea, v18);
if ( a3 == 1 )
{
m_textArea->setScale(m_textArea, 1.0);
m_textArea->m_width = 290.0;
}
LABEL_7:
GJWriteMessagePopup::updateCharCountLabel(a1, a3);
v9 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v19 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v9);
}
return _stack_chk_guard;
}