//
// GJWriteMessagePopup::updateText from 0x14029a990 to 0x14029ad19 (905 bytes)
//
// 3 xrefs:
// > GJWriteMessagePopup::updateSubject @ 0x14029a8f7
// > GJWriteMessagePopup::updateBody @ 0x14029a95a
// > ??> @ 0x1406d1d3c
//
// 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
//
// Hidden C++ exception states: #wind=2
void __fastcall GJWriteMessagePopup::updateText(__int64 a1, void **a2, int a3)
{
void **v3; // rsi
void **v5; // rcx
TextArea *v6; // rdi
unsigned __int8 v7; // al
void **v8; // rcx
__int64 v9; // rdx
int v10; // eax
int v11; // r13d
int v12; // r15d
__int64 v13; // rdi
__int64 v14; // rax
__int64 v15; // rcx
__int16 *v16; // rdx
_BYTE *v17; // rdx
size_t v18; // r8
__int64 v19; // rbx
void (__fastcall **v20)(__int64, const char *); // rdi
cocos2d::CCString *v21; // rax
const char *CString; // rax
cocos2d::ccColor3B v23[5]; // [rsp+20h] [rbp-49h] BYREF
int v24; // [rsp+30h] [rbp-39h]
__int128 v25; // [rsp+38h] [rbp-31h] BYREF
__int64 v26; // [rsp+48h] [rbp-21h]
__int64 v27; // [rsp+50h] [rbp-19h]
void **v28; // [rsp+60h] [rbp-9h]
void *Src[2]; // [rsp+68h] [rbp-1h] BYREF
__int64 v30; // [rsp+78h] [rbp+Fh]
__int64 v31; // [rsp+80h] [rbp+17h]
v24 = a3;
v3 = a2;
v28 = a2;
*(_OWORD *)Src = 0;
v30 = 0;
v31 = 15;
LOBYTE(Src[0]) = 0;
if ( a3 )
{
v8 = (void **)(a1 + 696);
if ( v8 != a2 )
{
if ( (unsigned __int64)a2[3] > 0xF )
a2 = (void **)*a2;
sub_14003CCE0(v8, a2, (size_t)v3[2]);
a3 = v24;
}
v6 = *(TextArea **)(*(_QWORD *)(a1 + 680) + 592LL);
qmemcpy(Src, "Messag", 6);
v7 = aMessage[6];
}
else
{
v5 = (void **)(a1 + 728);
if ( v5 != a2 )
{
if ( (unsigned __int64)a2[3] > 0xF )
a2 = (void **)*a2;
sub_14003CCE0(v5, a2, (size_t)v3[2]);
a3 = v24;
}
v6 = *(TextArea **)(*(_QWORD *)(a1 + 688) + 592LL);
qmemcpy(Src, "Subjec", 6);
v7 = aSubject[6];
}
HIWORD(Src[0]) = v7;
v30 = 7;
if ( v3[2] )
{
if ( a3 == 1 )
{
((void (__fastcall *)(TextArea *))v6->setScale_0)(v6);
v6->m_width = 290.0;
}
v17 = v3;
if ( (unsigned __int64)v3[3] > 0xF )
v17 = *v3;
v25 = 0;
v26 = 0;
v27 = 0;
v18 = -1;
do
++v18;
while ( v17[v18] );
sub_14003A930(&v25, v17, v18);
TextArea::setString(v6, (__int64)&v25);
*(_WORD *)&v23[0].r = -1;
v23[0].b = -1;
TextArea::colorAllCharactersTo(v6, v23);
v10 = v24;
}
else
{
v27 = 15;
v26 = 7;
v25 = *(_OWORD *)Src;
TextArea::setString(v6, (__int64)&v25);
*(_WORD *)&v23[0].r = -14136;
v23[0].b = -56;
TextArea::colorAllCharactersTo(v6, v23);
v10 = v24;
if ( v24 == 1 )
{
((void (__fastcall *)(TextArea *))v6->setScale_0)(v6);
v6->m_width = 290.0;
LABEL_15:
v11 = *(_DWORD *)(a1 + 712);
v12 = 200;
v13 = *(_QWORD *)(a1 + 760);
goto LABEL_16;
}
}
if ( v10 )
goto LABEL_15;
v11 = *(_DWORD *)(a1 + 744);
v12 = 35;
v13 = *(_QWORD *)(a1 + 768);
LABEL_16:
v14 = *(_QWORD *)(v13 + 368);
v15 = v13 + 368;
if ( (float)((float)v12 * 0.69999999) <= (float)v11 )
{
LOBYTE(v9) = -1;
(*(void (__fastcall **)(__int64, __int64))(v14 + 40))(v15, v9);
if ( (float)((float)v12 * 0.89999998) <= (float)v11 )
v16 = &word_140529AD8;
else
v16 = &word_140529AE4;
}
else
{
LOBYTE(v9) = 100;
(*(void (__fastcall **)(__int64, __int64))(v14 + 40))(v15, v9);
v16 = &word_140529AE4;
}
(**(void (__fastcall ***)(__int64, __int16 *))(v13 + 368))(v13 + 368, v16);
v19 = v13 + 360;
v20 = *(void (__fastcall ***)(__int64, const char *))(v13 + 360);
v21 = cocos2d::CCString::createWithFormat("%i", v12 - v11);
CString = cocos2d::CCString::getCString(v21);
(*v20)(v19, CString);
sub_14003A830((__int64)v3);
}