//
// GJRateLevelLayer::onRate from 0x820e3c to 0x820fa8 (364 bytes)
//
// 3 xrefs:
// > ??> @ 0xc03a8
// > GJRateLevelLayer::init @ 0x823244
// > ??> @ 0x122ead0
//
// 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 GJRateLevelLayer::onRate(GJRateLevelLayer *a1, cocos2d::CCObject *a2)
{
GameLevelManager *v3; // x0
char v4; // w0
UploadActionPopup *m_uploadPopup; // x0
UploadActionPopup *v6; // x0
UploadPopupDelegate_vtbl *v7; // x3
unsigned int *v8; // x2
int onClosePopup; // w0
UploadPopupDelegate v10; // [xsp+40h] [xbp+40h] BYREF
std::string v11; // 0:x2.8
if ( a1->m_stars != -1 )
{
v3 = GameLevelManager::sharedState();
GameLevelManager::suggestLevelStars(
v3,
a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed,
a1->m_stars,
a1->m_difficultySprite->m_featureState);
if ( v4 )
{
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
m_uploadPopup = a1->m_uploadPopup;
if ( m_uploadPopup )
m_uploadPopup->m_delegate = nullptr;
sub_D153B8((int)&v10, "Sending rating...");
v6 = (UploadActionPopup *)UploadActionPopup::create((UploadActionPopup *)&a1->UploadPopupDelegate, &v10, v11);
a1->m_uploadPopup = v6;
v7 = v10.__vftable - 3;
if ( (__int64 *)&v10.__vftable[-3] != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)&v10.__vftable[-1];
do
onClosePopup = __ldaxr(v8);
while ( __stlxr(onClosePopup - 1, v8) );
}
else
{
onClosePopup = (int)v10.__vftable[-1].onClosePopup;
LODWORD(v10.__vftable[-1].onClosePopup) = onClosePopup - 1;
}
if ( onClosePopup <= 0 )
operator delete(v7);
v6 = a1->m_uploadPopup;
}
v6->show(v6);
}
}
}