//
// ShareCommentLayer::onShare from 0x14048e270 to 0x14048e60b (923 bytes)
//
// 2 xrefs:
// > ShareCommentLayer::init @ 0x14048dab4
// > ??> @ 0x1406dbf90
//
// 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
//
// Hidden C++ exception states: #wind=7
void ShareCommentLayer::onShare(ShareCommentLayer *a1, cocos2d::CCObject *a2)
{
CommentType m_commentType; // ebx
UploadActionDelegate *v4; // rbx
__int64 v5; // rax
const char *v6; // rbx
GameLevelManager *v7; // rcx
UploadActionPopup *v8; // rax
const char *v9; // rbx
GJMultiplayerManager *v10; // rax
int m_percent; // r14d
std::string *p_m_descText; // rsi
std::string *m_bigStorage; // rcx
std::size_t m_size; // r15
size_t v15; // r8
__int64 v16; // r15
GameLevelManager *v17; // rsi
int m_itemID; // ebx
const char *v19; // rax
__int64 v20; // rsi
GameLevelManager *v21; // rbx
const char *v22; // rax
std::string *v23; // rax
_BOOL8 v24; // rdx
void *v25; // [rsp+30h] [rbp-19h]
void *v26; // [rsp+38h] [rbp-11h]
void *v27; // [rsp+40h] [rbp-9h]
void *v28; // [rsp+40h] [rbp-9h]
_BYTE v29[32]; // [rsp+48h] [rbp-1h] BYREF
__int128 Buf2; // [rsp+68h] [rbp+1Fh] BYREF
__int64 v31; // [rsp+78h] [rbp+2Fh]
__int64 v32; // [rsp+80h] [rbp+37h]
m_commentType = a1->m_commentType;
if ( m_commentType == FriendRequest )
{
v4 = &a1->UploadActionDelegate;
v5 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v27 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v5 = qword_1406C2EC0;
}
*(_QWORD *)(v5 + 808) = v4;
v6 = (const char *)sub_14003BDB0((__int64)v29, (__int64)&a1->m_descText);
v7 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v25 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v7 = (GameLevelManager *)qword_1406C2EC0;
}
if ( GameLevelManager::uploadFriendRequest(v7, a1->m_itemID, v6) )
{
*((_QWORD *)&Buf2 + 1) = 11822;
v31 = 10;
v32 = 15;
*(_QWORD *)&Buf2 = 0x2E676E69646E6553LL;
v8 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, (__int64)&Buf2);
a1->m_uploadPopup = v8;
v8->show(v8);
return;
}
}
else if ( m_commentType == Multiplayer )
{
v9 = (const char *)sub_14003BDB0((__int64)v29, (__int64)&a1->m_descText);
v10 = GJMultiplayerManager::sharedState();
GJMultiplayerManager::uploadComment(v10, v9, a1->m_itemID);
}
else if ( (unsigned int)(m_commentType - 4) <= 1 )
{
if ( a1->m_delegate )
{
v23 = (std::string *)sub_14003BDB0((__int64)v29, (__int64)&a1->m_descText);
a1->m_delegate->shareCommentClosed(a1->m_delegate, v23, a1);
}
}
else
{
Buf2 = 0;
m_percent = 0;
v31 = 0;
v32 = 15;
LOBYTE(Buf2) = 0;
p_m_descText = &a1->m_descText;
m_bigStorage = p_m_descText;
if ( p_m_descText->m_data.m_capacity > 0xF )
m_bigStorage = (std::string *)p_m_descText->m_data.m_bigStorage;
m_size = p_m_descText->m_data.m_size;
v15 = m_size;
if ( m_size )
v15 = 0;
if ( memcmp(m_bigStorage, &Buf2, v15) || m_size )
{
if ( m_commentType )
{
if ( m_commentType == Account )
{
v20 = sub_14003BDB0((__int64)v29, (__int64)p_m_descText);
v21 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v28 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v21 = (GameLevelManager *)qword_1406C2EC0;
}
v22 = (const char *)sub_14003BDB0((__int64)&Buf2, v20);
GameLevelManager::uploadComment(v21, v22, 1, 0, 0);
sub_14003A830(v20);
}
}
else
{
if ( a1->m_percentEnabled )
m_percent = a1->m_percent;
v16 = sub_14003BDB0((__int64)v29, (__int64)p_m_descText);
v17 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v26 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v17 = (GameLevelManager *)qword_1406C2EC0;
}
m_itemID = a1->m_itemID;
v19 = (const char *)sub_14003BDB0((__int64)&Buf2, v16);
GameLevelManager::uploadComment(v17, v19, 0, m_itemID, m_percent);
sub_14003A830(v16);
}
}
}
a1->m_commentInput->onClickTrackNode(a1->m_commentInput, 0);
a1->setKeypadEnabled(a1, 0);
LOBYTE(v24) = 1;
a1->removeFromParentAndCleanup(a1, v24);
}