//
// LevelLeaderboard::getSpriteButton from 0x140429620 to 0x14042986f (591 bytes)
//
// 4 xrefs:
// > LevelLeaderboard::init @ 0x140428963
// > LevelLeaderboard::init @ 0x140428a39
// > LevelLeaderboard::init @ 0x140428bf5
// > ??> @ 0x140926a38
//
// 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:12 +0000
//
// Hidden C++ exception states: #wind=3
cocos2d::CCObject *__fastcall LevelLeaderboard::getSpriteButton(
int a1,
const char *a2,
__int64 a3,
__int64 a4,
int a5,
const struct cocos2d::CCPoint *a6,
int a7)
{
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
const char *v14; // rcx
struct cocos2d::CCSprite *v15; // rbp
void **v16; // rsi
__int64 *v17; // rax
__int64 v18; // r9
cocos2d::CCObject *v19; // rbx
__int64 v20; // rax
cocos2d::CCObject *v21; // rbx
void *v22; // rcx
__int64 v24; // [rsp+30h] [rbp-B8h]
__int64 v25[2]; // [rsp+50h] [rbp-98h] BYREF
void *Block[2]; // [rsp+60h] [rbp-88h] BYREF
__int64 v27; // [rsp+70h] [rbp-78h]
unsigned __int64 v28; // [rsp+78h] [rbp-70h]
v25[1] = (__int64)a2;
v11 = cocos2d::CCString::createWithFormat("GJ_button_%02d.png", a7);
CString = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
v27 = 0;
v28 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003D230(Block, CString, v13);
v14 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v14 = *(const char **)a2;
v15 = cocos2d::CCSprite::createWithSpriteFrameName(v14);
v16 = Block;
if ( v28 > 0xF )
v16 = (void **)Block[0];
v25[0] = (__int64)operator new(0x2C8u);
v17 = (__int64 *)ButtonSprite::ButtonSprite(v25[0]);
v19 = (cocos2d::CCObject *)v17;
if ( v17 )
{
if ( ButtonSprite::init(v17, (__int64)v15, 32, v18, 32.0, 1065353216, v24, (const char *)v16, 0, 0) )
{
cocos2d::CCObject::autorelease(v19);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v19 + 8LL))(v19, 1);
v19 = nullptr;
}
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v25, a6);
cocos2d::CCPoint::operator=((char *)v19 + 672, v20);
ButtonSprite::updateSpriteBGSize((__int64 *)v19);
v21 = CCMenuItemSpriteExtra::create((int)v19, 0, a1, a3);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v21 + 160LL))(v21);
*((_DWORD *)v21 + 101) = a5;
if ( a4 )
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)a4 + 464LL))(a4, v21);
if ( v28 > 0xF )
{
v22 = Block[0];
if ( v28 + 1 >= 0x1000 )
{
v22 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
v27 = 0;
v28 = 15;
LOBYTE(Block[0]) = 0;
sub_14003D310((__int64)a2);
return v21;
}