//
// TopArtistsLayer::setupPageInfo from 0x1001a504c to 0x1001a52b0 (612 bytes)
//
// 2 xrefs:
// > sub_1001A5380 @ 0x1001a5384
// > ??> @ 0x1007adba0
//
// 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 TopArtistsLayer::setupPageInfo(TopArtistsLayer *a1, char *a2)
{
_QWORD *v3; // x0
__int64 v4; // x20
std::string *p_str; // x8
std::string::size_type size; // x22
std::string *v7; // x9
std::string::size_type v8; // x11
std::string *v9; // x10
__int64 v10; // x8
__int64 v11; // x23
std::string::size_type v12; // x21
std::string *v13; // x1
__int64 v14; // x0
__int64 v15; // x25
bool v16; // zf
std::string::size_type v17; // x11
std::string *v18; // x8
_BYTE *v19; // x9
_BYTE *v20; // x10
std::string::size_type v21; // x11
__int64 v22; // x8
cocos2d::CCString *v23; // x0
cocos2d::CCString *v24; // x0
cocos2d::CCString *v25; // x0
std::string __str; // [xsp+8h] [xbp-88h] BYREF
std::allocator __a[8]; // [xsp+20h] [xbp-70h] BYREF
char v28; // [xsp+37h] [xbp-59h]
std::string v29; // [xsp+38h] [xbp-58h] BYREF
if ( a2[23] < 0 )
a2 = *(char **)a2;
v3 = sub_100009900(&__str, a2);
v4 = sub_10024A15C(v3);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
else
size = __str.__r_.__value_.__l.__size_;
if ( size )
{
v7 = (std::string *)((char *)p_str + size);
v8 = size;
v9 = p_str;
while ( v9->__r_.__value_.__s.__data_[0] != 58 )
{
v9 = (std::string *)((char *)v9 + 1);
if ( !--v8 )
{
v9 = (std::string *)((char *)p_str + size);
break;
}
}
v10 = (char *)v9 - (char *)p_str;
if ( v9 == v7 )
v11 = -1;
else
v11 = v10;
}
else
{
v11 = -1;
}
v12 = 0;
do
{
std::string::basic_string(&v29, &__str, v12, v11 - v12, __a);
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v12 == size && !v29.__r_.__value_.__l.__size_ )
goto LABEL_28;
v13 = (std::string *)v29.__r_.__value_.__r.__words[0];
}
else
{
if ( v12 == size && !*((_BYTE *)&v29.__r_.__value_.__s + 23) )
goto LABEL_28;
v13 = &v29;
}
sub_100009900(__a, (char *)v13);
v14 = sub_100268E48(__a);
sub_10024A2D0(v4, v14);
if ( v28 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
LABEL_28:
if ( v11 == -1 )
goto LABEL_29;
v12 = v11 + 1;
v17 = __str.__r_.__value_.__l.__size_;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &__str;
else
v18 = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v17 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( v17 <= v12 )
{
LABEL_29:
v15 = -1;
}
else
{
v19 = (char *)v18 + v17;
v20 = (char *)v18 + v12;
v21 = ~v11 + v17;
while ( *v20 != 58 )
{
++v20;
if ( !--v21 )
{
v20 = v19;
break;
}
}
v22 = v20 - (_BYTE *)v18;
if ( v20 == v19 )
v15 = -1;
else
v15 = v22;
}
if ( SHIBYTE(v29.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v29.__r_.__value_.__l.__data_);
v16 = v11 == -1;
v11 = v15;
}
while ( !v16 );
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (unsigned int)sub_10024A36C(v4) >= 3 )
{
v23 = (cocos2d::CCString *)sub_10024A388(v4, 0);
a1->m_itemCount = cocos2d::CCString::intValue(v23);
v24 = (cocos2d::CCString *)sub_10024A388(v4, 1);
a1->m_pageStartIdx = cocos2d::CCString::intValue(v24);
v25 = (cocos2d::CCString *)sub_10024A388(v4, 2);
a1->m_pageEndIdx = cocos2d::CCString::intValue(v25);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_prevButton->setVisible)(
a1->m_prevButton,
a1->m_pageStartIdx != 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_nextButton->setVisible)(
a1->m_nextButton,
a1->m_pageEndIdx + a1->m_pageStartIdx < a1->m_itemCount);
TopArtistsLayer::updateLevelsLabel(a1);
}
}