//
// PlayLayer::levelComplete from 0x703730 to 0x7042dc (2988 bytes)
//
// 5 xrefs:
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x704404
// > ??> @ 0xbf830
// > PlayLayer::playEndAnimationToPos @ 0x6f4118
// > PlayLayer::playPlatformerEndAnimationToPos @ 0x704570
// > ??> @ 0x1545958
//
// 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:52:04 +0000
//
__int64 __fastcall PlayLayer::levelComplete(PlayLayer *this)
{
__int64 v2; // x0
int v3; // w22
char v4; // w20
double v5; // d0
_DWORD *v6; // x0
int v7; // w0
__int64 isNetworkAvailable; // x0
float v9; // s0
cocos2d::CCSequence *v10; // x23
cocos2d::CCFiniteTimeAction *v11; // x0
cocos2d::CCAction *v12; // x0
__int64 v13; // x22
__int64 v14; // x3
_BYTE *v15; // x2
char v16; // w5
char v17; // w4
void (__fastcall *v18)(__int64, _BYTE *); // x23
cocos2d::CCSequence *v19; // x20
cocos2d::CCFiniteTimeAction *v20; // x0
cocos2d::CCAction *v21; // x0
GameLevelManager *v23; // x0
__int64 v24; // x0
__int64 v25; // x23
__int64 *v26; // x0
__int64 v27; // x1
int v28; // w2
double TempMilliTime; // d0
GameManager *v30; // x0
__int64 v31; // x0
__int64 v32; // x0
__int64 v33; // x1
unsigned int v34; // w23
cocos2d::CCArray *v35; // x25
cocos2d::CCString *v36; // x0
const char *CString; // x0
size_t v38; // x0
__int64 v39; // x24
_DWORD *v40; // x24
int v41; // w0
_DWORD *v42; // x24
int v43; // w0
__int64 v44; // x0
_DWORD *v45; // x24
int v46; // w0
_DWORD *v47; // x24
int v48; // w0
int v49; // w23
int PlayTimerMilli; // w25
int v51; // w28
int v52; // w27
_DWORD *v53; // x1
GameStatsManager *v54; // x0
GameStatsManager *v55; // x0
GameStatsManager *hasCompletedStarLevel; // x0
GameStatsManager *v57; // x0
GameStatsManager *HasDiamonds; // x0
GameStatsManager *v59; // x0
GameStatsManager *v60; // x0
GameStatsManager *v61; // x0
GameStatsManager *v62; // x0
GameStatsManager *v63; // x0
GameStatsManager *v64; // x0
GJGameLevel *v65; // x0
GameManager *v66; // x0
GameManager *v67; // x0
int v68; // w26
int v69; // w1
GJGameLevel *v70; // x28
GameManager *v71; // x0
int v72; // w1
GJGameLevel *v73; // x28
int v74; // w27
GameStatsManager *v75; // x0
__int64 v76; // x23
float v77; // s0
__int64 v78; // x24
size_t v79; // x1
int v80; // [xsp+94h] [xbp+94h]
char *v81; // [xsp+98h] [xbp+98h]
int v82; // [xsp+98h] [xbp+98h]
int v83; // [xsp+98h] [xbp+98h]
_BYTE v84[8]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v85; // [xsp+A8h] [xbp+A8h] BYREF
size_t v86; // [xsp+B0h] [xbp+B0h]
void *v87; // [xsp+B8h] [xbp+B8h]
GameManager *v88; // [xsp+C0h] [xbp+C0h] BYREF
size_t v89; // [xsp+C8h] [xbp+C8h]
void *v90; // [xsp+D0h] [xbp+D0h]
__int64 v91; // [xsp+D8h] [xbp+D8h] BYREF
size_t v92; // [xsp+E0h] [xbp+E0h]
void *v93; // [xsp+E8h] [xbp+E8h]
__int64 v94; // [xsp+F0h] [xbp+F0h] BYREF
size_t v95; // [xsp+F8h] [xbp+F8h]
void *v96; // [xsp+100h] [xbp+100h]
v2 = *((_QWORD *)this + 1862);
if ( v2 )
{
v3 = *(unsigned __int8 *)(v2 + 1840);
v4 = *(_BYTE *)(v2 + 1842);
LABEL_3:
PlayerObject::playCompleteEffect(*((PlayerObject **)this + 407), v3, v4);
PlayerObject::playCompleteEffect(*((PlayerObject **)this + 408), v3, v4);
goto LABEL_4;
}
v3 = 0;
if ( *((_BYTE *)this + 12238) )
{
v4 = 0;
goto LABEL_3;
}
LABEL_4:
v5 = *((double *)this + 1838);
if ( v5 > *((double *)this + 1839) )
*((double *)this + 1839) = v5;
v6 = *((_DWORD **)this + 242);
if ( v6[285] != 1
&& !*((_BYTE *)this + 12544)
&& !*((_BYTE *)this + 12616)
&& !*((_BYTE *)this + 14185)
&& v6[237] - v6[238] > 0
&& (!*((_BYTE *)this + 12238) || *((double *)this + 1665) < 10.0)
&& *((double *)this + 1839) < 10.0 )
{
*((_BYTE *)this + 14021) = 1;
}
*((_BYTE *)this + 13336) = 1;
*((_BYTE *)this + 1982) = 1;
(*(void (__fastcall **)(PlayLayer *, float))(*(_QWORD *)this + 1464LL))(this, 1.0);
v7 = *((unsigned __int8 *)this + 12616);
if ( *((_BYTE *)this + 12616) )
{
if ( !*((_BYTE *)this + 14021) )
goto LABEL_15;
goto LABEL_26;
}
if ( *((_BYTE *)this + 14185) )
{
if ( !*((_BYTE *)this + 14021) )
{
v7 = *((unsigned __int8 *)this + 12616);
goto LABEL_15;
}
goto LABEL_26;
}
if ( *(_DWORD *)(*((_QWORD *)this + 242) + 1140LL) == 2 )
{
GJBaseGameLayer::getCapacityString(&v91, this);
v94 = 0;
v95 = 0;
v96 = nullptr;
v25 = *((_QWORD *)this + 242);
if ( (v91 & 1) != 0 )
{
std::string::__init(&v94, v93, v92);
}
else
{
v96 = v93;
v94 = v91;
v95 = v92;
}
v26 = (__int64 *)(v25 + 1176);
if ( (__int64 *)(v25 + 1176) != &v94 )
{
if ( (v94 & 1) != 0 )
std::string::assign(v26, v96, v95);
else
std::string::assign(v26, (char *)&v94 + 1, (unsigned __int8)v94 >> 1);
}
if ( (v94 & 1) != 0 )
operator delete(v96);
if ( !*((_BYTE *)this + 12544) )
{
v27 = *((_QWORD *)this + 409);
v28 = *((_DWORD *)this + 236) / 2;
if ( v27 )
*(_DWORD *)(v27 + 432) = v28;
*(_DWORD *)(*((_QWORD *)this + 242) + 1232LL) = v28;
}
if ( (v91 & 1) != 0 )
operator delete(v93);
if ( *((_BYTE *)this + 14021) )
goto LABEL_26;
if ( *((_BYTE *)this + 12616) )
goto LABEL_17;
if ( *((_BYTE *)this + 14185) )
{
v7 = *((unsigned __int8 *)this + 12616);
goto LABEL_15;
}
}
else if ( *((_BYTE *)this + 14021) )
{
goto LABEL_26;
}
if ( *((_BYTE *)this + 14186) || *((_BYTE *)this + 12544) )
goto LABEL_14;
v34 = 0;
v35 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(*((cocos2d::CCDictionary **)this + 1573));
while ( v34 < (unsigned int)cocos2d::CCArray::count(v35) )
{
v36 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v35, v34);
CString = (const char *)cocos2d::CCString::getCString(v36);
v94 = 0;
v81 = (char *)CString;
v95 = 0;
v96 = nullptr;
v38 = strlen(CString);
v39 = *((_QWORD *)this + 1573);
std::string::__init(&v94, v81, v38);
v40 = (_DWORD *)cocos2d::CCDictionary::objectForKey(v39, &v94);
if ( (v94 & 1) != 0 )
operator delete(v96);
if ( (*(unsigned int (__fastcall **)(_DWORD *))(*(_QWORD *)v40 + 1800LL))(v40) == 31 )
{
v41 = v40[448];
switch ( v41 )
{
case 2:
v47 = *((_DWORD **)this + 242);
++v34;
v47[257] = 1;
v48 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
v47[256] = v48;
v47[255] = v48 + 1;
break;
case 3:
v45 = *((_DWORD **)this + 242);
++v34;
v45[260] = 1;
v46 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
v45[259] = v46;
v45[258] = v46 + 1;
break;
case 1:
v42 = *((_DWORD **)this + 242);
++v34;
v42[254] = 1;
v43 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
v42[253] = v43;
v42[252] = v43 + 1;
break;
default:
goto LABEL_80;
}
}
else
{
LABEL_80:
++v34;
}
}
v65 = *((GJGameLevel **)this + 242);
if ( *((_DWORD *)v65 + 285) == 2 )
{
if ( (unsigned __int8)GJGameLevel::areCoinsVerified(v65) )
{
v76 = *((_QWORD *)this + 242);
*(_BYTE *)(v76 + 784) = 1;
v77 = (float)((float)rand() * 4.6566e-10) * 1000.0;
*(_DWORD *)(v76 + 780) = (int)v77;
*(_DWORD *)(v76 + 776) = (int)v77 + 1;
if ( *((_BYTE *)this + 12744) )
{
v78 = *((_QWORD *)this + 242);
GJBaseGameLayer::getRecordString(&v94, this, 1);
if ( (*(_BYTE *)(v78 + 440) & 1) != 0 )
{
**(_BYTE **)(v78 + 456) = 0;
*(_QWORD *)(v78 + 448) = 0;
}
else
{
*(_BYTE *)(v78 + 441) = 0;
*(_BYTE *)(v78 + 440) = 0;
}
std::string::reserve((__int64 *)(v78 + 440), 0);
v79 = v95;
*(_QWORD *)(v78 + 440) = v94;
*(_QWORD *)(v78 + 448) = v79;
*(_QWORD *)(v78 + 456) = v96;
}
}
}
if ( *((_BYTE *)this + 14021) )
{
LABEL_26:
PlayLayer::onQuit((GJGameLevel **)this);
return _stack_chk_guard;
}
LABEL_14:
v7 = *((unsigned __int8 *)this + 12616);
LABEL_15:
if ( !v7 && !*((_BYTE *)this + 14185) )
{
TempMilliTime = PlayLayer::getTempMilliTime(this);
GJGameLevel::savePercentage(
*((GJGameLevel **)this + 242),
100,
*((_BYTE *)this + 12544),
*((_DWORD *)this + 3052),
(int)(TempMilliTime - *((double *)this + 1841) - *((double *)this + 1842)),
*((_BYTE *)this + 14024));
if ( *((_BYTE *)this + 12544) )
{
v30 = (GameManager *)*(unsigned int *)(*((_QWORD *)this + 242) + 1140LL);
if ( (_DWORD)v30 != 1 )
{
LABEL_66:
PlayLayer::dtCommitPlaytime(this);
PlayLayer::dtFlushCells(this);
if ( *((_BYTE *)this + 14524) )
{
v31 = *((_QWORD *)this + 243);
if ( v31 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v31 + 520LL))(v31);
*((_QWORD *)this + 243) = 0;
}
v32 = *((_QWORD *)this + 244);
if ( v32 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v32 + 520LL))(v32);
*((_QWORD *)this + 244) = 0;
}
}
if ( !*((_BYTE *)this + 12544) )
{
v33 = *((_QWORD *)this + 242);
if ( *(_DWORD *)(v33 + 1140) == 2 )
*(_BYTE *)(v33 + 960) = *((_BYTE *)this + 14628) ^ 1;
}
goto LABEL_17;
}
}
else
{
GJBaseGameLayer::getRecordString(&v85, this, 1);
v49 = GJBaseGameLayer::countCollectedUserCoins(this);
PlayTimerMilli = GJBaseGameLayer::getPlayTimerMilli(this);
if ( *((_BYTE *)this + 12238) )
{
v67 = (GameManager *)GameManager::sharedState((GameManager *)*((unsigned __int8 *)this + 12238));
*((_DWORD *)v67 + 422) = *(_DWORD *)(*((_QWORD *)this + 242) + 1144LL);
*(_DWORD *)(GameManager::sharedState(v67) + 1692) = PlayTimerMilli;
if ( *((_BYTE *)this + 1920) )
{
v68 = *((_DWORD *)this + 479);
if ( !*(_BYTE *)(*((_QWORD *)this + 409) + 430LL) )
{
v68 -= PlayTimerMilli;
*((_DWORD *)this + 479) = v68;
}
v82 = *((_DWORD *)this + 3332);
v69 = *((_DWORD *)this + 3333);
v88 = nullptr;
v89 = 0;
v90 = nullptr;
v80 = v69;
v70 = *((GJGameLevel **)this + 242);
if ( (v85 & 1) != 0 )
{
std::string::__init((__int64 *)&v88, v87, v86);
}
else
{
v90 = v87;
v88 = (GameManager *)v85;
v89 = v86;
}
GJGameLevel::saveNewScore(v70, v68, 1, v82, v80, v49);
v71 = (GameManager *)(unsigned __int8)v88;
if ( ((unsigned __int8)v88 & 1) != 0 )
operator delete(v90);
*(_DWORD *)(GameManager::sharedState(v71) + 1696) = *((_DWORD *)this + 479);
}
else
{
*(_DWORD *)(GameManager::sharedState((GameManager *)*((unsigned __int8 *)this + 1920)) + 1696) = 0;
}
v72 = *((_DWORD *)this + 3333);
v91 = 0;
v92 = 0;
v93 = nullptr;
v83 = v72;
v73 = *((GJGameLevel **)this + 242);
v74 = *((_DWORD *)this + 3332);
if ( (v85 & 1) != 0 )
{
std::string::__init(&v91, v87, v86);
}
else
{
v93 = v87;
v91 = v85;
v92 = v86;
}
GJGameLevel::saveNewScore(v73, PlayTimerMilli, 0, v74, v83, v49);
if ( (v91 & 1) != 0 )
operator delete(v93);
GJGameLevel::clearPlatformerSave(*((GJGameLevel **)this + 242));
PlayLayer::setLastSavedCheckpoint((__int64)this, nullptr);
}
else
{
v94 = 0;
v95 = 0;
v96 = nullptr;
v51 = *((_DWORD *)this + 3332);
v52 = *((_DWORD *)this + 3333);
if ( (v85 & 1) != 0 )
{
std::string::__init(&v94, v87, v86);
}
else
{
v96 = v87;
v94 = v85;
v95 = v86;
}
GJGameLevel::saveNewScore(*((GJGameLevel **)this + 242), PlayTimerMilli, 0, v51, v52, v49);
if ( (v94 & 1) != 0 )
operator delete(v96);
}
if ( (v85 & 1) != 0 )
operator delete(v87);
v30 = (GameManager *)*(unsigned int *)(*((_QWORD *)this + 242) + 1140LL);
if ( (_DWORD)v30 != 1 )
goto LABEL_95;
}
v66 = (GameManager *)GameManager::sharedState(v30);
GameManager::reportPercentageForLevel(
v66,
*(_DWORD *)(*((_QWORD *)this + 242) + 328LL) - *(_DWORD *)(*((_QWORD *)this + 242) + 332LL),
100,
*((_BYTE *)this + 12544));
LABEL_95:
if ( !*((_BYTE *)this + 12544) )
{
v53 = *((_DWORD **)this + 242);
if ( v53[285] == 2 )
goto LABEL_140;
v54 = (GameStatsManager *)(unsigned int)(v53[237] - v53[238]);
if ( (int)v54 > 0 )
{
v55 = (GameStatsManager *)GameStatsManager::sharedState(v54);
hasCompletedStarLevel = (GameStatsManager *)(unsigned __int8)GameStatsManager::hasCompletedStarLevel(
v55,
*((GJGameLevel **)this + 242));
if ( !(_BYTE)hasCompletedStarLevel )
{
hasCompletedStarLevel = (GameStatsManager *)((char *)&dword_0 + 1);
*((_BYTE *)this + 14644) = (unsigned __int8)&dword_0 + 1;
}
v57 = (GameStatsManager *)GameStatsManager::sharedState(hasCompletedStarLevel);
*((_DWORD *)this + 3662) = GameStatsManager::awardCurrencyForLevel(v57, *((GJGameLevel **)this + 242));
HasDiamonds = (GameStatsManager *)(unsigned __int8)GJGameLevel::levelHasDiamonds(*((GJGameLevel **)this + 242));
if ( (_BYTE)HasDiamonds )
{
v75 = (GameStatsManager *)GameStatsManager::sharedState(HasDiamonds);
*((_DWORD *)this + 3663) = GameStatsManager::awardDiamondsForLevel(v75, *((GJGameLevel **)this + 242));
}
v59 = (GameStatsManager *)*((unsigned int *)this + 3662);
if ( (int)v59 > 0 )
{
v60 = (GameStatsManager *)GameStatsManager::sharedState(v59);
*((_BYTE *)this + 14656) = GameStatsManager::awardSecretKey(v60);
}
}
v61 = (GameStatsManager *)GJBaseGameLayer::processItems(this);
v62 = (GameStatsManager *)GameStatsManager::sharedState(v61);
v63 = (GameStatsManager *)GameStatsManager::completedLevel(v62, *((GJGameLevel **)this + 242));
v64 = (GameStatsManager *)GameStatsManager::sharedState(v63);
GameStatsManager::checkCoinAchievement(v64, *((GJGameLevel **)this + 242));
if ( !*((_BYTE *)this + 12544) )
{
LABEL_140:
if ( !*((_BYTE *)this + 12616)
&& !*((_BYTE *)this + 12236)
&& !*((_BYTE *)this + 14185)
&& !*((_BYTE *)this + 14186) )
{
GJGameLevel::recordCompletion(*((GJGameLevel **)this + 242));
if ( (unsigned __int8)PlayLayer::tracksPercent(this) )
{
GJGameLevel::dtAppendOrder(*((_QWORD *)this + 242), *((_QWORD *)this + 242) + 1592);
*((_DWORD *)this + 3617) = 100;
}
}
}
}
goto LABEL_66;
}
LABEL_17:
PlayLayer::commitJumps(this);
isNetworkAvailable = *((_QWORD *)this + 242);
if ( (*(_BYTE *)(isNetworkAvailable + 1432) || *(_BYTE *)(isNetworkAvailable + 1433))
&& *(_DWORD *)(isNetworkAvailable + 1140) != 2 )
{
isNetworkAvailable = (unsigned int)(*(_DWORD *)(isNetworkAvailable + 932) - *(_DWORD *)(isNetworkAvailable + 936));
if ( (_DWORD)isNetworkAvailable == 1 )
{
isNetworkAvailable = PlatformToolbox::isNetworkAvailable((PlatformToolbox *)isNetworkAvailable);
if ( (_BYTE)isNetworkAvailable )
{
v23 = *((GameLevelManager **)this + 242);
if ( *((_BYTE *)v23 + 1432) )
{
v44 = GameLevelManager::sharedState(v23);
GameLevelManager::getLevelLeaderboard(v44, *((_QWORD *)this + 242), 4, 0);
v23 = *((GameLevelManager **)this + 242);
}
isNetworkAvailable = *((unsigned __int8 *)v23 + 1433);
if ( (_DWORD)isNetworkAvailable )
{
v24 = GameLevelManager::sharedState((GameLevelManager *)isNetworkAvailable);
isNetworkAvailable = GameLevelManager::getLevelLeaderboard(v24, *((_QWORD *)this + 242), 4, 1);
}
}
}
}
if ( !v3 )
{
do
{
v9 = (float)v3++;
v10 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create((cocos2d::CCDelayTime *)isNetworkAvailable, v9 * 0.05);
v11 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, PlayLayer::spawnCircle, 0);
v12 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v10, v11, 0);
isNetworkAvailable = cocos2d::CCNode::runAction(this, v12);
}
while ( v3 != 5 );
v13 = CCCircleWave::create(nullptr, 10.0, 250.0, 0.5);
*(_DWORD *)(v13 + 356) = 4;
v14 = *(_QWORD *)v13;
v15 = *((_BYTE **)this + 407);
v16 = v15[2602];
v17 = v15[2603];
*(_BYTE *)(v13 + 342) = v15[2604];
*(_BYTE *)(v13 + 340) = v16;
*(_BYTE *)(v13 + 341) = v17;
v18 = *(void (__fastcall **)(__int64, _BYTE *))(v14 + 184);
PlayLayer::getEndPosition(this, (cocos2d::CCPoint *)v84);
v18(v13, v84);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**((_QWORD **)this + 490) + 464LL))(
*((_QWORD *)this + 490),
v13,
0);
}
if ( *((_BYTE *)this + 12544) )
{
v19 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(
(cocos2d::CCDelayTime *)*((unsigned __int8 *)this + 12544),
0.1);
v20 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, PlayLayer::showCompleteText, 0);
v21 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v19, v20, 0);
cocos2d::CCNode::runAction(this, v21);
}
else
{
PlayLayer::showCompleteEffect(this);
}
return _stack_chk_guard;
}