//
// MoreOptionsLayer::objectsForPage from 0x7c9cec to 0x7c9ebc (464 bytes)
//
// 4 xrefs:
// > MoreOptionsLayer::addToggle @ 0x7ca2d8
// > MoreOptionsLayer::init @ 0x7cb700
// > MoreOptionsLayer::init @ 0x7cb8c8
// > ??> @ 0xa59d8
//
// 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 *MoreOptionsLayer::objectsForPage(MoreOptionsLayer *a1, int a2)
{
cocos2d::CCDictionary *m_variables; // x20
char *v5; // x0
cocos2d::CCArray *v6; // x20
cocos2d::CCArray *v7; // x0
unsigned int *v9; // x1
int v10; // w2
MoreOptionsLayer *v11; // x0
cocos2d::CCDictionary *v12; // x23
char *v13; // x0
char *v14; // x21
unsigned int *v15; // x1
int v16; // w0
std::string v17; // [xsp+60h] [xbp+60h] BYREF
m_variables = a1->m_variables;
v5 = (char *)MoreOptionsLayer::objectKey(a1, a2);
sub_D153B8((int)&v17, v5);
v6 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(m_variables, &v17);
v7 = (cocos2d::CCArray *)((char *)v17.m_data.m_data - 24);
if ( (__int64 *)v17.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_2;
if ( &pthread_create )
{
v9 = (unsigned int *)((char *)v17.m_data.m_data - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *((_DWORD *)v17.m_data.m_data - 2);
*((_DWORD *)v17.m_data.m_data - 2) = v10 - 1;
}
if ( v10 > 0 )
{
LABEL_2:
if ( v6 )
return v6;
}
else
{
operator delete(v7);
if ( v6 )
return v6;
}
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v11 = a1;
v12 = a1->m_variables;
v13 = (char *)MoreOptionsLayer::objectKey(v11, a2);
sub_D153B8((int)&v17, v13);
cocos2d::CCDictionary::setObject((int)v12, v6);
v14 = (char *)v17.m_data.m_data - 24;
if ( (__int64 *)v17.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)((char *)v17.m_data.m_data - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v17.m_data.m_data - 2);
*((_DWORD *)v17.m_data.m_data - 2) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v14);
}
return v6;
}