//
// ShareCommentLayer::onShare from 0x7e6340 to 0x7e6828 (1256 bytes)
//
// 3 xrefs:
// > ??> @ 0x6f300
// > ShareCommentLayer::init @ 0x7e6d5c
// > ??> @ 0x122ba78
//
// 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 ShareCommentLayer::onShare(ShareCommentLayer *a1, cocos2d::CCObject *a2)
{
CommentType m_commentType; // w0
_DWORD *v4; // x23
unsigned __int64 v5; // x25
stl::StringData::Internal *m_data; // x0
unsigned __int64 v7; // x22
size_t v8; // x2
int v9; // w21
__int64 v10; // x22
__int64 *v11; // x0
CommentType v12; // w0
GameLevelManager *v13; // x21
ShareCommentDelegate *m_delegate; // x21
void (__fastcall *shareCommentClosed)(ShareCommentDelegate *__hidden, std::string, ShareCommentLayer *); // x23
long double v16; // q0
_DWORD *v17; // x2
char *v18; // x0
GameLevelManager *v19; // x22
unsigned int v20; // w21
int v21; // w21
char *v22; // x0
UploadActionPopup *m_uploadPopup; // x0
char *v24; // x21
GJMultiplayerManager *v25; // x22
unsigned int *v26; // x2
int v27; // w1
GameLevelManager *v28; // x23
unsigned int m_itemID; // w21
int m_percent; // w3
char *v31; // x21
unsigned int *v32; // x23
int v33; // w0
unsigned int *v34; // x23
int v35; // w1
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x2
unsigned int *v39; // x23
int v40; // w0
void *v41; // [xsp+70h] [xbp+70h] BYREF
std::string v42; // 0:x2.8
m_commentType = a1->m_commentType;
if ( m_commentType != FriendRequest )
{
if ( m_commentType == Multiplayer )
{
v25 = GJMultiplayerManager::sharedState();
sub_D18D28(&v41);
GJMultiplayerManager::uploadComment(v25, (std::string)&v41, a1->m_itemID);
v17 = v41;
v18 = (char *)v41 - 24;
if ( (char *)v41 - 24 == (char *)&qword_124B6B0 )
goto LABEL_17;
if ( &pthread_create )
{
v26 = (unsigned int *)((char *)v41 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
LABEL_31:
if ( v27 <= 0 )
{
LABEL_32:
operator delete(v18);
goto LABEL_17;
}
goto LABEL_17;
}
}
else
{
if ( (unsigned int)(m_commentType - 4) > 1 )
{
sub_D153B8((int)&v41, &byte_F288A0);
v4 = v41;
v5 = *((_QWORD *)v41 - 3);
m_data = a1->m_descText.m_data.m_data;
v7 = *((_QWORD *)m_data - 3);
if ( v5 > v7 )
v8 = *((_QWORD *)m_data - 3);
else
v8 = *((_QWORD *)v41 - 3);
v9 = memcmp(m_data, v41, v8);
if ( v9 || (v9 = 0x7FFFFFFF, v10 = v7 - v5, v10 > 0x7FFFFFFF) )
{
v11 = (__int64 *)(v4 - 6);
if ( v4 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_10;
}
else
{
v11 = (__int64 *)(v4 - 6);
if ( v10 >= (__int64)0xFFFFFFFF80000000LL )
v9 = v10;
else
v9 = 0x80000000;
if ( v11 == &qword_124B6B0 )
{
LABEL_10:
if ( v9 )
{
LABEL_11:
v12 = a1->m_commentType;
if ( v12 )
{
if ( v12 == Account )
{
v13 = GameLevelManager::sharedState();
sub_D18D28(&v41);
GameLevelManager::uploadAccountComment(v13);
if ( (char *)v41 - 24 != (char *)&qword_124B6B0 )
sub_7E5F10((char *)v41 - 24);
}
goto LABEL_17;
}
v28 = GameLevelManager::sharedState();
m_itemID = a1->m_itemID;
sub_D18D28(&v41);
m_percent = 0;
if ( a1->m_percentEnabled )
m_percent = a1->m_percent;
GameLevelManager::uploadLevelComment(v28, m_itemID, (__int64)&v41, m_percent);
v31 = (char *)v41 - 24;
if ( (char *)v41 - 24 == (char *)&qword_124B6B0 )
goto LABEL_17;
if ( &pthread_create )
{
v32 = (unsigned int *)((char *)v41 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v33 - 1;
}
if ( v33 > 0 )
goto LABEL_17;
v18 = v31;
goto LABEL_32;
}
LABEL_17:
ShareCommentLayer::onClose(a1, nullptr);
return;
}
}
if ( &pthread_create )
{
v34 = v4 - 2;
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *(v4 - 2);
*(v4 - 2) = v35 - 1;
}
if ( v35 <= 0 )
{
operator delete(v11);
if ( !v9 )
goto LABEL_17;
goto LABEL_11;
}
goto LABEL_10;
}
m_delegate = a1->m_delegate;
if ( !m_delegate )
goto LABEL_17;
shareCommentClosed = m_delegate->shareCommentClosed;
*(__n128 *)&v16 = sub_D18D28(&v41);
((void (__fastcall *)(ShareCommentDelegate *, void **, ShareCommentLayer *, long double))shareCommentClosed)(
m_delegate,
&v41,
a1,
v16);
v17 = v41;
v18 = (char *)v41 - 24;
if ( (char *)v41 - 24 == (char *)&qword_124B6B0 )
goto LABEL_17;
if ( &pthread_create )
{
v38 = (unsigned int *)((char *)v41 - 8);
do
v27 = __ldaxr(v38);
while ( __stlxr(v27 - 1, v38) );
goto LABEL_31;
}
}
v27 = *(v17 - 2);
*(v17 - 2) = v27 - 1;
goto LABEL_31;
}
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v19 = GameLevelManager::sharedState();
v20 = a1->m_itemID;
sub_D18D28(&v41);
v21 = (unsigned __int8)GameLevelManager::uploadFriendRequest(v19, v20, (__int64 *)&v41);
v22 = (char *)v41 - 24;
if ( (char *)v41 - 24 == (char *)&qword_124B6B0 )
goto LABEL_24;
if ( &pthread_create )
{
v36 = (unsigned int *)((char *)v41 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v37 - 1;
}
if ( v37 > 0 )
{
LABEL_24:
if ( !v21 )
goto LABEL_17;
}
else
{
operator delete(v22);
if ( !v21 )
goto LABEL_17;
}
sub_D153B8((int)&v41, "Sending...");
m_uploadPopup = (UploadActionPopup *)UploadActionPopup::create(
(UploadActionPopup *)&a1->UploadPopupDelegate,
(UploadPopupDelegate *)&v41,
v42);
a1->m_uploadPopup = m_uploadPopup;
v24 = (char *)v41 - 24;
if ( (char *)v41 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)((char *)v41 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v41 - 2);
*((_DWORD *)v41 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v24);
m_uploadPopup = a1->m_uploadPopup;
}
m_uploadPopup->show(m_uploadPopup);
}