//
// SecretRewardsLayer::createSecondaryLayer from 0x14056ad10 to 0x14056b16d (1117 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::onChestType @ 0x14056ab4d
// > ??> @ 0x14092c63c
//
// 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:19 +0000
//
__int64 __fastcall SecretRewardsLayer::createSecondaryLayer(__int64 *a1, int a2)
{
__int64 v3; // rcx
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rcx
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rdx
_QWORD *v11; // rdi
__int64 v12; // rbx
__int64 v13; // rax
void (__fastcall **v14)(__int64, __int64); // rbx
__int64 v15; // rax
int i; // esi
struct cocos2d::CCSprite *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rdx
struct cocos2d::CCLabelBMFont *v23; // rax
__int64 v24; // rcx
__int64 *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
int ChestItems; // eax
__int64 v29; // rdx
char *v30; // rax
__int64 v31; // rcx
__int64 v32; // rcx
cocos2d::CCDirector *v33; // rax
float ScreenBottom; // xmm0_4
__int64 v35; // rbx
__int64 v36; // rax
__int64 v37; // rcx
cocos2d::CCDirector *v38; // rax
float ScreenTop; // xmm6_4
__int64 v40; // rcx
cocos2d::CCDirector *v41; // rax
float ScreenRight; // xmm0_4
__int64 v43; // rax
_BYTE v45[16]; // [rsp+30h] [rbp-68h] BYREF
float v46; // [rsp+A0h] [rbp+8h] BYREF
float v47; // [rsp+A4h] [rbp+Ch]
char v48; // [rsp+B0h] [rbp+18h] BYREF
float v49; // [rsp+B4h] [rbp+1Ch]
char v50; // [rsp+B8h] [rbp+20h] BYREF
v3 = a1[54];
if ( v3 )
{
a1[69] = 0;
a1[56] = 0;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 512LL))(v3);
a1[54] = 0;
}
v5 = cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v5, &v46);
v6 = cocos2d::CCLayer::create();
v7 = *a1;
a1[54] = v6;
(*(void (__fastcall **)(__int64 *, __int64))(v7 + 464))(a1, v6);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v45, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v8);
LOBYTE(v10) = 75;
v11 = (_QWORD *)v9;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v9 + 320) + 40LL))(v9 + 320, v10);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v48, 370.0, 255.0);
(*(void (__fastcall **)(_QWORD *, char *))(*v11 + 312LL))(v11, &v48);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1[54] + 456LL))(a1[54], v11, 0xFFFFFFFFLL);
v12 = *v11;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, v46 * 0.5, v47 * 0.5);
(*(void (__fastcall **)(_QWORD *, __int64))(v12 + 184))(v11, v13);
v14 = (void (__fastcall **)(__int64, __int64))v11[40];
v15 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(a1[70] + 320) + 8LL))(a1[70] + 320);
(*v14)((__int64)(v11 + 40), v15);
for ( i = 0; i < 2; ++i )
{
v17 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1[54] + 456LL))(
a1[54],
v17,
0xFFFFFFFFLL);
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, 0.5, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v18 + 288))(v17, v19);
v20 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v45,
(float)((float)((float)i * 100.0) + (float)((float)i * 100.0)) + (float)((float)(v46 * 0.5) - 100.0),
(float)((float)(v49 * 0.5) + (float)(v47 * 0.5)) - 2.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v20 + 184))(v17, v21);
(**((void (__fastcall ***)(__int64, void *))v17 + 40))((__int64)v17 + 320, &unk_140704624);
LOBYTE(v22) = 75;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v17 + 40) + 40LL))((__int64)v17 + 320, v22);
}
v23 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
v24 = a1[54];
a1[56] = (__int64)v23;
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v24 + 464LL))(v24, v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1[56] + 160LL))(a1[56]);
v25 = (__int64 *)a1[56];
v26 = *v25;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v50,
v46 * 0.5,
(float)((float)(v49 * 0.5) + (float)(v47 * 0.5)) + 17.0);
(*(void (__fastcall **)(__int64 *, __int64))(v26 + 184))(v25, v27);
SecretRewardsLayer::updateUnlockedLabel(a1);
ChestItems = SecretRewardsLayer::generateChestItems(a1, (unsigned int)a2);
v30 = BoomScrollLayer::create(ChestItems, v29, a2 <= 5, 0, 0);
v31 = a1[54];
a1[69] = (__int64)v30;
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v31 + 464LL))(v31, v30);
v33 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v32);
ScreenBottom = cocos2d::CCDirector::getScreenBottom(v33);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, v46 * 0.5, ScreenBottom + 10.0);
v35 = a1[69];
cocos2d::CCPoint::operator=(v35 + 572, v36);
BoomScrollLayer::updateDots(v35);
*(_DWORD *)(a1[69] + 540) = 1063675494;
*(_BYTE *)(a1[69] + 608) = 1;
v38 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v37);
ScreenTop = cocos2d::CCDirector::getScreenTop(v38);
v41 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v40);
ScreenRight = cocos2d::CCDirector::getScreenRight(v41);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v45, 0.0, 0.0, ScreenRight, ScreenTop);
return cocos2d::CCRect::operator=(a1[69] + 612, v43);
}