//
// SecretRewardsLayer::switchToOpenedState from 0x14056c960 to 0x14056ca39 (217 bytes)
//
// 8 xrefs:
// > SecretRewardsLayer::init @ 0x1405690cc
// > SecretRewardsLayer::init @ 0x140569834
// > SecretRewardsLayer::generateChestItems @ 0x14056baad
// > SecretRewardsLayer::onSelectItem @ 0x14056bfc8
// > SecretRewardsLayer::onSpecialItem @ 0x14056c885
// > ??> @ 0x1408dbc28
// > ??> @ 0x1408dbc5c
// > ??> @ 0x14092c684
//
// 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:34:20 +0000
//
__int64 __fastcall SecretRewardsLayer::switchToOpenedState(__int64 a1, __int64 a2)
{
_DWORD *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, __int64 *); // rax
__int64 v13; // [rsp+30h] [rbp+8h] BYREF
v13 = a1;
v3 = (_DWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 952LL))(a2);
GJChestSprite::switchToState(v3, 4, 1);
v4 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v3 + 480LL))(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, __int64 *))(v10 + 320);
LOWORD(v13) = -26986;
BYTE2(v13) = -106;
(*v11)(v10 + 320, &v13);
}
}
}
return (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 936LL))(a2, 0);
}