//
// GJMoreGamesLayer::getMoreGamesList from 0x7d9734 to 0x7d9de8 (1716 bytes)
//
// 2 xrefs:
// > GJMoreGamesLayer::customSetup @ 0x7d9e0c
// > ??> @ 0x764e8
//
// 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
//
cocos2d::CCArray *GJMoreGamesLayer::getMoreGamesList(GJMoreGamesLayer *a1)
{
cocos2d::CCArray *v1; // x0
cocos2d::CCArray *v2; // x27
char *v3; // x0
char *v4; // x1
char *v5; // x0
char *v6; // x0
char *v7; // x1
char *v8; // x0
char *v9; // x0
char *v10; // x1
char *v11; // x0
char *i; // x21
cocos2d::CCString *v13; // x0
size_t v14; // x0
unsigned __int8 doesFileExist; // w0
char *v16; // x1
const char *v17; // x2
char *v18; // x0
char *v19; // x1
char *v20; // x0
const char *v21; // x1
char *v22; // x0
char *v23; // x19
char *v24; // x21
__int64 v25; // x1
__int64 *v26; // x0
unsigned int *v27; // x1
int v28; // w2
int v30; // w3
cocos2d::CCObject *v31; // x0
cocos2d::CCTextureCache *v32; // x0
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
__int64 v43; // [xsp+0h] [xbp+0h] BYREF
cocos2d::CCTexture2DPixelFormat v44; // [xsp+64h] [xbp+64h]
const char *CString; // [xsp+68h] [xbp+68h]
char *v46; // [xsp+80h] [xbp+80h] BYREF
char *v47; // [xsp+88h] [xbp+88h] BYREF
char *v48; // [xsp+90h] [xbp+90h] BYREF
char *v49; // [xsp+98h] [xbp+98h] BYREF
char *v50; // [xsp+A0h] [xbp+A0h] BYREF
void *p; // [xsp+A8h] [xbp+A8h]
void *v52; // [xsp+B0h] [xbp+B0h]
v44 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
v2 = (cocos2d::CCArray *)cocos2d::CCArray::create(v1);
v50 = nullptr;
p = nullptr;
v52 = nullptr;
sub_D153B8((int)&v46, "gjm");
v3 = (char *)p;
if ( p == v52 )
{
std::vector::_M_emplace_back_aux((__int64)&v50, &v46);
v4 = v46;
}
else
{
if ( p )
{
*(_QWORD *)p = v46;
v4 = &byte_124B6C8;
v46 = &byte_124B6C8;
}
else
{
v4 = v46;
}
p = v3 + 8;
}
v5 = v4 - 24;
if ( v4 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v4 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v4 - 2);
*((_DWORD *)v4 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v5);
}
sub_D153B8((int)&v47, "gjw");
v6 = (char *)p;
if ( v52 == p )
{
std::vector::_M_emplace_back_aux((__int64)&v50, &v47);
v7 = v47;
}
else
{
v7 = v47;
if ( p )
{
*(_QWORD *)p = v47;
v7 = &byte_124B6C8;
v47 = &byte_124B6C8;
}
p = v6 + 8;
}
v8 = v7 - 24;
if ( v7 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v7 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v7 - 2);
*((_DWORD *)v7 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v8);
}
sub_D153B8((unsigned int)&v43 + 144, "gjz");
v9 = (char *)p;
if ( v52 == p )
{
std::vector::_M_emplace_back_aux((__int64)&v50, &v48);
v10 = v48;
}
else
{
v10 = v48;
if ( p )
{
*(_QWORD *)p = v48;
v10 = &byte_124B6C8;
v48 = &byte_124B6C8;
}
p = v9 + 8;
}
v11 = v10 - 24;
if ( v10 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v10 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v10 - 2);
*((_DWORD *)v10 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v11);
}
for ( i = v50; p != i; i += 8 )
{
sub_D18D28(&v47);
v48 = &byte_124B6C8;
if ( PlatformToolbox::isHD() )
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"promo_%s-hd.png", v47);
else
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"promo_%s.png", v47);
CString = cocos2d::CCString::getCString(v13);
v14 = strlen(CString);
sub_D1798C(&v48, CString, v14);
sub_D153B8((int)&v49, v48);
doesFileExist = PlatformToolbox::doesFileExist(&v49);
v16 = v49;
v17 = (const char *)doesFileExist;
v18 = v49 - 24;
if ( v49 - 24 == (char *)&qword_124B6B0 )
goto LABEL_20;
if ( &pthread_create )
{
v16 = v49 - 8;
do
v30 = __ldaxr((unsigned int *)v16);
while ( __stlxr(v30 - 1, (unsigned int *)v16) );
}
else
{
v30 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v30 - 1;
}
if ( v30 > 0 )
{
LABEL_20:
if ( !(_DWORD)v17 )
goto LABEL_21;
}
else
{
CString = v17;
operator delete(v18);
if ( !(_DWORD)CString )
{
LABEL_21:
v19 = v48;
v20 = v48 - 24;
if ( v48 - 24 == (char *)&qword_124B6B0 )
goto LABEL_22;
goto LABEL_43;
}
}
v31 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v47, (const std::string *)v16);
cocos2d::CCArray::addObject(v2, v31);
v32 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v32, v48, 0);
v19 = v48;
v20 = v48 - 24;
if ( v48 - 24 == (char *)&qword_124B6B0 )
goto LABEL_22;
LABEL_43:
if ( &pthread_create )
{
v33 = (unsigned int *)(v19 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v19 - 2);
*((_DWORD *)v19 - 2) = v34 - 1;
}
if ( v34 > 0 )
{
LABEL_22:
v21 = v47;
v22 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
goto LABEL_48;
continue;
}
operator delete(v20);
v21 = v47;
v22 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
{
LABEL_48:
if ( &pthread_create )
{
v35 = (unsigned int *)(v21 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v22);
}
}
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v44);
v23 = v50;
v24 = (char *)p;
if ( v50 != p )
{
do
{
while ( 1 )
{
v25 = *(_QWORD *)v23;
v26 = (__int64 *)(*(_QWORD *)v23 - 24LL);
if ( v26 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v25 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v28 - 1;
}
if ( v28 <= 0 )
break;
}
v23 += 8;
if ( v24 == v23 )
goto LABEL_33;
}
v23 += 8;
operator delete(v26);
}
while ( v24 != v23 );
LABEL_33:
v24 = v50;
}
if ( v24 )
operator delete(v24);
return v2;
}