//
// LocalLevelManager::filesPicked from 0x1006cf2c0 to 0x1006cf467 (423 bytes)
//
// 2 xrefs:
// > sub_1006CF500 @ 0x1006cf50c
// > ??> @ 0x100b8f728
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:35:38 +0000
//
void __fastcall LocalLevelManager::filesPicked(__int64 a1, __int64 *a2)
{
__int64 v2; // r15
__int64 v3; // r13
char *v4; // rbx
bool v5; // bl
std::error_category *cat; // rbx
__int64 v7; // rbx
__int64 v8; // r14
const std::__fs::filesystem::path *v9; // rdi
__int64 v10; // rax
__int64 v11; // rax
const std::error_category *v12; // rbx
const std::error_category *v13; // r14
void *v14; // rdi
unsigned __int8 v16; // [rsp+18h] [rbp-58h] BYREF
char v17[7]; // [rsp+19h] [rbp-57h] BYREF
void *__p; // [rsp+28h] [rbp-48h]
std::error_code __ec; // [rsp+30h] [rbp-40h] BYREF
const std::error_category *v20; // [rsp+40h] [rbp-30h]
__ec = 0;
v20 = nullptr;
v2 = *a2;
v3 = a2[1];
if ( *a2 != v3 )
{
do
{
v16 = 12;
strcpy(v17, ".gdlvl");
v5 = sub_1004EE570((unsigned __int8 *)v2, &v16);
if ( (v16 & 1) != 0 )
operator delete(__p);
if ( v5 )
{
cat = (std::error_category *)__ec.__cat_;
if ( __ec.__cat_ >= v20 )
{
v4 = sub_1000568A0((__int64)&__ec, v2);
}
else
{
if ( (*(_BYTE *)v2 & 1) != 0 )
{
sub_10001AD30(&__ec.__cat_->__vftable, *(const void **)(v2 + 16), *(_QWORD *)(v2 + 8));
}
else
{
__ec.__cat_[2].__vftable = *(std::error_category_vtbl **)(v2 + 16);
*(_OWORD *)&cat->__vftable = *(_OWORD *)v2;
}
v4 = (char *)&cat[3];
}
__ec.__cat_ = (const std::error_category *)v4;
}
v2 += 24;
}
while ( v2 != v3 );
}
*(_DWORD *)(a1 + 612) = LocalLevelManager::importLevelsFromPaths(a1, (__int64 *)&__ec.__val_, *(_DWORD *)(a1 + 604));
v7 = *a2;
v8 = a2[1];
while ( v7 != v8 )
{
if ( (*(_BYTE *)v7 & 1) != 0 )
v9 = *(const std::__fs::filesystem::path **)(v7 + 16);
else
v9 = (const std::__fs::filesystem::path *)(v7 + 1);
remove(v9, &__ec);
v7 += 24;
}
v10 = cocos2d::CCDirector::sharedDirector();
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 128LL))(v10);
cocos2d::CCScheduler::scheduleSelector(v11, (__int64)LocalLevelManager::postFileResults, 0, a1, 0, 0, 0.0, 0.0);
v12 = *(const std::error_category **)&__ec.__val_;
if ( *(_QWORD *)&__ec.__val_ )
{
v13 = __ec.__cat_;
v14 = *(void **)&__ec.__val_;
if ( __ec.__cat_ != *(const std::error_category **)&__ec.__val_ )
{
do
{
if ( ((__int64)v13[-3].__vftable & 1) != 0 )
operator delete(v13[-1].__vftable);
v13 -= 3;
}
while ( v13 != v12 );
v14 = *(void **)&__ec.__val_;
}
__ec.__cat_ = v12;
operator delete(v14);
}
}