//
// LocalLevelManager::importLevelsFromPaths from 0x542ce8 to 0x542ea0 (440 bytes)
//
// 2 xrefs:
// > LocalLevelManager::filesPicked @ 0x54359a
// > AutoBackupPopup::onRestore @ 0x73cce6
//
// 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:52:20 +0000
//
int __fastcall LocalLevelManager::importLevelsFromPaths(cocos2d::CCArray **a1, _DWORD *a2, int a3)
{
int v4; // r9
int v5; // r5
int v6; // r7
int v7; // r3
cocos2d::CCString *v8; // r0
cocos2d::CCString *v9; // r0
cocos2d::CCString *v10; // r4
const char *CString; // r0
const char *v12; // r11
size_t v13; // r0
int v14; // r0
int v15; // r4
int v17; // r3
GameManager *v18; // r0
int v19; // r0
int v20; // r0
int v21; // s15
int v22; // s15
int v24; // [sp+Ch] [bp-30h]
unsigned __int8 v25[12]; // [sp+10h] [bp-2Ch] BYREF
int v26[3]; // [sp+1Ch] [bp-20h] BYREF
int v27[3]; // [sp+28h] [bp-14h] BYREF
v4 = a2[1];
if ( *a2 == v4 )
return 0;
v5 = *a2 + 1;
v6 = 0;
while ( 1 )
{
v7 = *(unsigned __int8 *)(v5 - 1);
if ( (v7 & 1) != 0 )
v8 = *(cocos2d::CCString **)(v5 + 7);
else
v8 = (cocos2d::CCString *)v5;
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithContentsOfFile(v8, (const char *)(v7 << 31));
v10 = v9;
if ( v9 && *(_BYTE *)cocos2d::CCString::getCString(v9) )
{
CString = (const char *)cocos2d::CCString::getCString(v10);
memset(v27, 0, sizeof(v27));
v12 = CString;
v13 = strlen(CString);
std::string::__init(v27, v12, v13);
cocos2d::ZipUtils::decompressString(v25, v27, 0, 11);
std::string::~string((int)v27);
v14 = GJGameLevel::createFromFullSaveString(v25);
v15 = v14;
if ( v14 )
{
std::string::basic_string(v26, v14 + 304);
v17 = (v26[0] & 1) != 0 ? v26[1] : (int)LOBYTE(v26[0]) >> 1;
v24 = v17;
v18 = (GameManager *)std::string::~string((int)v26);
if ( v24 )
{
if ( (*(_BYTE *)(v15 + 1132) & 1) != 0 )
{
**(_BYTE **)(v15 + 1140) = 0;
*(_DWORD *)(v15 + 1136) = 0;
}
else
{
*(_BYTE *)(v15 + 1133) = 0;
*(_BYTE *)(v15 + 1132) = 0;
}
*(_DWORD *)(v15 + 952) = 2;
v19 = GameManager::sharedState(v18);
std::string::basic_string(v27, v19 + 448);
std::string::operator=((unsigned __int8 *)(v15 + 316), (unsigned __int8 *)v27);
std::string::~string((int)v27);
*(_DWORD *)(v15 + 276) = 0;
v20 = rand();
*(_BYTE *)(v15 + 609) = 0;
*(_DWORD *)(v15 + 612) = 1;
*(_BYTE *)(v15 + 608) = 0;
v21 = (int)(float)((float)((float)v20 * 4.6566e-10) * 1000.0);
*(_DWORD *)(v15 + 272) = v21;
*(_DWORD *)(v15 + 268) = v21;
v22 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v15 + 604) = v22;
*(_DWORD *)(v15 + 600) = v22;
GJGameLevel::unverifyCoins((GJGameLevel *)v15);
*(_DWORD *)(v15 + 740) = a3;
cocos2d::CCArray::insertObject(a1[71], (cocos2d::CCObject *)v15, 0);
++v6;
}
}
std::string::~string((int)v25);
}
if ( v4 == v5 + 11 )
break;
v5 += 12;
}
if ( v6 )
LocalLevelManager::updateLevelOrder((LocalLevelManager *)a1);
return v6;
}