//
// GJRateLevelLayer::onCustomButton from 0x140419fd0 to 0x14041a25c (652 bytes)
//
// 2 xrefs:
// > ??> @ 0x14078bab8
// > ??> @ 0x140926618
//
// This function is hookable on this platform (idp: pc, 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 11:32:06 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall GJRateLevelLayer::onCustomButton(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v4; // ebx
__int64 v5; // rax
__int64 *v6; // rbx
__int64 v7; // rax
__int64 v8; // rcx
cocos2d::CCObject *v9; // rax
__int128 v10; // [rsp+50h] [rbp-48h] BYREF
__int64 v11; // [rsp+60h] [rbp-38h]
__int64 v12; // [rsp+68h] [rbp-30h]
_BYTE v13[40]; // [rsp+70h] [rbp-28h] BYREF
void *v14; // [rsp+A8h] [rbp+10h]
void *v15; // [rsp+A8h] [rbp+10h]
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
if ( (_DWORD)result == -4 )
{
result = (unsigned int)(int)(*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 0xFFFFFFFFLL);
if ( (int)result > 0 && *(int *)(a1 + 1096) > 0 )
{
v7 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v14 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v14);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v7 = *(_QWORD *)&qword_14090BFB0;
}
if ( !v7 )
{
v15 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v15);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v7 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v7 + 1488) = a1 + 1008;
v8 = *(_QWORD *)(a1 + 1080);
if ( v8 )
*(_QWORD *)(v8 + 664) = 0;
v10 = 0;
*(_QWORD *)&v10 = sub_14003D460(0x20u);
v11 = 16;
v12 = 31;
strcpy((char *)v10, "Updating rank...");
v9 = UploadActionPopup::create(a1 + 1000, (__int64)&v10);
*(_QWORD *)(a1 + 1080) = v9;
return (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v9 + 1064LL))(v9);
}
}
else if ( (_DWORD)result == -2 )
{
v4 = a1 + 1024;
if ( !a1 )
v4 = 0;
v10 = 0;
*(_QWORD *)&v10 = sub_14003D460(0x30u);
v11 = 33;
v12 = 47;
strcpy((char *)v10, "Do you want to unrate this level?");
v5 = sub_14003F4F0((__int64)v13, (__int64)&v10);
v6 = (__int64 *)FLAlertLayer::create(
v4,
(int)"Unrate Level",
v5,
(__int64)"Cancel",
(__int64)"Unrate",
1136525312,
0,
0,
1065353216);
sub_14003D310((__int64)&v10);
ButtonSprite::updateBGImage(v6[77], "GJ_button_06.png");
(*(void (__fastcall **)(__int64 *, __int64))(*v6 + 64))(v6, 4294967293LL);
return (*(__int64 (__fastcall **)(__int64 *))(*v6 + 1064))(v6);
}
return result;
}