//
// SecretGame01Layer::resetGame from 0xbc6e88 to 0xbc7530 (1704 bytes)
//
// 4 xrefs:
// > SecretLayer6::startGame01 @ 0xbc754c
// > ??> @ 0x9d9c0
// > SecretGame01Layer::scaleOutGame @ 0xbc4f04
// > ??> @ 0x1544598
//
// 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:03:32 +0000
//
__int64 __fastcall SecretGame01Layer::resetGame(SecretGame01Layer *this)
{
cocos2d::CCArray *v2; // x2
unsigned int *v3; // x1
char *v4; // x20
cocos2d::CCDirector *RowsForDifficulty; // x0
int v6; // w26
cocos2d::CCDirector *v7; // x0
float v8; // s9
float v9; // s8
float v10; // s11
float v11; // s10
size_t v12; // x0
unsigned __int8 v13; // w1
size_t v14; // x0
unsigned __int8 v15; // w4
unsigned __int8 v16; // w2
char *v17; // x7
size_t v18; // x1
int v19; // w5
unsigned __int8 *v20; // x8
signed __int64 v21; // x3
size_t v22; // x22
size_t v23; // x2
char *v24; // x3
size_t v25; // x4
size_t v26; // x2
const char *v27; // x1
size_t v28; // x0
int v29; // w22
cocos2d::CCSprite *v30; // x0
int v31; // w19
cocos2d::CCNode *v32; // x20
void (__fastcall *v33)(cocos2d::CCNode *, __int64 *); // x3
cocos2d::CCSprite *v34; // x0
__int64 v35; // x24
void (__fastcall *v36)(__int64, __int64 *); // x27
void (__fastcall *v37)(__int64, __int64 *); // x3
cocos2d::CCObject *v38; // x24
void (__fastcall *v39)(cocos2d::CCObject *, __int64 *); // x19
cocos2d::CCScaleTo *v40; // x0
cocos2d::CCEaseElasticOut *v41; // x0
cocos2d::CCActionInterval *v42; // x1
cocos2d::CCAction *v43; // x0
cocos2d::CCDelayTime *v44; // x0
cocos2d::CCSequence *v45; // x19
cocos2d::CCFiniteTimeAction *v46; // x0
cocos2d::CCAction *v47; // x0
char *v49; // x0
char *v50; // x1
char *v51; // x12
char *v52; // x0
unsigned __int8 *v53; // x3
char *v54; // x22
char *v55; // x14
unsigned __int8 *v56; // x6
char *v57; // x9
int v58; // t1
__int64 *v59; // x19
__int64 *v60; // x20
__int64 v61; // x0
char *v62; // [xsp+A8h] [xbp+A8h]
int v63; // [xsp+B4h] [xbp+B4h]
__int64 v64; // [xsp+C0h] [xbp+C0h] BYREF
float v65[2]; // [xsp+C8h] [xbp+C8h] BYREF
char v66[8]; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v67; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v68[2]; // [xsp+E0h] [xbp+E0h] BYREF
void *v69; // [xsp+F0h] [xbp+F0h]
__int64 v70[2]; // [xsp+F8h] [xbp+F8h] BYREF
void *v71; // [xsp+108h] [xbp+108h]
__int64 v72; // [xsp+110h] [xbp+110h] BYREF
size_t v73; // [xsp+118h] [xbp+118h]
void *v74; // [xsp+120h] [xbp+120h]
__int64 v75; // [xsp+128h] [xbp+128h] BYREF
size_t v76; // [xsp+130h] [xbp+130h]
void *v77; // [xsp+138h] [xbp+138h]
__int64 v78; // [xsp+140h] [xbp+140h] BYREF
size_t v79; // [xsp+148h] [xbp+148h]
void *v80; // [xsp+150h] [xbp+150h]
v2 = *((cocos2d::CCArray **)this + 51);
if ( v2 )
{
v3 = *((unsigned int **)v2 + 7);
if ( *v3 )
{
v59 = *((__int64 **)v3 + 2);
v60 = &v59[*v3 - 1];
if ( v59 <= v60 )
{
v61 = *v59;
if ( *v59 )
{
do
{
++v59;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v61 + 528LL))(v61, 1);
if ( v60 < v59 )
break;
v61 = *v59;
}
while ( *v59 );
v2 = *((cocos2d::CCArray **)this + 51);
}
}
}
}
cocos2d::CCArray::removeAllObjects(v2);
v4 = (char *)v68 + 1;
RowsForDifficulty = (cocos2d::CCDirector *)SecretGame01Layer::getRowsForDifficulty(this);
v6 = (int)RowsForDifficulty;
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(RowsForDifficulty);
v63 = v6 * v6;
cocos2d::CCDirector::getWinSize(&v64, v7);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, *(float *)&v64 * 0.5, *((float *)&v64 + 1) * 0.5);
v8 = (float)v6 * 0.5;
v9 = (float)(v6 - 1) * 0.5;
v10 = (float)(v65[1] + (float)(v8 * 30.0)) + (float)(v9 * 8.0);
v11 = (float)(v65[0] - (float)(v8 * 30.0)) - (float)(v9 * 8.0);
SecretGame01Layer::getFrameForDifficulty(0, v68);
if ( (v68[0] & 1) != 0 )
v4 = (char *)v69;
v72 = 0;
v73 = 0;
v74 = nullptr;
v12 = strlen(v4);
std::string::__init(&v72, v4, v12);
v75 = 0;
v76 = 0;
v77 = nullptr;
std::string::__init(&v75, "_001.png", 8u);
v78 = 0;
v79 = 0;
v80 = nullptr;
std::string::__init(&v78, "_2_001.png", 0xAu);
v13 = v72;
v14 = 0;
v15 = v78;
if ( (v72 & 1) == 0 )
goto LABEL_18;
LABEL_6:
v16 = v75;
v17 = (char *)v74;
v18 = v73;
v19 = v75 & 1;
if ( (v75 & 1) != 0 )
{
LABEL_7:
v20 = (unsigned __int8 *)v77;
v21 = v76;
if ( v14 <= v18 )
goto LABEL_8;
}
else
{
while ( 1 )
{
v21 = v16 >> 1;
v20 = (unsigned __int8 *)&v75 + 1;
if ( v14 > v18 )
break;
LABEL_8:
if ( v18 - v14 < v21 )
break;
v22 = v14;
if ( v21 )
{
v49 = &v17[v14];
v50 = &v17[v18];
if ( v21 > v50 - v49 )
break;
v51 = &v50[1 - v21];
if ( v49 == v51 )
break;
v52 = v49 + 1;
v53 = &v20[v21];
do
{
v54 = v52 - 1;
v55 = v52;
if ( (unsigned __int8)*(v52 - 1) == *v20 )
{
v56 = v20;
v57 = v52 - 1;
while ( ++v56 != v53 )
{
v58 = (unsigned __int8)*++v57;
if ( v58 != *v56 )
goto LABEL_54;
}
if ( v50 != v54 )
{
v22 = v54 - v17;
goto LABEL_10;
}
goto LABEL_20;
}
LABEL_54:
++v52;
}
while ( v51 != v55 );
if ( (v15 & 1) == 0 )
goto LABEL_21;
goto LABEL_48;
}
LABEL_10:
if ( v22 == -1 )
break;
v23 = v16 >> 1;
if ( v19 )
v23 = v76;
if ( (v15 & 1) != 0 )
{
v24 = (char *)v80;
v25 = v79;
}
else
{
v25 = v15 >> 1;
v24 = (char *)&v78 + 1;
}
std::string::replace(&v72, v22, v23, v24, v25);
v15 = v78;
v26 = (unsigned __int8)v78 >> 1;
if ( (v78 & 1) != 0 )
v26 = v79;
v13 = v72;
v14 = v26 + v22;
if ( (v72 & 1) != 0 )
goto LABEL_6;
LABEL_18:
v16 = v75;
v18 = v13 >> 1;
v17 = (char *)&v72 + 1;
v19 = v75 & 1;
if ( (v75 & 1) != 0 )
goto LABEL_7;
}
}
LABEL_20:
if ( (v15 & 1) != 0 )
{
LABEL_48:
operator delete(v80);
v19 = v75 & 1;
}
LABEL_21:
if ( v19 )
operator delete(v77);
v27 = (char *)&v72 + 1;
if ( (v72 & 1) != 0 )
v27 = (const char *)v74;
v62 = (char *)v27;
v70[0] = 0;
v70[1] = 0;
v71 = nullptr;
v28 = strlen(v27);
std::string::__init(v70, v62, v28);
if ( (v72 & 1) != 0 )
operator delete(v74);
v29 = 0;
if ( v63 )
{
do
{
v30 = (cocos2d::CCSprite *)((char *)v68 + 1);
v31 = vcvtms_s32_f32((float)v29 / (float)v6);
if ( (v68[0] & 1) != 0 )
v30 = (cocos2d::CCSprite *)v69;
v32 = (cocos2d::CCNode *)cocos2d::CCSprite::createWithSpriteFrameName(v30, (const char *)LOBYTE(v68[0]));
v33 = *(void (__fastcall **)(cocos2d::CCNode *, __int64 *))(*(_QWORD *)v32 + 960LL);
memset(&v67, 75, 3);
v33(v32, &v67);
v34 = (cocos2d::CCSprite *)((char *)v70 + 1);
if ( (v70[0] & 1) != 0 )
v34 = (cocos2d::CCSprite *)v71;
v35 = cocos2d::CCSprite::createWithSpriteFrameName(v34, (const char *)LOBYTE(v70[0]));
(*(void (__fastcall **)(cocos2d::CCNode *, __int64, __int64))(*(_QWORD *)v32 + 464LL))(v32, v35, 0xFFFFFFFFLL);
v36 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v35 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v67, v32, (const cocos2d::CCPoint *)&unk_155E960);
v36(v35, &v67);
v37 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v35 + 960LL);
memset(&v67, 60, 3);
v37(v35, &v67);
v38 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(__int64)v32,
0,
(__int64)this,
(__int64)SecretGame01Layer::onSelectButton,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v38, 1.2);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v38 + 72LL))(v38, (unsigned int)v29);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 51), v38);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 53) + 456LL))(
*((_QWORD *)this + 53),
v38);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v66,
(float)(v11 + 15.0) + (float)((float)(v29 % v6) * 38.0),
v10 - (float)((float)v31 * 38.0));
v39 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v38 + 184LL);
cocos2d::CCNode::convertToNodeSpace(&v67, *((cocos2d::CCNode **)this + 53), (const cocos2d::CCPoint *)v66);
v39(v38, &v67);
++v29;
v40 = (cocos2d::CCScaleTo *)(*(__int64 (__fastcall **)(cocos2d::CCNode *, float))(*(_QWORD *)v32 + 160LL))(
v32,
0.1);
v41 = (cocos2d::CCEaseElasticOut *)cocos2d::CCScaleTo::create(v40, 0.6, 1.0);
v43 = (cocos2d::CCAction *)cocos2d::CCEaseElasticOut::create(v41, v42, 0.6);
cocos2d::CCNode::runAction(v32, v43);
}
while ( v29 != v63 );
}
v44 = (cocos2d::CCDelayTime *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 53) + 1000LL))(
*((_QWORD *)this + 53),
0);
*((_DWORD *)this + 108) = 0;
v45 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v44, 0.8);
v46 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, SecretGame01Layer::gameStep01, 0);
v47 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v45, v46, 0);
cocos2d::CCNode::runAction(this, v47);
if ( (v70[0] & 1) != 0 )
operator delete(v71);
if ( (v68[0] & 1) != 0 )
operator delete(v69);
return _stack_chk_guard;
}