//
// SecretRewardsLayer::switchToOpenedState from 0x1403d6ef0 to 0x1403d6fc9 (217 bytes)
//
// 8 xrefs:
// > SecretRewardsLayer::init @ 0x1403d36e9
// > SecretRewardsLayer::init @ 0x1403d3e24
// > SecretRewardsLayer::generateChestItems @ 0x1403d6061
// > SecretRewardsLayer::onSelectItem @ 0x1403d656a
// > SecretRewardsLayer::onSpecialItem @ 0x1403d6e10
// > ??> @ 0x14069c6a4
// > ??> @ 0x14069c6d8
// > ??> @ 0x1406d7d6c
//
// 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; // rbx
__int64 v4; // rax
__int64 v5; // rdx
unsigned int *v6; // rbx
__int64 v7; // rax
__int64 *v8; // rbx
__int64 *i; // rsi
__int64 v10; // rdi
void (__fastcall **v11)(__int64, SecretRewardsLayer **); // rax
SecretRewardsLayer *v12; // [rsp+30h] [rbp+8h] BYREF
v12 = a1;
v3 = (GJChestSprite *)a2->getNormalImage(a2);
GJChestSprite::switchToState(v3, Opened, 1);
v4 = (__int64)v3->getChildren(v3);
if ( v4 )
{
v6 = *(unsigned int **)(v4 + 56);
v7 = *v6;
if ( (_DWORD)v7 )
{
v8 = *((__int64 **)v6 + 2);
for ( i = &v8[v7 - 1]; v8 <= i; ++v8 )
{
v10 = *v8;
if ( !*v8 )
break;
LOBYTE(v5) = 100;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v10 + 320) + 40LL))(v10 + 320, v5);
v11 = *(void (__fastcall ***)(__int64, SecretRewardsLayer **))(v10 + 320);
LOWORD(v12) = -26986;
BYTE2(v12) = -106;
(*v11)(v10 + 320, &v12);
}
}
}
a2->setEnabled(a2, 0);
}