//
// InfoLayer::setupPageInfo from 0x1007b26a0 to 0x1007b2b74 (1236 bytes)
//
// 2 xrefs:
// > sub_1007B2C50 @ 0x1007b2c5c
// > ??> @ 0x1009929f8
//
// 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
//
char __fastcall InfoLayer::setupPageInfo(InfoLayer *a1, __int64 a2, const char *a3, double a4)
{
unsigned int v4; // eax
const char *v5; // r14
size_t v6; // rax
size_t v7; // r15
char *v8; // rbx
size_t v9; // r12
char *v10; // rax
unsigned __int64 v11; // r15
__int64 v12; // r14
unsigned __int64 v13; // rsi
char *v14; // rdx
unsigned __int64 v15; // rcx
bool v16; // zf
unsigned __int64 v17; // r12
char *v18; // r13
size_t v19; // r12
char *v20; // rbx
char v21; // al
const char *v22; // r12
size_t v23; // r15
size_t v24; // rax
size_t v25; // r13
char *v26; // rbx
size_t v27; // r15
cocos2d::CCObject *v28; // rax
__int64 v29; // rbx
char *v30; // rax
unsigned __int64 v31; // rsi
__int64 v32; // r8
char *v33; // rdx
unsigned __int64 v34; // rdi
cocos2d::CCString *v35; // rax
InfoLayer *v36; // rbx
cocos2d::CCString *v37; // rax
cocos2d::CCString *v38; // rax
int m_itemCount; // ecx
int m_pageStartIdx; // esi
int v41; // edx
char *v42; // rax
const char *CString; // rax
unsigned __int64 v46; // [rsp+8h] [rbp-88h]
cocos2d::CCObject *v47; // [rsp+10h] [rbp-80h]
_QWORD v48[2]; // [rsp+18h] [rbp-78h] BYREF
void *__p; // [rsp+28h] [rbp-68h]
char __s[8]; // [rsp+30h] [rbp-60h] BYREF
size_t v51; // [rsp+38h] [rbp-58h]
void *v52; // [rsp+40h] [rbp-50h]
__int64 v53; // [rsp+48h] [rbp-48h]
size_t __dst; // [rsp+50h] [rbp-40h] BYREF
unsigned __int64 v55; // [rsp+58h] [rbp-38h]
void *v56; // [rsp+60h] [rbp-30h]
LOBYTE(v4) = InfoLayer::isCorrect(a1, a3);
if ( !(_BYTE)v4 )
return v4;
if ( (*(_BYTE *)a2 & 1) != 0 )
v5 = *(const char **)(a2 + 16);
else
v5 = (const char *)(a2 + 1);
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v7 = v6;
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
v56 = v8;
__dst = v9 + 1;
v55 = v7;
goto LABEL_12;
}
LOBYTE(__dst) = 2 * v6;
v8 = (char *)&__dst + 1;
if ( v6 )
LABEL_12:
memmove(v8, v5, v7);
v8[v7] = 0;
v47 = sub_10071F9E0();
if ( (__dst & 1) != 0 )
{
v10 = (char *)v56;
v11 = v55;
v12 = -1;
if ( !v55 )
goto LABEL_23;
LABEL_17:
v13 = v11;
v14 = v10;
while ( *v14 != 58 )
{
++v14;
if ( !--v13 )
{
v14 = &v10[v11];
break;
}
}
v12 = -1;
if ( v14 != &v10[v11] )
v12 = v14 - v10;
goto LABEL_23;
}
v11 = (unsigned __int8)__dst >> 1;
v10 = (char *)&__dst + 1;
v12 = -1;
if ( (unsigned __int8)__dst >> 1 )
goto LABEL_17;
LABEL_23:
v15 = 0;
v46 = v11;
do
{
if ( (__dst & 1) != 0 )
{
v17 = v55;
if ( v55 < v15 )
LABEL_77:
sub_1000547C0();
v18 = (char *)v56;
}
else
{
v17 = (unsigned __int8)__dst >> 1;
v18 = (char *)&__dst + 1;
if ( v15 > v17 )
goto LABEL_77;
}
v19 = v17 - v15;
if ( v19 >= v12 - v15 )
v19 = v12 - v15;
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v53 = v15;
if ( v19 >= 0x17 )
{
v23 = (v19 | 7) + 1;
if ( (v19 | 7) == 0x17 )
v23 = 26;
v20 = (char *)operator new(v23);
v52 = v20;
*(_QWORD *)__s = v23 | 1;
v51 = v19;
v11 = v46;
}
else
{
__s[0] = 2 * v19;
v20 = &__s[1];
if ( !v19 )
{
__s[1] = 0;
v21 = __s[0];
if ( (__s[0] & 1) == 0 )
goto LABEL_36;
goto LABEL_43;
}
}
memmove(v20, &v18[v53], v19);
v20[v19] = 0;
v21 = __s[0];
if ( (__s[0] & 1) == 0 )
{
LABEL_36:
if ( !v21 && v53 == v11 )
goto LABEL_56;
v22 = &__s[1];
goto LABEL_46;
}
LABEL_43:
if ( !v51 && v53 == v11 )
goto LABEL_56;
v22 = (const char *)v52;
LABEL_46:
v24 = strlen(v22);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v25 = v24;
if ( v24 >= 0x17 )
{
v27 = (v24 | 7) + 1;
if ( (v24 | 7) == 0x17 )
v27 = 26;
v26 = (char *)operator new(v27);
__p = v26;
v48[0] = v27 | 1;
v48[1] = v25;
v11 = v46;
LABEL_53:
memmove(v26, v22, v25);
goto LABEL_54;
}
LOBYTE(v48[0]) = 2 * v24;
v26 = (char *)v48 + 1;
if ( v24 )
goto LABEL_53;
LABEL_54:
v26[v25] = 0;
v28 = sub_1007AB360((__int64)v48, a4);
sub_10071FCD0((__int64)v47, v28);
if ( (v48[0] & 1) != 0 )
operator delete(__p);
LABEL_56:
v29 = -1;
if ( v12 == -1 )
goto LABEL_57;
if ( (__dst & 1) != 0 )
{
v30 = (char *)v56;
v31 = v55;
v32 = v12 + 1;
v53 = v12 + 1;
if ( v55 <= v12 + 1 )
goto LABEL_57;
}
else
{
v31 = (unsigned __int8)__dst >> 1;
v30 = (char *)&__dst + 1;
v32 = v12 + 1;
v53 = v12 + 1;
if ( v31 <= v12 + 1 )
goto LABEL_57;
}
v33 = &v30[v32];
v34 = v31 + ~v12;
while ( *v33 != 58 )
{
++v33;
if ( !--v34 )
{
v33 = &v30[v31];
break;
}
}
v29 = v33 - v30;
if ( v33 == &v30[v31] )
v29 = -1;
LABEL_57:
if ( (__s[0] & 1) != 0 )
operator delete(v52);
v16 = v12 == -1;
v12 = v29;
v15 = v53;
}
while ( !v16 );
if ( (__dst & 1) != 0 )
operator delete(v56);
v4 = sub_100720070((__int64)v47);
if ( v4 >= 3 )
{
v35 = (cocos2d::CCString *)sub_1007200C0((__int64)v47, 0);
v36 = a1;
a1->m_itemCount = cocos2d::CCString::intValue(v35);
v37 = (cocos2d::CCString *)sub_1007200C0((__int64)v47, 1u);
a1->m_pageStartIdx = cocos2d::CCString::intValue(v37);
v38 = (cocos2d::CCString *)sub_1007200C0((__int64)v47, 2u);
a1->m_pageEndIdx = cocos2d::CCString::intValue(v38);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))v36->m_leftArrow->setVisible)(
v36->m_leftArrow,
v36->m_pageStartIdx != 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))v36->m_rightArrow->setVisible)(
v36->m_rightArrow,
v36->m_pageStartIdx + v36->m_pageEndIdx < v36->m_itemCount);
m_itemCount = a1->m_itemCount;
m_pageStartIdx = a1->m_pageStartIdx;
v41 = m_pageStartIdx + a1->m_pageEndIdx;
if ( v41 >= m_itemCount )
v41 = a1->m_itemCount;
v42 = sub_1007AB580("%i to %i of %i", m_pageStartIdx + 1, v41, m_itemCount);
CString = cocos2d::CCString::getCString((cocos2d::CCString *)v42);
LOBYTE(v4) = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_pageLabel->setString)(
a1->m_pageLabel,
CString);
}
return v4;
}