//
// SecretRewardsLayer::createSecondaryLayer from 0xba188c to 0xba1c84 (1016 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::moveToSecondaryLayer @ 0xba1d6c
// > ??> @ 0x6e608
//
// This function is hookable on this platform (idp: arm, 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 13:02:47 +0000
//
__int64 __fastcall SecretRewardsLayer::createSecondaryLayer(SecretRewardsLayer *this, signed int a2)
{
cocos2d::CCDirector *v4; // x0
__int64 v5; // x1
cocos2d::CCDirector *v6; // x0
cocos2d::CCLayer *WinSize; // x0
int v8; // w23
__int64 v9; // x0
__int64 v10; // x20
void (__fastcall *v11)(__int64, _BYTE *); // x24
void (__fastcall *v12)(__int64, __int64); // x24
__int64 v13; // x0
const char *v14; // x1
__int64 v15; // x20
void (__fastcall *v16)(__int64, _BYTE *); // x24
void (__fastcall *v17)(__int64, _BYTE *); // x24
const char *v18; // x2
__int64 v19; // x0
__int64 v20; // x20
void (__fastcall *v21)(__int64, _BYTE *); // x24
cocos2d::CCObject *ChestItems; // x0
__int64 v23; // x0
cocos2d::CCDirector *v24; // x0
cocos2d::CCArray **v25; // x20
float v26; // s8
cocos2d::CCDirector *v27; // x0
float v28; // s0
cocos2d::CCDirector *v29; // x0
__int64 v30; // x19
cocos2d::CCDirector *v31; // x0
cocos2d::CCDirector *ScreenRight; // x0
float v33; // s0
cocos2d::CCDirector *v34; // x0
float v35; // s0
float v37; // [xsp+90h] [xbp+90h]
__int64 v38; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v39[4]; // [xsp+B0h] [xbp+B0h] BYREF
float v40; // [xsp+B4h] [xbp+B4h]
_BYTE v41[16]; // [xsp+B8h] [xbp+B8h] BYREF
v4 = (cocos2d::CCDirector *)_stack_chk_guard;
v5 = *((_QWORD *)this + 54);
if ( v5 )
{
*((_QWORD *)this + 69) = 0;
*((_QWORD *)this + 56) = 0;
v4 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 520LL))(v5);
*((_QWORD *)this + 54) = 0;
}
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize(&v38, v6);
v8 = 0;
v9 = cocos2d::CCLayer::create(WinSize);
*((_QWORD *)this + 54) = v9;
(*(void (__fastcall **)(SecretRewardsLayer *, __int64))(*(_QWORD *)this + 456LL))(this, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v41, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v41);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 912LL))(v10, 75);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v39, 370.0, 255.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v10 + 320LL))(v10, v39);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 54) + 464LL))(
*((_QWORD *)this + 54),
v10,
0xFFFFFFFFLL);
v11 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v10 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v41, *(float *)&v38 * 0.5, *((float *)&v38 + 1) * 0.5);
v11(v10, v41);
v12 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 960LL);
v13 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 70) + 944LL))(*((_QWORD *)this + 70));
v12(v10, v13);
while ( 1 )
{
v15 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"chain_01_001.png", v14);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 54) + 464LL))(
*((_QWORD *)this + 54),
v15,
0xFFFFFFFFLL);
v16 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v15 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v41, 0.5, 0.0);
v16(v15, v41);
v17 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v41,
(float)((float)(*(float *)&v38 * 0.5) + -100.0) + (float)((float)((float)v8 * 100.0) * 2.0),
(float)((float)(v40 * 0.5) + (float)(*((float *)&v38 + 1) * 0.5)) - 2.0);
v17(v15, v41);
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v15 + 960LL))(v15, &dword_1194AC0[6]);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v15 + 912LL))(v15, 75);
if ( v8 )
break;
v8 = 1;
}
v19 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)&byte_11E1A70, "goldFont.fnt", v18);
*((_QWORD *)this + 56) = v19;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 54) + 456LL))(*((_QWORD *)this + 54), v19);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 56) + 160LL))(*((_QWORD *)this + 56), 0.6);
v20 = *((_QWORD *)this + 56);
v21 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v41,
*(float *)&v38 * 0.5,
(float)((float)(v40 * 0.5) + (float)(*((float *)&v38 + 1) * 0.5)) + 17.0);
v21(v20, v41);
SecretRewardsLayer::updateUnlockedLabel(this);
ChestItems = SecretRewardsLayer::generateChestItems(this, a2);
v23 = BoomScrollLayer::create(ChestItems, 0, a2 <= 5, nullptr, 0);
*((_QWORD *)this + 69) = v23;
v24 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 54) + 456LL))(
*((_QWORD *)this + 54),
v23);
v25 = *((cocos2d::CCArray ***)this + 69);
v26 = *(float *)&v38 * 0.5;
v27 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v24);
cocos2d::CCDirector::getScreenBottom(v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v41, v26, v28 + 10.0);
BoomScrollLayer::setPagesIndicatorPosition(v25, (__int64)v41);
*(_DWORD *)(*((_QWORD *)this + 69) + 540LL) = 1063675494;
v29 = *((cocos2d::CCDirector **)this + 69);
*((_BYTE *)v29 + 608) = v8;
v30 = *((_QWORD *)this + 69);
v31 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v29);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v31);
v37 = v33;
v34 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
cocos2d::CCDirector::getScreenTop(v34);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v41, 0.0, 0.0, v37, v35);
cocos2d::CCRect::operator=(v30 + 612, v41);
return _stack_chk_guard;
}