//
// GJWriteMessagePopup::onSend from 0x1002a9c40 to 0x1002a9f33 (755 bytes)
//
// 1 xrefs:
// > GJWriteMessagePopup::init @ 0x1002a9151
//
// 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::onSend(GJWriteMessagePopup *a1, cocos2d::CCObject *a2)
{
__int128 v2; // xmm0
unsigned int sizex2; // eax
unsigned int v4; // eax
std::string *p_m_messageText; // r12
GameLevelManager *v6; // r14
unsigned int m_messageID; // r15d
char *v8; // rax
char *v9; // rdi
char *v10; // rbx
__int128 v11; // [rsp+8h] [rbp-A8h] BYREF
_QWORD v12[2]; // [rsp+20h] [rbp-90h] BYREF
char *v13; // [rsp+30h] [rbp-80h]
_QWORD v14[2]; // [rsp+38h] [rbp-78h] BYREF
void *__p; // [rsp+48h] [rbp-68h]
__int128 v16; // [rsp+50h] [rbp-60h] BYREF
void *v17; // [rsp+60h] [rbp-50h]
__int128 v18; // [rsp+70h] [rbp-40h] BYREF
void *longStorage; // [rsp+80h] [rbp-30h]
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_messageInput->onClickTrackNode)(a1->m_messageInput, 0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_subjectInput->onClickTrackNode)(a1->m_subjectInput, 0);
sizex2 = a1->m_subjectText.m_data.m_short.sizex2;
if ( (sizex2 & 1) == 0 )
{
if ( sizex2 >> 1 )
goto LABEL_3;
LABEL_9:
v13 = (char *)operator new(0x38u);
v12[0] = 57;
v12[1] = 48;
strcpy(v13, "You must enter a subject for the message");
v8 = (char *)FLAlertLayer::create(0, "No subject", v12, "Ok", 0, 0, 380.0, 0.0, 1.0);
if ( (v12[0] & 1) == 0 )
goto LABEL_22;
v9 = v13;
LABEL_14:
v10 = v8;
operator delete(v9);
v8 = v10;
goto LABEL_22;
}
if ( !a1->m_subjectText.m_data.m_long.size )
goto LABEL_9;
LABEL_3:
v4 = a1->m_messageText.m_data.m_short.sizex2;
if ( (v4 & 1) == 0 )
{
if ( v4 >> 1 )
goto LABEL_5;
goto LABEL_12;
}
if ( !a1->m_messageText.m_data.m_long.size )
{
LABEL_12:
__p = operator new(0x30u);
v14[0] = 49;
v14[1] = 40;
strcpy((char *)__p, "You can't send an empty message.");
v8 = (char *)FLAlertLayer::create(0, "No message", v14, "Ok", 0, 0, 380.0, 0.0, 1.0);
if ( (v14[0] & 1) == 0 )
goto LABEL_22;
v9 = (char *)__p;
goto LABEL_14;
}
LABEL_5:
p_m_messageText = &a1->m_messageText;
GameLevelManager::sharedState()->m_uploadMessageDelegate = &a1->UploadMessageDelegate;
v6 = GameLevelManager::sharedState();
m_messageID = a1->m_messageID;
if ( (a1->m_subjectText.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v16,
a1->m_subjectText.m_data.m_long.longStorage,
a1->m_subjectText.m_data.m_long.size,
*(double *)&v2);
if ( (p_m_messageText->m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_7;
LABEL_16:
longStorage = a1->m_messageText.m_data.m_long.longStorage;
v18 = *(_OWORD *)&p_m_messageText->m_data.m_short.sizex2;
goto LABEL_17;
}
v17 = a1->m_subjectText.m_data.m_long.longStorage;
v2 = *(_OWORD *)&a1->m_subjectText.m_data.m_short.sizex2;
v16 = v2;
if ( (p_m_messageText->m_data.m_short.sizex2 & 1) == 0 )
goto LABEL_16;
LABEL_7:
sub_100006B70(&v18, a1->m_messageText.m_data.m_long.longStorage, a1->m_messageText.m_data.m_long.size, *(double *)&v2);
LABEL_17:
GameLevelManager::uploadUserMessage(v6, m_messageID, &v16, &v18);
if ( (v18 & 1) != 0 )
operator delete(longStorage);
if ( (v16 & 1) != 0 )
operator delete(v17);
LOBYTE(v11) = 20;
strcpy((char *)&v11 + 1, "Sending...");
v8 = UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, &v11);
a1->m_uploadPopup = (UploadActionPopup *)v8;
LABEL_22:
(*(void (__fastcall **)(char *))(*(_QWORD *)v8 + 1288LL))(v8);
}