// // EditorPauseLayer::saveLevel from 0x1400dd840 to 0x1400dded1 (1681 bytes) // // 4 xrefs: // > EditorPauseLayer::onSaveAndPlay @ 0x1400ddf0c // > EditorPauseLayer::onSaveAndExit @ 0x1400de287 // > EditorPauseLayer::FLAlert_Clicked @ 0x1400de56c // > @ 0x1406c8a30 // // 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 // // Hidden C++ exception states: #wind=4 void EditorPauseLayer::saveLevel(EditorPauseLayer *a1) { LevelEditorLayer *m_editorLayer; // rcx GJGameLevel *m_level; // rsi int v4; // ebx int v5; // eax __int64 v6; // rax __int64 v7; // rbx void *v8; // rdx _BYTE *v9; // rax float LastObjectX; // xmm0_4 DrawGridLayer *m_drawGridLayer; // rdi LevelSettingsObject *m_levelSettings; // rbx const struct cocos2d::CCPoint *v13; // rax cocos2d::CCPoint v14; // rax float v15; // xmm0_4 LevelEditorLayer *v16; // rdx int m_timestamp; // ecx int v18; // ecx int v19; // eax int v20; // ebx float v21; // xmm0_4 LevelEditorLayer *v22; // r14 char v23; // r9 int v24; // ebx unsigned __int64 v25; // rdi _BYTE *v26; // rax size_t v27; // rdi size_t v28; // r8 __int64 v29; // r15 _QWORD *v30; // rdx __int64 v31; // r13 __int64 v32; // rbx __int64 v33; // r14 _BYTE *v34; // rax __int64 v35; // r15 void **v36; // rdx __int64 v37; // rax __int64 SongIDs; // rax __int64 SFXIDs; // rax LocalLevelManager *v40; // rax _BYTE v41[8]; // [rsp+58h] [rbp-B0h] BYREF _QWORD v42[3]; // [rsp+60h] [rbp-A8h] BYREF _QWORD Src[3]; // [rsp+78h] [rbp-90h] BYREF size_t Size; // [rsp+90h] [rbp-78h] unsigned __int64 v45; // [rsp+98h] [rbp-70h] void *v46[2]; // [rsp+A0h] [rbp-68h] BYREF size_t v47; // [rsp+B0h] [rbp-58h] unsigned __int64 v48; // [rsp+B8h] [rbp-50h] void **Buf1; // [rsp+C8h] [rbp-40h] BYREF __int64 Buf1_8; // [rsp+D0h] [rbp-38h] _QWORD Buf2[4]; // [rsp+E8h] [rbp-20h] BYREF _BYTE v52[528]; // [rsp+108h] [rbp+0h] BYREF Src[0] = a1; m_editorLayer = a1->m_editorLayer; m_level = m_editorLayer->m_level; LevelEditorLayer::getLevelString(m_editorLayer, Buf2); sub_14003BDB0((__int64)&Buf1, (__int64)&a1->m_editorLayer->m_levelString); v4 = sub_14003A760(&Buf1, Buf2); sub_14003A830((__int64)&Buf1); if ( v4 ) { m_level->m_hasBeenModified = 1; m_level->m_isVerifiedRaw = 0; v5 = (int)(float)((float)((float)rand() / 32767.0) * 1000.0); m_level->m_isVerified.seed = v5; m_level->m_isVerified.random = v5; GJGameLevel::unverifyCoins(m_level); sub_14003CCE0((void **)&m_level->m_capacityString, byte_140518980, 0); m_level->m_bestTime = 0; m_level->m_bestPoints = 0; *(_WORD *)&m_level->m_savedTime = 0; if ( m_level->m_isUploaded ) { m_level->m_isUploaded = 0; ++m_level->m_levelVersion; } } v6 = cocos2d::ZipUtils::compressString(&Buf1, Buf2, 0, 11); v7 = v6; v42[1] = v6; if ( &m_level->m_levelString != (std::string *)v6 ) { v8 = (void *)v6; if ( *(_QWORD *)(v6 + 24) > 0xFu ) v8 = *(void **)v6; sub_14003CCE0((void **)&m_level->m_levelString, v8, *(_QWORD *)(v6 + 16)); } sub_14003A830(v7); Buf2[2] = 0; v9 = Buf2; if ( Buf2[3] > 0xFu ) v9 = (_BYTE *)Buf2[0]; *v9 = 0; m_level->m_audioTrack = a1->m_editorLayer->m_level->m_audioTrack; m_level->m_twoPlayerMode = a1->m_editorLayer->m_levelSettings->m_twoPlayerMode; LastObjectX = LevelEditorLayer::getLastObjectX(a1->m_editorLayer); m_drawGridLayer = a1->m_editorLayer->m_drawGridLayer; cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42[1], LastObjectX + 340.0, 0.0); m_levelSettings = m_drawGridLayer->m_editorLayer->m_levelSettings; cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&Buf1, v13); v15 = LevelTools::timeForPos( v14, m_drawGridLayer->m_speedObjects, m_levelSettings->m_startSpeed, 0, 0, 0, m_levelSettings->m_platformerMode, 0, 0, 0); v16 = a1->m_editorLayer; m_timestamp = v16->m_level->GJBaseGameLayer::m_timestamp; if ( m_timestamp > 0 ) v15 = fmaxf((float)m_timestamp / 240.0, v15); v18 = (int)v15; if ( v16->m_levelSettings->m_platformerMode ) { v19 = 5; } else if ( v18 >= 10 ) { if ( v18 >= 30 ) { if ( v18 >= 60 ) v19 = (v18 >= 120) + 3; else v19 = 2; } else { v19 = 1; } } else { v19 = 0; } m_level->m_levelLength = v19; v20 = a1->m_editorLayer->m_objectCount.random - a1->m_editorLayer->m_objectCount.seed; m_level->m_objectCount.value = v20; v21 = (float)((float)rand() / 32767.0) * 1000.0; m_level->m_objectCount.seed = (int)v21; m_level->m_objectCount.random = v20 + (int)v21; m_level->m_coins = a1->m_editorLayer->m_coinCount.random - a1->m_editorLayer->m_coinCount.seed; m_level->m_lowDetailMode = a1->m_editorLayer->m_hasHighDetail; if ( v20 <= 40000 ) { m_level->m_highObjectsEnabled = 0; LABEL_24: m_level->m_unlimitedObjectsEnabled = 0; goto LABEL_25; } if ( v20 <= 80000 ) goto LABEL_24; LABEL_25: m_level->m_workingTime += (int)floorf(a1->m_editorLayer->m_sessionTime); v22 = a1->m_editorLayer; fmt::BasicWriter::BasicWriter(v52); v23 = 1; v24 = 0; v25 = 0; do { if ( ((1 << (v25 & 0x1F)) & v22->m_lockedLayers._Myvec._Mypair._Myval2._Myfirst[v25 >> 5]) != 0 ) { if ( !v23 ) { Buf1 = (void **)","; Buf1_8 = 0; *(_OWORD *)&v42[1] = (unsigned __int64)","; fmt::BasicWriter::operator<<(v52, &v42[1]); } fmt::BasicWriter::operator<<(v52, (unsigned int)v24); v23 = 0; } ++v24; ++v25; } while ( v24 <= 9999 ); v26 = (_BYTE *)fmt::BasicWriter::c_str(v52); *(_OWORD *)&Src[1] = 0; Size = 0; v45 = 0; v27 = -1; v28 = -1; v29 = Src[0]; do ++v28; while ( v26[v28] ); sub_14003A930(&Src[1], v26, v28); fmt::BasicWriter::~BasicWriter(v52); Buf1 = (void **)&Src[1]; if ( &m_level->m_lockedEditorLayers != (std::string *)&Src[1] ) { v30 = &Src[1]; if ( v45 > 0xF ) v30 = (_QWORD *)Src[1]; sub_14003CCE0((void **)&m_level->m_lockedEditorLayers, v30, Size); } sub_14003A830((__int64)&Src[1]); v31 = *(_QWORD *)(v29 + 584); fmt::BasicWriter::BasicWriter(v52); v32 = 0; Buf1 = (void **)","; Buf1_8 = 0; do { v33 = *(_QWORD *)(v31 + 14832); if ( v32 ) { Buf1 = (void **)","; Buf1_8 = 0; *(_OWORD *)&v42[1] = (unsigned __int64)","; fmt::BasicWriter::operator<<(v52, &v42[1]); } fmt::BasicWriter::operator<<(v52, (unsigned int)(int)*(float *)(v33 + 8 * v32)); *(_OWORD *)&v42[1] = (unsigned __int64)","; fmt::BasicWriter::operator<<(v52, &v42[1]); fmt::BasicWriter::operator<<(v52, (unsigned int)(int)*(float *)(v33 + 8 * v32++ + 4)); } while ( v32 < 10 ); v34 = (_BYTE *)fmt::BasicWriter::c_str(v52); *(_OWORD *)v46 = 0; v47 = 0; v48 = 0; v35 = Src[0]; do ++v27; while ( v34[v27] ); sub_14003A930(v46, v34, v27); fmt::BasicWriter::~BasicWriter(v52); Buf1 = v46; if ( &m_level->m_savedCameraPositions != (std::string *)v46 ) { v36 = v46; if ( v48 > 0xF ) v36 = (void **)v46[0]; sub_14003CCE0((void **)&m_level->m_savedCameraPositions, v36, v47); } sub_14003A830((__int64)v46); cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)&Buf1, (const struct cocos2d::CCPoint *)(*(_QWORD *)(v35 + 584) + 14856LL)); cocos2d::CCPoint::operator=(&m_level->m_previewLock, v37); v41[0] = 0; SongIDs = LevelEditorLayer::getSongIDs(*(_QWORD *)(v35 + 584), &Buf1, v41); sub_140051590((__int64)&m_level->m_songIDs, SongIDs); sub_14003A830((__int64)&Buf1); SFXIDs = LevelEditorLayer::getSFXIDs(*(_QWORD *)(v35 + 584), &Buf1); sub_140051590((__int64)&m_level->m_sfxIDs, SFXIDs); sub_14003A830((__int64)&Buf1); if ( !m_level->m_sfxIDs.m_data.m_size && !v41[0] ) sub_14003CCE0((void **)&m_level->m_songIDs, byte_140518980, 0); v40 = LocalLevelManager::sharedState(); GManager::save(v40); sub_14003A830((__int64)Buf2); }