// // LocalLevelManager::tryRecoverAutoSaves from 0x912730 to 0x913674 (3908 bytes) // // 2 xrefs: // > AppDelegate::applicationDidFinishLaunching @ 0x6e6a34 // > @ 0x63f10 // // 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:57:17 +0000 // __int64 __fastcall LocalLevelManager::tryRecoverAutoSaves(cocos2d::CCArray **this) { __int64 v2; // x19 char *v3; // x26 int v4; // w28 const char *v5; // x0 void **v6; // x23 cocos2d::CCString *v7; // x27 unsigned __int8 v8; // w20 cocos2d::CCString *v9; // x19 char *v10; // x20 cocos2d::CCString *v11; // x20 int v12; // t1 unsigned __int64 v13; // x2 __int64 v14; // x3 const char *v15; // x1 cocos2d::CCString *v16; // x0 cocos2d::CCString *v17; // x0 cocos2d::CCString *v18; // x19 size_t v19; // x0 unsigned int v20; // w19 __int64 v21; // x24 _BOOL4 v22; // w28 int v23; // w1 void **v24; // x0 unsigned __int64 v25; // x3 char v26; // w0 __int64 v27; // x0 __int64 v28; // x1 char v29; // w0 __int64 v30; // x0 __int64 v31; // x1 _BOOL4 v32; // w2 const char *v33; // x0 void **v34; // x0 __int64 v35; // x19 char *v36; // x0 const char *v38; // x0 __int64 *v39; // x19 char v40; // w0 __int64 v41; // x0 __int64 v42; // x1 char v43; // w0 __int64 v44; // x0 __int64 v45; // x1 char *v46; // x1 size_t v47; // x2 char v48; // w0 int v49; // w1 void *v50; // x1 __int64 v51; // x0 char *v52; // x6 char *v53; // x0 char *v54; // x8 char *v55; // x5 char *v56; // x9 char *v57; // x2 const char *v58; // x1 int v59; // t1 __int64 *v60; // x19 unsigned __int64 v61; // x0 __int64 v62; // x24 size_t v63; // x2 char *v64; // x1 void *v65; // x3 __int64 v66; // x0 size_t v67; // x3 char v68; // w1 unsigned int v69; // w19 __int64 *v70; // x0 __int64 v71; // x0 const char *v72; // x0 const char *v73; // x1 cocos2d::CCString *v74; // x1 size_t v75; // x2 const char *v76; // x1 cocos2d::CCString *v77; // x0 char *v78; // x0 char v79; // w0 __int64 v80; // x24 __int64 v81; // x0 __int64 v82; // x1 char *v83; // x1 size_t v84; // x2 _BOOL4 v85; // [xsp+78h] [xbp+78h] _BOOL4 v86; // [xsp+78h] [xbp+78h] unsigned __int8 v87; // [xsp+84h] [xbp+84h] cocos2d::CCObject *CString; // [xsp+B0h] [xbp+B0h] cocos2d::CCObject *v89; // [xsp+B0h] [xbp+B0h] int v90; // [xsp+B0h] [xbp+B0h] void **v91; // [xsp+B8h] [xbp+B8h] char v92[16]; // [xsp+C0h] [xbp+C0h] BYREF void *v93; // [xsp+D0h] [xbp+D0h] char *v94; // [xsp+D8h] [xbp+D8h] BYREF char *v95; // [xsp+E0h] [xbp+E0h] __int64 v96; // [xsp+E8h] [xbp+E8h] void **v97; // [xsp+F0h] [xbp+F0h] BYREF void **v98; // [xsp+F8h] [xbp+F8h] unsigned __int64 v99; // [xsp+100h] [xbp+100h] __int64 v100; // [xsp+108h] [xbp+108h] BYREF __int64 v101; // [xsp+110h] [xbp+110h] char *v102; // [xsp+118h] [xbp+118h] __int64 v103[2]; // [xsp+120h] [xbp+120h] BYREF void *v104; // [xsp+130h] [xbp+130h] __int64 v105[2]; // [xsp+138h] [xbp+138h] BYREF char *v106; // [xsp+148h] [xbp+148h] __int64 v107[2]; // [xsp+150h] [xbp+150h] BYREF void *v108; // [xsp+160h] [xbp+160h] __int64 v109[3]; // [xsp+168h] [xbp+168h] BYREF __int64 v110; // [xsp+180h] [xbp+180h] BYREF __int64 v111; // [xsp+188h] [xbp+188h] void *v112; // [xsp+190h] [xbp+190h] __int64 v113; // [xsp+198h] [xbp+198h] BYREF __int64 v114; // [xsp+1A0h] [xbp+1A0h] void *v115; // [xsp+1A8h] [xbp+1A8h] __int64 v116; // [xsp+1B0h] [xbp+1B0h] BYREF __int64 v117; // [xsp+1B8h] [xbp+1B8h] void *v118; // [xsp+1C0h] [xbp+1C0h] unsigned __int64 v119[2]; // [xsp+1C8h] [xbp+1C8h] BYREF void *v120; // [xsp+1D8h] [xbp+1D8h] __int64 v121; // [xsp+1E0h] [xbp+1E0h] BYREF __int64 v122; // [xsp+1E8h] [xbp+1E8h] void *v123; // [xsp+1F0h] [xbp+1F0h] __int64 v124; // [xsp+1F8h] [xbp+1F8h] BYREF size_t v125; // [xsp+200h] [xbp+200h] void *v126; // [xsp+208h] [xbp+208h] __int64 v127; // [xsp+210h] [xbp+210h] BYREF __int64 v128; // [xsp+218h] [xbp+218h] void *v129; // [xsp+220h] [xbp+220h] unsigned __int64 v130; // [xsp+228h] [xbp+228h] BYREF unsigned __int64 v131; // [xsp+230h] [xbp+230h] void *v132; // [xsp+238h] [xbp+238h] unsigned __int64 v133; // [xsp+240h] [xbp+240h] BYREF size_t v134; // [xsp+248h] [xbp+248h] void *v135; // [xsp+250h] [xbp+250h] __int64 v136[3]; // [xsp+258h] [xbp+258h] BYREF unsigned __int64 v137[3]; // [xsp+270h] [xbp+270h] BYREF GameToolbox::getSaveDirectory(_stack_chk_guard, (__int64)v92); v94 = nullptr; v95 = nullptr; v96 = 0; v100 = 0; v101 = 0; v102 = nullptr; std::string::__init(&v100, &unk_11528A8, 9u); GameToolbox::listFiles(v92, (__int64 *)&v94, (unsigned __int8 *)&v100, nullptr); if ( (v100 & 1) != 0 ) operator delete(v102); v97 = nullptr; v2 = (__int64)v94; v3 = v95; v98 = nullptr; v99 = 0; if ( v94 == v95 ) { v87 = 0; goto LABEL_61; } do { v103[0] = 0; v103[1] = 0; v104 = nullptr; std::string::__init(v103, ".gdlvl.tmp", 0xAu); v4 = (unsigned __int8)GameToolbox::stringEndsWith(v2, (__int64)v103); if ( (v103[0] & 1) != 0 ) { operator delete(v104); if ( v4 ) { LABEL_6: std::operator+((__int64)v92, v2, (unsigned __int64 *)v105); v5 = (char *)v105 + 1; if ( (v105[0] & 1) != 0 ) v5 = v106; remove(v5); if ( (v105[0] & 1) != 0 ) operator delete(v106); goto LABEL_10; } } else if ( v4 ) { goto LABEL_6; } v107[0] = 0; v107[1] = 0; v108 = nullptr; std::string::__init(v107, ".gdlvl", 6u); v23 = (unsigned __int8)GameToolbox::stringEndsWith(v2, (__int64)v107); if ( (v107[0] & 1) != 0 ) { v90 = v23; operator delete(v108); if ( !v90 ) goto LABEL_10; } else if ( !v23 ) { goto LABEL_10; } std::operator+((__int64)v92, v2, &v130); v24 = v98; if ( (unsigned __int64)v98 >= v99 ) { std::vector::__push_back_slow_path(&v97, &v130); } else { if ( v98 ) { v25 = v131; *v98 = (void *)v130; v24[1] = (void *)v25; v24[2] = v132; v24 = v98; v130 = 0; v131 = 0; v132 = nullptr; } v98 = v24 + 3; } if ( (v130 & 1) != 0 ) operator delete(v132); LABEL_10: v2 += 24; } while ( v3 != (char *)v2 ); v6 = v97; v91 = v98; if ( v97 == v98 ) { v87 = 0; goto LABEL_56; } v7 = (cocos2d::CCString *)((char *)v97 + 1); v87 = 0; while ( 2 ) { v8 = *(_BYTE *)v6; if ( (*(_BYTE *)v6 & 1) == 0 ) goto LABEL_76; LABEL_14: v9 = (cocos2d::CCString *)v6[2]; v10 = (char *)v6[1]; LABEL_15: v11 = (cocos2d::CCString *)&v10[(_QWORD)v9]; do { if ( v11 == v9 ) { v13 = 0; goto LABEL_19; } v12 = *((unsigned __int8 *)v11 - 1); v11 = (cocos2d::CCString *)((char *)v11 - 1); } while ( !memchr("/\\", v12, 2u) ); v13 = v11 - v9 + 1; LABEL_19: std::string::basic_string(&v100, (__int64)v6, v13, 0xFFFFFFFFFFFFFFFFLL); v14 = (unsigned __int8)v100 >> 1; if ( (v100 & 1) != 0 ) v14 = v101; std::string::basic_string(v103, (__int64)&v100, 9u, v14 - 15); v15 = (const char *)*(unsigned __int8 *)v6; v16 = v7; if ( ((unsigned __int8)v15 & 1) != 0 ) v16 = (cocos2d::CCString *)v6[2]; v17 = (cocos2d::CCString *)cocos2d::CCString::createWithContentsOfFile(v16, v15); v18 = v17; if ( !v17 || !*(_BYTE *)cocos2d::CCString::getCString(v17) ) { if ( (*(_BYTE *)v6 & 1) != 0 ) v38 = (const char *)v6[2]; else v38 = (const char *)v7; remove(v38); goto LABEL_72; } CString = (cocos2d::CCObject *)cocos2d::CCString::getCString(v18); v105[0] = 0; v105[1] = 0; v106 = nullptr; v19 = strlen((const char *)CString); std::string::__init(v105, CString, v19); cocos2d::ZipUtils::decompressString(v107, v105, 0, 11); v89 = GJGameLevel::createFromFullSaveString((__int64)v107); v20 = 0; if ( !v89 ) { LABEL_47: v33 = (const char *)v7; if ( (*(_BYTE *)v6 & 1) != 0 ) v33 = (const char *)v6[2]; remove(v33); if ( (v107[0] & 1) != 0 ) operator delete(v108); if ( (v105[0] & 1) != 0 ) { operator delete(v106); if ( (v103[0] & 1) != 0 ) goto LABEL_53; goto LABEL_73; } LABEL_72: if ( (v103[0] & 1) != 0 ) { LABEL_53: operator delete(v104); if ( (v100 & 1) == 0 ) goto LABEL_74; goto LABEL_54; } LABEL_73: if ( (v100 & 1) == 0 ) goto LABEL_74; LABEL_54: v6 += 3; v7 = (cocos2d::CCString *)((char *)v7 + 24); operator delete(v102); if ( v91 == v6 ) goto LABEL_55; continue; } break; } while ( 1 ) { if ( v20 >= (unsigned int)cocos2d::CCArray::count(*(this + 45)) ) goto LABEL_87; v21 = cocos2d::CCArray::objectAtIndex(*(this + 45), v20); GJGameLevel::generateAutoSaveUID(v109, (GJGameLevel *)v21); v22 = sub_91069C((__int64)v109, (__int64)v103); if ( (v109[0] & 1) != 0 ) break; if ( v22 ) goto LABEL_40; LABEL_29: ++v20; } operator delete((void *)v109[2]); if ( !v22 ) goto LABEL_29; LABEL_40: if ( !v21 ) { LABEL_87: v121 = 0; v122 = 0; v39 = (__int64 *)((char *)v89 + 344); v40 = *((_BYTE *)v89 + 344); v123 = nullptr; if ( (v40 & 1) != 0 ) { std::string::__init(&v121, *((void **)v89 + 45), *((_QWORD *)v89 + 44)); } else { v41 = *v39; v42 = *((_QWORD *)v89 + 44); v123 = *((void **)v89 + 45); v121 = v41; v122 = v42; } if ( (v121 & 1) != 0 ) { v62 = v122; operator delete(v123); if ( v62 ) goto LABEL_91; } else if ( (unsigned __int8)v121 >> 1 ) { LABEL_91: v127 = 0; v128 = 0; v43 = *((_BYTE *)v89 + 344); v129 = nullptr; if ( (v43 & 1) != 0 ) { std::string::__init(&v127, *((void **)v89 + 45), *((_QWORD *)v89 + 44)); } else { v44 = *v39; v45 = *((_QWORD *)v89 + 44); v129 = *((void **)v89 + 45); v127 = v44; v128 = v45; } sub_911DAC((__int64)&v127, &v133); if ( v39 != (__int64 *)&v133 ) { if ( (v133 & 1) != 0 ) { v46 = (char *)v135; v47 = v134; } else { v47 = (unsigned __int8)v133 >> 1; v46 = (char *)&v133 + 1; } std::string::assign(v39, v46, v47); } if ( (v133 & 1) != 0 ) operator delete(v135); if ( (v127 & 1) != 0 ) operator delete(v129); LABEL_101: cocos2d::CCArray::insertObject(*(this + 45), v89, 0); goto LABEL_102; } v124 = 0; v125 = 0; v126 = nullptr; std::string::__init(&v124, "Recovered Autosave", 0x12u); if ( v39 != &v124 ) { if ( (v124 & 1) != 0 ) { v64 = (char *)v126; v63 = v125; } else { v63 = (unsigned __int8)v124 >> 1; v64 = (char *)&v124 + 1; } std::string::assign(v39, v64, v63); } if ( (v124 & 1) != 0 ) operator delete(v126); goto LABEL_101; } v26 = *(_BYTE *)(v21 + 392); v112 = nullptr; v110 = 0; v111 = 0; if ( (v26 & 1) != 0 ) { std::string::__init(&v110, *(void **)(v21 + 408), *(_QWORD *)(v21 + 400)); } else { v27 = *(_QWORD *)(v21 + 392); v28 = *(_QWORD *)(v21 + 400); v112 = *(void **)(v21 + 408); v110 = v27; v111 = v28; } v113 = 0; v114 = 0; v29 = *((_BYTE *)v89 + 392); v115 = nullptr; if ( (v29 & 1) != 0 ) { std::string::__init(&v113, *((void **)v89 + 51), *((_QWORD *)v89 + 50)); v32 = sub_91069C((__int64)&v110, (__int64)&v113); if ( (v113 & 1) == 0 ) goto LABEL_45; LABEL_84: v86 = v32; operator delete(v115); v32 = v86; goto LABEL_45; } v30 = *((_QWORD *)v89 + 49); v31 = *((_QWORD *)v89 + 50); v115 = *((void **)v89 + 51); v113 = v30; v114 = v31; v32 = sub_91069C((__int64)&v110, (__int64)&v113); if ( (v113 & 1) != 0 ) goto LABEL_84; LABEL_45: if ( (v110 & 1) != 0 ) { v85 = v32; operator delete(v112); if ( v85 ) goto LABEL_47; } else if ( v32 ) { goto LABEL_47; } v79 = *(_BYTE *)(v21 + 344); v116 = 0; v117 = 0; v80 = v21 + 344; v118 = nullptr; if ( (v79 & 1) != 0 ) { std::string::__init(&v116, *(void **)(v80 + 16), *(_QWORD *)(v80 + 8)); } else { v81 = *(_QWORD *)v80; v82 = *(_QWORD *)(v80 + 8); v118 = *(void **)(v80 + 16); v116 = v81; v117 = v82; } sub_911DAC((__int64)&v116, v119); if ( (unsigned __int64 *)((char *)v89 + 344) != v119 ) { if ( (v119[0] & 1) != 0 ) { v83 = (char *)v120; v84 = v119[1]; } else { v84 = LOBYTE(v119[0]) >> 1; v83 = (char *)v119 + 1; } std::string::assign((__int64 *)v89 + 43, v83, v84); } if ( (v119[0] & 1) != 0 ) operator delete(v120); if ( (v116 & 1) != 0 ) operator delete(v118); cocos2d::CCArray::insertObject(*(this + 45), v89, v20); LABEL_102: v48 = *((_BYTE *)v89 + 1440); *((_DWORD *)v89 + 285) = 2; if ( (v48 & 1) != 0 ) { **((_BYTE **)v89 + 182) = 0; *((_QWORD *)v89 + 181) = 0; } else { *((_BYTE *)v89 + 1441) = 0; *((_BYTE *)v89 + 1440) = 0; } *((_BYTE *)v89 + 784) = 0; v49 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0); *((_DWORD *)v89 + 195) = v49; *((_DWORD *)v89 + 194) = v49; GJGameLevel::unverifyCoins(v89); *((_BYTE *)v89 + 786) = 1; v130 = 0; v131 = 0; v132 = nullptr; if ( (*(_BYTE *)v6 & 1) != 0 ) { std::string::__init((__int64 *)&v130, v6[2], (size_t)v6[1]); } else { v50 = v6[1]; v130 = (unsigned __int64)*v6; v131 = (unsigned __int64)v50; v132 = v6[2]; } if ( (v100 & 1) != 0 ) { v51 = v101; v52 = v102; if ( (unsigned __int64)(v101 - 10) <= 0x7FFFFFFFFFFFFFF5LL ) { LABEL_108: v53 = &v52[v51]; if ( v53 - 9 != v52 ) { v54 = v52 + 1; while ( 1 ) { v55 = v54 - 1; v56 = v54; if ( *(v54 - 1) == 95 ) break; LABEL_167: ++v54; if ( v56 == v53 - 9 ) goto LABEL_134; } v57 = v54 - 1; v58 = "_recovered"; while ( 1 ) { ++v58; if ( v54 + 8 == v57 ) break; v59 = (unsigned __int8)*++v57; if ( v59 != *(unsigned __int8 *)v58 ) goto LABEL_167; } if ( v53 != v55 && v55 - v52 != -1 ) { LABEL_116: v60 = (__int64 *)(this + 52); v61 = (unsigned __int64)*(this + 53); if ( (cocos2d::CCArray *)v61 != *(this + 54) ) goto LABEL_117; LABEL_153: std::vector::__push_back_slow_path(v60, &v130); if ( (v130 & 1) != 0 ) goto LABEL_154; LABEL_120: if ( (v107[0] & 1) == 0 ) goto LABEL_121; LABEL_155: operator delete(v108); if ( (v105[0] & 1) != 0 ) goto LABEL_156; LABEL_122: if ( (v103[0] & 1) == 0 ) goto LABEL_123; LABEL_157: operator delete(v104); if ( (v100 & 1) != 0 ) goto LABEL_158; goto LABEL_124; } } } } else { v51 = (unsigned __int8)v100 >> 1; v52 = (char *)&v100 + 1; if ( (unsigned __int64)(v51 - 10) <= 0x7FFFFFFFFFFFFFF5LL ) goto LABEL_108; } LABEL_134: v65 = (void *)(*(_BYTE *)v6 >> 1); if ( (*(_BYTE *)v6 & 1) != 0 ) v65 = v6[1]; std::string::basic_string(v136, (__int64)v6, 0, (size_t)v65 - 6); v66 = std::string::append((__int64)v136, "_recovered", 0xAu); v67 = *(_QWORD *)(v66 + 8); v133 = *(_QWORD *)v66; v134 = v67; v135 = *(void **)(v66 + 16); *(_QWORD *)v66 = 0; *(_QWORD *)(v66 + 8) = 0; v68 = v136[0]; *(_QWORD *)(v66 + 16) = 0; if ( (v68 & 1) != 0 ) operator delete((void *)v136[2]); std::operator+(".gdlvl", (__int64)&v133, v137); if ( (v130 & 1) != 0 ) { *(_BYTE *)v132 = 0; v131 = 0; } else { LOWORD(v130) = 0; } v69 = 2; std::string::reserve((__int64 *)&v130, 0); v70 = (__int64 *)v137[0]; v132 = (void *)v137[2]; v130 = v137[0]; v131 = v137[1]; while ( 1 ) { v71 = cocos2d::CCFileUtils::sharedFileUtils((cocos2d::CCFileUtils *)v70); if ( !(*(unsigned __int8 (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v71 + 160LL))(v71, &v130) ) break; v76 = (char *)&v133 + 1; if ( (v133 & 1) != 0 ) v76 = (const char *)v135; v77 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s%i.gdlvl", v76, v69); v78 = (char *)cocos2d::CCString::getCString(v77); v70 = std::string::assign((__int64 *)&v130, v78); if ( ++v69 == 100 ) { if ( (*(_BYTE *)v6 & 1) == 0 ) goto LABEL_165; LABEL_143: v72 = (const char *)v6[2]; goto LABEL_144; } } if ( (*(_BYTE *)v6 & 1) != 0 ) goto LABEL_143; LABEL_165: v72 = (const char *)v7; LABEL_144: v73 = (char *)&v130 + 1; if ( (v130 & 1) != 0 ) v73 = (const char *)v132; if ( rename(v72, v73) && &v130 != (unsigned __int64 *)v6 ) { if ( (*(_BYTE *)v6 & 1) != 0 ) { v74 = (cocos2d::CCString *)v6[2]; v75 = (size_t)v6[1]; } else { v74 = v7; v75 = *(_BYTE *)v6 >> 1; } std::string::assign((__int64 *)&v130, v74, v75); } if ( (v133 & 1) == 0 ) goto LABEL_116; v60 = (__int64 *)(this + 52); operator delete(v135); v61 = (unsigned __int64)*(this + 53); if ( (cocos2d::CCArray *)v61 == *(this + 54) ) goto LABEL_153; LABEL_117: if ( v61 ) { std::string::basic_string(v61, &v130); v61 = v60[1]; } v60[1] = v61 + 24; if ( (v130 & 1) == 0 ) goto LABEL_120; LABEL_154: operator delete(v132); if ( (v107[0] & 1) != 0 ) goto LABEL_155; LABEL_121: if ( (v105[0] & 1) == 0 ) goto LABEL_122; LABEL_156: operator delete(v106); if ( (v103[0] & 1) != 0 ) goto LABEL_157; LABEL_123: if ( (v100 & 1) != 0 ) LABEL_158: operator delete(v102); LABEL_124: v87 = 1; LABEL_74: v6 += 3; v7 = (cocos2d::CCString *)((char *)v7 + 24); if ( v91 != v6 ) { v8 = *(_BYTE *)v6; if ( (*(_BYTE *)v6 & 1) == 0 ) { LABEL_76: v9 = v7; v10 = (char *)(v8 >> 1); goto LABEL_15; } goto LABEL_14; } LABEL_55: v91 = v97; LABEL_56: if ( v91 ) { v34 = v98; if ( v98 != v91 ) { do { v98 = v34 - 3; std::string::~string((__int64)(v34 - 3)); v34 = v98; } while ( v98 != v91 ); v91 = v97; } operator delete(v91); } LABEL_61: v35 = (__int64)v94; if ( v94 ) { v36 = v95; if ( v94 != v95 ) { do { v95 = v36 - 24; std::string::~string((__int64)(v36 - 24)); v36 = v95; } while ( (char *)v35 != v95 ); v36 = v94; } operator delete(v36); } if ( (v92[0] & 1) != 0 ) operator delete(v93); return v87; }
GD Web Decomp Icon

GD Web Decomp

Raw Source