// // GameLevelManager::processOnDownloadLevelCompleted from 0x4d9aac to 0x4da3c4 (2328 bytes) // // 2 xrefs: // > GameLevelManager::onDownloadLevelCompleted @ 0x4da3f6 // > GameLevelManager::onUpdateLevelCompleted @ 0x4da45e // // 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:50:55 +0000 // int __fastcall GameLevelManager::processOnDownloadLevelCompleted( GameLevelManager *a1, unsigned __int8 *a2, _DWORD *a3, int a4) { cocos2d::CCArray *v7; // r7 int result; // r0 int (*v9)(void); // r3 cocos2d::CCString *v10; // r0 const char *v11; // r11 cocos2d::CCString *v12; // r0 cocos2d::CCString *v13; // r0 int v14; // r0 const char *v15; // r1 cocos2d::CCArray *v16; // r9 cocos2d::CCString *v17; // r0 char *CString; // r0 cocos2d::CCString *v19; // r0 char *v20; // r0 cocos2d::CCString *v21; // r0 char *v22; // r0 cocos2d::CCString *v23; // r0 const char *v24; // r8 size_t v25; // r0 cocos2d::CCString *v26; // r0 const char *v27; // r8 size_t v28; // r0 cocos2d::CCString *v29; // r0 const char *v30; // r10 size_t v31; // r0 cocos2d::CCString *v32; // r0 const char *v33; // r8 size_t v34; // r0 cocos2d::CCString *v35; // r0 const char *v36; // r10 size_t v37; // r0 cocos2d::CCString *v38; // r0 const char *v39; // r9 size_t v40; // r0 MusicDownloadManager *v41; // r0 GJGameLevel *v42; // r0 bool v43; // r2 int *v44; // r5 GameManager *v45; // r0 GameManager *v46; // r0 int v47; // r3 int v48; // r0 char *v49; // r0 signed int v50; // r0 cocos2d::CCString *v51; // r0 char *v52; // r0 int v53; // r6 int v54; // r8 int v55; // r10 char *v56; // r3 char *v57; // r8 const void *v58; // r0 unsigned __int8 *v59; // r3 char *v60; // r2 size_t v61; // r0 _BOOL4 v62; // r7 int v63; // r0 cocos2d::CCString *v64; // r0 const char *v65; // r7 size_t v66; // r0 cocos2d::CCString *v67; // r0 char *v68; // r0 char *v69; // r8 const void *v70; // r0 unsigned __int8 *v71; // r3 char *v72; // r2 size_t v73; // r0 _BOOL4 v74; // r8 int v75; // r0 int SavedLevel; // r0 int v77; // r7 const char *LevelKey; // r0 float v79; // r2 int v80; // r3 void (__fastcall ***v81)(_DWORD, int *, int); // r0 int v82; // r3 int v83; // r3 int v84; // r3 void (__fastcall ***v85)(_DWORD, int *); // r0 int v86; // r3 const char *LevelDownloadKey; // r0 float v88; // r2 int v89; // r3 void (__fastcall ***v90)(_DWORD, int *); // r0 int v91; // r3 cocos2d::CCArray *v92; // r10 cocos2d::CCString *v93; // r0 size_t v94; // r0 cocos2d::CCString *v95; // r0 const char *v96; // r10 size_t v97; // r0 GJRewardItem *v98; // r8 GameStatsManager *v99; // r0 GameStatsManager *v100; // r0 const char *v102; // [sp+1Ch] [bp-168h] _BOOL4 v103; // [sp+20h] [bp-164h] int v104; // [sp+20h] [bp-164h] int v105; // [sp+20h] [bp-164h] int v106; // [sp+24h] [bp-160h] int v107; // [sp+28h] [bp-15Ch] int v108; // [sp+30h] [bp-154h] BYREF int v109; // [sp+34h] [bp-150h] int v110; // [sp+38h] [bp-14Ch] int v111; // [sp+3Ch] [bp-148h] BYREF int v112; // [sp+40h] [bp-144h] int v113; // [sp+44h] [bp-140h] int v114; // [sp+48h] [bp-13Ch] BYREF int v115; // [sp+4Ch] [bp-138h] int v116; // [sp+50h] [bp-134h] int v117[3]; // [sp+54h] [bp-130h] BYREF int v118[3]; // [sp+60h] [bp-124h] BYREF int v119[3]; // [sp+6Ch] [bp-118h] BYREF int v120[3]; // [sp+78h] [bp-10Ch] BYREF int v121[3]; // [sp+84h] [bp-100h] BYREF int v122[3]; // [sp+90h] [bp-F4h] BYREF int v123[3]; // [sp+9Ch] [bp-E8h] BYREF int v124[2]; // [sp+A8h] [bp-DCh] BYREF char *v125; // [sp+B0h] [bp-D4h] int v126[2]; // [sp+B4h] [bp-D0h] BYREF char *v127; // [sp+BCh] [bp-C8h] int v128[3]; // [sp+C0h] [bp-C4h] BYREF int v129[2]; // [sp+CCh] [bp-B8h] BYREF char *v130; // [sp+D4h] [bp-B0h] int v131[3]; // [sp+D8h] [bp-ACh] BYREF int v132; // [sp+E4h] [bp-A0h] BYREF int v133; // [sp+E8h] [bp-9Ch] int v134; // [sp+ECh] [bp-98h] int v135; // [sp+F0h] [bp-94h] BYREF int v136; // [sp+F4h] [bp-90h] int v137; // [sp+F8h] [bp-8Ch] _BYTE v138[20]; // [sp+FCh] [bp-88h] BYREF unsigned __int8 v139[20]; // [sp+110h] [bp-74h] BYREF unsigned __int8 v140[44]; // [sp+124h] [bp-60h] BYREF unsigned __int8 v141[44]; // [sp+150h] [bp-34h] BYREF v7 = sub_4C1A88(a3, "_"); if ( !cocos2d::CCArray::count(v7) ) { if ( a4 ) { result = *((_DWORD *)a1 + 213); if ( !result ) return result; v9 = *(int (**)(void))(*(_DWORD *)result + 4); } else { result = *((_DWORD *)a1 + 206); if ( !result ) return result; v9 = *(int (**)(void))(*(_DWORD *)result + 4); } return v9(); } v10 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 0); v11 = (const char *)cocos2d::CCString::intValue(v10); v12 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 1u); v107 = cocos2d::CCString::boolValue(v12); v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v7, 2u); v14 = cocos2d::CCString::intValue(v13); if ( (*(_BYTE *)a3 & 1) != 0 ) v15 = (const char *)a3[2]; else v15 = (char *)a3 + 1; v106 = v14; GameLevelManager::removeDLFromActive(a1, v15); v16 = sub_4C1A88(a2, "#"); if ( cocos2d::CCArray::count(v16) > 2u ) { v135 = 0; v136 = 0; v137 = 0; std::string::__init(&v135, "-1", 2u); v103 = sub_4A9CC4(a2, (unsigned __int8 *)&v135); std::string::~string((int)&v135); if ( !v103 ) { v108 = 0; v109 = 0; v110 = 0; v111 = 0; v112 = 0; v113 = 0; v114 = 0; v115 = 0; v116 = 0; if ( cocos2d::CCArray::count(v16) > 6u ) { v17 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 6u); CString = (char *)cocos2d::CCString::getCString(v17); std::string::assign(&v108, CString); } if ( cocos2d::CCArray::count(v16) > 7u ) { v19 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 7u); v20 = (char *)cocos2d::CCString::getCString(v19); std::string::assign(&v111, v20); } if ( cocos2d::CCArray::count(v16) > 8u ) { v21 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 8u); v22 = (char *)cocos2d::CCString::getCString(v21); std::string::assign(&v114, v22); } v23 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 0); v24 = (const char *)cocos2d::CCString::getCString(v23); memset(v117, 0, sizeof(v117)); v25 = strlen(v24); std::string::__init(v117, v24, v25); v26 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 1u); v27 = (const char *)cocos2d::CCString::getCString(v26); memset(v118, 0, sizeof(v118)); v28 = strlen(v27); std::string::__init(v118, v27, v28); v29 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 2u); v30 = (const char *)cocos2d::CCString::getCString(v29); memset(v119, 0, sizeof(v119)); v31 = strlen(v30); std::string::__init(v119, v30, v31); if ( cocos2d::CCArray::count(v16) > 3u ) { v32 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 3u); v33 = (const char *)cocos2d::CCString::getCString(v32); v135 = 0; v136 = 0; v137 = 0; v34 = strlen(v33); std::string::__init(&v135, v33, v34); std::string::basic_string(v120, (int)&v135); GameLevelManager::storeUserNames((unsigned __int8 *)a1, (unsigned __int8 *)v120); std::string::~string((int)v120); std::string::~string((int)&v135); } if ( cocos2d::CCArray::count(v16) > 4u ) { v35 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 4u); v36 = (const char *)cocos2d::CCString::getCString(v35); v132 = 0; v133 = 0; v134 = 0; v37 = strlen(v36); std::string::__init(&v132, v36, v37); if ( cocos2d::CCArray::count(v16) <= 5u ) { v39 = (const char *)&unk_B6B226; } else { v38 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v16, 5u); v39 = (const char *)cocos2d::CCString::getCString(v38); } v135 = 0; v136 = 0; v137 = 0; v40 = strlen(v39); v41 = (MusicDownloadManager *)std::string::__init(&v135, v39, v40); v104 = MusicDownloadManager::sharedState(v41); std::string::basic_string(v121, (int)&v132); std::string::basic_string(v122, (int)&v135); MusicDownloadManager::createSongsInfo(v104, v121, v122); std::string::~string((int)v122); std::string::~string((int)v121); std::string::~string((int)&v135); std::string::~string((int)&v132); } std::string::basic_string(v123, (int)v117); v42 = (GJGameLevel *)GameLevelManager::responseToDict((cocos2d::CCDictionary *)v123, 0); v44 = GJGameLevel::create(v42, (cocos2d::CCDictionary *)((char *)&dword_0 + 1), v43); v45 = (GameManager *)std::string::~string((int)v123); if ( *((_BYTE *)v44 + 592) ) { v46 = (GameManager *)GameManager::sharedState(v45); if ( GameManager::getGameVariable(v46, "0108") ) *((_BYTE *)v44 + 593) = 1; } if ( (v108 & 1) != 0 ) v47 = v109; else v47 = (int)(unsigned __int8)v108 >> 1; if ( v47 ) { v48 = GameLevelManager::applyDeathBlob((int)a1, v44[67] - v44[68], (unsigned __int8 *)&v108); v105 = v48; if ( v48 >= 0 ) v44[326] = v48; } else { v105 = -1; } if ( v107 ) *((_BYTE *)v44 + 477) = 1; if ( v11 == (const char *)-2 ) GJGameLevel::setDailyID((GJGameLevel *)v44, v44[186] - v44[187]); std::string::basic_string(v124, (int)(v44 + 76)); v126[0] = 0; v126[1] = 0; v127 = nullptr; std::string::__init(v126, &unk_B6B226, 0); if ( (v124[0] & 1) != 0 ) v49 = v125; else v49 = (char *)v124 + 1; v50 = strlen(v49); if ( v50 > 39 ) { v53 = 40; v54 = 0; v55 = (int)(float)((float)v50 / 40.0); do { if ( (v124[0] & 1) != 0 ) v56 = v125; else v56 = (char *)v124 + 1; std::string::push_back(v126, v56[v54]); --v53; v54 += v55; } while ( v53 ); } else { std::string::operator=((unsigned __int8 *)v126, (unsigned __int8 *)v124); } v51 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%c%s%s%c%c%s", (const char *)&dword_78, "I25", "fpAa", 112, 67, "Qg"); v52 = (char *)cocos2d::CCString::getCString(v51); std::string::append(v126, v52); if ( (v126[0] & 1) != 0 ) v57 = v127; else v57 = (char *)v126 + 1; v58 = (const void *)strlen(v57); rtsha1::calc((rtsha1 *)v57, v58, (int)v138, v59); rtsha1::toHexString((rtsha1 *)v138, v140, v60); memset(v128, 0, sizeof(v128)); v61 = strlen((const char *)v140); std::string::__init(v128, v140, v61); v62 = sub_4A9CC4((unsigned __int8 *)v128, (unsigned __int8 *)v118); std::string::~string((int)v128); if ( !v62 ) { if ( a4 ) v63 = *((_DWORD *)a1 + 213); else v63 = *((_DWORD *)a1 + 206); if ( v63 ) (*(void (__fastcall **)(int, const char *))(*(_DWORD *)v63 + 4))(v63, v11); LABEL_115: std::string::~string((int)v126); std::string::~string((int)v124); std::string::~string((int)v119); std::string::~string((int)v118); std::string::~string((int)v117); std::string::~string((int)&v114); LABEL_116: std::string::~string((int)&v111); return std::string::~string((int)&v108); } v64 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i,%i,%i,%i,%i,%i,%i,%i", (const char *)(v44[101] - v44[102]), v44[193] - v44[194], v44[189] - v44[190], v44[67] - v44[68], v44[198] - v44[199], v44[182], v44[201] - v44[202], v44[186] - v44[187]); v65 = (const char *)cocos2d::CCString::getCString(v64); v129[0] = 0; v129[1] = 0; v130 = nullptr; v66 = strlen(v65); std::string::__init(v129, v65, v66); v67 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%c%s%s%c%c%s", (const char *)&dword_78, "I25", "fpAa", 112, 67, "Qg"); v68 = (char *)cocos2d::CCString::getCString(v67); std::string::append(v129, v68); if ( (v129[0] & 1) != 0 ) v69 = v130; else v69 = (char *)v129 + 1; v70 = (const void *)strlen(v69); rtsha1::calc((rtsha1 *)v69, v70, (int)v139, v71); rtsha1::toHexString((rtsha1 *)v139, v141, v72); memset(v131, 0, sizeof(v131)); v73 = strlen((const char *)v141); std::string::__init(v131, v141, v73); v74 = sub_4A9CC4((unsigned __int8 *)v131, (unsigned __int8 *)v119); std::string::~string((int)v131); if ( !v74 ) { if ( !a4 ) { v75 = *((_DWORD *)a1 + 206); LABEL_78: if ( v75 ) (*(void (__fastcall **)(int, const char *))(*(_DWORD *)v75 + 4))(v75, v11); std::string::~string((int)v129); goto LABEL_115; } LABEL_77: v75 = *((_DWORD *)a1 + 213); goto LABEL_78; } if ( a4 ) { if ( v106 > 0 ) GJGameLevel::setDailyID((GJGameLevel *)v44, v106); SavedLevel = GameLevelManager::getSavedLevel(a1, (GJGameLevel *)v44); if ( !SavedLevel ) goto LABEL_77; if ( v44[153] > *(_DWORD *)(SavedLevel + 612) ) v77 = 3; else v77 = 1; GameLevelManager::saveLevel(a1, (GJGameLevel *)v44); LevelKey = (const char *)GameLevelManager::getLevelKey(a1, v11); GameLevelManager::makeTimeStamp(a1, LevelKey, v79, v80); GameLevelManager::updateLevelRewards(a1, (GJGameLevel *)v44); v81 = *((void (__fastcall ****)(_DWORD, int *, int))a1 + 213); if ( v81 ) (**v81)(v81, v44, v77); } else { if ( v11 == (const char *)-1 ) { GameLevelManager::saveLevel(a1, (GJGameLevel *)v44); v82 = v44[186] - v44[187]; if ( *((_DWORD *)a1 + 150) < v82 ) *((_DWORD *)a1 + 150) = v82; } else if ( v11 == (const char *)-2 ) { GameLevelManager::saveLevel(a1, (GJGameLevel *)v44); v83 = v44[186] - v44[187]; if ( *((_DWORD *)a1 + 153) < v83 ) *((_DWORD *)a1 + 153) = v83; } else { if ( v11 != (const char *)-3 ) { GameLevelManager::markLevelAsDownloaded((cocos2d::CCDictionary **)a1, v11); GameLevelManager::saveLevel(a1, (GJGameLevel *)v44); if ( (v114 & 1) != 0 ) v86 = v115; else v86 = (int)(unsigned __int8)v114 >> 1; if ( v86 ) { if ( v44[186] - v44[187] > 200000 ) { v92 = sub_4C1A88(&v114, "|"); if ( cocos2d::CCArray::count(v92) > 1u ) { v93 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v92, 0); v102 = (const char *)cocos2d::CCString::getCString(v93); v132 = 0; v133 = 0; v134 = 0; v94 = strlen(v102); std::string::__init(&v132, v102, v94); v95 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v92, 1u); v96 = (const char *)cocos2d::CCString::getCString(v95); v135 = 0; v136 = 0; v137 = 0; v97 = strlen(v96); std::string::__init(&v135, v96, v97); v98 = (GJRewardItem *)GameLevelManager::parseEventReward( (int)a1, (unsigned __int8 *)&v132, (unsigned __int8 *)&v135); std::string::~string((int)&v135); v99 = (GameStatsManager *)std::string::~string((int)&v132); if ( v98 ) { v100 = (GameStatsManager *)GameStatsManager::sharedState(v99); GameStatsManager::storeEventChest(v100, v44[186] - v44[187], v98); } } } } LevelDownloadKey = (const char *)GameLevelManager::getLevelDownloadKey(a1, v11, v107, v106); GameLevelManager::makeTimeStamp(a1, LevelDownloadKey, v88, v89); v90 = *((void (__fastcall ****)(_DWORD, int *))a1 + 206); if ( v90 ) (**v90)(v90, v44); GameLevelManager::updateLevelRewards(a1, (GJGameLevel *)v44); goto LABEL_85; } GameLevelManager::saveLevel(a1, (GJGameLevel *)v44); v84 = v44[186] - v44[187]; if ( *((_DWORD *)a1 + 156) < v84 ) *((_DWORD *)a1 + 156) = v84; } v85 = *((void (__fastcall ****)(_DWORD, int *))a1 + 206); if ( v85 ) (**v85)(v85, v44); } LABEL_85: if ( v105 >= 0 ) v44[326] = v105; if ( (v111 & 1) != 0 ) v91 = v112; else v91 = (int)(unsigned __int8)v111 >> 1; if ( v91 ) GameLevelManager::applyLevelControlsSection((int)a1, (int)v44, (unsigned __int8 *)&v111); std::string::~string((int)v129); std::string::~string((int)v126); std::string::~string((int)v124); std::string::~string((int)v119); std::string::~string((int)v118); std::string::~string((int)v117); std::string::~string((int)&v114); goto LABEL_116; } } if ( a4 ) result = *((_DWORD *)a1 + 213); else result = *((_DWORD *)a1 + 206); if ( result ) { v9 = *(int (**)(void))(*(_DWORD *)result + 4); return v9(); } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source