//
// GJRateLevelLayer::onCustomButton from 0x100506800 to 0x1005069b0 (432 bytes)
//
// 1 xrefs:
// > ??> @ 0x10095a1f0
//
// 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 GJRateLevelLayer::onCustomButton(GJRateLevelLayer *a1, cocos2d::CCObject *a2)
{
int v2; // eax
UploadActionPopup *v3; // r14
int v4; // r14d
GameLevelManager *v5; // rax
UploadActionPopup *m_uploadPopup; // rax
_QWORD v7[2]; // [rsp+8h] [rbp-48h] BYREF
void *__p; // [rsp+18h] [rbp-38h]
__int128 v9[3]; // [rsp+20h] [rbp-30h] BYREF
v2 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
if ( v2 != -4 )
{
if ( v2 != -2 )
return;
__p = operator new(0x28u);
v7[0] = 41;
v7[1] = 33;
strcpy((char *)__p, "Do you want to unrate this level?");
v3 = (UploadActionPopup *)FLAlertLayer::create_1(
(int)a1 + 968,
(int)"Unrate Level",
(__int64)v7,
(int)"Cancel",
(int)"Unrate",
COERCE_DOUBLE(1136525312));
if ( (v7[0] & 1) != 0 )
operator delete(__p);
ButtonSprite::updateBGImage(v3->m_button2, "GJ_button_06.png");
((void (__fastcall *)(UploadActionPopup *, __int64))v3->setTag)(v3, 4294967293LL);
goto LABEL_6;
}
v4 = (int)((float (__fastcall *)(GJRateLevelLayer *, __int64))a1->getValue)(a1, 0xFFFFFFFFLL);
if ( v4 > 0 && a1->m_featureState > 0 )
{
v5 = GameLevelManager::sharedState();
if ( GameLevelManager::updateLevelRankAdmin(v5, a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed, v4) )
{
GameLevelManager::sharedState()->m_uploadActionDelegate = &a1->UploadActionDelegate;
m_uploadPopup = a1->m_uploadPopup;
if ( m_uploadPopup )
m_uploadPopup->m_delegate = nullptr;
strcpy((char *)v9, " Updating rank...");
v3 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, v9);
a1->m_uploadPopup = v3;
if ( (v9[0] & 1) != 0 )
{
operator delete(*(void **)&v9[1]);
v3 = a1->m_uploadPopup;
}
LABEL_6:
((void (__fastcall *)(UploadActionPopup *))v3->show)(v3);
}
}
}