//
// SecretRewardsLayer::switchToOpenedState from 0xa615e8 to 0xa61708 (288 bytes)
//
// 6 xrefs:
// > SecretRewardsLayer::onSpecialItem @ 0xa61920
// > SecretRewardsLayer::onSelectItem @ 0xa61fac
// > SecretRewardsLayer::init @ 0xa62f04
// > SecretRewardsLayer::init @ 0xa63de4
// > SecretRewardsLayer::generateChestItems @ 0xa6a768
// > ??> @ 0xa8b40
//
// 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 SecretRewardsLayer::switchToOpenedState(SecretRewardsLayer *a1, CCMenuItemSpriteExtra *a2)
{
GJChestSprite *v3; // x19
__int64 v4; // x0
unsigned int *v5; // x1
char *v6; // x20
__int64 v7; // x0
char *v8; // x24
__int64 *i; // x19
__int64 v10; // x2
_BYTE v11[8]; // [xsp+50h] [xbp+50h] BYREF
v3 = (GJChestSprite *)a2->getNormalImage(a2);
GJChestSprite::switchToState(v3, Opened, 1);
v4 = (__int64)v3->getChildren(v3);
if ( v4 )
{
v5 = *(unsigned int **)(v4 + 56);
if ( *v5 )
{
v6 = *((char **)v5 + 2);
v7 = 8LL * *v5 - 8;
v8 = &v6[v7];
if ( v6 <= &v6[v7] )
{
for ( i = *(__int64 **)v6; *(_QWORD *)v6; i = *(__int64 **)v6 )
{
v6 += 8;
(*(void (__fastcall **)(__int64 *, __int64))(*i + 896))(i, 100);
v10 = *i;
memset(v11, 150, 3);
(*(void (__fastcall **)(__int64 *, _BYTE *))(v10 + 944))(i, v11);
if ( v8 < v6 )
break;
}
}
}
}
a2->setEnabled(a2, 0);
}