//
// GJWriteMessagePopup::closeMessagePopup from 0xa342d8 to 0xa34504 (556 bytes)
//
// 3 xrefs:
// > GJWriteMessagePopup::onClose @ 0xa34508
// > GJWriteMessagePopup::onClosePopup @ 0xa3456c
// > ??> @ 0xfc100
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:59:49 +0000
//
__int64 __fastcall GJWriteMessagePopup::closeMessagePopup(GJWriteMessagePopup *this, unsigned __int8 a2)
{
int v3; // w21
__int64 v4; // x0
__int64 v5; // x1
__int64 *v6; // x23
char v7; // w0
GameLevelManager *v8; // x0
size_t v9; // x1
char *v10; // x1
size_t v11; // x2
char v12; // w0
GameLevelManager *v13; // x0
size_t v14; // x1
char *v15; // x1
size_t v16; // x2
GameLevelManager *v17; // x0
__int64 v18; // x0
cocos2d::CCDictionary **v19; // x0
GJMessagePopup *StoredUserMessage; // x0
GJUserMessage *v21; // x1
__int64 v22; // x0
__int64 v23; // x2
GameLevelManager *v25; // [xsp+40h] [xbp+40h] BYREF
size_t v26; // [xsp+48h] [xbp+48h]
void *v27; // [xsp+50h] [xbp+50h]
v3 = a2;
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 88) + 1160LL))(*((_QWORD *)this + 88), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 89) + 1160LL))(*((_QWORD *)this + 89), 0);
if ( !v3 && *((_DWORD *)this + 174) )
{
v4 = *((unsigned __int8 *)this + 720);
v5 = (unsigned __int8)v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *((_QWORD *)this + 91);
if ( v5 )
{
v6 = (__int64 *)GJUserMessage::create((GJUserMessage *)v4);
v7 = *((_BYTE *)this + 720);
v25 = nullptr;
v26 = 0;
v27 = nullptr;
if ( (v7 & 1) != 0 )
{
std::string::__init((__int64 *)&v25, *((void **)this + 92), *((_QWORD *)this + 91));
}
else
{
v8 = *((GameLevelManager **)this + 90);
v9 = *((_QWORD *)this + 91);
v27 = *((void **)this + 92);
v25 = v8;
v26 = v9;
}
if ( v6 + 44 != (__int64 *)&v25 )
{
if ( ((unsigned __int8)v25 & 1) != 0 )
{
v10 = (char *)v27;
v11 = v26;
}
else
{
v11 = (unsigned __int8)v25 >> 1;
v10 = (char *)&v25 + 1;
}
std::string::assign(v6 + 44, v10, v11);
}
if ( ((unsigned __int8)v25 & 1) != 0 )
operator delete(v27);
v12 = *((_BYTE *)this + 744);
v25 = nullptr;
v26 = 0;
v27 = nullptr;
if ( (v12 & 1) != 0 )
{
std::string::__init((__int64 *)&v25, *((void **)this + 95), *((_QWORD *)this + 94));
}
else
{
v13 = *((GameLevelManager **)this + 93);
v14 = *((_QWORD *)this + 94);
v27 = *((void **)this + 95);
v25 = v13;
v26 = v14;
}
if ( v6 + 41 != (__int64 *)&v25 )
{
if ( ((unsigned __int8)v25 & 1) != 0 )
{
v15 = (char *)v27;
v16 = v26;
}
else
{
v16 = (unsigned __int8)v25 >> 1;
v15 = (char *)&v25 + 1;
}
std::string::assign(v6 + 41, v15, v16);
}
v17 = (GameLevelManager *)(unsigned __int8)v25;
if ( ((unsigned __int8)v25 & 1) != 0 )
operator delete(v27);
v18 = GameLevelManager::sharedState(v17);
v4 = GameLevelManager::storeUserMessageReply(v18, *((_DWORD *)this + 174), (GJUserMessage *)v6);
}
v19 = (cocos2d::CCDictionary **)GameLevelManager::sharedState((GameLevelManager *)v4);
StoredUserMessage = (GJMessagePopup *)GameLevelManager::getStoredUserMessage(v19, *((_DWORD *)this + 174));
if ( StoredUserMessage )
{
v22 = GJMessagePopup::create(StoredUserMessage, v21);
v23 = *(_QWORD *)v22;
*(_BYTE *)(v22 + 596) = 1;
(*(void (**)(void))(v23 + 1312))();
}
}
(*(void (__fastcall **)(GJWriteMessagePopup *, _QWORD))(*(_QWORD *)this + 1072LL))(this, 0);
(*(void (__fastcall **)(GJWriteMessagePopup *, __int64))(*(_QWORD *)this + 528LL))(this, 1);
return _stack_chk_guard;
}