// // LocalLevelManager::exportLevelsToFile from 0x91367c to 0x913fe8 (2412 bytes) // // 5 xrefs: // > EditLevelLayer::onExportLevel @ 0x7ee224 // > LevelBrowserLayer::onExportSelected @ 0x7f73fc // > EditorPauseLayer::FLAlert_Clicked @ 0x8b70d8 // > EditorUI::handleEditorAction @ 0xbd8550 // > @ 0xde580 // // 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:18 +0000 // __int64 __fastcall LocalLevelManager::exportLevelsToFile(LocalLevelManager *this, cocos2d::CCArray *a2) { cocos2d::CCFileUtils *v3; // x0 __int64 v4; // x0 __int64 v5; // x0 size_t v6; // x3 char v7; // w1 char *v8; // x0 char *v9; // x0 DIR *v10; // x21 struct dirent *v11; // x0 size_t v12; // x0 int v13; // w24 unsigned int v14; // w20 const char *v16; // x0 unsigned int v17; // w26 __int64 v18; // x19 size_t v19; // x2 char *v20; // x1 const char *v21; // x0 FILE *v22; // x19 char *v23; // x0 size_t v24; // x2 char *v25; // x0 __int64 v26; // x1 __int64 v27; // x1 cocos2d::CCString *v28; // x0 char *CString; // x0 char *v30; // x2 size_t v31; // x3 __int64 *v32; // x0 size_t v33; // x3 size_t v34; // x3 unsigned int i; // w19 const char *v36; // x1 cocos2d::CCString *v37; // x0 char *v38; // x0 const char *v39; // x0 FILE *v40; // x0 char *v41; // x19 char *v42; // x0 __int64 v43; // x0 __int64 v44; // x1 char *v45; // x2 size_t v46; // x3 __int64 *v47; // x0 size_t v48; // x3 char v49; // w1 _BOOL4 v51; // [xsp+74h] [xbp+74h] char *d_name; // [xsp+88h] [xbp+88h] int v53; // [xsp+88h] [xbp+88h] __int64 v54; // [xsp+98h] [xbp+98h] BYREF size_t v55; // [xsp+A0h] [xbp+A0h] char *path; // [xsp+A8h] [xbp+A8h] __int64 v57; // [xsp+B0h] [xbp+B0h] BYREF size_t v58; // [xsp+B8h] [xbp+B8h] void *v59; // [xsp+C0h] [xbp+C0h] void *v60[3]; // [xsp+C8h] [xbp+C8h] BYREF void *v61; // [xsp+E0h] [xbp+E0h] BYREF char *v62; // [xsp+E8h] [xbp+E8h] char *v63; // [xsp+F0h] [xbp+F0h] __int64 v64; // [xsp+F8h] [xbp+F8h] BYREF __int64 v65; // [xsp+100h] [xbp+100h] void *v66; // [xsp+108h] [xbp+108h] __int64 v67[2]; // [xsp+110h] [xbp+110h] BYREF void *v68; // [xsp+120h] [xbp+120h] unsigned __int64 v69[3]; // [xsp+128h] [xbp+128h] BYREF __int64 v70; // [xsp+140h] [xbp+140h] BYREF size_t v71; // [xsp+148h] [xbp+148h] void *v72; // [xsp+150h] [xbp+150h] __int64 v73; // [xsp+158h] [xbp+158h] BYREF __int64 v74; // [xsp+160h] [xbp+160h] void *v75; // [xsp+168h] [xbp+168h] __int64 v76; // [xsp+170h] [xbp+170h] BYREF size_t v77; // [xsp+178h] [xbp+178h] void *v78; // [xsp+180h] [xbp+180h] if ( !a2 || !(unsigned int)cocos2d::CCArray::count(a2) ) return 0; if ( *((int *)this + 146) > 0 ) return (unsigned int)-2; v54 = 0; v51 = cocos2d::CCArray::count(a2) == 1; v55 = 0; path = nullptr; std::string::__init(&v54, &byte_11B8890, 0); v57 = 0; v58 = 0; v59 = nullptr; v3 = (cocos2d::CCFileUtils *)std::string::__init(&v57, &byte_11B8890, 0); v4 = cocos2d::CCFileUtils::sharedFileUtils(v3); (*(void (__fastcall **)(void **__return_ptr))(*(_QWORD *)v4 + 144LL))(v60); v5 = std::string::append((__int64)v60, "exports/", 8u); v6 = *(_QWORD *)(v5 + 8); v76 = *(_QWORD *)v5; v77 = v6; v78 = *(void **)(v5 + 16); *(_QWORD *)v5 = 0; *(_QWORD *)(v5 + 8) = 0; v7 = v54; *(_QWORD *)(v5 + 16) = 0; if ( (v7 & 1) != 0 ) { *path = 0; v55 = 0; } else { LOWORD(v54) = 0; } std::string::reserve(&v54, 0); path = (char *)v78; v54 = v76; v55 = v77; if ( ((__int64)v60[0] & 1) != 0 ) operator delete(v60[2]); v8 = (char *)&v54 + 1; if ( (v54 & 1) != 0 ) v8 = path; mkdir(v8, 0x1EDu); v9 = (char *)&v54 + 1; if ( (v54 & 1) != 0 ) v9 = path; v10 = opendir(v9); if ( v10 ) { while ( 1 ) { v11 = readdir(v10); if ( !v11 ) { closedir(v10); break; } v70 = 0; v71 = 0; v72 = nullptr; d_name = v11->d_name; v12 = strlen(v11->d_name); std::string::__init(&v70, d_name, v12); v76 = 0; v77 = 0; v78 = nullptr; std::string::__init(&v76, ".gdlvl", 6u); v13 = (unsigned __int8)GameToolbox::stringEndsWith((__int64)&v70, (__int64)&v76); if ( (v76 & 1) != 0 ) { operator delete(v78); if ( !v13 ) goto LABEL_16; } else if ( !v13 ) { goto LABEL_16; } std::operator+((__int64)&v54, (__int64)&v70, (unsigned __int64 *)&v73); v16 = (char *)&v73 + 1; if ( (v73 & 1) != 0 ) v16 = (const char *)v75; remove(v16); if ( (v73 & 1) != 0 ) operator delete(v75); LABEL_16: if ( (v70 & 1) != 0 ) operator delete(v72); } } if ( v51 ) { v43 = cocos2d::CCArray::objectAtIndex(a2, 0); v64 = 0; v65 = 0; v66 = nullptr; if ( (*(_BYTE *)(v43 + 344) & 1) != 0 ) { std::string::__init(&v64, *(void **)(v43 + 360), *(_QWORD *)(v43 + 352)); } else { v44 = *(_QWORD *)(v43 + 352); v64 = *(_QWORD *)(v43 + 344); v65 = v44; v66 = *(void **)(v43 + 360); } sub_9120B4((char *)&v64, (unsigned __int64 *)v67); if ( (v54 & 1) != 0 ) { v45 = path; v46 = v55; } else { v46 = (unsigned __int8)v54 >> 1; v45 = (char *)&v54 + 1; } v47 = std::string::insert(v67, 0, v45, v46); v48 = v47[1]; v76 = *v47; v77 = v48; v78 = (void *)v47[2]; *v47 = 0; v47[1] = 0; v49 = v57; v47[2] = 0; if ( (v49 & 1) != 0 ) { *(_BYTE *)v59 = 0; v58 = 0; } else { LOWORD(v57) = 0; } std::string::reserve(&v57, 0); v57 = v76; v58 = v77; v59 = v78; if ( (v67[0] & 1) != 0 ) operator delete(v68); if ( (v64 & 1) != 0 ) operator delete(v66); } v61 = nullptr; v62 = nullptr; v17 = 0; v63 = nullptr; v53 = 0; while ( v17 < (unsigned int)cocos2d::CCArray::count(a2) ) { v18 = cocos2d::CCArray::objectAtIndex(a2, v17); GJGameLevel::getExportSaveString((GJGameLevel *)v18, (__int64)&v64); cocos2d::ZipUtils::compressString(v67, (int)&v64, 0, -1); v70 = 0; v71 = 0; v72 = nullptr; if ( v51 ) { if ( (v57 & 1) != 0 ) { v19 = v58; if ( v58 ) { v20 = (char *)v59; LABEL_34: std::string::assign(&v70, v20, v19); goto LABEL_35; } } else { LODWORD(v19) = (int)(unsigned __int8)v57 >> 1; if ( (_DWORD)v19 ) { v19 = (int)v19; v20 = (char *)&v57 + 1; goto LABEL_34; } } } v73 = 0; v74 = 0; v75 = nullptr; if ( (*(_BYTE *)(v18 + 344) & 1) != 0 ) { std::string::__init(&v73, *(void **)(v18 + 360), *(_QWORD *)(v18 + 352)); } else { v26 = *(_QWORD *)(v18 + 352); v73 = *(_QWORD *)(v18 + 344); v74 = v26; v75 = *(void **)(v18 + 360); } v27 = (unsigned __int8)v73 >> 1; if ( (v73 & 1) != 0 ) v27 = v74; if ( !v27 ) { v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"level_%i", (const char *)v17); CString = (char *)cocos2d::CCString::getCString(v28); std::string::assign(&v73, CString); } sub_9120B4((char *)&v73, v69); if ( (v54 & 1) != 0 ) { v30 = path; v31 = v55; } else { v31 = (unsigned __int8)v54 >> 1; v30 = (char *)&v54 + 1; } v32 = std::string::insert(v69, 0, v30, v31); v33 = v32[1]; v76 = *v32; v77 = v33; v78 = (void *)v32[2]; *v32 = 0; v32[1] = 0; v32[2] = 0; if ( (v70 & 1) != 0 ) { *(_BYTE *)v72 = 0; v71 = 0; } else { LOWORD(v70) = 0; } std::string::reserve(&v70, 0); v72 = v78; v70 = v76; v71 = v77; if ( (v69[0] & 1) != 0 ) operator delete((void *)v69[2]); v34 = (unsigned __int8)v70 >> 1; if ( (v70 & 1) != 0 ) v34 = v71; std::string::basic_string(&v76, (__int64)&v70, 0, v34 - 6); for ( i = 2; ; ++i ) { v39 = (char *)&v70 + 1; if ( (v70 & 1) != 0 ) v39 = (const char *)v72; v40 = fopen(v39, "r"); if ( !v40 ) break; fclose(v40); v36 = (char *)&v76 + 1; if ( (v76 & 1) != 0 ) v36 = (const char *)v78; v37 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_%i.gdlvl", v36, i); v38 = (char *)cocos2d::CCString::getCString(v37); std::string::assign(&v70, v38); } if ( (v76 & 1) != 0 ) operator delete(v78); if ( (v73 & 1) != 0 ) operator delete(v75); LABEL_35: v21 = (char *)&v70 + 1; if ( (v70 & 1) != 0 ) v21 = (const char *)v72; v22 = fopen(v21, "w"); if ( v22 ) { if ( (v67[0] & 1) != 0 ) { v23 = (char *)v68; v24 = v67[1]; } else { v24 = LOBYTE(v67[0]) >> 1; v23 = (char *)v67 + 1; } fwrite(v23, 1u, v24, v22); fclose(v22); v25 = v62; ++v53; if ( v62 == v63 ) { std::vector::__push_back_slow_path((__int64 *)&v61, &v70); } else { if ( v62 ) { std::string::basic_string((unsigned __int64)v62, &v70); v25 = v62; } v62 = v25 + 24; } } if ( (v70 & 1) != 0 ) operator delete(v72); if ( (v67[0] & 1) != 0 ) operator delete(v68); ++v17; if ( (v64 & 1) != 0 ) operator delete(v66); } if ( v53 ) { *((_DWORD *)this + 146) = v53; PlatformToolbox::shareFiles((__int64 *)&v61); v14 = -2; } else { v14 = 0; } v41 = (char *)v61; if ( v61 ) { v42 = v62; if ( v61 != v62 ) { do { v62 = v42 - 24; std::string::~string((__int64)(v42 - 24)); v42 = v62; } while ( v41 != v62 ); v42 = (char *)v61; } operator delete(v42); } if ( (v57 & 1) != 0 ) operator delete(v59); if ( (v54 & 1) != 0 ) operator delete(path); return v14; }
GD Web Decomp Icon

GD Web Decomp

Raw Source