//
// GJMessagePopup::onReply from 0x1002a7c90 to 0x1002a7e99 (521 bytes)
//
// 1 xrefs:
// > GJMessagePopup::loadFromGJMessage @ 0x1002a7a35
//
// 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 GJMessagePopup::onReply(GJMessagePopup *a1, cocos2d::CCObject *a2)
{
__int128 v2; // xmm0
GameLevelManager *v3; // rax
GJUserMessage *v4; // rax
GJUserMessage *m_message; // rsi
bool v6; // zf
std::string *p_m_title; // rsi
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v8; // r13
__int64 size; // r15
const std::string::value_type *data; // r12
const std::string::value_type *v11; // r14
__int64 v12; // rdx
std::string::value_type *v13; // rax
char *v14; // rax
GJUserMessage *v15; // r14
GameLevelManager *v16; // rax
GJWriteMessagePopup *v17; // rax
std::string v18; // [rsp+0h] [rbp-80h] BYREF
std::string __str; // [rsp+20h] [rbp-60h] BYREF
GJUserMessage *v20; // [rsp+38h] [rbp-48h]
std::string __n[2]; // [rsp+40h] [rbp-40h] BYREF
v3 = GameLevelManager::sharedState();
if ( !GameLevelManager::getStoredUserMessageReply(v3, a1->m_message->m_messageID) )
{
v4 = GJUserMessage::create_1();
m_message = a1->m_message;
v6 = (m_message->m_title.m_data.m_short.sizex2 & 1) == 0;
v20 = v4;
if ( v6 )
{
p_m_title = &m_message->m_title;
__n[0].__r_.__value_.__r.__words[2] = (std::string::size_type)p_m_title->m_data.m_long.longStorage;
v2 = *(_OWORD *)&p_m_title->m_data.m_short.sizex2;
*(_OWORD *)&__n[0].__r_.__value_.__l.0 = *(_OWORD *)&p_m_title->m_data.m_short.sizex2;
}
else
{
sub_100006B70(
__n,
m_message->m_title.m_data.m_long.longStorage,
m_message->m_title.m_data.m_long.size,
*(double *)&v2);
}
v8 = __n[0].__r_.__value_.__s.0;
size = *(_BYTE *)&__n[0].__r_.__value_.__l.0 >> 1;
data = __n[0].__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&__n[0].__r_.__value_.__s.0 & 1) != 0 )
{
data = __n[0].__r_.__value_.__l.__data_;
size = __n[0].__r_.__value_.__l.__size_;
}
if ( size >= 4 )
{
v11 = &data[size];
v12 = size;
v13 = (std::string::value_type *)data;
do
{
v14 = (char *)memchr(v13, 82, v12 - 3);
if ( !v14 )
break;
if ( *(_DWORD *)v14 == 540697938 )
{
if ( v14 != v11 && v14 - data != -1 )
goto LABEL_17;
break;
}
v13 = v14 + 1;
v12 = v11 - v13;
}
while ( v11 - v13 >= 4 );
}
__str.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)8;
strcpy(__str.__r_.__value_.__s.__data_, "Re: ");
std::string::append(&__str, data, size);
std::string::operator=(__n, &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v8 = __n[0].__r_.__value_.__s.0;
LABEL_17:
if ( (*(_BYTE *)&v8 & 1) != 0 )
sub_100006B70(&v18, __n[0].__r_.__value_.__l.__data_, __n[0].__r_.__value_.__l.__size_, *(double *)&v2);
else
v18 = __n[0];
v15 = v20;
std::string::operator=((std::string *)&v20->m_title, &v18);
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v18.__r_.__value_.__l.__data_);
v16 = GameLevelManager::sharedState();
GameLevelManager::storeUserMessageReply(v16, a1->m_message->m_messageID, v15);
if ( (*(_BYTE *)&__n[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__n[0].__r_.__value_.__l.__data_);
}
v17 = GJWriteMessagePopup::create(a1->m_message->m_accountID, a1->m_message->m_messageID);
v17->m_noElasticity = 1;
((void (__fastcall *)(GJWriteMessagePopup *))v17->show)(v17);
((void (__fastcall *)(GJMessagePopup *, _QWORD))a1->setKeypadEnabled)(a1, 0);
((void (__fastcall *)(GJMessagePopup *, __int64))a1->removeFromParentAndCleanup)(a1, 1);
}