//
// RateStarsLayer::onRate from 0x8246bc to 0x82483c (384 bytes)
//
// 3 xrefs:
// > ??> @ 0x74028
// > RateStarsLayer::init @ 0x824f28
// > ??> @ 0x122bda8
//
// 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 RateStarsLayer::onRate(RateStarsLayer *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
char v4; // w0
GameLevelManager *v5; // x0
UploadActionPopup *m_popup; // x0
UploadActionPopup *v7; // x0
UploadPopupDelegate_vtbl *v8; // x3
unsigned int *v9; // x2
int onClosePopup; // w0
UploadPopupDelegate v11; // [xsp+40h] [xbp+40h] BYREF
std::string v12; // 0:x2.8
if ( a1->m_starsRate != -1 )
{
if ( a1->m_moderator )
{
v3 = GameLevelManager::sharedState();
GameLevelManager::suggestLevelStars(v3, a1->m_levelID, a1->m_starsRate, a1->m_featureState);
if ( v4 )
{
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
m_popup = a1->m_popup;
if ( m_popup )
m_popup->m_delegate = nullptr;
sub_D153B8((int)&v11, "Sending rating...");
v7 = (UploadActionPopup *)UploadActionPopup::create((UploadActionPopup *)&a1->UploadPopupDelegate, &v11, v12);
a1->m_popup = v7;
v8 = v11.__vftable - 3;
if ( (__int64 *)&v11.__vftable[-3] != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)&v11.__vftable[-1];
do
onClosePopup = __ldaxr(v9);
while ( __stlxr(onClosePopup - 1, v9) );
}
else
{
onClosePopup = (int)v11.__vftable[-1].onClosePopup;
LODWORD(v11.__vftable[-1].onClosePopup) = onClosePopup - 1;
}
if ( onClosePopup <= 0 )
operator delete(v8);
v7 = a1->m_popup;
}
v7->show(v7);
}
}
else
{
RateStarsLayer::onClose(a1, nullptr);
v5 = GameLevelManager::sharedState();
GameLevelManager::rateStars(v5, a1->m_levelID, a1->m_starsRate);
}
}
}