// // LocalLevelManager::exportLevelsToFile from 0x14046e780 to 0x14046ece5 (1381 bytes) // // 5 xrefs: // > EditLevelLayer::onExportLevel @ 0x14017cc4b // > EditorPauseLayer::onExport @ 0x140182997 // > EditorUI::handleEditorAction @ 0x1401c4634 // > LevelBrowserLayer::onExportSelected @ 0x1403e9798 // > @ 0x1409280f4 // // This function is hookable on this platform (idp: pc, 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 11:32:38 +0000 // // Hidden C++ exception states: #wind=12 __int64 __fastcall LocalLevelManager::exportLevelsToFile(__int64 a1, cocos2d::CCArray *a2) { cocos2d::CCArray *v2; // r12 unsigned int v3; // r15d struct cocos2d::CCObject *v4; // rax const char *v5; // rax char v6; // bl unsigned int v7; // r13d struct cocos2d::CCObject *v8; // rsi DS_Dictionary *v9; // rdi const char **v10; // rbx void **v11; // rdx unsigned int v12; // r14d cocos2d::CCString *v13; // rax char *CString; // rax size_t v15; // r8 _QWORD *v16; // rax char *v17; // r8 __int64 v18; // rax __int128 v19; // xmm6 __int128 v20; // xmm7 char *v21; // rcx int v22; // ebx size_t v23; // r8 char **v24; // rdx const char *v25; // rcx FILE *v26; // rax const char *v27; // rdx cocos2d::CCString *v28; // rax char *v29; // rax size_t v30; // r8 void *v31; // rcx const char *v32; // rcx FILE *v33; // rax FILE *v34; // rbx void **v35; // rcx unsigned int v37; // [rsp+38h] [rbp-D0h] __m256i v38; // [rsp+40h] [rbp-C8h] BYREF DS_Dictionary *FileName; // [rsp+60h] [rbp-A8h] char *FileName_8[2]; // [rsp+68h] [rbp-A0h] BYREF __int128 v41; // [rsp+78h] [rbp-90h] __int128 v42; // [rsp+88h] [rbp-80h] BYREF __int64 v43; // [rsp+98h] [rbp-70h] unsigned __int64 v44; // [rsp+A0h] [rbp-68h] void *Src[2]; // [rsp+A8h] [rbp-60h] BYREF size_t Size; // [rsp+B8h] [rbp-50h] unsigned __int64 v47; // [rsp+C0h] [rbp-48h] __int128 v48; // [rsp+C8h] [rbp-40h] BYREF size_t v49; // [rsp+D8h] [rbp-30h] unsigned __int64 v50; // [rsp+E0h] [rbp-28h] void *v51[4]; // [rsp+E8h] [rbp-20h] BYREF void *Buffer[4]; // [rsp+108h] [rbp+0h] BYREF _QWORD v53[4]; // [rsp+128h] [rbp+20h] BYREF _QWORD v54[4]; // [rsp+148h] [rbp+40h] BYREF v2 = a2; v38.m256i_i64[0] = (__int64)a2; v3 = 0; if ( a2 && cocos2d::CCArray::count(a2) ) { v37 = cocos2d::CCArray::count(v2); v48 = 0; v49 = 0; v50 = 15; LOBYTE(v48) = 0; *(_OWORD *)Src = 0; Size = 0; v47 = 15; LOBYTE(Src[0]) = 0; if ( v37 == 1 ) { v4 = cocos2d::CCArray::objectAtIndex(v2, 0); sub_14003F4F0((__int64)v51, (__int64)v4 + 344); v5 = (const char *)construct_environment_block(v53, (__int64)v51); v6 = GameToolbox::showSaveFileDialog( "Export Level", "GD Level Files (*.gdlvl)", (const CHAR *)&dword_140725750 + 1, v5, Src); sub_14003D310((__int64)v53); sub_14003D310((__int64)v51); if ( v6 ) { LABEL_5: v7 = 0; memset(&v38.m256i_u64[1], 0, 24); if ( cocos2d::CCArray::count(v2) ) { do { v8 = cocos2d::CCArray::objectAtIndex(v2, v3); FileName = (DS_Dictionary *)operator new(0xF0u); v9 = DS_Dictionary::DS_Dictionary(FileName); (*(void (__fastcall **)(struct cocos2d::CCObject *, DS_Dictionary *))(*(_QWORD *)v8 + 40LL))(v8, v9); v10 = (const char **)off_1408FE090; do DS_Dictionary::removeKey(v9, *v10++); while ( v10 != (const char **)&dword_1408FE350 ); v2 = (cocos2d::CCArray *)v38.m256i_i64[0]; DS_Dictionary::saveRootSubDictToString(v9, v53); if ( v9 ) { DS_Dictionary::~DS_Dictionary(v9); j_j_free(v9); } cocos2d::ZipUtils::compressString(Buffer, v53, 0, 0xFFFFFFFFLL, 11); *(_OWORD *)FileName_8 = 0; *(_QWORD *)&v41 = 0; *((_QWORD *)&v41 + 1) = 15; LOBYTE(FileName_8[0]) = 0; if ( v37 == 1 && Size ) { v11 = Src; if ( v47 > 0xF ) v11 = (void **)Src[0]; sub_1400405A0((void **)FileName_8, v11, Size); } else { sub_14003F4F0((__int64)v51, (__int64)v8 + 344); if ( !v51[2] ) { v13 = cocos2d::CCString::createWithFormat("level_%i", v3); CString = (char *)cocos2d::CCString::getCString(v13); v15 = -1; do ++v15; while ( CString[v15] ); sub_1400405A0(v51, CString, v15); } v16 = construct_environment_block(v54, (__int64)v51); v17 = (char *)&v48; if ( v50 > 0xF ) v17 = (char *)v48; v18 = sub_140059D70(v16, 0, v17, v49); v19 = *(_OWORD *)v18; v20 = *(_OWORD *)(v18 + 16); *(_QWORD *)(v18 + 16) = 0; *(_QWORD *)(v18 + 24) = 15; *(_BYTE *)v18 = 0; if ( *((_QWORD *)&v41 + 1) > 0xFu ) { v21 = FileName_8[0]; if ( (unsigned __int64)(*((_QWORD *)&v41 + 1) + 1LL) >= 0x1000 ) { v21 = *((char **)FileName_8[0] - 1); if ( (unsigned __int64)(FileName_8[0] - v21 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free(v21); } *(_OWORD *)FileName_8 = v19; v41 = v20; sub_14003D310((__int64)v54); v22 = 2; v23 = v41 - 6; v42 = 0; v43 = 0; v44 = 0; if ( (unsigned __int64)v41 < 6 ) v23 = v41; v24 = FileName_8; if ( *((_QWORD *)&v41 + 1) > 0xFu ) v24 = (char **)FileName_8[0]; sub_14003D230(&v42, v24, v23); while ( 1 ) { v25 = (const char *)FileName_8; if ( *((_QWORD *)&v41 + 1) > 0xFu ) v25 = FileName_8[0]; v26 = fopen(v25, "r"); if ( !v26 ) break; fclose(v26); v27 = (const char *)&v42; if ( v44 > 0xF ) v27 = (const char *)v42; v28 = cocos2d::CCString::createWithFormat("%s_%i.gdlvl", v27, v22); v29 = (char *)cocos2d::CCString::getCString(v28); v30 = -1; do ++v30; while ( v29[v30] ); sub_1400405A0((void **)FileName_8, v29, v30); ++v22; } if ( v44 > 0xF ) { v31 = (void *)v42; if ( v44 + 1 >= 0x1000 ) { v31 = *(void **)(v42 - 8); if ( (unsigned __int64)(v42 - (_QWORD)v31 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free(v31); } v43 = 0; v44 = 15; LOBYTE(v42) = 0; sub_14003D310((__int64)v51); } v32 = (const char *)FileName_8; if ( *((_QWORD *)&v41 + 1) > 0xFu ) v32 = FileName_8[0]; v33 = fopen(v32, "w"); v34 = v33; if ( v33 ) { v35 = Buffer; if ( Buffer[3] > (void *)0xF ) v35 = (void **)Buffer[0]; fwrite(v35, 1u, (size_t)Buffer[2], v33); fclose(v34); ++v7; sub_140075F50(&v38.m256i_i64[1], (__int64)FileName_8); } sub_14003D310((__int64)FileName_8); sub_14003D310((__int64)Buffer); sub_14003D310((__int64)v53); ++v3; } while ( v3 < cocos2d::CCArray::count((cocos2d::CCArray *)v38.m256i_i64[0]) ); } v12 = v7; sub_1400760C0(&v38.m256i_i64[1]); goto LABEL_53; } } else if ( GameToolbox::showFolderDialog("Select Export Folder", (LPSTR *)&v48) ) { goto LABEL_5; } v12 = -1; LABEL_53: sub_14003D310((__int64)Src); sub_14003D310((__int64)&v48); return v12; } return 0; }
GD Web Decomp Icon

GD Web Decomp

Raw Source