//
// MoreOptionsLayer::goToPage from 0x7ca85c to 0x7cadcc (1392 bytes)
//
// 4 xrefs:
// > MoreOptionsLayer::init @ 0x7cbea4
// > MoreOptionsLayer::onNextPage @ 0x7cc134
// > MoreOptionsLayer::onPrevPage @ 0x7cc140
// > ??> @ 0x53a18
//
// 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 MoreOptionsLayer::goToPage(MoreOptionsLayer *a1, int a2)
{
int v2; // w22
int m_pageCount; // w0
int m_page; // w1
cocos2d::CCDictionary *m_variables; // x19
char *v7; // x0
cocos2d::CCArray *v8; // x21
char *v9; // x0
unsigned int v10; // w19
cocos2d::CCDictionary *v11; // x19
char *v12; // x0
__int64 v13; // x19
char *v14; // x0
cocos2d::CCDictionary *v15; // x19
char *v16; // x0
cocos2d::CCArray *v17; // x21
char *v18; // x0
unsigned int v19; // w19
cocos2d::CCDictionary *v20; // x19
char *v21; // x0
__int64 v22; // x19
char *v23; // x0
CCMenuItemSpriteExtra *m_leftBtn; // x2
CCTextInputNode *m_offsetInput; // x19
void (__fastcall *setTouchEnabled)(cocos2d::CCLayer *__hidden, bool); // x22
int v27; // w0
unsigned int v28; // w1
__int64 v29; // x0
unsigned int v30; // w1
__int64 v31; // x0
char *v32; // x20
unsigned int *v33; // x19
int v34; // w0
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
_QWORD v43[2]; // [xsp+0h] [xbp+0h] BYREF
std::string v44; // [xsp+60h] [xbp+60h] BYREF
v2 = a2;
m_pageCount = a1->m_pageCount;
if ( m_pageCount < a2 )
{
v2 = 0;
}
else if ( a2 < 0 )
{
v2 = m_pageCount;
}
m_page = a1->m_page;
if ( m_page != v2 )
{
m_variables = a1->m_variables;
v7 = (char *)MoreOptionsLayer::objectKey(a1, m_page);
sub_D153B8((unsigned int)v43 + 96, v7);
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(m_variables, &v44);
v9 = (char *)v44.m_data.m_data - 24;
if ( (__int64 *)v44.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)((char *)v44.m_data.m_data - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v44.m_data.m_data - 2);
*((_DWORD *)v44.m_data.m_data - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v9);
}
v10 = 0;
if ( v8 )
{
while ( v10 < (unsigned int)cocos2d::CCArray::count(v8) )
{
v28 = v10++;
v29 = cocos2d::CCArray::objectAtIndex(v8, v28);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v29 + 328LL))(v29, 0);
}
}
v11 = a1->m_variables;
v12 = (char *)MoreOptionsLayer::layerKey(a1, a1->m_page);
sub_D153B8((unsigned int)v43 + 96, v12);
v13 = cocos2d::CCDictionary::objectForKey(v11, &v44);
v14 = (char *)v44.m_data.m_data - 24;
if ( (__int64 *)v44.m_data.m_data - 3 == &qword_124B6B0 )
goto LABEL_8;
if ( &pthread_create )
{
v35 = (unsigned int *)((char *)v44.m_data.m_data - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v44.m_data.m_data - 2);
*((_DWORD *)v44.m_data.m_data - 2) = v36 - 1;
}
if ( v36 > 0 )
{
LABEL_8:
if ( !v13 )
goto LABEL_10;
}
else
{
operator delete(v14);
if ( !v13 )
{
LABEL_10:
v15 = a1->m_variables;
v16 = (char *)MoreOptionsLayer::objectKey(a1, v2);
sub_D153B8((unsigned int)v43 + 96, v16);
v17 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v15, &v44);
v18 = (char *)v44.m_data.m_data - 24;
if ( (__int64 *)v44.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)((char *)v44.m_data.m_data - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v44.m_data.m_data - 2);
*((_DWORD *)v44.m_data.m_data - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v18);
}
v19 = 0;
if ( v17 )
{
while ( v19 < (unsigned int)cocos2d::CCArray::count(v17) )
{
v30 = v19++;
v31 = cocos2d::CCArray::objectAtIndex(v17, v30);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v31 + 328LL))(v31, 1);
}
}
v20 = a1->m_variables;
v21 = (char *)MoreOptionsLayer::layerKey(a1, v2);
sub_D153B8((unsigned int)v43 + 96, v21);
v22 = cocos2d::CCDictionary::objectForKey(v20, &v44);
v23 = (char *)v44.m_data.m_data - 24;
if ( (__int64 *)v44.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)((char *)v44.m_data.m_data - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v44.m_data.m_data - 2);
*((_DWORD *)v44.m_data.m_data - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v23);
}
if ( v22 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v22 + 328LL))(v22, 1);
m_leftBtn = a1->m_leftBtn;
a1->m_page = v2;
m_leftBtn->setVisible(m_leftBtn, 1);
a1->m_rightBtn->setVisible(a1->m_rightBtn, 1);
m_offsetInput = a1->m_offsetInput;
setTouchEnabled = m_offsetInput->setTouchEnabled;
v27 = ((__int64 (__fastcall *)(CCTextInputNode *))m_offsetInput->isVisible)(m_offsetInput);
setTouchEnabled(m_offsetInput, v27);
sub_D153B8((unsigned int)v43 + 96, "Options");
switch ( a1->m_page )
{
case 0:
sub_D1798C(&v44, "Gameplay", 8);
break;
case 1:
case 2:
sub_D1798C(&v44, "Visual", 6);
break;
case 3:
sub_D1798C(&v44, "Practice", 8);
break;
case 4:
sub_D1798C(&v44, "Performance", 11);
break;
case 5:
sub_D1798C(&v44, "Audio", 5);
break;
case 6:
sub_D1798C(&v44, "Other", 5);
break;
default:
break;
}
a1->m_categoryLabel->setString(a1->m_categoryLabel, (const unsigned __int8 *)v44.m_data.m_data);
v32 = (char *)v44.m_data.m_data - 24;
if ( (__int64 *)v44.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)((char *)v44.m_data.m_data - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *((_DWORD *)v44.m_data.m_data - 2);
*((_DWORD *)v44.m_data.m_data - 2) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v32);
}
return;
}
}
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 328LL))(v13, 0);
goto LABEL_10;
}
}