//
// GJMessagePopup::onReply from 0x1002db0f8 to 0x1002db2f4 (508 bytes)
//
// 1 xrefs:
// > GJMessagePopup::loadFromGJMessage @ 0x1002daeac
//
// 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)
{
GameLevelManager *v3; // x0
GJUserMessage *v4; // x20
GJUserMessage *m_message; // x8
char v6; // w21
std::string *p_dst; // x22
signed __int64 size; // x8
char *v9; // x23
std::string *v10; // x0
char *v11; // x0
std::string *v12; // x1
std::string::size_type v13; // x2
GameLevelManager *v14; // x0
GJWriteMessagePopup *v15; // x0
std::string __p; // [xsp+0h] [xbp-80h] BYREF
std::string __str; // [xsp+18h] [xbp-68h] BYREF
std::string __dst; // [xsp+30h] [xbp-50h] BYREF
v3 = GameLevelManager::sharedState();
if ( !GameLevelManager::getStoredUserMessageReply(v3, a1->m_message->m_messageID) )
{
v4 = GJUserMessage::create_1();
m_message = a1->m_message;
if ( m_message->m_title.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&__dst, (void *)m_message->m_title.m_data.m_long.capacitym1, m_message->m_title.m_data.m_long.size);
else
__dst = (std::string)m_message->m_title;
v6 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
else
size = __dst.__r_.__value_.__l.__size_;
if ( size >= 4 )
{
v9 = (char *)p_dst + size;
v10 = p_dst;
do
{
v11 = (char *)memchr(v10, 82, size - 3);
if ( !v11 )
break;
if ( *(_DWORD *)v11 == 540697938 )
{
if ( v11 != v9 && v11 - (char *)p_dst != -1 )
goto LABEL_28;
break;
}
v10 = (std::string *)(v11 + 1);
size = v9 - (char *)v10;
}
while ( v9 - (char *)v10 >= 4 );
}
sub_100009900(&__str, "Re: ");
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v12 = &__dst;
else
v12 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
else
v13 = __dst.__r_.__value_.__l.__size_;
std::string::append(&__str, (const std::string::value_type *)v12, v13);
std::string::operator=(&__dst, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v6 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
LABEL_28:
if ( v6 < 0 )
sub_1000097D0(&__p, __dst.__r_.__value_.__l.__data_, __dst.__r_.__value_.__l.__size_);
else
__p = __dst;
std::string::operator=((std::string *)&v4->m_title, &__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v14 = GameLevelManager::sharedState();
GameLevelManager::storeUserMessageReply(v14, a1->m_message->m_messageID, v4);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}
v15 = GJWriteMessagePopup::create(a1->m_message->m_accountID, a1->m_message->m_messageID);
v15->m_noElasticity = 1;
((void (__fastcall *)(GJWriteMessagePopup *))v15->show)(v15);
((void (__fastcall *)(GJMessagePopup *, _QWORD))a1->setKeypadEnabled)(a1, 0);
((void (__fastcall *)(GJMessagePopup *, __int64))a1->removeFromParentAndCleanup)(a1, 1);
}