// // GameLevelManager::saveLevel from 0x706a48 to 0x7071f0 (1960 bytes) // // 8 xrefs: // > LevelInfoLayer::downloadLevel @ 0x6d789c // > GameLevelManager::gotoLevelPage @ 0x707294 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x707cfc // > GameLevelManager::processOnDownloadLevelCompleted @ 0x707f50 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x7081c4 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x70820c // > GameLevelManager::processOnDownloadLevelCompleted @ 0x70824c // > @ 0x871c8 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // void GameLevelManager::saveLevel(GameLevelManager *a1, GJGameLevel *a2) { _BOOL4 m_gauntletLevel; // w25 _BOOL4 v5; // w24 GJGameLevel *SavedLevel; // x20 int random; // w2 cocos2d::CCDictionary *m_onlineLevels; // x20 char *LevelKey; // x0 _DWORD *v10; // x19 char *v11; // x0 int v12; // w21 float v13; // s0 int v14; // w21 float v15; // s0 int v16; // w21 float v17; // s0 int v18; // w21 int v19; // w0 float v20; // s0 char *v21; // x0 int NormalPercent; // w0 int v23; // w28 float v24; // s0 int v25; // w28 int v26; // w0 int m_bestTime; // w5 int m_ticksTime; // w4 int m_clicksTime; // w3 int v30; // w2 int m_coinsPoints; // w2 int m_bestPoints; // w5 int m_ticksPoints; // w4 bool m_savedPoints; // w0 int m_platformerSeed; // w2 int m_cbsOverride; // w1 _BOOL4 m_lowDetailModeToggled; // w0 int m_levelIndex; // w0 int m_levelFolder; // w0 size_t v40; // x2 int v41; // w2 _DWORD *v42; // x4 char *v43; // x0 char *v44; // x0 int v45; // w20 int v46; // w0 cocos2d::CCDictionary *m_dailyLevels; // x20 cocos2d::CCString *v48; // x0 char *CString; // x0 unsigned int *v50; // x19 int v51; // w1 cocos2d::CCDictionary *m_gauntletLevels; // x20 cocos2d::CCString *v53; // x0 char *v54; // x0 unsigned int *v55; // x19 char *v56; // x0 unsigned int *v57; // x1 int v58; // w2 unsigned int *v59; // x4 int v60; // w1 unsigned int *v61; // x1 int v62; // w2 unsigned int *v63; // x5 int v64; // w1 unsigned int *v65; // x19 unsigned __int64 v66; // [xsp+70h] [xbp+70h] __int64 v67; // [xsp+78h] [xbp+78h] _DWORD *v68; // [xsp+80h] [xbp+80h] _DWORD *v69; // [xsp+88h] [xbp+88h] int v70; // [xsp+88h] [xbp+88h] int v71; // [xsp+88h] [xbp+88h] void *v72; // [xsp+A8h] [xbp+A8h] BYREF void *v73; // [xsp+B0h] [xbp+B0h] BYREF m_gauntletLevel = a2->m_gauntletLevel; v5 = a2->m_dailyID.random - a2->m_dailyID.seed > 0; SavedLevel = GameLevelManager::getSavedLevel(a1, a2); if ( !SavedLevel || (v5 || m_gauntletLevel) && SavedLevel->m_levelID.random - SavedLevel->m_levelID.seed != a2->m_levelID.random - a2->m_levelID.seed ) { LABEL_4: if ( !v5 ) goto LABEL_5; LABEL_32: m_dailyLevels = a1->m_dailyLevels; v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i", (const char *)(unsigned int)(a2->m_dailyID.random - a2->m_dailyID.seed)); CString = (char *)cocos2d::CCString::getCString(v48); sub_D153B8((int)&v73, CString); cocos2d::CCDictionary::setObject((int)m_dailyLevels, a2); v10 = v73; v11 = (char *)v73 - 24; if ( (char *)v73 - 24 == (char *)&qword_124B6B0 ) return; if ( &pthread_create ) { v50 = (unsigned int *)((char *)v73 - 8); do v51 = __ldaxr(v50); while ( __stlxr(v51 - 1, v50) ); goto LABEL_41; } goto LABEL_74; } v12 = SavedLevel->m_attempts.random - SavedLevel->m_attempts.seed; a2->m_attempts.value = v12; v13 = (float)((float)rand() * 4.6566e-10) * 1000.0; a2->m_attempts.seed = (int)v13; a2->m_attempts.random = v12 + (int)v13; v14 = SavedLevel->m_jumps.random - SavedLevel->m_jumps.seed; a2->m_jumps.value = v14; v15 = (float)((float)rand() * 4.6566e-10) * 1000.0; a2->m_jumps.seed = (int)v15; a2->m_jumps.random = v14 + (int)v15; v16 = SavedLevel->m_clicks.random - SavedLevel->m_clicks.seed; a2->m_clicks.value = v16; v17 = (float)((float)rand() * 4.6566e-10) * 1000.0; a2->m_clicks.seed = (int)v17; a2->m_clicks.random = v16 + (int)v17; v18 = SavedLevel->m_attemptTime.random - SavedLevel->m_attemptTime.seed; a2->m_attemptTime.value = v18; v19 = rand(); a2->m_isChkValid = SavedLevel->m_isChkValid; v20 = (float)((float)v19 * 4.6566e-10) * 1000.0; a2->m_attemptTime.seed = (int)v20; a2->m_attemptTime.random = v18 + (int)v20; a2->m_chk = SavedLevel->m_chk; sub_D18D28(&v73, &SavedLevel->m_personalBests); sub_D18EA8(&a2->m_personalBests, &v73); v21 = (char *)v73 - 24; if ( (char *)v73 - 24 != (char *)&qword_124B6B0 ) { if ( &pthread_create ) { v61 = (unsigned int *)((char *)v73 - 8); do v62 = __ldaxr(v61); while ( __stlxr(v62 - 1, v61) ); } else { v62 = *((_DWORD *)v73 - 2); *((_DWORD *)v73 - 2) = v62 - 1; } if ( v62 <= 0 ) operator delete(v21); } NormalPercent = GJGameLevel::getNormalPercent(SavedLevel); GJGameLevel::setNormalPercent(a2, NormalPercent); a2->m_practicePercent = SavedLevel->m_practicePercent; v23 = SavedLevel->m_orbCompletion.random - SavedLevel->m_orbCompletion.seed; a2->m_orbCompletion.value = v23; v24 = (float)((float)rand() * 4.6566e-10) * 1000.0; a2->m_orbCompletion.seed = (int)v24; a2->m_orbCompletion.random = v23 + (int)v24; v25 = SavedLevel->m_newNormalPercent2.random - SavedLevel->m_newNormalPercent2.seed; a2->m_newNormalPercent2.value = v25; v26 = rand(); m_bestTime = SavedLevel->m_bestTime; m_ticksTime = SavedLevel->m_ticksTime; m_clicksTime = SavedLevel->m_clicksTime; a2->m_coinsTime = SavedLevel->m_coinsTime; a2->m_bestTime = m_bestTime; a2->m_ticksTime = m_ticksTime; a2->m_clicksTime = m_clicksTime; v30 = (int)(float)((float)((float)v26 * 4.6566e-10) * 1000.0); a2->m_newNormalPercent2.seed = v30; a2->m_newNormalPercent2.random = v25 + v30; sub_D18EA8(&a2->m_inputsTime, &SavedLevel->m_inputsTime); m_coinsPoints = SavedLevel->m_coinsPoints; m_bestPoints = SavedLevel->m_bestPoints; m_ticksPoints = SavedLevel->m_ticksPoints; a2->m_clicksPoints = SavedLevel->m_clicksPoints; a2->m_coinsPoints = m_coinsPoints; a2->m_bestPoints = m_bestPoints; a2->m_ticksPoints = m_ticksPoints; sub_D18EA8(&a2->m_inputsPoints, &SavedLevel->m_inputsPoints); m_savedPoints = SavedLevel->m_savedPoints; m_platformerSeed = SavedLevel->m_platformerSeed; a2->m_savedTime = SavedLevel->m_savedTime; a2->m_savedPoints = m_savedPoints; m_cbsOverride = SavedLevel->m_cbsOverride; m_lowDetailModeToggled = SavedLevel->m_lowDetailModeToggled; a2->m_platformerSeed = m_platformerSeed; a2->m_cbsOverride = m_cbsOverride; if ( m_lowDetailModeToggled ) goto LABEL_10; if ( GJGameLevel::getNormalPercent(SavedLevel) > 0 ) { LOBYTE(m_lowDetailModeToggled) = SavedLevel->m_lowDetailModeToggled; LABEL_10: a2->m_lowDetailModeToggled = m_lowDetailModeToggled; } m_levelIndex = SavedLevel->m_levelIndex; if ( m_levelIndex > a2->m_levelIndex ) a2->m_levelIndex = m_levelIndex; if ( SavedLevel->m_levelFavorited ) a2->m_levelFavorited = 1; m_levelFolder = SavedLevel->m_levelFolder; if ( m_levelFolder > 0 ) a2->m_levelFolder = m_levelFolder; if ( SavedLevel->m_gauntletLevel2 ) a2->m_gauntletLevel2 = 1; sub_D18D28(&v72, &a2->m_creatorName); sub_D153B8((int)&v73, &byte_F10E40); v68 = v72; v69 = v73; v66 = *((_QWORD *)v72 - 3); if ( *((_QWORD *)v73 - 3) > v66 ) v40 = *((_QWORD *)v72 - 3); else v40 = *((_QWORD *)v73 - 3); v67 = *((_QWORD *)v73 - 3); v41 = memcmp(v72, v73, v40); v42 = v68; if ( !v41 ) { v41 = 0x7FFFFFFF; if ( (__int64)(v66 - v67) <= 0x7FFFFFFF ) { if ( (__int64)(v66 - v67) >= (__int64)0xFFFFFFFF80000000LL ) v41 = v66 - v67; else v41 = 0x80000000; } } v43 = (char *)(v69 - 6); if ( v69 - 6 != (_DWORD *)&qword_124B6B0 ) { if ( &pthread_create ) { v63 = v69 - 2; do v64 = __ldaxr(v63); while ( __stlxr(v64 - 1, v63) ); } else { v64 = *(v69 - 2); *(v69 - 2) = v64 - 1; } if ( v64 <= 0 ) { v71 = v41; operator delete(v43); v42 = v72; v41 = v71; } else { v42 = v72; } } v44 = (char *)(v42 - 6); if ( v42 - 6 == (_DWORD *)&qword_124B6B0 ) goto LABEL_29; if ( &pthread_create ) { v59 = v42 - 2; do v60 = __ldaxr(v59); while ( __stlxr(v60 - 1, v59) ); } else { v60 = *(v42 - 2); *(v42 - 2) = v60 - 1; } if ( v60 > 0 ) { LABEL_29: if ( v41 ) goto LABEL_30; } else { v70 = v41; operator delete(v44); if ( v70 ) goto LABEL_30; } sub_D18D28(&v73, &SavedLevel->m_creatorName); sub_D18EA8(&a2->m_creatorName, &v73); v56 = (char *)v73 - 24; if ( (char *)v73 - 24 != (char *)&qword_124B6B0 ) { if ( &pthread_create ) { v57 = (unsigned int *)((char *)v73 - 8); do v58 = __ldaxr(v57); while ( __stlxr(v58 - 1, v57) ); } else { v58 = *((_DWORD *)v73 - 2); *((_DWORD *)v73 - 2) = v58 - 1; } if ( v58 <= 0 ) operator delete(v56); } LABEL_30: if ( a2->m_accountID.random != a2->m_accountID.seed ) goto LABEL_4; v45 = SavedLevel->m_accountID.random - SavedLevel->m_accountID.seed; a2->m_accountID.value = v45; v46 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0); a2->m_accountID.seed = v46; a2->m_accountID.random = v45 + v46; if ( v5 ) goto LABEL_32; LABEL_5: random = a2->m_levelID.random; if ( m_gauntletLevel ) { m_gauntletLevels = a1->m_gauntletLevels; v53 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i", (const char *)(unsigned int)(random - a2->m_levelID.seed)); v54 = (char *)cocos2d::CCString::getCString(v53); sub_D153B8((int)&v73, v54); cocos2d::CCDictionary::setObject((int)m_gauntletLevels, a2); v10 = v73; v11 = (char *)v73 - 24; if ( (char *)v73 - 24 == (char *)&qword_124B6B0 ) return; if ( &pthread_create ) { v55 = (unsigned int *)((char *)v73 - 8); do v51 = __ldaxr(v55); while ( __stlxr(v51 - 1, v55) ); goto LABEL_41; } } else { m_onlineLevels = a1->m_onlineLevels; LevelKey = (char *)GameLevelManager::getLevelKey(a1, random - a2->m_levelID.seed); sub_D153B8((int)&v73, LevelKey); cocos2d::CCDictionary::setObject((int)m_onlineLevels, a2); v10 = v73; v11 = (char *)v73 - 24; if ( (char *)v73 - 24 == (char *)&qword_124B6B0 ) return; if ( &pthread_create ) { v65 = (unsigned int *)((char *)v73 - 8); do v51 = __ldaxr(v65); while ( __stlxr(v51 - 1, v65) ); goto LABEL_41; } } LABEL_74: v51 = *(v10 - 2); *(v10 - 2) = v51 - 1; LABEL_41: if ( v51 <= 0 ) operator delete(v11); }
GD Web Decomp Icon

GD Web Decomp

Raw Source