//
// MoreOptionsLayer::goToPage from 0x10087ea40 to 0x10087eefe (1214 bytes)
//
// 3 xrefs:
// > MoreOptionsLayer::init @ 0x10087dd4c
// > sub_10087EA00 @ 0x10087ea0d
// > sub_10087EA20 @ 0x10087ea2d
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:36:56 +0000
//
void __fastcall MoreOptionsLayer::goToPage(__int64 a1, int a2)
{
int v2; // edx
int v3; // r14d
__int64 v4; // r15
__int64 v5; // rax
const char *CString; // r13
size_t v7; // rax
std::string::size_type v8; // r12
char *data; // r15
size_t v10; // r14
__int64 v11; // r15
unsigned int v12; // r12d
__int64 v13; // rax
__int64 v14; // r14
__int64 v15; // rax
const char *v16; // r13
size_t v17; // rax
std::string::size_type v18; // r12
char *v19; // r15
int v20; // r14d
size_t v21; // r14
__int64 v22; // r15
__int64 v23; // r15
__int64 v24; // rax
const char *v25; // r13
size_t v26; // rax
std::string::size_type v27; // r12
char *v28; // r15
size_t v29; // r14
__int64 v30; // r15
unsigned int v31; // r12d
__int64 v32; // rax
__int64 v33; // r15
__int64 v34; // rax
const char *v35; // r13
size_t v36; // rax
std::string::size_type v37; // r12
char *v38; // r15
size_t v39; // r14
__int64 v40; // r15
__int64 v41; // r14
unsigned __int8 v42; // al
unsigned __int64 v43; // rax
__int64 v44; // rdi
std::string::pointer v45; // rsi
char v46; // [rsp+0h] [rbp-50h]
__int64 v47; // [rsp+0h] [rbp-50h]
__int64 v48; // [rsp+0h] [rbp-50h]
__int64 v49; // [rsp+0h] [rbp-50h]
__int64 v50; // [rsp+0h] [rbp-50h]
int v51; // [rsp+Ch] [rbp-44h]
std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF
v2 = a2;
if ( a2 < 0 )
v2 = *(_DWORD *)(a1 + 688);
v3 = 0;
if ( *(_DWORD *)(a1 + 688) >= a2 )
v3 = v2;
if ( *(_DWORD *)(a1 + 680) != v3 )
{
v4 = *(_QWORD *)(a1 + 696);
v5 = sub_10088E820("object_%i", v46);
CString = (const char *)cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v8 = v7;
v47 = v4;
v51 = v3;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
data = (char *)operator new(v10);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v10 + 1;
__dst[0].__r_.__value_.__l.__size_ = v8;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst[0].__r_.__value_.__s.__data_;
if ( !v7 )
{
LABEL_14:
data[v8] = 0;
v11 = cocos2d::CCDictionary::objectForKey(v47, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v11 && (unsigned int)sub_1007FEF90(v11) )
{
v12 = 0;
do
{
v13 = sub_1007FEFE0(v11, v12);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 344LL))(v13, 0);
++v12;
}
while ( v12 < (unsigned int)sub_1007FEF90(v11) );
}
v14 = *(_QWORD *)(a1 + 696);
v15 = sub_10088E820("layer_%i", v47);
v16 = (const char *)cocos2d::CCString::getCString(v15);
v17 = strlen(v16);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v18 = v17;
v48 = v14;
if ( v17 >= 0x17 )
{
v21 = 26;
if ( (v17 | 7) != 0x17 )
v21 = (v17 | 7) + 1;
v19 = (char *)operator new(v21);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v19;
__dst[0].__r_.__value_.__r.__words[0] = v21 + 1;
__dst[0].__r_.__value_.__l.__size_ = v18;
v20 = v51;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v17);
v19 = __dst[0].__r_.__value_.__s.__data_;
v20 = v51;
if ( !v17 )
{
LABEL_28:
v19[v18] = 0;
v22 = cocos2d::CCDictionary::objectForKey(v48, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v22 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v22 + 344LL))(v22, 0);
v23 = *(_QWORD *)(a1 + 696);
v24 = sub_10088E820("object_%i", v48);
v25 = (const char *)cocos2d::CCString::getCString(v24);
v26 = strlen(v25);
if ( v26 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_66;
v27 = v26;
v49 = v23;
if ( v26 >= 0x17 )
{
v29 = 26;
if ( (v26 | 7) != 0x17 )
v29 = (v26 | 7) + 1;
v28 = (char *)operator new(v29);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v28;
__dst[0].__r_.__value_.__r.__words[0] = v29 + 1;
v20 = v51;
__dst[0].__r_.__value_.__l.__size_ = v27;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v26);
v28 = __dst[0].__r_.__value_.__s.__data_;
if ( !v26 )
{
LABEL_40:
v28[v27] = 0;
v30 = cocos2d::CCDictionary::objectForKey(v49, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v30 && (unsigned int)sub_1007FEF90(v30) )
{
v31 = 0;
do
{
v32 = sub_1007FEFE0(v30, v31);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v32 + 344LL))(v32, 1);
++v31;
}
while ( v31 < (unsigned int)sub_1007FEF90(v30) );
}
v33 = *(_QWORD *)(a1 + 696);
v34 = sub_10088E820("layer_%i", v49);
v35 = (const char *)cocos2d::CCString::getCString(v34);
v36 = strlen(v35);
if ( v36 < 0xFFFFFFFFFFFFFFF8LL )
{
v37 = v36;
v50 = v33;
if ( v36 >= 0x17 )
{
v39 = 26;
if ( (v36 | 7) != 0x17 )
v39 = (v36 | 7) + 1;
v38 = (char *)operator new(v39);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v38;
__dst[0].__r_.__value_.__r.__words[0] = v39 + 1;
v20 = v51;
__dst[0].__r_.__value_.__l.__size_ = v37;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v36);
v38 = __dst[0].__r_.__value_.__s.__data_;
if ( !v36 )
goto LABEL_54;
}
memmove(v38, v35, v37);
LABEL_54:
v38[v37] = 0;
v40 = cocos2d::CCDictionary::objectForKey(v50, (char *)__dst);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
if ( v40 )
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v40 + 344LL))(v40, 1);
*(_DWORD *)(a1 + 680) = v20;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 712) + 344LL))(*(_QWORD *)(a1 + 712), 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 720) + 344LL))(*(_QWORD *)(a1 + 720), 1);
v41 = *(_QWORD *)(a1 + 728);
v42 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v41 + 352LL))(v41);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v41 + 1000LL))(v41, v42);
__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;
v43 = *(unsigned int *)(a1 + 680);
if ( v43 < 7 )
std::string::assign(
__dst,
(const std::string::value_type *)&unk_100A12D78 + *((int *)&unk_100A12D78 + v43));
v44 = *(_QWORD *)(a1 + 752);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v45 = __dst[0].__r_.__value_.__l.__data_;
else
v45 = __dst[0].__r_.__value_.__s.__data_;
(*(void (__fastcall **)(__int64, std::string::pointer))(*(_QWORD *)v44 + 928LL))(v44, v45);
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst[0].__r_.__value_.__l.__data_);
return;
}
LABEL_66:
sub_100003630();
}
}
memmove(v28, v25, v27);
goto LABEL_40;
}
}
memmove(v19, v16, v18);
goto LABEL_28;
}
}
memmove(data, CString, v8);
goto LABEL_14;
}
}