//
// FileSaveManager::firstLoad from 0x57d604 to 0x57dbd8 (1492 bytes)
//
// 2 xrefs:
// > ??> @ 0x64e48
// > ??> @ 0x113b9f8
//
// 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 FileSaveManager::firstLoad(FileSaveManager *a1)
{
cocos2d::CCDictionary *StoreData; // x20
cocos2d::CCString *v3; // x0
cocos2d::CCDictionary *m_storeData; // x20
cocos2d::CCDictionary *v5; // x25
char *v6; // x0
cocos2d::CCString *v7; // x0
char *v8; // x20
char *v9; // x0
_QWORD *v10; // x22
stl::StringData::Internal *m_data; // x26
unsigned __int64 v12; // x21
unsigned __int64 v13; // x27
size_t v14; // x2
unsigned int v15; // w20
__int64 *v16; // x3
__int64 v17; // x21
unsigned int *v18; // x22
int v19; // w0
cocos2d::CCArray *v20; // x22
cocos2d::CCString *v21; // x0
char *v22; // x21
cocos2d::CCObject *v23; // x28
char *v24; // x0
cocos2d::CCDictionary *v25; // x26
char *v26; // x0
cocos2d::CCDictionary *v27; // x20
char *v28; // x21
unsigned int *v29; // x20
int v30; // w0
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x26
int v36; // w0
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
int v41; // w0
char *CString; // [xsp+78h] [xbp+78h]
__int64 *p; // [xsp+88h] [xbp+88h]
__int64 *v44; // [xsp+90h] [xbp+90h]
cocos2d::CCArray *v45; // [xsp+98h] [xbp+98h]
unsigned int v46; // [xsp+A4h] [xbp+A4h]
_QWORD *v48; // [xsp+C8h] [xbp+C8h] BYREF
std::string v49; // [xsp+D0h] [xbp+D0h] BYREF
v46 = 0;
StoreData = FileSaveManager::getStoreData(a1);
cocos2d::CCObject::retain(StoreData);
a1->m_storeData = StoreData;
v45 = cocos2d::CCDictionary::allKeys(StoreData);
if ( (unsigned int)cocos2d::CCArray::count(v45) )
{
while ( 1 )
{
v3 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v45, v46);
CString = (char *)cocos2d::CCString::getCString(v3);
m_storeData = a1->m_storeData;
sub_D153B8((int)&v49, CString);
v5 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(m_storeData, &v49);
v6 = (char *)v49.m_data.m_data - 24;
if ( (__int64 *)v49.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)((char *)v49.m_data.m_data - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v49.m_data.m_data - 2);
*((_DWORD *)v49.m_data.m_data - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v49, "category");
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v5, &v49);
v8 = (char *)cocos2d::CCString::getCString(v7);
v9 = (char *)v49.m_data.m_data - 24;
if ( (__int64 *)v49.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)((char *)v49.m_data.m_data - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v49.m_data.m_data - 2);
*((_DWORD *)v49.m_data.m_data - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v48, v8);
sub_D153B8((int)&v49, "group");
v10 = v48;
m_data = v49.m_data.m_data;
v12 = *(v48 - 3);
v13 = *((_QWORD *)v49.m_data.m_data - 3);
p = v48 - 3;
v44 = (__int64 *)((char *)v49.m_data.m_data - 24);
if ( v13 > v12 )
v14 = *(v48 - 3);
else
v14 = *((_QWORD *)v49.m_data.m_data - 3);
v15 = memcmp(v48, v49.m_data.m_data, v14);
v16 = p;
if ( !v15 )
{
v15 = 0x7FFFFFFF;
v17 = v12 - v13;
if ( v17 <= 0x7FFFFFFF )
{
if ( v17 >= (__int64)0xFFFFFFFF80000000LL )
v15 = v17;
else
v15 = 0x80000000;
}
}
if ( v44 != &qword_124B6B0 )
break;
LABEL_13:
if ( v16 == &qword_124B6B0 )
goto LABEL_14;
if ( &pthread_create )
{
v18 = (unsigned int *)(v10 - 1);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v10 - 2);
*((_DWORD *)v10 - 2) = v19 - 1;
}
if ( v19 > 0 )
{
LABEL_14:
if ( !v15 )
goto LABEL_22;
}
else
{
operator delete(v16);
if ( !v15 )
{
LABEL_22:
v20 = cocos2d::CCDictionary::allKeys(v5);
while ( v15 < (unsigned int)cocos2d::CCArray::count(v20) )
{
v21 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v20, v15);
v22 = (char *)cocos2d::CCString::getCString(v21);
sub_D153B8((int)&v49, v22);
v23 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v5, &v49);
v24 = (char *)v49.m_data.m_data - 24;
if ( (__int64 *)v49.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)((char *)v49.m_data.m_data - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *((_DWORD *)v49.m_data.m_data - 2);
*((_DWORD *)v49.m_data.m_data - 2) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v24);
}
if ( !v23 )
goto LABEL_27;
if ( !_dynamic_cast(
v23,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCDictionary,
0) )
goto LABEL_27;
v25 = a1->m_storeData;
sub_D153B8((int)&v49, v22);
cocos2d::CCDictionary::setObject((int)v25, v23);
v26 = (char *)v49.m_data.m_data - 24;
if ( (__int64 *)v49.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_27;
if ( &pthread_create )
{
v33 = (unsigned int *)((char *)v49.m_data.m_data - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v49.m_data.m_data - 2);
*((_DWORD *)v49.m_data.m_data - 2) = v34 - 1;
}
if ( v34 <= 0 )
{
++v15;
operator delete(v26);
}
else
{
LABEL_27:
++v15;
}
}
v27 = a1->m_storeData;
sub_D153B8((int)&v49, CString);
cocos2d::CCDictionary::removeObjectForKey(v27, &v49);
v28 = (char *)v49.m_data.m_data - 24;
if ( (__int64 *)v49.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)((char *)v49.m_data.m_data - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v49.m_data.m_data - 2);
*((_DWORD *)v49.m_data.m_data - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v28);
}
}
}
if ( ++v46 >= (unsigned int)cocos2d::CCArray::count(v45) )
return;
}
if ( &pthread_create )
{
v35 = (unsigned int *)((char *)m_data - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
if ( v36 > 0 )
goto LABEL_50;
}
else
{
v41 = *((_DWORD *)m_data - 2);
*((_DWORD *)m_data - 2) = v41 - 1;
if ( v41 > 0 )
{
LABEL_50:
v10 = v48;
v16 = v48 - 3;
goto LABEL_13;
}
}
operator delete(v44);
goto LABEL_50;
}
}