//
// LevelSearchLayer::toggleStar from 0x140311c60 to 0x140311e8a (554 bytes)
//
// 4 xrefs:
// > LevelSearchLayer::clearFilters @ 0x14030e8aa
// > LevelSearchLayer::init @ 0x14030da89
// > ??> @ 0x1406d482c
// > ??> @ 0x1406d4838
//
// 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 LevelSearchLayer::toggleStar(LevelSearchLayer *a1, cocos2d::CCObject *a2)
{
__int64 v3; // rcx
cocos2d::CCString *v4; // rax
bool v5; // di
void *v6; // rcx
cocos2d::CCRGBAProtocol *v7; // rcx
bool v8; // di
__int64 v9; // rbx
struct cocos2d::CCString *v10; // rax
void *v11; // rcx
_WORD v12[4]; // [rsp+20h] [rbp-40h] BYREF
void *v13; // [rsp+28h] [rbp-38h]
void *Block[2]; // [rsp+30h] [rbp-30h] BYREF
__int64 v15; // [rsp+40h] [rbp-20h]
unsigned __int64 v16; // [rsp+48h] [rbp-18h]
v3 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v13 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v3 = qword_1406C2EC0;
}
v15 = 11;
v16 = 15;
Block[0] = (void *)0x6C69665F72617473LL;
Block[1] = (void *)7497076;
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v3 + 344), Block);
v5 = cocos2d::CCString::boolValue(v4);
if ( v16 > 0xF )
{
v6 = Block[0];
if ( v16 + 1 >= 0x1000 )
{
v6 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v6 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v6);
}
v7 = &a1->m_starsSprite->cocos2d::CCRGBAProtocol;
v8 = !v5;
if ( v8 )
{
v12[0] = -1;
LOBYTE(v12[1]) = -1;
}
else
{
memset(v12, 125, 3);
}
v7->setColor(v7, (const cocos2d::ccColor3B *)v12);
v9 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v13 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v9 = qword_1406C2EC0;
}
v15 = 11;
v16 = 15;
Block[0] = (void *)0x6C69665F72617473LL;
Block[1] = (void *)7497076;
v10 = cocos2d::CCString::createWithFormat("%i", v8);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v9 + 344), v10, Block);
if ( v16 > 0xF )
{
v11 = Block[0];
if ( v16 + 1 >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v11);
}
}