//
// cocos2d::CCConfiguration::init from 0xaaf310 to 0xaaf5e8 (728 bytes)
//
// 2 xrefs:
// > cocos2d::CCConfiguration::sharedConfiguration @ 0xaaf760
// > ??> @ 0x467b8
//
// 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
//
bool cocos2d::CCConfiguration::init(cocos2d::CCConfiguration *a1)
{
cocos2d::CCDictionary *v2; // x0
__int64 v3; // x25
char *v4; // x0
const std::string *v5; // x1
cocos2d::CCObject *v6; // x21
void *v7; // x0
void *v8; // x0
__int64 v9; // x27
__int64 v10; // x26
void *v11; // x0
__int64 v12; // x26
__int64 v13; // x23
void *v14; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
__int64 v24; // [xsp+78h] [xbp+78h] BYREF
__int64 v25; // [xsp+80h] [xbp+80h] BYREF
v2 = cocos2d::CCDictionary::create();
*(_QWORD *)&a1[1].m_uIndexInArray = v2;
cocos2d::CCObject::retain(v2);
v3 = *(_QWORD *)&a1[1].m_uIndexInArray;
v4 = (char *)cocos2d::cocos2dVersion();
sub_D153B8((int)&v24, v4);
v6 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v24, v5);
sub_D153B8((int)&v25, "cocos2d.x.version");
cocos2d::CCDictionary::setObject(v3, v6);
v7 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v25 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v7);
}
v8 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v24 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v8);
}
v9 = *(_QWORD *)&a1[1].m_uIndexInArray;
v10 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v10);
*(_BYTE *)(v10 + 56) = 0;
*(_QWORD *)v10 = &off_11FB020;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v10);
sub_D153B8((int)&v25, "cocos2d.x.compiled_with_profiler");
cocos2d::CCDictionary::setObject(v9, (cocos2d::CCObject *)v10);
v11 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v25 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v11);
}
v12 = *(_QWORD *)&a1[1].m_uIndexInArray;
v13 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v13);
*(_BYTE *)(v13 + 56) = 1;
*(_QWORD *)v13 = &off_11FB020;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v13);
sub_D153B8((int)&v25, "cocos2d.x.compiled_with_gl_state_cache");
cocos2d::CCDictionary::setObject(v12, (cocos2d::CCObject *)v13);
v14 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v25 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v14);
}
return 1;
}