// // GameLevelManager::saveLevel from 0x100537770 to 0x100537f8a (2074 bytes) // // 7 xrefs: // > LevelInfoLayer::downloadLevel @ 0x1002c007a // > GameLevelManager::gotoLevelPage @ 0x1005380b0 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x100545435 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x1005454a8 // > GameLevelManager::processOnDownloadLevelCompleted @ 0x1005454fd // > GameLevelManager::processOnDownloadLevelCompleted @ 0x10054556d // > GameLevelManager::processOnDownloadLevelCompleted @ 0x100545603 // // 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 __fastcall GameLevelManager::saveLevel(GameLevelManager *a1, GJGameLevel *a2) { __int128 v2; // xmm0 GameLevelManager *v4; // r15 int random; // r14d bool m_gauntletLevel; // r13 bool v7; // cc int v8; // r14d GJGameLevel *SavedGauntletLevel; // rax int v10; // esi GJGameLevel *SavedLevel; // r12 int v12; // r14d int v13; // eax int v14; // r14d int v15; // eax int v16; // r14d int v17; // eax int v18; // r14d double v19; // xmm0_8 int v20; // r14d float v21; // xmm0_4 int v22; // r14d int v23; // eax int v24; // r14d int v25; // eax bool m_lowDetailModeToggled; // al int m_levelIndex; // eax int m_levelFolder; // eax std::string *p_m_creatorName; // rcx bool v30; // zf char v31; // r13 void *v32; // r14 __int64 v33; // r15 char *v34; // rdi bool v35; // r15 int v36; // r14d __int64 m_dailyLevels; // r14 cocos2d::CCString *v38; // rax const char *CString; // r12 size_t v40; // rax size_t v41; // r15 char *v42; // r13 size_t v43; // r14 cocos2d::CCString *v44; // rax size_t v45; // rax cocos2d::CCString *v46; // rax size_t v47; // rax size_t v48; // r14 size_t v49; // r14 char v50; // [rsp+0h] [rbp-C0h] __int16 __s2[11]; // [rsp+1h] [rbp-BFh] BYREF GameLevelManager *v52; // [rsp+18h] [rbp-A8h] std::string __str; // [rsp+20h] [rbp-A0h] BYREF std::string v54; // [rsp+40h] [rbp-80h] BYREF std::string *v55; // [rsp+60h] [rbp-60h] __int64 v56; // [rsp+68h] [rbp-58h] __int128 __s1; // [rsp+70h] [rbp-50h] BYREF void *__p; // [rsp+80h] [rbp-40h] bool v59; // [rsp+97h] [rbp-29h] v4 = a1; random = a2->m_dailyID.random; m_gauntletLevel = a2->m_gauntletLevel; v7 = random <= a2->m_dailyID.seed; v8 = random - a2->m_dailyID.seed; if ( v7 ) { v10 = a2->m_levelID.random - a2->m_levelID.seed; if ( !m_gauntletLevel ) { SavedLevel = GameLevelManager::getSavedLevel(a1, v10); if ( !SavedLevel ) goto LABEL_56; goto LABEL_9; } SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(a1, v10); if ( !SavedGauntletLevel ) goto LABEL_52; } else { SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(a1, v8); if ( !SavedGauntletLevel ) { LABEL_43: m_dailyLevels = (__int64)v4->m_dailyLevels; v38 = (cocos2d::CCString *)sub_1007AB580("%i", v50); CString = cocos2d::CCString::getCString(v38); v40 = strlen(CString); if ( v40 < 0xFFFFFFFFFFFFFFF8LL ) { v41 = v40; if ( v40 >= 0x17 ) { v56 = m_dailyLevels; v43 = 26; if ( (v40 | 7) != 0x17 ) v43 = (v40 | 7) + 1; v42 = (char *)operator new(v43); __p = v42; *(_QWORD *)&__s1 = v43 + 1; m_dailyLevels = v56; *((_QWORD *)&__s1 + 1) = v41; } else { LOBYTE(__s1) = 2 * v40; v42 = (char *)&__s1 + 1; if ( !v40 ) goto LABEL_68; } goto LABEL_67; } LABEL_71: sub_100006BF0(*(double *)&v2); } } SavedLevel = SavedGauntletLevel; if ( SavedGauntletLevel->m_levelID.random - SavedGauntletLevel->m_levelID.seed != a2->m_levelID.random - a2->m_levelID.seed ) goto LABEL_42; LABEL_9: LODWORD(v56) = v8; v12 = SavedLevel->m_attempts.random - SavedLevel->m_attempts.seed; a2->m_attempts.value = v12; v13 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0); a2->m_attempts.seed = v13; a2->m_attempts.random = v13 + v12; v14 = SavedLevel->m_jumps.random - SavedLevel->m_jumps.seed; a2->m_jumps.value = v14; v15 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0); a2->m_jumps.seed = v15; a2->m_jumps.random = v15 + v14; v16 = SavedLevel->m_clicks.random - SavedLevel->m_clicks.seed; a2->m_clicks.value = v16; v17 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0); a2->m_clicks.seed = v17; a2->m_clicks.random = v17 + v16; v18 = SavedLevel->m_attemptTime.random - SavedLevel->m_attemptTime.seed; a2->m_attemptTime.value = v18; HIDWORD(v19) = 0; *(float *)&v19 = (float)((float)rand() * 4.6566129e-10) * 1000.0; a2->m_attemptTime.seed = (int)*(float *)&v19; a2->m_attemptTime.random = (int)*(float *)&v19 + v18; a2->m_isChkValid = SavedLevel->m_isChkValid; a2->m_chk = SavedLevel->m_chk; if ( (SavedLevel->m_personalBests.m_data.m_short.sizex2 & 1) != 0 ) sub_100006B70( &__str, SavedLevel->m_personalBests.m_data.m_long.longStorage, SavedLevel->m_personalBests.m_data.m_long.size, v19); else __str = (std::string)SavedLevel->m_personalBests; std::string::operator=((std::string *)&a2->m_personalBests, &__str); if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 ) operator delete(__str.__r_.__value_.__l.__data_); v20 = SavedLevel->m_normalPercent.random - SavedLevel->m_normalPercent.seed; a2->m_normalPercent.value = v20; v21 = (float)((float)rand() * 4.6566129e-10) * 1000.0; a2->m_normalPercent.seed = (int)v21; a2->m_normalPercent.random = (int)v21 + v20; a2->m_practicePercent = SavedLevel->m_practicePercent; v22 = SavedLevel->m_orbCompletion.random - SavedLevel->m_orbCompletion.seed; a2->m_orbCompletion.value = v22; v23 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0); a2->m_orbCompletion.seed = v23; a2->m_orbCompletion.random = v23 + v22; v24 = SavedLevel->m_newNormalPercent2.random - SavedLevel->m_newNormalPercent2.seed; a2->m_newNormalPercent2.value = v24; v25 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0); a2->m_newNormalPercent2.seed = v25; a2->m_newNormalPercent2.random = v25 + v24; *(_OWORD *)&a2->m_bestTime = *(_OWORD *)&SavedLevel->m_bestTime; std::string::operator=((std::string *)&a2->m_inputsTime, (const std::string *)&SavedLevel->m_inputsTime); v2 = *(_OWORD *)&SavedLevel->m_bestPoints; *(_OWORD *)&a2->m_bestPoints = v2; std::string::operator=((std::string *)&a2->m_inputsPoints, (const std::string *)&SavedLevel->m_inputsPoints); a2->m_platformerSeed = SavedLevel->m_platformerSeed; a2->m_savedTime = SavedLevel->m_savedTime; a2->m_savedPoints = SavedLevel->m_savedPoints; m_lowDetailModeToggled = SavedLevel->m_lowDetailModeToggled; if ( m_lowDetailModeToggled || SavedLevel->m_normalPercent.random > SavedLevel->m_normalPercent.seed ) { a2->m_lowDetailModeToggled = m_lowDetailModeToggled; m_levelIndex = SavedLevel->m_levelIndex; if ( m_levelIndex <= a2->m_levelIndex ) { LABEL_17: if ( !SavedLevel->m_levelFavorited ) goto LABEL_18; LABEL_26: a2->m_levelFavorited = 1; m_levelFolder = SavedLevel->m_levelFolder; if ( m_levelFolder <= 0 ) goto LABEL_20; goto LABEL_19; } } else { m_levelIndex = SavedLevel->m_levelIndex; if ( m_levelIndex <= a2->m_levelIndex ) goto LABEL_17; } a2->m_levelIndex = m_levelIndex; if ( SavedLevel->m_levelFavorited ) goto LABEL_26; LABEL_18: m_levelFolder = SavedLevel->m_levelFolder; if ( m_levelFolder > 0 ) LABEL_19: a2->m_levelFolder = m_levelFolder; LABEL_20: if ( SavedLevel->m_gauntletLevel2 ) a2->m_gauntletLevel2 = 1; p_m_creatorName = &a2->m_creatorName; v30 = (a2->m_creatorName.m_data.m_short.sizex2 & 1) == 0; v59 = m_gauntletLevel; v55 = (std::string *)&a2->m_creatorName; if ( v30 ) { __p = a2->m_creatorName.m_data.m_long.longStorage; v2 = *(_OWORD *)&p_m_creatorName->m_data.m_short.sizex2; __s1 = *(_OWORD *)&p_m_creatorName->m_data.m_short.sizex2; } else { sub_100006B70( &__s1, a2->m_creatorName.m_data.m_long.longStorage, a2->m_creatorName.m_data.m_long.size, *(double *)&v2); } v52 = a1; __s2[0] = 45; v31 = __s1; v32 = __p; if ( (__s1 & 1) != 0 ) { v33 = *((_QWORD *)&__s1 + 1); v34 = (char *)__p; } else { v33 = (unsigned __int8)__s1 >> 1; v34 = (char *)&__s1 + 1; } v35 = memcmp(v34, __s2, v33 != 0) == 0 && v33 == 1; if ( (v31 & 1) != 0 ) operator delete(v32); v30 = !v35; v4 = v52; m_gauntletLevel = v59; v8 = v56; if ( !v30 ) { if ( (SavedLevel->m_creatorName.m_data.m_short.sizex2 & 1) != 0 ) { sub_100006B70( &v54, SavedLevel->m_creatorName.m_data.m_long.longStorage, SavedLevel->m_creatorName.m_data.m_long.size, *(double *)&v2); } else { v54.__r_.__value_.__r.__words[2] = (std::string::size_type)SavedLevel->m_creatorName.m_data.m_long.longStorage; v2 = *(_OWORD *)&SavedLevel->m_creatorName.m_data.m_short.sizex2; *(_OWORD *)&v54.__r_.__value_.__l.0 = v2; } std::string::operator=(v55, &v54); if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v54.__r_.__value_.__l.__data_); } if ( a2->m_accountID.random == a2->m_accountID.seed ) { v36 = SavedLevel->m_accountID.random - SavedLevel->m_accountID.seed; a2->m_accountID.value = v36; DWORD1(v2) = 0; *(float *)&v2 = (float)((float)rand() * 4.6566129e-10) * 1000.0; a2->m_accountID.seed = (int)*(float *)&v2; a2->m_accountID.random = (int)*(float *)&v2 + v36; v8 = v56; } LABEL_42: if ( v8 > 0 ) goto LABEL_43; if ( m_gauntletLevel ) { LABEL_52: m_dailyLevels = (__int64)v4->m_gauntletLevels; v44 = (cocos2d::CCString *)sub_1007AB580("%i", v50); CString = cocos2d::CCString::getCString(v44); v45 = strlen(CString); if ( v45 >= 0xFFFFFFFFFFFFFFF8LL ) goto LABEL_71; v41 = v45; if ( v45 >= 0x17 ) { v56 = m_dailyLevels; v48 = 26; if ( (v45 | 7) != 0x17 ) v48 = (v45 | 7) + 1; v42 = (char *)operator new(v48); __p = v42; *(_QWORD *)&__s1 = v48 + 1; m_dailyLevels = v56; *((_QWORD *)&__s1 + 1) = v41; goto LABEL_67; } LOBYTE(__s1) = 2 * v45; v42 = (char *)&__s1 + 1; if ( !v45 ) goto LABEL_68; LABEL_67: memmove(v42, CString, v41); goto LABEL_68; } LABEL_56: m_dailyLevels = (__int64)v4->m_onlineLevels; v46 = (cocos2d::CCString *)sub_1007AB580("%i", v50); CString = cocos2d::CCString::getCString(v46); v47 = strlen(CString); if ( v47 >= 0xFFFFFFFFFFFFFFF8LL ) goto LABEL_71; v41 = v47; if ( v47 >= 0x17 ) { v56 = m_dailyLevels; v49 = 26; if ( (v47 | 7) != 0x17 ) v49 = (v47 | 7) + 1; v42 = (char *)operator new(v49); __p = v42; *(_QWORD *)&__s1 = v49 + 1; m_dailyLevels = v56; *((_QWORD *)&__s1 + 1) = v41; goto LABEL_67; } LOBYTE(__s1) = 2 * v47; v42 = (char *)&__s1 + 1; if ( v47 ) goto LABEL_67; LABEL_68: v42[v41] = 0; cocos2d::CCDictionary::setObject_1(m_dailyLevels, a2, (char *)&__s1); if ( (__s1 & 1) != 0 ) operator delete(__p); }
GD Web Decomp Icon

GD Web Decomp

Raw Source