//
// ShardsPage::goToPage from 0x1004c76e0 to 0x1004c7815 (309 bytes)
//
// 2 xrefs:
// > ShardsPage::init @ 0x1004c72e7
// > ShardsPage::onSwitchPage @ 0x1004c76cf
//
// 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 ShardsPage::goToPage(ShardsPage *a1, int a2)
{
signed int v2; // eax
ShardsPage *v3; // rcx
intptr_t i; // r15
ShardsPage *v5; // r13
cocos2d::CCObject *v6; // rax
cocos2d::CCObject_vtbl *v7; // rax
void (__cdecl *v8)(cocos2d::CCObject *__hidden); // rbx
unsigned __int64 v9; // r14
ShardsPage *v10; // r14
cocos2d::CCSprite *m_tierSprite; // r14
cocos2d::CCSpriteFrameCache *v12; // rax
const char *v13; // rsi
cocos2d::CCSpriteFrame *v14; // rax
__int64 v15; // [rsp-40h] [rbp-40h]
if ( (unsigned int)a2 <= 3 && a1->m_page != a2 )
{
a1->m_page = a2;
v2 = cocos2d::CCDictionary::count(a1->m_pages);
v3 = a1;
if ( v2 > 0 )
{
v15 = (unsigned int)v2;
for ( i = 0; i != v15; ++i )
{
v5 = v3;
v6 = cocos2d::CCDictionary::objectForKey(v3->m_pages, i);
if ( v6 )
{
v7 = v6[1].__vftable;
if ( LODWORD(v7->copyWithZone) )
{
v8 = v7->~CCObject_0;
v9 = (unsigned __int64)v8 + 8 * LODWORD(v7->copyWithZone) - 8;
do
{
if ( !*(_QWORD *)v8 )
break;
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)v8 + 328LL))(*(_QWORD *)v8, i == a2);
v8 = (void (__cdecl *)(cocos2d::CCObject *__hidden))((char *)v8 + 8);
}
while ( (unsigned __int64)v8 <= v9 );
}
}
v3 = v5;
}
}
v10 = v3;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))v3->m_prevButton->setVisible)(v3->m_prevButton, a2 != 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))v10->m_nextButton->setVisible)(v10->m_nextButton, a2 != 3);
m_tierSprite = v10->m_tierSprite;
v12 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v13 = "tier1Icon_001.png";
if ( a2 >= 2 )
v13 = "tier2Icon_001.png";
v14 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v12, v13);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_tierSprite->setDisplayFrame)(
m_tierSprite,
v14);
}
}