//
// GameLevelManager::getSavedDailyLevel from 0x6f20d0 to 0x6f21dc (268 bytes)
//
// 6 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x60fda4
// > GameLevelManager::getSavedLevel @ 0x6f2364
// > GameStatsManager::getTotalCollectedCurrency @ 0x7a4b88
// > DailyLevelPage::init @ 0x914ea8
// > DailyLevelPage::createNodeIfLoaded @ 0x915638
// > ??> @ 0xb1cd8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
GJGameLevel *GameLevelManager::getSavedDailyLevel(GameLevelManager *a1, int a2)
{
cocos2d::CCDictionary *m_dailyLevels; // x21
cocos2d::CCString *v3; // x0
char *CString; // x0
GJGameLevel *v5; // x20
char *v6; // x0
unsigned int *v8; // x2
int v9; // w1
std::string v10; // [xsp+40h] [xbp+40h] BYREF
m_dailyLevels = a1->m_dailyLevels;
v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", *(const char **)&a2);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((int)&v10, CString);
v5 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey(m_dailyLevels, &v10);
v6 = (char *)v10.m_data.m_data - 24;
if ( (__int64 *)v10.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)((char *)v10.m_data.m_data - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *((_DWORD *)v10.m_data.m_data - 2);
*((_DWORD *)v10.m_data.m_data - 2) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v6);
}
return v5;
}