//
// ShareCommentLayer::onShare from 0x1001d5570 to 0x1001d5880 (784 bytes)
//
// 1 xrefs:
// > ShareCommentLayer::init @ 0x1001d4dd8
//
// 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 ShareCommentLayer::onShare(ShareCommentLayer *a1, cocos2d::CCObject *a2)
{
CommentType m_commentType; // w8
GameLevelManager *v4; // x20
int v5; // w21
ShareCommentDelegate *m_delegate; // x20
GJMultiplayerManager *v7; // x20
std::string *p_m_descText; // x20
bool v9; // w0
bool v10; // w21
void **p_dst; // x8
_BOOL4 v12; // w0
_BOOL4 v13; // w20
CommentType v14; // w8
GameLevelManager *v15; // x21
__int64 m_itemID; // x22
UploadActionPopup *m_uploadPopup; // x0
GameLevelManager *v18; // x21
__int64 v19; // x3
__int128 v20; // [xsp+0h] [xbp-E0h] BYREF
char *v21; // [xsp+10h] [xbp-D0h]
__int128 v22; // [xsp+20h] [xbp-C0h] BYREF
char *v23; // [xsp+30h] [xbp-B0h]
void *__p[2]; // [xsp+38h] [xbp-A8h] BYREF
char v25; // [xsp+4Fh] [xbp-91h]
std::string __dst; // [xsp+50h] [xbp-90h] BYREF
__int128 v27; // [xsp+70h] [xbp-70h] BYREF
char *longStorage; // [xsp+80h] [xbp-60h]
void *v29[2]; // [xsp+88h] [xbp-58h] BYREF
char v30; // [xsp+9Fh] [xbp-41h]
__int128 v31; // [xsp+A0h] [xbp-40h] BYREF
char *v32; // [xsp+B0h] [xbp-30h]
m_commentType = a1->m_commentType;
if ( (unsigned int)(m_commentType - 4) < 2 )
{
m_delegate = a1->m_delegate;
if ( !m_delegate )
goto LABEL_25;
if ( a1->m_descText.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&__dst, (void *)a1->m_descText.m_data.m_long.capacitym1, a1->m_descText.m_data.m_long.size);
else
__dst = a1->m_descText;
((void (__fastcall *)(ShareCommentDelegate *, std::string *, ShareCommentLayer *))m_delegate->shareCommentClosed)(
m_delegate,
&__dst,
a1);
if ( (__dst.m_data.m_short.shortStorage.__elems_[22] & 0x80000000) == 0 )
goto LABEL_25;
p_dst = (void **)&__dst;
goto LABEL_24;
}
if ( m_commentType == Multiplayer )
{
v7 = GJMultiplayerManager::sharedState();
if ( a1->m_descText.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&v27, (void *)a1->m_descText.m_data.m_long.capacitym1, a1->m_descText.m_data.m_long.size);
}
else
{
v27 = *(_OWORD *)&a1->m_descText.m_data.m_short.sizex2;
longStorage = a1->m_descText.m_data.m_long.longStorage;
}
GJMultiplayerManager::uploadComment(v7, (__int64)&v27, (unsigned int)a1->m_itemID);
if ( (SHIBYTE(longStorage) & 0x80000000) == 0 )
goto LABEL_25;
p_dst = (void **)&v27;
goto LABEL_24;
}
if ( m_commentType != FriendRequest )
{
p_m_descText = &a1->m_descText;
sub_100009900(__p, "");
v9 = sub_1000045BC(&a1->m_descText.m_data.m_long.capacitym1, __p);
v10 = v9;
if ( v25 < 0 )
{
operator delete(__p[0]);
if ( v10 )
goto LABEL_25;
}
else if ( v9 )
{
goto LABEL_25;
}
v14 = a1->m_commentType;
if ( v14 == Account )
{
v18 = GameLevelManager::sharedState();
if ( a1->m_descText.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&v20, (void *)a1->m_descText.m_data.m_long.capacitym1, a1->m_descText.m_data.m_long.size);
}
else
{
v20 = *(_OWORD *)&p_m_descText->m_data.m_short.sizex2;
v21 = a1->m_descText.m_data.m_long.longStorage;
}
GameLevelManager::uploadAccountComment(v18, (__int64)&v20);
if ( (SHIBYTE(v21) & 0x80000000) == 0 )
goto LABEL_25;
p_dst = (void **)&v20;
}
else
{
if ( v14 )
goto LABEL_25;
v15 = GameLevelManager::sharedState();
m_itemID = (unsigned int)a1->m_itemID;
if ( a1->m_descText.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&v22, (void *)a1->m_descText.m_data.m_long.capacitym1, a1->m_descText.m_data.m_long.size);
}
else
{
v22 = *(_OWORD *)&p_m_descText->m_data.m_short.sizex2;
v23 = a1->m_descText.m_data.m_long.longStorage;
}
v19 = a1->m_percentEnabled ? (unsigned int)a1->m_percent : 0LL;
GameLevelManager::uploadLevelComment((__int64)v15, m_itemID, (__int64)&v22, v19);
if ( (SHIBYTE(v23) & 0x80000000) == 0 )
goto LABEL_25;
p_dst = (void **)&v22;
}
LABEL_24:
operator delete(*p_dst);
goto LABEL_25;
}
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
v4 = GameLevelManager::sharedState();
v5 = a1->m_itemID;
if ( a1->m_descText.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(&v31, (void *)a1->m_descText.m_data.m_long.capacitym1, a1->m_descText.m_data.m_long.size);
}
else
{
v31 = *(_OWORD *)&a1->m_descText.m_data.m_short.sizex2;
v32 = a1->m_descText.m_data.m_long.longStorage;
}
v12 = GameLevelManager::uploadFriendRequest(v4, v5, (void **)&v31);
v13 = v12;
if ( (SHIBYTE(v32) & 0x80000000) == 0 )
{
if ( v12 )
goto LABEL_33;
LABEL_25:
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_commentInput->onClickTrackNode)(a1->m_commentInput, 0);
((void (__fastcall *)(ShareCommentLayer *, _QWORD))a1->setKeypadEnabled)(a1, 0);
((void (__fastcall *)(ShareCommentLayer *, __int64))a1->removeFromParentAndCleanup)(a1, 1);
return;
}
operator delete((void *)v31);
if ( !v13 )
goto LABEL_25;
LABEL_33:
sub_100009900(v29, "Sending...");
m_uploadPopup = (UploadActionPopup *)UploadActionPopup::create(&a1->UploadPopupDelegate, v29);
a1->m_uploadPopup = m_uploadPopup;
if ( v30 < 0 )
{
operator delete(v29[0]);
m_uploadPopup = a1->m_uploadPopup;
}
((void (__fastcall *)(UploadActionPopup *))m_uploadPopup->show)(m_uploadPopup);
}