//
// BrowseSmartTemplateLayer::goToPage from 0x1405f09a0 to 0x1405f0b0e (366 bytes)
//
// 7 xrefs:
// > BrowseSmartTemplateLayer::init @ 0x1405efe3f
// > BrowseSmartTemplateLayer::onClick @ 0x1405f0edc
// > BrowseSmartTemplateLayer::onClick @ 0x1405f0ef1
// > BrowseSmartKeyLayer::init @ 0x1405f1534
// > ??> @ 0x1408e3110
// > ??> @ 0x1408e3150
// > ??> @ 0x14092f21c
//
// 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 11:35:05 +0000
//
unsigned int __fastcall BrowseSmartTemplateLayer::goToPage(__int64 a1, int a2)
{
cocos2d::CCArray *v3; // rcx
unsigned int i; // ebp
bool v5; // r15
cocos2d::CCArray *v6; // r14
unsigned int j; // esi
struct cocos2d::CCObject *v8; // rdi
*(_DWORD *)(a1 + 680) = a2;
v3 = *(cocos2d::CCArray **)(a1 + 672);
if ( a2 >= 0 )
{
if ( *(_DWORD *)(a1 + 680) > cocos2d::CCArray::count(v3) - 1 )
*(_DWORD *)(a1 + 680) = 0;
}
else
{
*(_DWORD *)(a1 + 680) = cocos2d::CCArray::count(v3) - 1;
}
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672)); ++i )
{
v5 = *(_DWORD *)(a1 + 680) == i;
v6 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 672), i);
for ( j = 0; j < cocos2d::CCArray::count(v6); ++j )
{
v8 = cocos2d::CCArray::objectAtIndex(v6, j);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v8 + 336LL))(v8, v5);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v8 + 936LL))(v8, v5);
}
}
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 672)) > 1 )
return BrowseSmartTemplateLayer::updateDots(a1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 696) + 336LL))(*(_QWORD *)(a1 + 696), 0);
return (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 688) + 336LL))(*(_QWORD *)(a1 + 688), 0);
}