//
// LevelLeaderboard::getSpriteButton from 0x140301ca0 to 0x140301e73 (467 bytes)
//
// 4 xrefs:
// > LevelLeaderboard::init @ 0x140301005
// > LevelLeaderboard::init @ 0x1403010dd
// > LevelLeaderboard::init @ 0x140301294
// > ??> @ 0x1406d437c
//
// 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=2
CCMenuItemSpriteExtra *__fastcall LevelLeaderboard::getSpriteButton(
cocos2d::CCObject *a1,
const char *a2,
cocos2d::SEL_MenuHandler *a3,
__int64 a4,
int a5,
__int64 a6,
int a7)
{
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
const char *v14; // rcx
cocos2d::CCSprite *v15; // rax
int v16; // r8d
void **v17; // rcx
ButtonSprite *v18; // rbx
__int64 v19; // rax
CCMenuItemSpriteExtra *v20; // rbx
void *v21; // rcx
bool v23; // [rsp+28h] [rbp-A0h]
cocos2d::CCPoint v24[2]; // [rsp+40h] [rbp-88h] BYREF
void *Block[2]; // [rsp+50h] [rbp-78h] BYREF
__m128i si128; // [rsp+60h] [rbp-68h]
v24[1] = (cocos2d::CCPoint)a2;
v11 = cocos2d::CCString::createWithFormat("GJ_button_%02d.png", a7);
CString = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
si128 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003A930(Block, CString, v13);
v14 = a2;
if ( *((_QWORD *)a2 + 3) > 0xFu )
v14 = *(const char **)a2;
v15 = cocos2d::CCSprite::createWithSpriteFrameName(v14);
v17 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v17 = (void **)Block[0];
v18 = ButtonSprite::create(v15, 32, v16, 32.0, 1.0, v23, (const char *)v17, 0);
cocos2d::CCPoint::CCPoint(v24);
cocos2d::CCPoint::operator=(&v18->m_spritePosition, v19);
ButtonSprite::updateSpriteBGSize(v18);
v20 = CCMenuItemSpriteExtra::create(v18, nullptr, a1, a3);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v20->setScale_0)(v20);
HIDWORD(v20->m_pDisabledImage) = a5;
if ( a4 )
(*(void (__fastcall **)(__int64, CCMenuItemSpriteExtra *))(*(_QWORD *)a4 + 448LL))(a4, v20);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v21 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v21);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
sub_14003A830((__int64)a2);
return v20;
}