//
// SecretGame01Layer::resetGame from 0x6e5188 to 0x6e55ce (1094 bytes)
//
// 1 xrefs:
// > SecretLayer6::startGame01 @ 0x6e5602
//
// 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:24 +0000
//
int __fastcall SecretGame01Layer::resetGame(SecretGame01Layer *this)
{
int v2; // r2
int RowsForDifficulty; // r11
float v4; // s17
float v5; // s15
float v6; // s16
float v7; // s17
char *v8; // r6
_DWORD *v9; // r2
int *v10; // r6
int *v11; // r5
int v12; // r0
int v13; // t1
size_t v14; // r0
size_t i; // r3
char *v16; // r6
unsigned int v17; // r1
unsigned __int8 *v18; // r5
int v19; // r0
unsigned __int8 *v20; // r7
char *v21; // r1
int v22; // r12
unsigned __int8 *v23; // r0
unsigned __int8 *v24; // r12
char *v25; // r3
int v26; // r8
unsigned __int8 *v27; // lr
char *v28; // r8
int v29; // t1
size_t v30; // r8
unsigned int v31; // r2
char *v32; // r3
size_t v33; // r1
int v34; // r3
const char *v35; // r5
size_t v36; // r0
int v37; // r7
const char *v38; // r1
float v39; // s15
char *v40; // r0
const cocos2d::CCPoint *v41; // r6
void (__fastcall *v42)(const cocos2d::CCPoint *, _DWORD *); // r2
const char *v43; // r1
cocos2d::CCSprite *v44; // r0
int v45; // r8
void (__fastcall *v46)(int, _DWORD *); // r10
void (__fastcall *v47)(int, _DWORD *); // r2
cocos2d::CCObject *v48; // r8
float v49; // r2
cocos2d::CCEaseElasticOut *v50; // r0
float v51; // r2
cocos2d::CCAction *v52; // r0
float v53; // r1
cocos2d::CCSequence *v54; // r7
cocos2d::CCFiniteTimeAction *v55; // r0
cocos2d::CCAction *v56; // r0
void (__fastcall *v58)(cocos2d::CCObject *, _DWORD *); // [sp+Ch] [bp-78h]
float v59[2]; // [sp+18h] [bp-6Ch] BYREF
float v60[2]; // [sp+20h] [bp-64h] BYREF
char v61[8]; // [sp+28h] [bp-5Ch] BYREF
int (__fastcall *v62)(SecretGame01Layer *, cocos2d::CCObject *); // [sp+30h] [bp-54h]
int v63; // [sp+34h] [bp-50h]
_DWORD v64[2]; // [sp+38h] [bp-4Ch] BYREF
char v65; // [sp+40h] [bp-44h] BYREF
char v66[7]; // [sp+41h] [bp-43h] BYREF
char *v67; // [sp+48h] [bp-3Ch]
int v68[2]; // [sp+4Ch] [bp-38h] BYREF
cocos2d::CCSprite *v69; // [sp+54h] [bp-30h]
char v70[4]; // [sp+58h] [bp-2Ch] BYREF
unsigned int v71; // [sp+5Ch] [bp-28h]
char *v72; // [sp+60h] [bp-24h]
int v73; // [sp+64h] [bp-20h] BYREF
unsigned int v74; // [sp+68h] [bp-1Ch]
unsigned __int8 *v75; // [sp+6Ch] [bp-18h]
int v76; // [sp+70h] [bp-14h] BYREF
size_t v77; // [sp+74h] [bp-10h]
char *v78; // [sp+78h] [bp-Ch]
v2 = *((_DWORD *)this + 79);
if ( v2 )
{
v9 = *(_DWORD **)(v2 + 52);
if ( *v9 )
{
v10 = (int *)v9[3];
v11 = &v10[*v9 - 1];
while ( v10 <= v11 )
{
v13 = *v10++;
v12 = v13;
if ( !v13 )
break;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v12 + 264))(v12, 1);
}
}
}
cocos2d::CCArray::removeAllObjects(*((cocos2d::CCArray **)this + 79));
RowsForDifficulty = SecretGame01Layer::getRowsForDifficulty(this, *((_DWORD *)this + 83));
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)RowsForDifficulty);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v59);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, v59[0] * 0.5, v59[1] * 0.5);
v4 = (float)((float)RowsForDifficulty * 0.5) * 30.0;
v5 = (float)((float)(RowsForDifficulty - 1) * 0.5) * 8.0;
v6 = (float)(v4 + v60[1]) + v5;
v7 = (float)(v60[0] - v4) - v5;
SecretGame01Layer::getFrameForDifficulty((SecretGame01Layer *)&v65, (int)this, 0);
if ( (v65 & 1) != 0 )
v8 = v67;
else
v8 = v66;
*(_DWORD *)v70 = 0;
v71 = 0;
v72 = nullptr;
v14 = strlen(v8);
std::string::__init((int *)v70, v8, v14);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "_001.png", 8u);
v76 = 0;
v77 = 0;
v78 = nullptr;
std::string::__init(&v76, "_2_001.png", 0xAu);
for ( i = 0; ; i = v34 + v30 )
{
if ( (v70[0] & 1) != 0 )
{
v16 = v72;
v17 = v71;
}
else
{
v17 = (int)(unsigned __int8)v70[0] >> 1;
v16 = &v70[1];
}
if ( (v73 & 1) != 0 )
{
v18 = v75;
v19 = v74;
}
else
{
v19 = (int)(unsigned __int8)v73 >> 1;
v18 = (unsigned __int8 *)&v73 + 1;
}
if ( i > v17 || v17 - i < v19 )
break;
if ( v19 )
{
v20 = (unsigned __int8 *)&v16[i];
v21 = &v16[v17];
if ( v21 - &v16[i] >= v19 )
{
v22 = 1 - v19;
v23 = &v18[v19];
v24 = (unsigned __int8 *)&v21[v22];
LABEL_20:
while ( 1 )
{
v25 = (char *)v20;
if ( v20 == v24 )
break;
v26 = *v20++;
if ( v26 == *v18 )
{
v27 = v18;
v28 = v25;
while ( ++v27 != v23 )
{
v29 = (unsigned __int8)*++v28;
if ( v29 != *v27 )
goto LABEL_20;
}
goto LABEL_27;
}
}
}
v25 = v21;
LABEL_27:
if ( v25 == v21 )
break;
v30 = v25 - v16;
}
else
{
v30 = i;
}
if ( v30 == -1 )
break;
if ( (v73 & 1) != 0 )
v31 = v74;
else
v31 = (int)(unsigned __int8)v73 >> 1;
if ( (v76 & 1) != 0 )
{
v32 = v78;
v33 = v77;
}
else
{
v33 = (int)(unsigned __int8)v76 >> 1;
v32 = (char *)&v76 + 1;
}
std::string::replace(v70, v30, v31, v32, v33);
if ( (v76 & 1) != 0 )
v34 = v77;
else
v34 = (int)(unsigned __int8)v76 >> 1;
}
std::string::~string((int)&v76);
std::string::~string((int)&v73);
if ( (v70[0] & 1) != 0 )
v35 = v72;
else
v35 = &v70[1];
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
v36 = strlen(v35);
std::string::__init(v68, v35, v36);
std::string::~string((int)v70);
v37 = 0;
while ( v37 != RowsForDifficulty * RowsForDifficulty )
{
v39 = floorf((float)v37 / (float)RowsForDifficulty);
if ( (v65 & 1) != 0 )
v40 = v67;
else
v40 = v66;
v41 = (const cocos2d::CCPoint *)cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)v40, v38);
v42 = *(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD *))(*(_DWORD *)v41 + 480);
memset(v64, 75, 3);
v42(v41, v64);
if ( (v68[0] & 1) != 0 )
v44 = v69;
else
v44 = (cocos2d::CCSprite *)((char *)v68 + 1);
v45 = cocos2d::CCSprite::createWithSpriteFrameName(v44, v43);
(*(void (__fastcall **)(const cocos2d::CCPoint *, int, int))(*(_DWORD *)v41 + 232))(v41, v45, -1);
v46 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v45 + 92);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v64, v41);
v46(v45, v64);
v47 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v45 + 480);
memset(v64, 60, 3);
v47(v45, v64);
v62 = SecretGame01Layer::onSelectButton;
v63 = 0;
v48 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v41,
0,
(int)this,
(int)SecretGame01Layer::onSelectButton,
0);
CCMenuItemSpriteExtra::setSizeMult((int)v48, 1.2);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v48 + 36))(v48, v37);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 79), v48);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 81) + 228))(*((_DWORD *)this + 81), v48);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(v7 + 15.0) + (float)((float)(v37 % RowsForDifficulty) * 38.0),
v6 - (float)((float)(int)v39 * 38.0));
v58 = *(void (__fastcall **)(cocos2d::CCObject *, _DWORD *))(*(_DWORD *)v48 + 92);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v64, *((const cocos2d::CCPoint **)this + 81));
v58(v48, v64);
++v37;
(*(void (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v41 + 80))(v41, 1036831949);
v50 = (cocos2d::CCEaseElasticOut *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F19999A, 1.0, v49);
v52 = (cocos2d::CCAction *)cocos2d::CCEaseElasticOut::create(v50, (cocos2d::CCActionInterval *)0x3F19999A, v51);
cocos2d::CCNode::runAction(v41, v52);
}
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 81) + 500))(*((_DWORD *)this + 81), 0);
*((_DWORD *)this + 82) = 0;
v54 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create((cocos2d::CCDelayTime *)0x3F4CCCCD, v53);
v64[1] = 0;
v64[0] = SecretGame01Layer::gameStep01;
v55 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, SecretGame01Layer::gameStep01, 0);
v56 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v54, v55, 0);
cocos2d::CCNode::runAction(this, v56);
std::string::~string((int)v68);
return std::string::~string((int)&v65);
}