//
// GJMessagePopup::onReply from 0x8d0d90 to 0x8d104c (700 bytes)
//
// 3 xrefs:
// > ??> @ 0xae120
// > GJMessagePopup::loadFromGJMessage @ 0x8cdfe8
// > ??> @ 0x122e030
//
// 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 GJMessagePopup::onReply(GJMessagePopup *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
GJWriteMessagePopup *v4; // x0
GJWriteMessagePopup_vtbl *v5; // x2
GJUserMessage *v6; // x24
void *v7; // x0
GameLevelManager *v8; // x0
void *v9; // x0
unsigned int *v10; // x1
int v11; // w2
void *v12; // x0
unsigned int *v13; // x1
int v14; // w2
unsigned int *v15; // x1
int v16; // w2
__int64 v17; // [xsp+0h] [xbp+0h] BYREF
__int64 v18; // [xsp+58h] [xbp+58h] BYREF
__int64 v19; // [xsp+60h] [xbp+60h] BYREF
v3 = GameLevelManager::sharedState();
if ( !GameLevelManager::getStoredUserMessageReply(v3, a1->m_message->m_messageID) )
{
v6 = GJUserMessage::create(nullptr);
sub_D18D28(&v18);
if ( sub_D1641C((unsigned int)&v17 + 88, "Re: ") == -1 )
{
sub_D153B8((int)&v19, "Re: ");
sub_D15E14(&v19, &v18);
sub_D18EA8(&v18, &v19);
v12 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v19 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
}
sub_D18D28(&v19);
sub_D18EA8(&v6->m_title, &v19);
v7 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v19 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v7);
}
v8 = GameLevelManager::sharedState();
GameLevelManager::storeUserMessageReply(v8, a1->m_message->m_messageID, v6);
v9 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v18 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
}
v4 = GJWriteMessagePopup::create(a1->m_message->m_accountID, a1->m_message->m_messageID);
v5 = v4->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v4->m_noElasticity = 1;
((void (*)(void))v5->show)();
GJMessagePopup::onClose(a1, nullptr);
}