//
// GJRateLevelLayer::onCustomButton from 0x952ea8 to 0x953090 (488 bytes)
//
// 2 xrefs:
// > ??> @ 0xdc2d0
// > ??> @ 0x146b4a0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:57:23 +0000
//
__int64 __fastcall GJRateLevelLayer::onCustomButton(GJRateLevelLayer *this, cocos2d::CCObject *a2)
{
int v3; // w0
ButtonSprite **v4; // x20
GameLevelManager *v6; // x0
GameLevelManager *v7; // x0
GameLevelManager *updated; // x0
__int64 v9; // x0
__int64 v10; // x0
char v11; // w1
__int64 v12; // [xsp+40h] [xbp+40h] BYREF
__int64 v13; // [xsp+48h] [xbp+48h]
void *v14; // [xsp+50h] [xbp+50h]
v3 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
if ( v3 == -4 )
{
if ( (int)(*(float (__fastcall **)(GJRateLevelLayer *, __int64))(*(_QWORD *)this + 1464LL))(this, 0xFFFFFFFFLL) > 0 )
{
v6 = (GameLevelManager *)*((unsigned int *)this + 278);
if ( (int)v6 > 0 )
{
v7 = (GameLevelManager *)GameLevelManager::sharedState(v6);
updated = (GameLevelManager *)(unsigned __int8)GameLevelManager::updateLevelRankAdmin(v7);
if ( (_BYTE)updated )
{
*(_QWORD *)(GameLevelManager::sharedState(updated) + 1360) = (char *)this + 1024;
v9 = *((_QWORD *)this + 137);
if ( v9 )
*(_QWORD *)(v9 + 664) = 0;
v12 = 0;
v13 = 0;
v14 = nullptr;
std::string::__init(&v12, "Updating rank...", 0x10u);
v10 = UploadActionPopup::create((char *)this + 1016, &v12);
v11 = v12;
*((_QWORD *)this + 137) = v10;
if ( (v11 & 1) != 0 )
{
operator delete(v14);
v10 = *((_QWORD *)this + 137);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 1312LL))(v10);
}
}
}
}
else if ( v3 == -2 )
{
v12 = 0;
v13 = 0;
v14 = nullptr;
std::string::__init(&v12, "Do you want to unrate this level?", 0x21u);
v4 = (ButtonSprite **)FLAlertLayer::create(
(__int64)this + 1040,
(cocos2d::CCLabelBMFont *)"Unrate Level",
(char *)&v12,
(ButtonSprite *)"Cancel",
(ButtonSprite *)"Unrate",
380.0);
if ( (v12 & 1) != 0 )
operator delete(v14);
ButtonSprite::updateBGImage(v4[77], "GJ_button_06.png");
(*((void (__fastcall **)(ButtonSprite **, __int64))*v4 + 9))(v4, 4294967293LL);
(*((void (__fastcall **)(ButtonSprite **))*v4 + 164))(v4);
}
return _stack_chk_guard;
}