//
// LevelSearchLayer::toggleDifficulty from 0x100053ec4 to 0x100054130 (620 bytes)
//
// 1 xrefs:
// > LevelSearchLayer::init @ 0x1000527b4
//
// 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
//
void __fastcall LevelSearchLayer::toggleDifficulty(LevelSearchLayer *a1, cocos2d::CCObject *a2)
{
__int64 v3; // x20
_BOOL4 v4; // w22
int i; // w21
bool v6; // w21
cocos2d::CCDictionary *m_difficultyDict; // x23
__int64 v8; // x24
cocos2d::CCString *v9; // x0
char *CString; // x0
__int64 v11; // x0
GameLevelManager *v12; // x0
cocos2d::CCDictionary *v13; // x20
cocos2d::CCString *v14; // x0
char *v15; // x0
cocos2d::CCString *v16; // x0
_BOOL8 v17; // x20
int k; // w22
int j; // w22
int m; // w22
void *__p[2]; // [xsp+8h] [xbp-48h] BYREF
char v22; // [xsp+1Fh] [xbp-31h]
v3 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
v4 = LevelSearchLayer::checkDiff(a1, v3);
if ( a1->m_type == 1 )
{
for ( i = 0; i != 8; ++i )
{
if ( (_DWORD)v3 != i )
LevelSearchLayer::toggleDifficultyNum(a1, i, 0);
}
}
v6 = !v4;
m_difficultyDict = a1->m_difficultyDict;
v8 = sub_100268F4C("%i", !v4);
v9 = (cocos2d::CCString *)sub_100268F4C("D%i", v3);
CString = (char *)cocos2d::CCString::getCString(v9);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(m_difficultyDict, v8, __p);
if ( v22 < 0 )
operator delete(__p[0]);
v11 = sub_10024A388(a1->m_difficultySprites, v3);
if ( v4 )
{
memset(__p, 125, 3);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v11 + 944LL))(v11, __p);
goto LABEL_10;
}
BYTE2(__p[0]) = -1;
LOWORD(__p[0]) = -1;
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v11 + 944LL))(v11, __p);
if ( (_DWORD)v3 )
{
if ( (_DWORD)v3 == 6 )
{
for ( j = 0; j != 6; ++j )
LevelSearchLayer::toggleDifficultyNum(a1, j, 0);
goto LABEL_11;
}
if ( (_DWORD)v3 != 7 )
{
LABEL_10:
LevelSearchLayer::toggleDifficultyNum(a1, 0, 0);
LevelSearchLayer::toggleDifficultyNum(a1, 6, 0);
LABEL_11:
LevelSearchLayer::toggleDifficultyNum(a1, 7, 0);
goto LABEL_12;
}
for ( k = 0; k != 7; ++k )
LevelSearchLayer::toggleDifficultyNum(a1, k, 0);
}
else
{
for ( m = 1; m != 8; ++m )
LevelSearchLayer::toggleDifficultyNum(a1, m, 0);
}
LABEL_12:
v12 = GameLevelManager::sharedState();
GameLevelManager::setDiffVal(v12, v3, v6);
v13 = a1->m_difficultyDict;
v14 = (cocos2d::CCString *)sub_100268F4C("D%i", 6);
v15 = (char *)cocos2d::CCString::getCString(v14);
sub_100009900(__p, v15);
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v13, __p);
v17 = cocos2d::CCString::boolValue(v16);
if ( v22 < 0 )
operator delete(__p[0]);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))a1->m_demonTypeButton->setEnabled)(a1->m_demonTypeButton, v17);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BOOL8))a1->m_demonTypeButton->setVisible)(a1->m_demonTypeButton, v17);
}