//
// LevelSearchLayer::toggleDifficulty from 0x4962a4 to 0x496474 (464 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:41 +0000
//
int __fastcall LevelSearchLayer::toggleDifficulty(cocos2d::CCArray **this, cocos2d::CCObject *a2)
{
const char *v3; // r5
unsigned __int8 v4; // r6
int v5; // r10
const char *v6; // r6
cocos2d::CCObject *v7; // r9
const char *DiffKey; // r11
size_t v9; // r0
const char *v10; // r7
void (*v11)(void); // r2
int i; // r9
const char *v13; // r1
GameLevelManager *v14; // r0
GameLevelManager *v15; // r0
int v16; // r5
const char *v17; // r0
const char *v18; // r6
size_t v19; // r0
cocos2d::CCString *v20; // r0
int v21; // r5
const char *v23; // r9
const char *v24; // r1
const char *v25; // r9
const char *v26; // r1
_BYTE v27[3]; // [sp+4h] [bp-18h] BYREF
int v28; // [sp+8h] [bp-14h] BYREF
int v29; // [sp+Ch] [bp-10h]
int v30; // [sp+10h] [bp-Ch]
v3 = (const char *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2);
v4 = LevelSearchLayer::checkDiff((LevelSearchLayer *)this, v3);
if ( *(this + 82) == (cocos2d::CCArray *)((char *)&dword_0 + 1) )
{
v10 = nullptr;
do
{
if ( v10 != v3 )
LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, v10, nullptr);
++v10;
}
while ( v10 != byte_8 );
}
v5 = (int)*(this + 88);
v6 = (const char *)(v4 ^ 1);
v7 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v6);
v28 = 0;
v29 = 0;
v30 = 0;
DiffKey = (const char *)LevelSearchLayer::getDiffKey((LevelSearchLayer *)this, v3);
v9 = strlen(DiffKey);
std::string::__init(&v28, DiffKey, v9);
cocos2d::CCDictionary::setObject(v5, v7);
std::string::~string((int)&v28);
v11 = *(void (**)(void))(*(_DWORD *)cocos2d::CCArray::objectAtIndex(*(this + 86), (unsigned int)v3) + 480);
if ( v6 )
{
v27[0] = -1;
v27[1] = -1;
v27[2] = -1;
v11();
if ( !v3 )
{
for ( i = 1; i != 8; ++i )
{
v13 = (const char *)i;
v14 = (GameLevelManager *)LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, v13, nullptr);
}
goto LABEL_19;
}
if ( v3 == &byte_6 )
{
v23 = nullptr;
do
{
v24 = v23++;
LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, v24, nullptr);
}
while ( v23 != &byte_6 );
goto LABEL_18;
}
}
else
{
memset(v27, 125, sizeof(v27));
v11();
if ( !v3 || v3 == &byte_6 )
goto LABEL_17;
}
if ( v3 != &byte_7 || !v6 )
{
LABEL_17:
LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, nullptr, nullptr);
LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, &byte_6, nullptr);
LABEL_18:
v14 = (GameLevelManager *)LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, &byte_7, nullptr);
goto LABEL_19;
}
v25 = nullptr;
do
{
v26 = v25++;
v14 = (GameLevelManager *)LevelSearchLayer::toggleDifficultyNum((LevelSearchLayer *)this, v26, nullptr);
}
while ( v25 != &byte_7 );
LABEL_19:
v15 = (GameLevelManager *)GameLevelManager::sharedState(v14);
GameLevelManager::setDiffVal(v15, (int)v3, (bool)v6);
v16 = (int)*(this + 88);
v17 = (const char *)LevelSearchLayer::getDiffKey((LevelSearchLayer *)this, &byte_6);
v28 = 0;
v29 = 0;
v30 = 0;
v18 = v17;
v19 = strlen(v17);
std::string::__init(&v28, v18, v19);
v20 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v16, &v28);
v21 = cocos2d::CCString::boolValue(v20);
std::string::~string((int)&v28);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 90) + 528))(*(this + 90), v21);
return (*(int (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 90) + 172))(*(this + 90), v21);
}