//
// GJWriteMessagePopup::closeMessagePopup from 0x8cf294 to 0x8cf4d4 (576 bytes)
//
// 3 xrefs:
// > GJWriteMessagePopup::onClose @ 0x8cf4d8
// > GJWriteMessagePopup::onClosePopup @ 0x8cf53c
// > ??> @ 0xc1800
//
// 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::closeMessagePopup(GJWriteMessagePopup *a1, bool a2)
{
_BOOL4 v3; // w21
GJUserMessage *v4; // x0
GJUserMessage *v5; // x22
void *v6; // x0
void *v7; // x0
GameLevelManager *v8; // x0
GameLevelManager *v9; // x0
GJUserMessage *StoredUserMessage; // x0
GJMessagePopup *v11; // x0
GJMessagePopup_vtbl *v12; // x2
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
__int64 v17; // [xsp+60h] [xbp+60h] BYREF
v3 = a2;
a1->m_messageInput->onClickTrackNode(a1->m_messageInput, 0);
a1->m_subjectInput->onClickTrackNode(a1->m_subjectInput, 0);
if ( !v3 && a1->m_accountID )
{
v4 = *((GJUserMessage **)a1->m_messageText.m_data.m_data - 3);
if ( v4 )
{
v5 = GJUserMessage::create(v4);
sub_D18D28(&v17);
sub_D18EA8(&v5->m_content, &v17);
v6 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v17 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v6);
}
sub_D18D28(&v17);
sub_D18EA8(&v5->m_title, &v17);
v7 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v17 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v7);
}
v8 = GameLevelManager::sharedState();
GameLevelManager::storeUserMessageReply(v8, a1->m_accountID, v5);
}
v9 = GameLevelManager::sharedState();
StoredUserMessage = GameLevelManager::getStoredUserMessage(v9, a1->m_accountID);
if ( StoredUserMessage )
{
v11 = GJMessagePopup::create(StoredUserMessage);
v12 = v11->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v11->m_noElasticity = 1;
((void (*)(void))v12->show)();
}
}
a1->setKeypadEnabled(a1, 0);
a1->removeFromParentAndCleanup(a1, 1);
}