//
// RateDemonLayer::onRate from 0x1403c92a0 to 0x1403c9436 (406 bytes)
//
// 2 xrefs:
// > RateDemonLayer::init @ 0x1403c9024
// > ??> @ 0x1406d79dc
//
// 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=2
void RateDemonLayer::onRate(RateDemonLayer *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // rcx
__int64 v4; // rax
UploadActionPopup *m_popup; // rax
UploadActionPopup *v6; // rax
_BOOL8 v7; // rdx
RateLevelDelegate *m_delegate; // rcx
__int128 v9; // [rsp+20h] [rbp-28h] BYREF
__int64 v10; // [rsp+30h] [rbp-18h]
__int64 v11; // [rsp+38h] [rbp-10h]
void *v12; // [rsp+50h] [rbp+8h]
void *v13; // [rsp+50h] [rbp+8h]
if ( a1->m_demonRate != -1 )
{
v3 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v12 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v3 = (GameLevelManager *)qword_1406C2EC0;
}
if ( GameLevelManager::rateDemon(v3, a1->m_levelID, a1->m_demonRate, a1->m_moderator) )
{
if ( !a1->m_moderator )
{
LABEL_12:
a1->setKeypadEnabled(a1, 0);
LOBYTE(v7) = 1;
a1->removeFromParentAndCleanup(a1, v7);
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->rateLevelClosed(m_delegate);
return;
}
v4 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v13 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = qword_1406C2EC0;
}
*(_QWORD *)(v4 + 808) = &a1->UploadActionDelegate;
m_popup = a1->m_popup;
if ( m_popup )
m_popup->m_delegate = nullptr;
v9 = 0;
*(_QWORD *)&v9 = sub_14003AA10(0x20u);
v10 = 17;
v11 = 31;
strcpy((char *)v9, "Sending rating...");
v6 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, (__int64)&v9);
a1->m_popup = v6;
v6->show(v6);
}
if ( a1->m_moderator )
return;
goto LABEL_12;
}
}