//
// LocalLevelManager::tryLoadMainLevelString from 0x1001c86dc to 0x1001c8818 (316 bytes)
//
// 1 xrefs:
// > LocalLevelManager::getMainLevelString @ 0x1001c8888
//
// 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
//
void __fastcall LocalLevelManager::tryLoadMainLevelString(LocalLevelManager *a1, int a2)
{
cocos2d::CCFileUtils *v3; // x20
cocos2d::CCString *v4; // x0
char *CString; // x0
void **v6; // x1
void **v7; // x0
cocos2d::CCString *v8; // x0
char *v9; // x0
std::string::size_type size; // x9
char v11; // w8
std::string *v12; // x0
std::string __str; // [xsp+8h] [xbp-78h] BYREF
void *__p[2]; // [xsp+20h] [xbp-60h] BYREF
char v15; // [xsp+37h] [xbp-49h]
void *v16[2]; // [xsp+38h] [xbp-48h] BYREF
char v17; // [xsp+4Fh] [xbp-31h]
int v18; // [xsp+50h] [xbp-30h] BYREF
int *v19; // [xsp+58h] [xbp-28h] BYREF
v18 = a2;
if ( !sub_100018814(&a1->m_mainLevels.__table_.__bucket_list_.__ptr_.__value_, &v18) )
{
v3 = cocos2d::CCFileUtils::sharedFileUtils();
v4 = (cocos2d::CCString *)sub_100268F4C("levels/%i.txt", v18);
CString = (char *)cocos2d::CCString::getCString(v4);
sub_100009900(v16, CString);
if ( v17 >= 0 )
v6 = v16;
else
v6 = (void **)v16[0];
((void (__fastcall *)(void **__return_ptr, cocos2d::CCFileUtils *, void **, _QWORD))v3->createCCArrayWithContentsOfFile)(
__p,
v3,
v6,
0);
if ( v15 >= 0 )
v7 = __p;
else
v7 = (void **)__p[0];
v8 = cocos2d::CCString::createWithContentsOfFile((const char *)v7);
if ( v8 )
{
v9 = (char *)cocos2d::CCString::getCString(v8);
sub_100009900(&__str, v9);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
v11 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( size )
{
v19 = &v18;
v12 = (std::string *)sub_100140AE0((unsigned __int64)&a1->m_mainLevels, &v18, (__int64)&unk_100639F54, &v19);
std::string::operator=(v12 + 1, &__str);
v11 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
}
if ( v11 < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}
if ( v15 < 0 )
operator delete(__p[0]);
if ( v17 < 0 )
operator delete(v16[0]);
}
}