//
// GJWriteMessagePopup::onSend from 0x8cb918 to 0x8cbd58 (1088 bytes)
//
// 3 xrefs:
// > ??> @ 0x78270
// > GJWriteMessagePopup::init @ 0x8cffa8
// > ??> @ 0x122c040
//
// 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 GJWriteMessagePopup::onSend(GJWriteMessagePopup *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x25
unsigned int m_messageID; // w21
void *v5; // x0
void *v6; // x0
UploadActionPopup *m_uploadPopup; // x0
void *v8; // x2
FLAlertLayer *v9; // x0
__int64 v10; // x2
FLAlertLayer *v11; // x19
void *v12; // x0
FLAlertLayer *v13; // x0
unsigned int *v14; // x2
int v15; // w1
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w0
unsigned int *v20; // x1
int v21; // w3
unsigned int *v22; // x2
__int64 v23; // [xsp+68h] [xbp+68h] BYREF
__int64 v24; // [xsp+70h] [xbp+70h] BYREF
a1->m_messageInput->onClickTrackNode(a1->m_messageInput, 0);
a1->m_subjectInput->onClickTrackNode(a1->m_subjectInput, 0);
if ( !*((_QWORD *)a1->m_subjectText.m_data.m_data - 3) )
{
sub_D153B8((int)&v24, "You must enter a subject for the message");
v13 = FLAlertLayer::create(0, (__int64)"No subject", (__int64)&v24);
v10 = v24;
v11 = v13;
v12 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) == &qword_124B6B0 )
goto LABEL_8;
if ( &pthread_create )
{
v14 = (unsigned int *)(v24 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
LABEL_13:
if ( v15 <= 0 )
operator delete(v12);
goto LABEL_8;
}
LABEL_35:
v15 = *(_DWORD *)(v10 - 8);
*(_DWORD *)(v10 - 8) = v15 - 1;
goto LABEL_13;
}
if ( !*((_QWORD *)a1->m_messageText.m_data.m_data - 3) )
{
sub_D153B8((int)&v24, "You can't send an empty message.");
v9 = FLAlertLayer::create(0, (__int64)"No message", (__int64)&v24);
v10 = v24;
v11 = v9;
v12 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) == &qword_124B6B0 )
{
LABEL_8:
v11->show(v11);
return;
}
if ( &pthread_create )
{
v22 = (unsigned int *)(v24 - 8);
do
v15 = __ldaxr(v22);
while ( __stlxr(v15 - 1, v22) );
goto LABEL_13;
}
goto LABEL_35;
}
GameLevelManager::sharedState()->m_uploadMessageDelegate = &a1->UploadMessageDelegate;
v3 = GameLevelManager::sharedState();
m_messageID = a1->m_messageID;
sub_D18D28(&v23);
sub_D18D28(&v24);
GameLevelManager::uploadUserMessage(v3, m_messageID, &v23, (cocos2d::ZipUtils *)&v24);
v5 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v24 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v5);
}
v6 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v23 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v24, "Sending...");
m_uploadPopup = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate);
a1->m_uploadPopup = m_uploadPopup;
v8 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v24 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v8);
m_uploadPopup = a1->m_uploadPopup;
}
m_uploadPopup->show(m_uploadPopup);
}