//
// GJBaseGameLayer::resetLevelVariables from 0x9e7128 to 0x9e7bf8 (2768 bytes)
//
// 4 xrefs:
// > PlayLayer::resetLevel @ 0x711108
// > LevelEditorLayer::onStopPlaytest @ 0x78de0c
// > LevelEditorLayer::onPlaytest @ 0x796318
// > ??> @ 0xc09d0
//
// 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 12:59:00 +0000
//
__int64 __fastcall GJBaseGameLayer::resetLevelVariables(GJBaseGameLayer *this)
{
char *v2; // x21
_DWORD *v3; // x0
_QWORD **v4; // x19
__int64 v5; // x1
GameManager *v6; // x0
GameManager *v7; // x0
cocos2d::CCArray **v8; // x0
FMODAudioEngine *v9; // x0
__int64 v10; // x0
__int64 v11; // x2
__int64 v12; // x1
char *v13; // x22
__int64 v14; // x0
_BYTE *v15; // x0
_DWORD *v16; // x1
char v17; // w1
__int64 v18; // x2
char v19; // w0
_QWORD *v20; // x0
_QWORD *v21; // x19
__int64 v22; // x2
__int64 v23; // x0
_QWORD *v24; // x0
_QWORD *v25; // x19
__int64 v26; // x2
__int64 v27; // x0
__int64 v28; // x3
__int64 v29; // x2
_QWORD **v30; // x19
ShaderLayer *v31; // x0
__int64 v32; // x2
__int64 v33; // x1
__int64 v34; // x3
__int64 v35; // x2
__int64 v36; // x3
__int64 v37; // x2
__int64 v38; // x22
__int64 i; // x19
__int64 v40; // x23
char *v41; // x0
char *v42; // x2
_QWORD **v43; // x19
__int64 v44; // x22
__int64 j; // x19
__int64 v46; // x23
char *v47; // x0
char *v48; // x2
_QWORD **v49; // x19
__int64 v50; // x22
__int64 k; // x19
__int64 v52; // x23
char *v53; // x0
char *v54; // x2
_QWORD **v55; // x19
__int64 v56; // x22
__int64 m; // x19
__int64 v58; // x23
char *v59; // x0
char *v60; // x2
_QWORD **v61; // x19
__int64 v62; // x22
__int64 n; // x19
__int64 v64; // x23
char *v65; // x0
char *v66; // x2
_QWORD **v67; // x19
__int64 v68; // x23
void (__fastcall *v69)(__int64, _QWORD *); // x24
float *v70; // x0
float v71; // s0
GJGroundLayer *v72; // x23
float v73; // s0
long double v74; // q0
GJGroundLayer *v75; // x23
float v76; // s0
__int64 *v77; // x0
cocos2d::CCDirector *v78; // x0
cocos2d::CCDirector *v79; // x0
__int64 v80; // x0
__int64 v81; // x19
int v82; // w26
int v83; // w22
__int64 v84; // x24
_QWORD *v85; // x19
__int64 ii; // x25
int v87; // w21
int v88; // w1
__int64 v89; // x23
__int64 v90; // x22
_QWORD *v91; // x27
int v92; // w19
__int64 v93; // x28
__int64 v94; // x19
__int64 v95; // x3
int v97; // [xsp+7Ch] [xbp+7Ch]
_QWORD v98[2]; // [xsp+80h] [xbp+80h] BYREF
v2 = (char *)this + 1328;
v3 = *((_DWORD **)this + 409);
*((_DWORD *)this + 481) = 0;
v4 = *((_QWORD ***)this + 167);
*((_DWORD *)this + 475) = v3[88];
v5 = _stack_chk_guard;
*((_DWORD *)this + 476) = v3[89];
v98[1] = v5;
*((_DWORD *)this + 477) = v3[91];
*((_BYTE *)this + 1912) = 0;
*((_BYTE *)this + 1896) = 0;
if ( v4 )
{
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)v2,
*v4);
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)v2,
v4[1]);
operator delete(v4);
}
*((_QWORD *)this + 166) = (char *)this + 1336;
*((_QWORD *)this + 168) = 0;
*((_QWORD *)this + 167) = 0;
std::__tree>::clear((_QWORD *)this + 510);
(*(void (__fastcall **)(GJBaseGameLayer *))(*(_QWORD *)this + 1424LL))(this);
GJBaseGameLayer::unlinkAllEvents(this);
highestDeltaX = 0;
highestDeltaY = 0;
v6 = (GameManager *)GameManager::sharedState((GameManager *)&highestDeltaY);
GameManager::printGJLog(v6);
v8 = (cocos2d::CCArray **)GameManager::sharedState(v7);
v9 = (FMODAudioEngine *)GameManager::clearGJLog(v8);
v10 = FMODAudioEngine::sharedEngine(v9);
FMODAudioEngine::updateReverb(v10, 0, 0);
GJBaseGameLayer::updateBGArtSpeed((__int64)this, 0.1, 0.1);
GJBaseGameLayer::updateMGArtSpeed((__int64)this, 0.3, 0.5);
*((_BYTE *)this + 1983) = 0;
v11 = *((_QWORD *)this + 248);
v12 = *((_QWORD *)this + 249);
if ( v11 != v12 )
*((_QWORD *)this + 249) = v12 + 8 * ~((unsigned __int64)(v12 - 8 - v11) >> 3);
v13 = (char *)this + 0x2000;
GJBaseGameLayer::clearActivatedAudioTriggers(this);
GJBaseGameLayer::removeTemporaryParticles((cocos2d::CCArray **)this);
*((_DWORD *)this + 479) = 0;
*((_BYTE *)this + 1920) = 0;
GJBaseGameLayer::updateSpecialLabels(this);
*((_BYTE *)this + 13336) = 0;
v14 = *((_QWORD *)this + 409);
if ( v14 )
{
v13 = (char *)this + 0x2000;
*(_BYTE *)(*((_QWORD *)this + 269) + 1648LL) = *(_BYTE *)(v14 + 448) ^ 1;
v15 = *((_BYTE **)this + 409);
v16 = *((_DWORD **)this + 242);
*((_BYTE *)this + 1979) = v15[456];
if ( v16 )
{
v13 = (char *)this + 0x2000;
if ( v16[285] == 1 && (*((_BYTE *)this + 12238) || v16[82] - v16[83] == 22) )
*((_BYTE *)this + 1979) = 1;
}
v17 = 0;
*((_BYTE *)this + 1980) = v15[459];
v18 = *((_QWORD *)this + 407);
*((_BYTE *)this + 1981) = v15[451];
if ( !v15[449] )
v17 = v13[4046] ^ 1;
*(_BYTE *)(v18 + 3048) = v17;
v19 = 0;
if ( !*(_BYTE *)(*((_QWORD *)this + 409) + 449LL) )
v19 = v13[4046] ^ 1;
*(_BYTE *)(*((_QWORD *)this + 408) + 3048LL) = v19;
*(_BYTE *)(*((_QWORD *)this + 407) + 1369LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 450LL);
*(_BYTE *)(*((_QWORD *)this + 408) + 1369LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 450LL);
*(_BYTE *)(*((_QWORD *)this + 407) + 1370LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 460LL);
*(_BYTE *)(*((_QWORD *)this + 408) + 1370LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 460LL);
*(_BYTE *)(*((_QWORD *)this + 407) + 3053LL) = *((_BYTE *)this + 1979) ^ 1;
*(_BYTE *)(*((_QWORD *)this + 408) + 3053LL) = *((_BYTE *)this + 1979) ^ 1;
*(_BYTE *)(*((_QWORD *)this + 407) + 3054LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 462LL);
*(_BYTE *)(*((_QWORD *)this + 408) + 3054LL) = *(_BYTE *)(*((_QWORD *)this + 409) + 462LL);
}
GJBaseGameLayer::resetActiveEnterEffects(this);
GJBaseGameLayer::resetSongTriggerValues(this);
if ( *((_QWORD *)this + 137) )
{
v20 = *((_QWORD **)this + 136);
if ( v20 )
{
do
{
v21 = (_QWORD *)*v20;
operator delete(v20);
v20 = v21;
}
while ( v21 );
}
v22 = *((_QWORD *)this + 135);
v23 = 0;
*((_QWORD *)this + 136) = 0;
if ( v22 )
{
do
*(_QWORD *)(*((_QWORD *)this + 134) + 8 * v23++) = 0;
while ( v23 != v22 );
}
*((_QWORD *)this + 137) = 0;
}
if ( *((_QWORD *)this + 161) )
{
v24 = *((_QWORD **)this + 160);
if ( v24 )
{
do
{
v25 = (_QWORD *)*v24;
operator delete(v24);
v24 = v25;
}
while ( v25 );
}
v26 = *((_QWORD *)this + 159);
v27 = 0;
*((_QWORD *)this + 160) = 0;
if ( v26 )
{
do
*(_QWORD *)(*((_QWORD *)this + 158) + 8 * v27++) = 0;
while ( v27 != v26 );
}
*((_QWORD *)this + 161) = 0;
}
*((_DWORD *)this + 236) = 0;
*((_DWORD *)this + 238) = 0;
*((_DWORD *)this + 285) = 0;
*((_DWORD *)this + 240) = 0;
*((_DWORD *)this + 241) = 0;
if ( !v13[4046] )
{
v28 = *((_QWORD *)this + 1603);
v29 = *((_QWORD *)this + 1604);
if ( v28 != v29 )
*((_QWORD *)this + 1604) = v29
- 24
* (((0xAAAAAAAAAAAAAABLL * ((unsigned __int64)(v29 - 24 - v28) >> 3))
& 0x1FFFFFFFFFFFFFFFLL)
+ 1);
}
PlayerObject::releaseAllButtons(*((PlayerObject **)this + 407));
PlayerObject::releaseAllButtons(*((PlayerObject **)this + 408));
*((_QWORD *)this + 1582) = 0;
*((_BYTE *)this + 12665) = 1;
v13[4012] = 0;
GJEffectManager::resetEffects(*((GJEffectManager **)this + 269));
v30 = *((_QWORD ***)this + 147);
if ( v30 )
{
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)this + 1168,
*v30);
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)this + 1168,
v30[1]);
operator delete(v30);
}
v31 = *((ShaderLayer **)this + 1552);
*((_QWORD *)this + 148) = 0;
*((_QWORD *)this + 146) = (char *)this + 1176;
*((_QWORD *)this + 147) = 0;
if ( v31 )
{
ShaderLayer::resetAllShaders(v31);
GJBaseGameLayer::updateShaderLayer(this, 0.0);
}
GJBaseGameLayer::resetGradientLayers(this);
v32 = *((_QWORD *)this + 206);
v33 = *((_QWORD *)this + 207);
if ( v32 != v33 )
*((_QWORD *)this + 207) = v33 + 32 * ~((unsigned __int64)(v33 - 32 - v32) >> 5);
v34 = *((_QWORD *)this + 209);
v35 = *((_QWORD *)this + 210);
if ( v34 != v35 )
*((_QWORD *)this + 210) = v35
- 96
* (((0x2AAAAAAAAAAAAABLL * ((unsigned __int64)(v35 - 96 - v34) >> 5)) & 0x7FFFFFFFFFFFFFFLL)
+ 1);
v36 = *((_QWORD *)this + 212);
v37 = *((_QWORD *)this + 213);
if ( v36 != v37 )
*((_QWORD *)this + 213) = v37
- 96
* (((0x2AAAAAAAAAAAAABLL * ((unsigned __int64)(v37 - 96 - v36) >> 5)) & 0x7FFFFFFFFFFFFFFLL)
+ 1);
v38 = *((_QWORD *)this + 185);
for ( i = *((_QWORD *)this + 186); v38 != i; i = *((_QWORD *)this + 186) )
{
v40 = i - 240;
*((_QWORD *)this + 186) = i - 240;
v41 = *(char **)(i - 32);
if ( v41 )
{
v42 = *(char **)(i - 24);
if ( v41 != v42 )
*(_QWORD *)(i - 24) = &v42[4 * ~((unsigned __int64)(v42 - 4 - v41) >> 2)];
operator delete(v41);
}
v43 = *(_QWORD ***)(i - 232);
if ( v43 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v40,
*v43);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v40,
v43[1]);
operator delete(v43);
}
}
v44 = *((_QWORD *)this + 188);
for ( j = *((_QWORD *)this + 189); v44 != j; j = *((_QWORD *)this + 189) )
{
v46 = j - 240;
*((_QWORD *)this + 189) = j - 240;
v47 = *(char **)(j - 32);
if ( v47 )
{
v48 = *(char **)(j - 24);
if ( v47 != v48 )
*(_QWORD *)(j - 24) = &v48[4 * ~((unsigned __int64)(v48 - 4 - v47) >> 2)];
operator delete(v47);
}
v49 = *(_QWORD ***)(j - 232);
if ( v49 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v46,
*v49);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v46,
v49[1]);
operator delete(v49);
}
}
v50 = *((_QWORD *)this + 191);
for ( k = *((_QWORD *)this + 192); v50 != k; k = *((_QWORD *)this + 192) )
{
v52 = k - 240;
*((_QWORD *)this + 192) = k - 240;
v53 = *(char **)(k - 32);
if ( v53 )
{
v54 = *(char **)(k - 24);
if ( v53 != v54 )
*(_QWORD *)(k - 24) = &v54[4 * ~((unsigned __int64)(v54 - 4 - v53) >> 2)];
operator delete(v53);
}
v55 = *(_QWORD ***)(k - 232);
if ( v55 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v52,
*v55);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v52,
v55[1]);
operator delete(v55);
}
}
v56 = *((_QWORD *)this + 194);
for ( m = *((_QWORD *)this + 195); v56 != m; m = *((_QWORD *)this + 195) )
{
v58 = m - 240;
*((_QWORD *)this + 195) = m - 240;
v59 = *(char **)(m - 32);
if ( v59 )
{
v60 = *(char **)(m - 24);
if ( v59 != v60 )
*(_QWORD *)(m - 24) = &v60[4 * ~((unsigned __int64)(v60 - 4 - v59) >> 2)];
operator delete(v59);
}
v61 = *(_QWORD ***)(m - 232);
if ( v61 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v58,
*v61);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v58,
v61[1]);
operator delete(v61);
}
}
v62 = *((_QWORD *)this + 197);
for ( n = *((_QWORD *)this + 198); v62 != n; n = *((_QWORD *)this + 198) )
{
v64 = n - 240;
*((_QWORD *)this + 198) = n - 240;
v65 = *(char **)(n - 32);
if ( v65 )
{
v66 = *(char **)(n - 24);
if ( v65 != v66 )
*(_QWORD *)(n - 24) = &v66[4 * ~((unsigned __int64)(v66 - 4 - v65) >> 2)];
operator delete(v65);
}
v67 = *(_QWORD ***)(n - 232);
if ( v67 )
{
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v64,
*v67);
std::__tree,std::__map_value_compare,std::less,true>,std::allocator>>::destroy(
v64,
v67[1]);
operator delete(v67);
}
}
if ( *((_QWORD *)this + 203) )
sub_998DD4((_QWORD *)this + 200);
*((_BYTE *)this + 12605) = 1;
(*(void (__fastcall **)(GJBaseGameLayer *, float))(*(_QWORD *)this + 1464LL))(this, 1.0);
GJBaseGameLayer::updateMGOffsetY(this, 0.0, 0.0, 0, 0.0, -1, -1);
v68 = *((_QWORD *)this + 493);
v69 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v68 + 184LL);
v70 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v68 + 192LL))(v68);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, *v70, 0.0);
v69(v68, v98);
v71 = GJBaseGameLayer::resetCamera(this);
*(_DWORD *)(*((_QWORD *)this + 495) + 460LL) = 0;
*(_DWORD *)(*((_QWORD *)this + 496) + 460LL) = 0;
v72 = *((GJGroundLayer **)this + 495);
v73 = (*(float (__fastcall **)(GJGroundLayer *, float))(*(_QWORD *)v72 + 136LL))(v72, v71);
v74 = GJGroundLayer::scaleGround(v72, v73);
v75 = *((GJGroundLayer **)this + 496);
v76 = (*(float (__fastcall **)(GJGroundLayer *, long double))(*(_QWORD *)v75 + 136LL))(v75, v74);
GJGroundLayer::scaleGround(v75, v76);
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 495), 0.0, 0.0);
GJGroundLayer::updateShadows(*((GJGroundLayer **)this + 495));
GJGroundLayer::updateShadowXPos(*((GJGroundLayer **)this + 496), 0.0, 0.0);
GJGroundLayer::updateShadows(*((GJGroundLayer **)this + 496));
GJBaseGameLayer::togglePlayerStreakBlend((__int64)this, 1u, 0);
*((_DWORD *)this + 290) = 0;
*((_QWORD *)this + 155) = 0;
cocos2d::CCPoint::operator=((char *)this + 1248, &unk_155D2C8);
v77 = *((__int64 **)this + 495);
*((_DWORD *)this + 308) = 0;
GJGroundLayer::toggleVisible02(v77, 1u);
GJGroundLayer::toggleVisible02(*((__int64 **)this + 496), 1u);
*((_DWORD *)this + 253) = 0;
GJGameState::stopTweenAction((GJBaseGameLayer *)((char *)this + 424), 25);
*((_BYTE *)this + 672) = 0;
*((_BYTE *)this + 764) = 0;
*((_DWORD *)this + 190) = 0;
*((_DWORD *)this + 192) = 0;
*((_BYTE *)this + 12618) = *((_BYTE *)this + 12617);
*((_BYTE *)this + 12650) = 0;
GJBaseGameLayer::clearPickedUpItems((cocos2d::CCDictionary **)this);
*((_BYTE *)this + 1000) = 0;
*((_BYTE *)this + 1008) = 0;
*((_BYTE *)this + 12604) = 0;
*((_DWORD *)this + 251) = 0;
*((float *)this + 3141) = 1.0;
cocos2d::CCNode::stopActionByTag(this, 14);
*((_QWORD *)this + 122) = 0;
*((_QWORD *)this + 123) = 0;
GJBaseGameLayer::resetPlayer(this);
GJBaseGameLayer::resetSpawnChannelIndex(this);
cocos2d::CCNode::stopAllActions(*((cocos2d::CCNode **)this + 1569));
v78 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 1569) + 344LL))(
*((_QWORD *)this + 1569),
0);
v79 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v78);
cocos2d::CCDirector::getWinSize(v98, v79);
v80 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 407) + 192LL))(*((_QWORD *)this + 407));
*((float *)this + 249) = (float)(*(float *)(v80 + 4) - *((float *)v98 + 1)) + 90.0;
if ( *((_BYTE *)this + 12424) )
{
v81 = *((_QWORD *)this + 1671);
v82 = *((_DWORD *)this + 3055);
v97 = (*((_QWORD *)this + 1672) - v81) >> 3;
if ( v82 < v97 )
{
v83 = *((_DWORD *)this + 3056);
if ( v82 <= v83 )
{
v84 = 8LL * v82;
v85 = *(_QWORD **)(v81 + v84);
if ( !v85 )
goto LABEL_100;
LABEL_84:
for ( ii = (v85[1] - *v85) >> 3; ; LODWORD(ii) = -1 )
{
v87 = *((_DWORD *)this + 3057);
if ( (int)ii > v87 )
{
v88 = *((_DWORD *)this + 3058);
if ( v87 <= v88 )
{
v89 = 8LL * v87;
v90 = 4LL * v87;
while ( 1 )
{
v91 = *(_QWORD **)(*v85 + v89);
if ( v91 )
{
v92 = *(_DWORD *)(**(_QWORD **)(*((_QWORD *)this + 1692) + v84) + v90);
if ( v92 > 0 )
{
v93 = 0;
v94 = 8 * ((unsigned int)(v92 - 1) + 1LL);
do
{
v95 = *(_QWORD *)(*v91 + v93);
v93 += 8;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v95 + 1312LL))(v95, 1);
}
while ( v93 != v94 );
v88 = *((_DWORD *)this + 3058);
}
}
++v87;
v89 += 8;
v90 += 4;
if ( v88 < v87 || (int)ii <= v87 )
break;
v85 = *(_QWORD **)(*((_QWORD *)this + 1671) + v84);
}
v83 = *((_DWORD *)this + 3056);
}
}
++v82;
v84 += 8;
if ( v83 < v82 || v97 <= v82 )
break;
v85 = *(_QWORD **)(*((_QWORD *)this + 1671) + v84);
if ( v85 )
goto LABEL_84;
LABEL_100:
;
}
}
}
}
GJBaseGameLayer::toggleDualMode(this, nullptr, 0, nullptr, 0);
return _stack_chk_guard;
}