//
// GJWriteMessagePopup::onSend from 0x1002963d0 to 0x1002966c3 (755 bytes)
//
// 1 xrefs:
// > GJWriteMessagePopup::init @ 0x1002958d1
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:27:51 +0000
//
__int64 __fastcall GJWriteMessagePopup::onSend(__int64 a1, double a2)
{
unsigned int v2; // eax
unsigned int v3; // eax
_BYTE *v4; // r12
__int64 v5; // r14
unsigned int v6; // r15d
char *v7; // rax
char *v8; // rdi
char *v9; // 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 *v19; // [rsp+80h] [rbp-30h]
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 704) + 1160LL))(*(_QWORD *)(a1 + 704), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 712) + 1160LL))(*(_QWORD *)(a1 + 712), 0);
v2 = *(unsigned __int8 *)(a1 + 744);
if ( (v2 & 1) == 0 )
{
if ( v2 >> 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");
v7 = (char *)FLAlertLayer::create(0, "No subject", v12, "Ok", 0, 0, 380.0, 0.0, 1.0);
if ( (v12[0] & 1) == 0 )
return (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v7 + 1312LL))(v7);
v8 = v13;
LABEL_14:
v9 = v7;
operator delete(v8);
v7 = v9;
return (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v7 + 1312LL))(v7);
}
if ( !*(_QWORD *)(a1 + 752) )
goto LABEL_9;
LABEL_3:
v3 = *(unsigned __int8 *)(a1 + 720);
if ( (v3 & 1) == 0 )
{
if ( v3 >> 1 )
goto LABEL_5;
goto LABEL_12;
}
if ( !*(_QWORD *)(a1 + 728) )
{
LABEL_12:
__p = operator new(0x30u);
v14[0] = 49;
v14[1] = 40;
strcpy((char *)__p, "You can't send an empty message.");
v7 = (char *)FLAlertLayer::create(0, "No message", v14, "Ok", 0, 0, 380.0, 0.0, 1.0);
if ( (v14[0] & 1) == 0 )
return (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v7 + 1312LL))(v7);
v8 = (char *)__p;
goto LABEL_14;
}
LABEL_5:
v4 = (_BYTE *)(a1 + 720);
*(_QWORD *)(GameLevelManager::sharedState(a2) + 1400) = a1 + 664;
v5 = GameLevelManager::sharedState(a2);
v6 = *(_DWORD *)(a1 + 692);
if ( (*(_BYTE *)(a1 + 744) & 1) != 0 )
{
sub_10001AD30(&v16, *(const void **)(a1 + 760), *(_QWORD *)(a1 + 752));
if ( (*v4 & 1) != 0 )
goto LABEL_7;
LABEL_16:
v19 = *(void **)(a1 + 736);
v18 = *(_OWORD *)v4;
goto LABEL_17;
}
v17 = *(void **)(a1 + 760);
v16 = *(_OWORD *)(a1 + 744);
if ( (*v4 & 1) == 0 )
goto LABEL_16;
LABEL_7:
sub_10001AD30(&v18, *(const void **)(a1 + 736), *(_QWORD *)(a1 + 728));
LABEL_17:
GameLevelManager::uploadUserMessage(v5, v6, &v16, &v18);
if ( (v18 & 1) != 0 )
operator delete(v19);
if ( (v16 & 1) != 0 )
operator delete(v17);
LOBYTE(v11) = 20;
strcpy((char *)&v11 + 1, "Sending...");
v7 = UploadActionPopup::create(a1 + 672, &v11);
*(_QWORD *)(a1 + 784) = v7;
return (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v7 + 1312LL))(v7);
}