//
// RateStarsLayer::onRate from 0x1403cab00 to 0x1403cace1 (481 bytes)
//
// 2 xrefs:
// > RateStarsLayer::init @ 0x1403ca7c0
// > ??> @ 0x1406d7ad8
//
// 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
//
// Hidden C++ exception states: #wind=3
void RateStarsLayer::onRate(RateStarsLayer *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // rcx
char v4; // al
__int64 v5; // rax
UploadActionPopup *m_popup; // rax
UploadActionPopup *v7; // rax
_BOOL8 v8; // rdx
RateLevelDelegate *m_delegate; // rcx
GameLevelManager *v10; // rcx
__int128 v11; // [rsp+20h] [rbp-28h] BYREF
__int64 v12; // [rsp+30h] [rbp-18h]
__int64 v13; // [rsp+38h] [rbp-10h]
void *v14; // [rsp+50h] [rbp+8h]
void *v15; // [rsp+50h] [rbp+8h]
void *v16; // [rsp+50h] [rbp+8h]
if ( a1->m_starsRate != -1 )
{
if ( a1->m_moderator )
{
v3 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v14 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v3 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::suggestLevelStars(v3, a1->m_levelID, a1->m_starsRate, a1->m_featureState);
if ( v4 )
{
v5 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v15 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v5 = qword_1406C2EC0;
}
*(_QWORD *)(v5 + 808) = &a1->UploadActionDelegate;
m_popup = a1->m_popup;
if ( m_popup )
m_popup->m_delegate = nullptr;
v11 = 0;
*(_QWORD *)&v11 = sub_14003AA10(0x20u);
v12 = 17;
v13 = 31;
strcpy((char *)v11, "Sending rating...");
v7 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, (__int64)&v11);
a1->m_popup = v7;
v7->show(v7);
}
}
else
{
a1->setKeypadEnabled(a1, 0);
LOBYTE(v8) = 1;
a1->removeFromParentAndCleanup(a1, v8);
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->rateLevelClosed(m_delegate);
v10 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v16 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v10 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::rateStars(v10, a1->m_levelID, a1->m_starsRate);
}
}
}