//
// GJRateLevelLayer::onCustomButton from 0x1402f54d0 to 0x1402f5744 (628 bytes)
//
// 2 xrefs:
// > ??> @ 0x140586b48
// > ??> @ 0x1406d3fe0
//
// 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 GJRateLevelLayer::onCustomButton(GJRateLevelLayer *a1, cocos2d::CCObject *a2)
{
int v3; // eax
int v4; // ebx
__int64 v5; // rax
FLAlertLayer *v6; // rbx
void (__fastcall **v7)(UploadActionPopup *); // rdx
UploadActionPopup *v8; // rcx
__int64 v9; // rax
UploadActionPopup *m_uploadPopup; // rcx
UploadActionPopup *v11; // rax
__int128 v12; // [rsp+50h] [rbp-48h] BYREF
__int64 v13; // [rsp+60h] [rbp-38h]
__int64 v14; // [rsp+68h] [rbp-30h]
char v15[40]; // [rsp+70h] [rbp-28h] BYREF
void *v16; // [rsp+A8h] [rbp+10h]
void *v17; // [rsp+A8h] [rbp+10h]
v3 = a2->getTag(a2);
if ( v3 != -4 )
{
if ( v3 != -2 )
return;
v4 = (_DWORD)a1 + 960;
if ( !a1 )
v4 = 0;
v12 = 0;
*(_QWORD *)&v12 = sub_14003AA10(0x30u);
v13 = 33;
v14 = 47;
strcpy((char *)v12, "Do you want to unrate this level?");
v5 = sub_14003BDB0((__int64)v15, (__int64)&v12);
v6 = FLAlertLayer::create(
v4,
(int)"Unrate Level",
v5,
(__int64)"Cancel",
(__int64)"Unrate",
1136525312,
0,
0,
1065353216);
sub_14003A830((__int64)&v12);
ButtonSprite::updateBGImage(v6->m_button2, "GJ_button_06.png");
v6->setTag(v6, -3);
v7 = (void (__fastcall **)(UploadActionPopup *))v6->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v8 = (UploadActionPopup *)v6;
goto LABEL_15;
}
if ( (int)a1->getValue(a1, -1) > 0 && a1->m_featureState > 0 )
{
v9 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v16 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v9 = qword_1406C2EC0;
}
if ( !v9 )
{
v17 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v9 = qword_1406C2EC0;
}
*(_QWORD *)(v9 + 808) = &a1->UploadActionDelegate;
m_uploadPopup = a1->m_uploadPopup;
if ( m_uploadPopup )
m_uploadPopup->m_delegate = nullptr;
v12 = 0;
*(_QWORD *)&v12 = sub_14003AA10(0x20u);
v13 = 16;
v14 = 31;
strcpy((char *)v12, "Updating rank...");
v11 = (UploadActionPopup *)UploadActionPopup::create((__int64)&a1->UploadPopupDelegate, (__int64)&v12);
a1->m_uploadPopup = v11;
v7 = (void (__fastcall **)(UploadActionPopup *))v11->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v8 = v11;
LABEL_15:
v7[130](v8);
}
}