//
// GameLevelManager::getMainLevel from 0x4b3098 to 0x4b3206 (366 bytes)
//
// 22 xrefs:
// > GameManager::verifyStarUnlocks @ 0x41358a
// > GameManager::verifySyncedCoins @ 0x4135be
// > GameManager::verifySyncedCoins @ 0x413630
// > GameManager::verifyCoinUnlocks @ 0x419e18
// > GameManager::verifyCoinUnlocks @ 0x419e8a
// > GameManager::recountUserStats @ 0x41ba56
// > GameManager::dataLoaded @ 0x41cdd4
// > GameManager::dataLoaded @ 0x41cf8e
// > GameManager::dataLoaded @ 0x41cfa8
// > GameManager::dataLoaded @ 0x41cfc2
// > LevelSelectLayer::init @ 0x5128da
// > GameStatsManager::getTotalCollectedCurrency @ 0x517fe2
// > GameStatsManager::getTotalCollectedCurrency @ 0x518014
// > GameStatsManager::getTotalCollectedCurrency @ 0x518044
// > GameStatsManager::awardOldSpecialStats @ 0x52a47c
// > SecretLayer2::onSecretLevel @ 0x61b9cc
// > SecretLayer2::init @ 0x61fc9a
// > GJWorldNode::init @ 0x62d8da
// > GJWorldNode::unlockActiveItem @ 0x62e900
// > GJWorldNode::onLevel @ 0x62f706
// > LevelAreaInnerLayer::playStep1 @ 0x6a49bc
// > LevelAreaInnerLayer::init @ 0x6a5506
//
// 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:50:04 +0000
//
int __fastcall GameLevelManager::getMainLevel(GameLevelManager *this, char *a2, int a3, int a4)
{
int v6; // r5
const char *LevelKey; // r10
size_t v9; // r0
int v10; // r5
int v11; // r2
int v12; // r3
int Level; // r0
int v14; // r2
int v15; // r3
int v16; // r6
int v17; // r0
int v18; // r6
const char *v19; // r0
const char *v20; // r7
size_t v21; // r0
GameLevelManager *v23; // [sp+0h] [bp-10h] BYREF
char *v24; // [sp+4h] [bp-Ch]
int v25; // [sp+8h] [bp-8h]
int v26; // [sp+Ch] [bp-4h]
v23 = this;
v24 = a2;
v25 = a3;
v26 = a4;
v6 = *((_DWORD *)this + 134);
v23 = nullptr;
v24 = nullptr;
v25 = 0;
LevelKey = (const char *)GameLevelManager::getLevelKey(this, a2);
v9 = strlen(LevelKey);
std::string::__init((int *)&v23, LevelKey, v9);
v10 = cocos2d::CCDictionary::objectForKey(v6, &v23);
std::string::~string((int)&v23);
Level = LevelTools::getLevel((LevelTools *)a2, a3, v11, v12);
v16 = Level;
if ( v10 )
{
std::string::basic_string((int *)&v23, Level + 304);
std::string::operator=((unsigned __int8 *)(v10 + 304), (unsigned __int8 *)&v23);
std::string::~string((int)&v23);
GJGameLevel::setStars((GJGameLevel *)v10, *(_DWORD *)(v16 + 772) - *(_DWORD *)(v16 + 776));
*(_DWORD *)(v10 + 788) = *(_DWORD *)(v16 + 788);
*(_DWORD *)(v10 + 920) = *(_DWORD *)(v16 + 920);
std::string::basic_string((int *)&v23, v16 + 280);
std::string::operator=((unsigned __int8 *)(v10 + 280), (unsigned __int8 *)&v23);
std::string::~string((int)&v23);
*(_DWORD *)(v10 + 432) = *(_DWORD *)(v16 + 432);
*(_BYTE *)(v10 + 824) = *(_BYTE *)(v16 + 824);
GJGameLevel::setDemon((GJGameLevel *)v10, *(_DWORD *)(v16 + 756) - *(_DWORD *)(v16 + 760));
*(_DWORD *)(v10 + 428) = *(_DWORD *)(v16 + 428);
std::string::basic_string((int *)&v23, v16 + 972);
std::string::operator=((unsigned __int8 *)(v10 + 972), (unsigned __int8 *)&v23);
std::string::~string((int)&v23);
GJGameLevel::setLevelID((GJGameLevel *)v10, (int)a2);
*(_DWORD *)(v10 + 1000) = *(_DWORD *)(v16 + 1000);
*(_DWORD *)(v10 + 724) = *(_DWORD *)(v16 + 724);
}
else
{
v17 = LevelTools::getLevel((LevelTools *)a2, 0, v14, v15);
v18 = *((_DWORD *)this + 134);
v10 = v17;
v19 = (const char *)GameLevelManager::getLevelKey(this, a2);
v23 = nullptr;
v24 = nullptr;
v25 = 0;
v20 = v19;
v21 = strlen(v19);
std::string::__init((int *)&v23, v20, v21);
cocos2d::CCDictionary::setObject(v18, (cocos2d::CCObject *)v10);
std::string::~string((int)&v23);
}
return v10;
}