//
// InfoLayer::onComment from 0x1007b0760 to 0x1007b0b4b (1003 bytes)
//
// 2 xrefs:
// > InfoLayer::FLAlert_Clicked @ 0x1007b20c5
// > InfoLayer::init @ 0x1007af1a6
//
// 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 InfoLayer::onComment(InfoLayer *a1, cocos2d::CCObject *a2)
{
GJAccountManager *v2; // rax
GameManager *v3; // rax
GameLevelManager *v4; // r14
GameLevelManager *v5; // rax
GJUserScore *m_score; // rcx
int m_userID; // esi
_DWORD *v8; // r14
void *v9; // rdi
GameManager *v10; // rax
GJLevelList *m_levelList; // rcx
GJGameLevel *m_level; // rcx
const char *PostCommentKey; // rax
int TimeLeft; // eax
char *v15; // rax
const char *CString; // r14
size_t v17; // rax
size_t v18; // rbx
char *v19; // r15
GJUserScore *v20; // rax
unsigned int v21; // ecx
size_t v22; // r12
GJLevelList *v23; // rax
GJGameLevel *v24; // rax
GJGameLevel *v25; // rax
__int128 v26; // [rsp+8h] [rbp-98h] BYREF
void *v27; // [rsp+18h] [rbp-88h]
_QWORD v28[2]; // [rsp+20h] [rbp-80h] BYREF
void *__p; // [rsp+30h] [rbp-70h]
_QWORD v30[2]; // [rsp+38h] [rbp-68h] BYREF
void *v31; // [rsp+48h] [rbp-58h]
__int128 v32; // [rsp+50h] [rbp-50h] BYREF
void *v33; // [rsp+60h] [rbp-40h]
_QWORD __dst[2]; // [rsp+68h] [rbp-38h] BYREF
char *v35; // [rsp+78h] [rbp-28h]
v2 = GJAccountManager::sharedState();
if ( v2->m_accountID <= v2->m_unkInt1 )
{
__p = operator new(0x78u);
v28[0] = 121;
v28[1] = 113;
strcpy(
(char *)__p,
"You need an account to post comments. You can create one for free from settings in the main menu.");
v8 = FLAlertLayer::create_1(0, (int)"Account Needed", (__int64)v28, (int)"Close", 0, COERCE_DOUBLE(1136525312));
if ( (v28[0] & 1) != 0 )
{
v9 = __p;
LABEL_7:
operator delete(v9);
}
}
else
{
v3 = GameManager::sharedState();
if ( GameManager::getGameVariable(v3, "0012") )
{
v4 = GameLevelManager::sharedState();
v5 = GameLevelManager::sharedState();
m_score = a1->m_score;
if ( m_score )
{
m_userID = m_score->m_userID;
}
else
{
m_levelList = a1->m_levelList;
if ( m_levelList )
{
m_userID = -m_levelList->m_listID;
}
else
{
m_level = a1->m_level;
if ( m_level )
m_userID = m_level->m_levelID.random - m_level->m_levelID.seed;
else
m_userID = 0;
}
}
PostCommentKey = GameLevelManager::getPostCommentKey(v5, m_userID);
TimeLeft = GameLevelManager::getTimeLeft(v4, PostCommentKey, 15.0);
if ( (unsigned int)(TimeLeft - 1) <= 0xE )
{
v15 = sub_1007AB580("Please wait %i seconds before posting a new comment!", TimeLeft);
CString = cocos2d::CCString::getCString((cocos2d::CCString *)v15);
v17 = strlen(CString);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(COERCE_DOUBLE(1097859072));
v18 = v17;
if ( v17 >= 0x17 )
{
v22 = 26;
if ( (v17 | 7) != 0x17 )
v22 = (v17 | 7) + 1;
v19 = (char *)operator new(v22);
v35 = v19;
__dst[0] = v22 + 1;
__dst[1] = v18;
}
else
{
LOBYTE(__dst[0]) = 2 * v17;
v19 = (char *)__dst + 1;
if ( !v17 )
goto LABEL_27;
}
memmove(v19, CString, v18);
LABEL_27:
v19[v18] = 0;
v8 = FLAlertLayer::create_1(0, (int)"Too fast", (__int64)__dst, (int)"OK", 0, COERCE_DOUBLE(1133903872));
if ( (__dst[0] & 1) == 0 )
goto LABEL_38;
v9 = v35;
goto LABEL_7;
}
LOBYTE(v32) = 22;
strcpy((char *)&v32 + 1, "Add Comment");
v20 = a1->m_score;
if ( v20 )
{
v21 = v20->m_userID;
}
else
{
v23 = a1->m_levelList;
if ( v23 )
{
v21 = -v23->m_listID;
}
else
{
v24 = a1->m_level;
if ( v24 )
v21 = v24->m_levelID.random - v24->m_levelID.seed;
else
v21 = 0;
}
}
LOWORD(v26) = 0;
v8 = ShareCommentLayer::create(&v32, 0x64u, 0, v21, &v26);
if ( (v26 & 1) != 0 )
{
operator delete(v27);
if ( (v32 & 1) == 0 )
{
LABEL_36:
v25 = a1->m_level;
if ( !v25 )
goto LABEL_38;
LABEL_37:
v8[189] = v25->m_orbCompletion.random - v25->m_orbCompletion.seed;
goto LABEL_38;
}
}
else if ( (v32 & 1) == 0 )
{
goto LABEL_36;
}
operator delete(v33);
v25 = a1->m_level;
if ( !v25 )
goto LABEL_38;
goto LABEL_37;
}
v10 = GameManager::sharedState();
GameManager::setGameVariable(v10, "0012", 1);
v31 = operator new(0x108u);
v30[0] = 265;
v30[1] = 259;
strcpy(
(char *)v31,
"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.");
v8 = FLAlertLayer::create_1(
(int)a1 + 648,
(int)"Comment Rules",
(__int64)v30,
(int)"Next",
0,
COERCE_DOUBLE(1136525312));
if ( (v30[0] & 1) != 0 )
operator delete(v31);
(*(void (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)v8 + 72LL))(v8, 3);
}
LABEL_38:
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v8 + 1288LL))(v8);
}