//
// InfoLayer::onComment from 0x7e1f50 to 0x7e23e0 (1168 bytes)
//
// 4 xrefs:
// > InfoLayer::FLAlert_Clicked @ 0x7e245c
// > ??> @ 0x73578
// > InfoLayer::init @ 0x7e4e58
// > ??> @ 0x122bd18
//
// 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 InfoLayer::onComment(InfoLayer *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v3; // x0
GameManager *v4; // x0
GameManager *v5; // x0
FLAlertLayer *v6; // x20
void *v7; // x0
GameLevelManager *v8; // x20
GameLevelManager *v9; // x22
int ID; // w0
const char *PostCommentKey; // x0
unsigned int TimeLeft; // w0
CommentType v13; // w22
_DWORD *v14; // x22
void *v15; // x0
void *v16; // x0
GJGameLevel *m_level; // x0
FLAlertLayer *v18; // x0
__int64 v19; // x2
FLAlertLayer *v20; // x20
void *v21; // x0
cocos2d::CCString *v22; // x0
char *CString; // x0
FLAlertLayer *v24; // x0
unsigned int *v25; // x2
int v26; // w1
unsigned int *v27; // x2
int v28; // w1
unsigned int *v29; // x2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
__int64 v34; // [xsp+58h] [xbp+58h] BYREF
__int64 v35; // [xsp+60h] [xbp+60h] BYREF
std::string v36; // 0:x5.8
v3 = GJAccountManager::sharedState();
if ( v3->m_accountID - v3->m_unkInt1 <= 0 )
{
sub_D153B8(
(int)&v35,
"You need an account to post comments. You can create one for free from settings in the main menu.");
v18 = FLAlertLayer::create(0, (__int64)"Account Needed", (__int64)&v35);
v19 = v35;
v20 = v18;
v21 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v35 - 8);
do
v26 = __ldaxr(v29);
while ( __stlxr(v26 - 1, v29) );
LABEL_18:
if ( v26 <= 0 )
operator delete(v21);
goto LABEL_13;
}
LABEL_39:
v26 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v26 - 1;
goto LABEL_18;
}
LABEL_13:
v20->show(v20);
return;
}
v4 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v4, "0012") )
{
v5 = GameManager::sharedState();
GameManager::setGameVariable(v5, "0012", 1);
sub_D153B8(
(int)&v35,
"1. Do not spam.\n"
"2. Do not harass other players.\n"
"3. Do not post inappropriate or controversial content.\n"
"4. Do not try to bypass these rules.\n"
"These rules and their enforcement are entirely at Elder Moderators' discretion.");
v6 = FLAlertLayer::create((int)a1 + 648, (__int64)"Comment Rules", (__int64)&v35);
v7 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v35 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v7);
}
v6->setTag(v6, 3);
v6->show(v6);
return;
}
v8 = GameLevelManager::sharedState();
v9 = GameLevelManager::sharedState();
ID = InfoLayer::getID(a1);
PostCommentKey = GameLevelManager::getPostCommentKey(v9, ID);
TimeLeft = GameLevelManager::getTimeLeft(v8, PostCommentKey, 15.0);
if ( TimeLeft - 1 <= 0xE )
{
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Please wait %i seconds before posting a new comment!",
(const char *)TimeLeft);
CString = (char *)cocos2d::CCString::getCString(v22);
sub_D153B8((int)&v35, CString);
v24 = FLAlertLayer::create(0, (__int64)"Too fast", (__int64)&v35);
v19 = v35;
v20 = v24;
v21 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v35 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
goto LABEL_18;
}
goto LABEL_39;
}
goto LABEL_13;
}
sub_D153B8((int)&v34, "Add Comment");
v13 = InfoLayer::getID(a1);
sub_D153B8((int)&v35, &byte_F288A0);
v14 = (_DWORD *)ShareCommentLayer::create((ShareCommentLayer *)&v34, (std::string)100LL, 0, v13, (int)&v35, v36);
v15 = (void *)(v35 - 24);
if ( (__int64 *)(v35 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v35 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(v35 - 8);
*(_DWORD *)(v35 - 8) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v15);
}
v16 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)(v34 - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *(_DWORD *)(v34 - 8);
*(_DWORD *)(v34 - 8) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v16);
}
m_level = a1->m_level;
if ( m_level )
v14[181] = m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed;
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v14 + 1288LL))(v14);
}