//
// BrowseSmartTemplateLayer::goToPage from 0x9df580 to 0x9df6d8 (344 bytes)
//
// 5 xrefs:
// > BrowseSmartTemplateLayer::onClick @ 0x9df71c
// > BrowseSmartTemplateLayer::onClick @ 0x9df740
// > BrowseSmartTemplateLayer::init @ 0x9dfac4
// > BrowseSmartKeyLayer::init @ 0x9e0b98
// > ??> @ 0x5cdd8
//
// 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 BrowseSmartTemplateLayer::goToPage(BrowseSmartTemplateLayer *a1, int a2)
{
unsigned int i; // w23
unsigned int v4; // w19
_BOOL4 v5; // w22
cocos2d::CCArray *v6; // x21
__int64 v7; // x20
bool v8; // cf
unsigned int v9; // w1
a1->m_page = a2;
if ( a2 < 0 )
{
a1->m_page = cocos2d::CCArray::count(a1->m_pages) - 1;
}
else if ( a2 > (unsigned int)cocos2d::CCArray::count(a1->m_pages) - 1 )
{
a1->m_page = 0;
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(a1->m_pages); ++i )
{
v4 = 0;
v5 = a1->m_page == i;
v6 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(a1->m_pages, i);
while ( 1 )
{
v8 = v4 >= (unsigned int)cocos2d::CCArray::count(v6);
v9 = v4++;
if ( v8 )
break;
v7 = cocos2d::CCArray::objectAtIndex(v6, v9);
(*(void (__fastcall **)(__int64, _BOOL4))(*(_QWORD *)v7 + 328LL))(v7, v5);
(*(void (__fastcall **)(__int64, _BOOL4))(*(_QWORD *)v7 + 1040LL))(v7, v5);
}
}
if ( (unsigned int)cocos2d::CCArray::count(a1->m_pages) <= 1 )
{
a1->m_prevPageBtn->setVisible(a1->m_prevPageBtn, 0);
a1->m_nextPageBtn->setVisible(a1->m_nextPageBtn, 0);
}
else
{
BrowseSmartTemplateLayer::updateDots(a1);
}
}