// // LevelEditorLayer::createObjectsFromString from 0x1000df360 to 0x1000dfafd (1949 bytes) // // 3 xrefs: // > EditorUI::spriteFromObjectString @ 0x100033f82 // > EditorUI::pasteObjects @ 0x10003a7fb // > LevelEditorLayer::duplicateKeyframeAnimation @ 0x1000f44f4 // // 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 // __int64 __fastcall LevelEditorLayer::createObjectsFromString( GJBaseGameLayer *a1, unsigned __int8 *a2, char a3, char a4) { unsigned int v4; // r14d __int64 v5; // r14 const void *v6; // rdi LevelEditorLayer *v7; // rax cocos2d::CCArray *m_redoObjects; // rdi void **v9; // r14 double v10; // xmm0_8 void **v11; // rbx int v12; // r13d __int64 v13; // rax const std::string *v14; // r12 std::string::size_type v15; // r15 unsigned int v16; // eax std::string::size_type size; // rax __int64 v18; // rbx char v19; // r14 std::string::size_type v20; // rcx std::string::size_type v21; // r15 std::string::size_type v22; // rax unsigned int v23; // ebx std::string::size_type v24; // rbx std::string::pointer v25; // r13 unsigned int v26; // r13d std::string::size_type v27; // r13 std::string::pointer v28; // r14 size_t v29; // rbx char *v30; // r14 size_t v31; // r12 char *v32; // rbx size_t v33; // r13 char *v34; // rbx size_t v35; // r12 std::string *v36; // r14 GameObject *v37; // rax GameObject *v38; // r15 int m_objectID; // eax __int16 m_currentLayer; // ax UndoObject *v41; // r14 bool m_increaseMaxUndoRedo; // bl unsigned int v43; // eax unsigned int v44; // ecx cocos2d::CCScheduler *m_editorUI; // rdi void **v47; // r14 void **v48; // rdi std::string *begin; // rbx std::__vector_base::pointer end; // r14 std::__vector_base::pointer v51; // rdi char *data; // [rsp+0h] [rbp-E0h] const std::string *v53; // [rsp+8h] [rbp-D8h] __int64 v54; // [rsp+10h] [rbp-D0h] int v55; // [rsp+1Ch] [rbp-C4h] __int64 v58; // [rsp+28h] [rbp-B8h] std::string::size_type v59; // [rsp+30h] [rbp-B0h] std::string::size_type v60; // [rsp+30h] [rbp-B0h] __int64 v61; // [rsp+38h] [rbp-A8h] void *__p[2]; // [rsp+40h] [rbp-A0h] BYREF __int64 v63; // [rsp+50h] [rbp-90h] std::vector v64; // [rsp+58h] [rbp-88h] BYREF std::vector __s2; // [rsp+70h] [rbp-70h] BYREF char __dst[16]; // [rsp+90h] [rbp-50h] BYREF char *v67; // [rsp+A0h] [rbp-40h] LevelEditorLayer *v68; // [rsp+A8h] [rbp-38h] char v69; // [rsp+B7h] [rbp-29h] v68 = (LevelEditorLayer *)a1; LOWORD(__s2.__begin_) = 8194; BYTE2(__s2.__begin_) = 0; v4 = *a2; if ( (v4 & 1) != 0 ) { v5 = *((_QWORD *)a2 + 1); v6 = *((const void **)a2 + 2); } else { v5 = v4 >> 1; v6 = a2 + 1; } if ( memcmp(v6, (char *)&__s2.__begin_ + 1, v5 != 0) == 0 && v5 == 1 || !v5 ) return 0; v7 = v68; v68->m_keepGroupParents = 1; m_redoObjects = v7->m_redoObjects; sub_100720270(m_redoObjects); v54 = sub_10071F9E0(m_redoObjects, (char *)&__s2.__begin_ + 1); memset(&__s2, 0, sizeof(__s2)); sub_1000CADA0((__int64)&__s2, 0x259u); v9 = (void **)operator new(0x12C8u); __bzero(v9, 4808); v64.__begin_ = v9; v64.__end_ = v9 + 601; v64.__end_cap_.__value_ = v9 + 601; v10 = 0.0; *(_OWORD *)__p = 0; v63 = 0; sub_1000DC810(a2, ";", (__int64)__p, 0.0); v11 = (void **)__p[0]; if ( __p[1] != __p[0] ) { v61 = 0; v12 = 0; while ( a4 || v68->m_initializing || v68->m_objectCount.random - v68->m_objectCount.seed < 80000 ) { v13 = 0; *v64.__begin_ = nullptr; do { v64.__begin_[v13 + 1] = nullptr; v64.__begin_[v13 + 2] = nullptr; v64.__begin_[v13 + 3] = nullptr; v13 += 4; v64.__begin_[v13] = nullptr; } while ( v13 != 600 ); v14 = (const std::string *)&v11[3 * v61]; v15 = std::string::find(v14, 44, 0); v16 = (unsigned int)v14->__r_.__value_.__l.0; if ( (v16 & 1) != 0 ) size = v14->__r_.__value_.__l.__size_; else LODWORD(size) = v16 >> 1; v18 = (int)size; data = v14->__r_.__value_.__s.__data_; v19 = 1; v20 = 0; v53 = v14; v58 = (int)size; if ( (_DWORD)size ) { LABEL_21: if ( (v19 & 1) != 0 ) { v23 = (unsigned int)v14->__r_.__value_.__l.0; if ( (v23 & 1) != 0 ) { v24 = v14->__r_.__value_.__l.__size_; if ( v24 < v20 ) goto LABEL_101; v25 = v14->__r_.__value_.__l.__data_; } else { v24 = v23 >> 1; v25 = data; if ( v20 > v24 ) LABEL_101: sub_1000547C0(); } v29 = v24 - v20; if ( v29 >= v15 - v20 ) v29 = v15 - v20; if ( v29 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100006BF0(v10); v69 = v19; if ( v29 >= 0x17 ) { v59 = v20; v31 = (v29 | 7) + 1; if ( (v29 | 7) == 0x17 ) v31 = 26; v30 = (char *)operator new(v31); v67 = v30; *(_QWORD *)__dst = v31 | 1; *(_QWORD *)&__dst[8] = v29; v14 = v53; v20 = v59; } else { __dst[0] = 2 * v29; v30 = &__dst[1]; if ( !v29 ) { __dst[1] = 0; if ( (__dst[0] & 1) == 0 ) goto LABEL_37; LABEL_42: v32 = v67; v12 = atoi(v67); operator delete(v32); goto LABEL_58; } } memmove(v30, &v25[v20], v29); v30[v29] = 0; if ( (__dst[0] & 1) != 0 ) goto LABEL_42; LABEL_37: v12 = atoi(&__dst[1]); LABEL_58: v18 = v58; v19 = v69; LABEL_59: v19 ^= 1u; goto LABEL_60; } if ( v12 <= 0 ) goto LABEL_59; v69 = v19; v55 = v12; v26 = (unsigned int)v14->__r_.__value_.__l.0; if ( (v26 & 1) != 0 ) { v27 = v14->__r_.__value_.__l.__size_; if ( v27 < v20 ) goto LABEL_103; v28 = v14->__r_.__value_.__l.__data_; } else { v27 = v26 >> 1; v28 = data; if ( v20 > v27 ) LABEL_103: sub_1000547C0(); } v33 = v27 - v20; if ( v33 >= v15 - v20 ) v33 = v15 - v20; if ( v33 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100006BF0(v10); if ( v33 >= 0x17 ) { v60 = v20; v35 = (v33 | 7) + 1; if ( (v33 | 7) == 0x17 ) v35 = 26; v34 = (char *)operator new(v35); v67 = v34; *(_QWORD *)__dst = v35 | 1; *(_QWORD *)&__dst[8] = v33; v14 = v53; v20 = v60; } else { __dst[0] = 2 * v33; v34 = &__dst[1]; if ( !v33 ) goto LABEL_55; } memmove(v34, &v28[v20], v33); LABEL_55: v34[v33] = 0; v12 = v55; v36 = &__s2.__begin_[v55]; if ( (v36->m_data.m_short.sizex2 & 1) != 0 ) operator delete(v36->m_data.m_long.longStorage); v36->m_data.m_long.longStorage = v67; v10 = *(double *)__dst; *(_OWORD *)&v36->m_data.m_short.sizex2 = *(_OWORD *)__dst; v64.__begin_[v55] = v68; goto LABEL_58; } LABEL_60: while ( v15 != -1 ) { v21 = v15 + 1; v22 = std::string::find(v14, 44, v21); v20 = v21; v15 = v22; if ( v20 != v18 ) goto LABEL_21; } v37 = GameObject::objectFromVector(&__s2, &v64, v68, 0); v38 = v37; if ( v37 ) { m_objectID = v37->m_objectID; if ( m_objectID != 142 && (m_objectID != 1329 || v68->m_coinCount.random - v68->m_coinCount.seed <= 2) ) { ((void (__fastcall *)(GameObject *, _QWORD))v38->setVisible)(v38, 0); ((void (__fastcall *)(LevelEditorLayer *, GameObject *))v68->addToSection)(v68, v38); LevelEditorLayer::addSpecial(v68, v38); m_currentLayer = v68->m_currentLayer; if ( m_currentLayer != -1 && !v68->m_keepEditorLayer && v38->m_editorLayer != m_currentLayer && v38->m_editorLayer2 != m_currentLayer ) { v38->m_editorLayer = m_currentLayer; } sub_10071FCD0(v54, v38); if ( !a3 ) { v41 = UndoObject::create(v38, New); sub_100720270(v68->m_redoObjects); m_increaseMaxUndoRedo = v68->m_increaseMaxUndoRedo; v43 = sub_100720070(v68->m_undoObjects); v44 = 200; if ( m_increaseMaxUndoRedo ) v44 = 1000; if ( v43 >= v44 ) sub_100720230(v68->m_undoObjects, 0, 1); sub_10071FCD0(v68->m_undoObjects, v41); } } } if ( (*(_BYTE *)&v14->__r_.__value_.__s.0 & 1) != 0 ) { *v14->__r_.__value_.__l.__data_ = 0; v14->__r_.__value_.__l.__size_ = 0; } else { *(_WORD *)&v14->__r_.__value_.__l.0 = 0; } v11 = (void **)__p[0]; if ( 0xAAAAAAAAAAAAAAABLL * (((char *)__p[1] - (char *)__p[0]) >> 3) <= ++v61 ) goto LABEL_81; } m_editorUI = (cocos2d::CCScheduler *)v68->m_editorUI; if ( m_editorUI ) { EditorUI::showMaxError((EditorUI *)m_editorUI); v11 = (void **)__p[0]; } } LABEL_81: v68->m_keepGroupParents = 0; if ( v11 ) { v47 = (void **)__p[1]; v48 = v11; if ( __p[1] != v11 ) { do { if ( (*(_BYTE *)(v47 - 3) & 1) != 0 ) operator delete(*(v47 - 1)); v47 -= 3; } while ( v47 != v11 ); v48 = (void **)__p[0]; } __p[1] = v11; operator delete(v48); } if ( v64.__begin_ ) { v64.__end_ = v64.__begin_; operator delete(v64.__begin_); } begin = __s2.__begin_; if ( __s2.__begin_ ) { end = __s2.__end_; v51 = __s2.__begin_; if ( __s2.__end_ != __s2.__begin_ ) { do { if ( (end[-1].m_data.m_short.sizex2 & 1) != 0 ) operator delete(end[-1].m_data.m_long.longStorage); --end; } while ( end != begin ); v51 = __s2.__begin_; } __s2.__end_ = begin; operator delete(v51); } return v54; }
GD Web Decomp Icon

GD Web Decomp

Raw Source