//
// SecretRewardsLayer::createSecondaryLayer from 0x6cfae4 to 0x6cfdbc (728 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::moveToSecondaryLayer @ 0x6cfe64
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:57:02 +0000
//
int __fastcall SecretRewardsLayer::createSecondaryLayer(SecretRewardsLayer *this, GJChestSprite *a2)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLayer *WinSize; // r0
int v6; // r0
int v7; // r3
int v8; // r6
void (__fastcall *v9)(int, _BYTE *); // r7
void (__fastcall *v10)(int, int); // r7
int v11; // r0
const char *v12; // r1
int i; // r7
int v14; // r6
const char *v15; // r2
int v16; // r0
int v17; // r6
void (__fastcall *v18)(int, _BYTE *); // r10
cocos2d::CCObject *ChestItems; // r0
unsigned int v20; // r0
cocos2d::CCDirector *v21; // r0
unsigned int v22; // r6
float v23; // s17
cocos2d::CCDirector *v24; // r0
float v25; // r0
cocos2d::CCDirector *v26; // r0
int v27; // r4
cocos2d::CCDirector *v28; // r0
cocos2d::CCDirector *ScreenRight; // r6
cocos2d::CCDirector *v30; // r0
float v31; // r0
void (__fastcall *v33)(int, _BYTE *); // [sp+Ch] [bp-30h]
void (__fastcall *v34)(int, _BYTE *); // [sp+Ch] [bp-30h]
float v35; // [sp+14h] [bp-28h] BYREF
float v36; // [sp+18h] [bp-24h]
_BYTE v37[4]; // [sp+1Ch] [bp-20h] BYREF
float v38; // [sp+20h] [bp-1Ch]
_BYTE v39[16]; // [sp+24h] [bp-18h] BYREF
v4 = *((cocos2d::CCDirector **)this + 82);
if ( v4 )
{
*((_DWORD *)this + 98) = 0;
*((_DWORD *)this + 84) = 0;
v4 = (cocos2d::CCDirector *)(*(int (__fastcall **)(cocos2d::CCDirector *))(*(_DWORD *)v4 + 260))(v4);
*((_DWORD *)this + 82) = 0;
}
cocos2d::CCDirector::sharedDirector(v4);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v35);
v6 = cocos2d::CCLayer::create(WinSize);
v7 = *(_DWORD *)this;
*((_DWORD *)this + 82) = v6;
(*(void (__fastcall **)(SecretRewardsLayer *, int))(v7 + 228))(this, v6);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square05.png", v39);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 456))(v8, 75);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v37, 370.0, 255.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v8 + 160))(v8, v37);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 82) + 232))(*((_DWORD *)this + 82), v8, -1);
v9 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v35 * 0.5, v36 * 0.5);
v9(v8, v39);
v10 = *(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 480);
v11 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 99) + 472))(*((_DWORD *)this + 99));
v10(v8, v11);
for ( i = 0; ; i = 1 )
{
v14 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"chain_01_001.png", v12);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 82) + 232))(*((_DWORD *)this + 82), v14, -1);
v33 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v14 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, 0.5, 0.0);
v33(v14, v39);
v34 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v14 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v39,
(float)((float)(v35 * 0.5) - 100.0) + (float)((float)((float)i * 100.0) + (float)((float)i * 100.0)),
(float)((float)(v38 * 0.5) + (float)(v36 * 0.5)) - 2.0);
v34(v14, v39);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v14 + 480))(v14, &unk_BEFE4C);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v14 + 456))(v14, 75);
if ( i )
break;
}
v16 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)" ", "goldFont.fnt", v15);
*((_DWORD *)this + 84) = v16;
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 82) + 228))(*((_DWORD *)this + 82), v16);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 84) + 80))(*((_DWORD *)this + 84), 1058642330);
v17 = *((_DWORD *)this + 84);
v18 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v17 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v35 * 0.5, (float)((float)(v38 * 0.5) + (float)(v36 * 0.5)) + 17.0);
v18(v17, v39);
SecretRewardsLayer::updateUnlockedLabel(this);
ChestItems = SecretRewardsLayer::generateChestItems(this, a2);
v20 = BoomScrollLayer::create(ChestItems, 0, (int)a2 <= 5, nullptr, 0);
*((_DWORD *)this + 98) = v20;
v21 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, unsigned int))(**((_DWORD **)this + 82) + 228))(
*((_DWORD *)this + 82),
v20);
v22 = *((_DWORD *)this + 98);
v23 = v35 * 0.5;
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v25 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v24));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v23, v25 + 10.0);
v26 = (cocos2d::CCDirector *)BoomScrollLayer::setPagesIndicatorPosition(v22, (int)v39);
*(_DWORD *)(*((_DWORD *)this + 98) + 416) = 1063675494;
*(_BYTE *)(*((_DWORD *)this + 98) + 472) = i;
v27 = *((_DWORD *)this + 98);
v28 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v26);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v28);
v30 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
v31 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v30));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, 0.0, 0.0, *(float *)&ScreenRight, v31);
return cocos2d::CCRect::operator=(v27 + 476, v39);
}