//
// GJOptionsLayer::goToPage from 0x4ab384 to 0x4ab52a (422 bytes)
//
// 3 xrefs:
// > GJOptionsLayer::init @ 0x4ab766
// > GJOptionsLayer::onNextPage @ 0x4ab808
// > GJOptionsLayer::onPrevPage @ 0x4ab812
//
// 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 GJOptionsLayer::goToPage(GJOptionsLayer *a1, int a2)
{
int m_maxPage; // r6
int m_page; // r1
cocos2d::CCDictionary *m_values; // r8
char *v6; // r0
cocos2d::CCArray *v7; // r10
cocos2d::CCDictionary *v8; // r8
char *v9; // r0
int v10; // r8
unsigned int i; // r8
int v12; // r0
cocos2d::CCDictionary *v13; // r8
char *v14; // r0
cocos2d::CCArray *v15; // r10
cocos2d::CCDictionary *v16; // r8
char *v17; // r0
int v18; // r7
unsigned int j; // r8
int v20; // r0
CCMenuItemSpriteExtra *m_prevButton; // r0
std::string v22; // [sp+8h] [bp-8h] BYREF
if ( a2 > a1->m_maxPage )
{
m_maxPage = 0;
}
else
{
m_maxPage = a2 & ~(a2 >> 31);
if ( a2 < 0 )
m_maxPage = a1->m_maxPage;
}
m_page = a1->m_page;
if ( m_page != m_maxPage )
{
m_values = a1->m_values;
v6 = (char *)GJOptionsLayer::objectKey(a1, m_page);
sub_776584((int)&v22, v6);
v7 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(m_values, &v22);
sub_774008(&v22);
if ( v7 )
{
for ( i = 0; i < cocos2d::CCArray::count(v7); ++i )
{
v12 = cocos2d::CCArray::objectAtIndex(v7, i);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v12 + 164))(v12, 0);
}
}
v8 = a1->m_values;
v9 = (char *)GJOptionsLayer::layerKey(a1, a1->m_page);
sub_776584((int)&v22, v9);
v10 = cocos2d::CCDictionary::objectForKey(v8, &v22);
sub_774008(&v22);
if ( v10 )
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v10 + 164))(v10, 0);
v13 = a1->m_values;
v14 = (char *)GJOptionsLayer::objectKey(a1, m_maxPage);
sub_776584((int)&v22, v14);
v15 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v13, &v22);
sub_774008(&v22);
if ( v15 )
{
for ( j = 0; j < cocos2d::CCArray::count(v15); ++j )
{
v20 = cocos2d::CCArray::objectAtIndex(v15, j);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v20 + 164))(v20, 1);
}
}
v16 = a1->m_values;
v17 = (char *)GJOptionsLayer::layerKey(a1, m_maxPage);
sub_776584((int)&v22, v17);
v18 = cocos2d::CCDictionary::objectForKey(v16, &v22);
sub_774008(&v22);
if ( v18 )
(*(void (__fastcall **)(int, int))(*(_DWORD *)v18 + 164))(v18, 1);
m_prevButton = a1->m_prevButton;
a1->m_page = m_maxPage;
m_prevButton->setVisible(m_prevButton, m_maxPage > 0);
a1->m_nextButton->setVisible(a1->m_nextButton, a1->m_page < a1->m_maxPage);
}
}