//
// MoreOptionsLayer::goToPage from 0x10079d6e0 to 0x10079db9e (1214 bytes)
//
// 3 xrefs:
// > MoreOptionsLayer::init @ 0x10079ca34
// > MoreOptionsLayer::onPrevPage @ 0x10079d6ad
// > MoreOptionsLayer::onNextPage @ 0x10079d6cd
//
// 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 __fastcall MoreOptionsLayer::goToPage(MoreOptionsLayer *a1, int a2)
{
double v2; // xmm0_8
int m_pageCount; // edx
int v4; // r14d
cocos2d::CCDictionary *m_variables; // r15
cocos2d::CCString *v6; // rax
const char *CString; // r13
size_t v8; // rax
std::string::size_type v9; // r12
char *data; // r15
size_t v11; // r14
__int64 v12; // r15
unsigned int v13; // r12d
__int64 v14; // rax
cocos2d::CCDictionary *v15; // r14
cocos2d::CCString *v16; // rax
const char *v17; // r13
size_t v18; // rax
std::string::size_type v19; // r12
char *v20; // r15
int v21; // r14d
size_t v22; // r14
__int64 v23; // r15
cocos2d::CCDictionary *v24; // r15
cocos2d::CCString *v25; // rax
const char *v26; // r13
size_t v27; // rax
std::string::size_type v28; // r12
char *v29; // r15
size_t v30; // r14
__int64 v31; // r15
unsigned int v32; // r12d
__int64 v33; // rax
cocos2d::CCDictionary *v34; // r15
cocos2d::CCString *v35; // rax
const char *v36; // r13
size_t v37; // rax
std::string::size_type v38; // r12
char *v39; // r15
size_t v40; // r14
__int64 v41; // r15
CCTextInputNode *m_offsetInput; // r14
unsigned __int8 v43; // al
unsigned __int64 m_page; // rax
cocos2d::CCLabelBMFont *m_categoryLabel; // rdi
std::string::pointer v46; // rsi
char v47; // [rsp+0h] [rbp-50h]
__int64 v48; // [rsp+0h] [rbp-50h]
__int64 v49; // [rsp+0h] [rbp-50h]
__int64 v50; // [rsp+0h] [rbp-50h]
__int64 v51; // [rsp+0h] [rbp-50h]
int v52; // [rsp+Ch] [rbp-44h]
std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF
m_pageCount = a2;
if ( a2 < 0 )
m_pageCount = a1->m_pageCount;
v4 = 0;
if ( a1->m_pageCount >= a2 )
v4 = m_pageCount;
if ( a1->m_page != v4 )
{
m_variables = a1->m_variables;
v6 = (cocos2d::CCString *)sub_1007AB580("object_%i", v47);
CString = cocos2d::CCString::getCString(v6);
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v9 = v8;
v48 = (__int64)m_variables;
v52 = v4;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
data = (char *)operator new(v11);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v11 + 1;
__dst[0].__r_.__value_.__l.__size_ = v9;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v8);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v8 )
{
LABEL_14:
data[v9] = 0;
v12 = cocos2d::CCDictionary::objectForKey_1(v48, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v12 && (unsigned int)sub_100720070(v12) )
{
v13 = 0;
do
{
v14 = sub_1007200C0(v12, v13);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v14 + 328LL))(v14, 0);
++v13;
}
while ( v13 < (unsigned int)sub_100720070(v12) );
}
v15 = a1->m_variables;
v16 = (cocos2d::CCString *)sub_1007AB580("layer_%i", v48);
v17 = cocos2d::CCString::getCString(v16);
v18 = strlen(v17);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v19 = v18;
v49 = (__int64)v15;
if ( v18 >= 0x17 )
{
v22 = 26;
if ( (v18 | 7) != 0x17 )
v22 = (v18 | 7) + 1;
v20 = (char *)operator new(v22);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v20;
__dst[0].__r_.__value_.__r.__words[0] = v22 + 1;
__dst[0].__r_.__value_.__l.__size_ = v19;
v21 = v52;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v18);
v20 = __dst[0].__r_.__value_.__s.__data_;
v21 = v52;
if ( !v18 )
{
LABEL_28:
v20[v19] = 0;
v23 = cocos2d::CCDictionary::objectForKey_1(v49, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v23 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v23 + 328LL))(v23, 0);
v24 = a1->m_variables;
v25 = (cocos2d::CCString *)sub_1007AB580("object_%i", v49);
v26 = cocos2d::CCString::getCString(v25);
v27 = strlen(v26);
if ( v27 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v28 = v27;
v50 = (__int64)v24;
if ( v27 >= 0x17 )
{
v30 = 26;
if ( (v27 | 7) != 0x17 )
v30 = (v27 | 7) + 1;
v29 = (char *)operator new(v30);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v29;
__dst[0].__r_.__value_.__r.__words[0] = v30 + 1;
v21 = v52;
__dst[0].__r_.__value_.__l.__size_ = v28;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v27);
v29 = __dst[0].__r_.__value_.__s.__data_;
if ( !v27 )
{
LABEL_40:
v29[v28] = 0;
v31 = cocos2d::CCDictionary::objectForKey_1(v50, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v31 && (unsigned int)sub_100720070(v31) )
{
v32 = 0;
do
{
v33 = sub_1007200C0(v31, v32);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v33 + 328LL))(v33, 1);
++v32;
}
while ( v32 < (unsigned int)sub_100720070(v31) );
}
v34 = a1->m_variables;
v35 = (cocos2d::CCString *)sub_1007AB580("layer_%i", v50);
v36 = cocos2d::CCString::getCString(v35);
v37 = strlen(v36);
if ( v37 < 0xFFFFFFFFFFFFFFF8LL )
{
v38 = v37;
v51 = (__int64)v34;
if ( v37 >= 0x17 )
{
v40 = 26;
if ( (v37 | 7) != 0x17 )
v40 = (v37 | 7) + 1;
v39 = (char *)operator new(v40);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v39;
__dst[0].__r_.__value_.__r.__words[0] = v40 + 1;
v21 = v52;
__dst[0].__r_.__value_.__l.__size_ = v38;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v37);
v39 = __dst[0].__r_.__value_.__s.__data_;
if ( !v37 )
goto LABEL_54;
}
memmove(v39, v36, v38);
LABEL_54:
v39[v38] = 0;
v41 = cocos2d::CCDictionary::objectForKey_1(v51, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v41 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v41 + 328LL))(v41, 1);
a1->m_page = v21;
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_leftBtn->setVisible)(a1->m_leftBtn, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_rightBtn->setVisible)(a1->m_rightBtn, 1);
m_offsetInput = a1->m_offsetInput;
v43 = ((__int64 (__fastcall *)(CCTextInputNode *))m_offsetInput->isVisible)(m_offsetInput);
((void (__fastcall *)(CCTextInputNode *, _QWORD))m_offsetInput->setTouchEnabled)(m_offsetInput, v43);
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)14;
*(_DWORD *)((char *)&__dst[0].__r_.__value_.__l.0 + 1) = 1769238607;
HIDWORD(__dst[0].__r_.__value_.__r.__words[0]) = 1936617321;
__dst[0].__r_.__value_.__s.__data_[7] = 0;
m_page = (unsigned int)a1->m_page;
if ( m_page < 7 )
std::string::assign(
__dst,
(const std::string::value_type *)&unk_1008236C4 + *((int *)&unk_1008236C4 + m_page));
m_categoryLabel = a1->m_categoryLabel;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v46 = __dst[0].__r_.__value_.__l.__data_;
else
v46 = __dst[0].__r_.__value_.__s.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))m_categoryLabel->setString)(
m_categoryLabel,
v46);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
return;
}
LABEL_66:
sub_100006BF0(v2);
}
}
memmove(v29, v26, v28);
goto LABEL_40;
}
}
memmove(v20, v17, v19);
goto LABEL_28;
}
}
memmove(data, CString, v9);
goto LABEL_14;
}
}