//
// MoreOptionsLayer::goToPage from 0x140375600 to 0x140375ba0 (1440 bytes)
//
// 4 xrefs:
// > MoreOptionsLayer::init @ 0x140374a35
// > MoreOptionsLayer::onNextPage @ 0x1403755e8
// > MoreOptionsLayer::onPrevPage @ 0x1403755f8
// > ??> @ 0x1406d5b88
//
// 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
//
// Hidden C++ exception states: #wind=2
void MoreOptionsLayer::goToPage(MoreOptionsLayer *a1, int a2)
{
int m_pageCount; // r15d
unsigned int v4; // esi
int m_page; // edx
cocos2d::CCString *v6; // rax
const char *CString; // rax
size_t v8; // rbx
size_t v9; // r8
cocos2d::CCArray *v10; // r14
void *v11; // rcx
unsigned int i; // edi
struct cocos2d::CCObject *v13; // rax
cocos2d::CCString *v14; // rax
const char *v15; // rax
size_t v16; // r8
__int64 v17; // rdi
void *v18; // rcx
cocos2d::CCString *v19; // rax
const char *v20; // rax
size_t v21; // r8
cocos2d::CCArray *v22; // rdi
void *v23; // rcx
struct cocos2d::CCObject *v24; // rax
__int64 v25; // rdx
cocos2d::CCString *v26; // rax
const char *v27; // rax
__int64 v28; // rbx
__int64 v29; // rdx
void *v30; // rcx
_BOOL8 v31; // rdx
CCTextInputNode *m_offsetInput; // rcx
CCTextInputNode_vtbl *v33; // rbx
bool v34; // al
unsigned __int8 v35; // al
void *v36; // rcx
void *v37[2]; // [rsp+20h] [rbp-50h] BYREF
__int64 v38; // [rsp+30h] [rbp-40h]
unsigned __int64 v39; // [rsp+38h] [rbp-38h]
void *Block[2]; // [rsp+40h] [rbp-30h] BYREF
__m128i si128; // [rsp+50h] [rbp-20h]
m_pageCount = a2;
v4 = 0;
if ( a2 <= a1->m_pageCount )
{
if ( a2 < 0 )
m_pageCount = a1->m_pageCount;
}
else
{
m_pageCount = 0;
}
m_page = a1->m_page;
if ( m_page != m_pageCount )
{
v6 = cocos2d::CCString::createWithFormat("object_%i", m_page);
CString = cocos2d::CCString::getCString(v6);
*(_OWORD *)Block = 0;
si128 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
sub_14003A930(Block, CString, v9);
v10 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_variables, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v11 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v11);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v10 )
{
for ( i = 0; i < cocos2d::CCArray::count(v10); ++i )
{
v13 = cocos2d::CCArray::objectAtIndex(v10, i);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v13->__vftable[4].update)(v13, 0);
}
}
v14 = cocos2d::CCString::createWithFormat("layer_%i", a1->m_page);
v15 = cocos2d::CCString::getCString(v14);
*(_OWORD *)Block = 0;
si128 = 0;
v16 = -1;
do
++v16;
while ( v15[v16] );
sub_14003A930(Block, v15, v16);
v17 = cocos2d::CCDictionary::objectForKey(a1->m_variables, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v18 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v18);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v17 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 320LL))(v17, 0);
v19 = cocos2d::CCString::createWithFormat("object_%i", m_pageCount);
v20 = cocos2d::CCString::getCString(v19);
*(_OWORD *)Block = 0;
si128 = 0;
v21 = -1;
do
++v21;
while ( v20[v21] );
sub_14003A930(Block, v20, v21);
v22 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_variables, Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v23 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v23 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v23);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v22 && cocos2d::CCArray::count(v22) )
{
do
{
v24 = cocos2d::CCArray::objectAtIndex(v22, v4);
LOBYTE(v25) = 1;
((void (__fastcall *)(struct cocos2d::CCObject *, __int64))v24->__vftable[4].update)(v24, v25);
++v4;
}
while ( v4 < cocos2d::CCArray::count(v22) );
}
v26 = cocos2d::CCString::createWithFormat("layer_%i", m_pageCount);
v27 = cocos2d::CCString::getCString(v26);
*(_OWORD *)Block = 0;
si128 = 0;
do
++v8;
while ( v27[v8] );
sub_14003A930(Block, v27, v8);
v28 = cocos2d::CCDictionary::objectForKey(a1->m_variables, Block);
v29 = si128.m128i_i64[1];
if ( si128.m128i_i64[1] > 0xFuLL )
{
v30 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v30 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v30);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( v28 )
{
LOBYTE(v29) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v28 + 320LL))(v28, v29);
}
a1->m_page = m_pageCount;
LOBYTE(v29) = 1;
a1->m_leftBtn->setVisible(a1->m_leftBtn, v29);
LOBYTE(v31) = 1;
a1->m_rightBtn->setVisible(a1->m_rightBtn, v31);
m_offsetInput = a1->m_offsetInput;
v33 = m_offsetInput->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v34 = m_offsetInput->isVisible(m_offsetInput);
v33->setTouchEnabled(a1->m_offsetInput, v34);
HIWORD(v37[1]) = 0;
v38 = 7;
v39 = 15;
qmemcpy(v37, "Option", 6);
*(void **)((char *)v37 + 6) = (void *)(unsigned __int8)aOptions[6];
switch ( a1->m_page )
{
case 0:
v38 = 8;
strcpy((char *)v37, "Gameplay");
break;
case 1:
case 2:
v38 = 6;
strcpy((char *)v37, "Visual");
break;
case 3:
v38 = 8;
strcpy((char *)v37, "Practice");
break;
case 4:
v38 = 11;
strcpy((char *)v37, "Performance");
break;
case 5:
LODWORD(v37[0]) = 1768191297;
v35 = 111;
goto LABEL_51;
case 6:
LODWORD(v37[0]) = 1701344335;
v35 = 114;
LABEL_51:
WORD2(v37[0]) = v35;
v38 = 5;
break;
default:
break;
}
a1->m_categoryLabel->setString(&a1->m_categoryLabel->cocos2d::CCLabelProtocol, (const char *)v37);
if ( v39 > 0xF )
{
v36 = v37[0];
if ( v39 + 1 >= 0x1000 )
{
v36 = *((void **)v37[0] - 1);
if ( (unsigned __int64)((char *)v37[0] - (char *)v36 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v36);
}
}
}