// // GJBaseGameLayer::generateTargetGroups from 0x48d238 to 0x48d9c8 (1936 bytes) // // 1 xrefs: // > GJBaseGameLayer::updateSpecialGroupData @ 0x4952ec // // 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 // void GJBaseGameLayer::generateTargetGroups(GJBaseGameLayer *a1) { cocos2d::CCArray *m_targetGroupsArray; // r0 cocos2d::CCArray *v3; // r0 unsigned int v4; // r0 unsigned int v5; // r6 int *v6; // r5 cocos2d::CCArray *m_objects; // r3 cocos2d::ccArray *data; // r3 cocos2d::CCDictionary *arr; // r6 cocos2d::CCDictionary_vtbl *v10; // r5 cocos2d::CCDictionary_vtbl *v11; // t1 _BYTE *v12; // r9 unsigned int v13; // r1 int *j; // r2 _DWORD *k; // r8 _BYTE *v16; // r0 unsigned int v17; // r8 int **v18; // r2 cocos2d::CCArray *Group; // r10 int m; // r3 int v21; // r4 int v22; // r3 _BOOL4 v23; // r6 unsigned int v24; // r0 float v25; // s16 float v26; // r0 float v27; // s17 unsigned int v28; // r1 unsigned int v29; // r1 cocos2d::ccArray *v30; // r3 cocos2d::CCObject **v31; // r7 cocos2d::CCObject **v32; // r5 int v33; // r8 int v34; // t1 cocos2d::ccArray *v35; // r3 cocos2d::ccArray *v36; // r3 cocos2d::CCObject **v37; // r6 cocos2d::CCObject **v38; // r4 cocos2d::CCArray *v39; // r0 cocos2d::CCArray *v40; // r8 cocos2d::CCArray *v41; // r7 cocos2d::CCDictionary *v42; // r9 int v43; // r4 cocos2d::ccArray *v44; // r3 cocos2d::CCArray *v45; // r5 cocos2d::CCObject *v46; // r4 cocos2d::CCObject *v47; // t1 int v48; // r4 int v49; // r5 _DWORD *v50; // r0 int v51; // r4 _DWORD *v52; // r0 unsigned int *setTag; // r7 unsigned int *copyWithZone; // r5 bool i; // zf _DWORD *v56; // r0 unsigned int v57; // r7 int v58; // r10 _DWORD **v59; // r0 _DWORD *inserted; // r0 int v61; // r0 _BYTE *v62; // r0 unsigned int m_uOrderOfArrival; // r6 intptr_t v64; // r6 cocos2d::CCObject *v65; // r0 cocos2d::CCArray *StickyGroup; // r0 cocos2d::CCObject *v67; // r0 GameObject *v68; // r6 int v69; // r7 unsigned int v70; // r8 GameObject *v71; // r5 cocos2d::CCObject *v72; // r0 cocos2d::CCObject *v73; // r0 intptr_t v74; // r7 cocos2d::CCObject *v75; // r0 int v76; // r5 int v77; // t1 unsigned int v78; // r7 intptr_t v79; // r7 cocos2d::CCObject *v80; // r0 cocos2d::CCObject *v81; // r0 cocos2d::CCDictionary *v82; // [sp+Ch] [bp-100h] cocos2d::CCDictionary *v83; // [sp+10h] [bp-FCh] cocos2d::CCDictionary *v84; // [sp+10h] [bp-FCh] int v85; // [sp+14h] [bp-F8h] cocos2d::CCDictionary *v86; // [sp+18h] [bp-F4h] cocos2d::CCObject *n; // [sp+18h] [bp-F4h] _DWORD *v88; // [sp+1Ch] [bp-F0h] _BYTE *v89; // [sp+20h] [bp-ECh] cocos2d::CCObject **v90; // [sp+24h] [bp-E8h] cocos2d::CCArray *v91; // [sp+28h] [bp-E4h] cocos2d::CCArray *v92; // [sp+28h] [bp-E4h] std::unordered_map> *p_m_targetGroups; // [sp+2Ch] [bp-E0h] GameObject *GroupParent; // [sp+34h] [bp-D8h] cocos2d::CCArray *v95; // [sp+38h] [bp-D4h] cocos2d::CCObject **v96; // [sp+40h] [bp-CCh] unsigned int m_uniqueID; // [sp+4Ch] [bp-C0h] int v98; // [sp+5Ch] [bp-B0h] int v99[2]; // [sp+60h] [bp-ACh] BYREF unsigned int v100[2]; // [sp+68h] [bp-A4h] BYREF unsigned int v101[2]; // [sp+70h] [bp-9Ch] BYREF int *v102; // [sp+78h] [bp-94h] BYREF unsigned int v103; // [sp+7Ch] [bp-90h] int v104; // [sp+80h] [bp-8Ch] int v105; // [sp+84h] [bp-88h] _DWORD v106[2]; // [sp+88h] [bp-84h] BYREF int v107; // [sp+90h] [bp-7Ch] BYREF int v108[2]; // [sp+94h] [bp-78h] BYREF int *v109; // [sp+9Ch] [bp-70h] int v110; // [sp+A0h] [bp-6Ch] int v111; // [sp+B0h] [bp-5Ch] BYREF unsigned int v112; // [sp+B4h] [bp-58h] _DWORD v113[7]; // [sp+CCh] [bp-40h] BYREF int v114[4]; // [sp+E8h] [bp-24h] BYREF float v115; // [sp+F8h] [bp-14h] BYREF int v116; // [sp+FCh] [bp-10h] m_targetGroupsArray = a1->m_targetGroupsArray; if ( m_targetGroupsArray ) { cocos2d::CCArray::removeAllObjects(m_targetGroupsArray); } else { v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr); a1->m_targetGroupsArray = v3; cocos2d::CCObject::retain(v3); } p_m_targetGroups = &a1->m_targetGroups; std::_Hashtable>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::clear((int)&a1->m_targetGroups); v104 = 0; v105 = 0; v106[0] = 1065353216; v106[1] = 0; v4 = sub_773A14(v106, 10); v5 = v4; v103 = v4; if ( v4 == 1 ) { v107 = 0; v6 = &v107; } else { v6 = (int *)sub_46C43A(v4); memset(v6, 0, 4 * v5); } v102 = v6; std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_Hashtable( v108, 10); std::_Hashtable>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_Hashtable( &v111, 10); m_objects = a1->m_objects; if ( m_objects ) { data = m_objects->data; if ( data->num ) { arr = (cocos2d::CCDictionary *)data->arr; v83 = (cocos2d::CCDictionary *)((char *)arr + 4 * data->num + -4); while ( arr <= v83 ) { v11 = arr->__vftable; arr = (cocos2d::CCDictionary *)((char *)arr + 4); v10 = v11; if ( !v11 ) break; if ( v10[22].~CCDictionary == (void (__fastcall *)(cocos2d::CCDictionary *__hidden))&stru_BBC.st_info || (*((int (__fastcall **)(cocos2d::CCDictionary_vtbl *))v10->copyWithZone + 223))(v10) == 45 ) { v114[0] = (int)v10[31].setTag; v57 = v114[0]; v58 = v114[0] % v103; v59 = sub_46C8CE(&v102, v114[0] % v103, v114); if ( !v59 || (inserted = *v59) == nullptr ) { v61 = operator new(0xCu); *(_DWORD *)v61 = 0; *(_DWORD *)(v61 + 4) = v57; *(_BYTE *)(v61 + 8) = 0; *(_BYTE *)(v61 + 9) = 0; *(_BYTE *)(v61 + 10) = 0; *(_BYTE *)(v61 + 11) = 0; inserted = std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert_unique_node( (int)&v102, v58, v57, (_DWORD *)v61); } v62 = inserted + 2; if ( LOBYTE(v10[40].getTag) ) { if ( BYTE1(v10[40].getTag) ) v62[3] = 1; else v62[2] = 1; } else if ( BYTE1(v10[40].getTag) ) { v62[1] = 1; } else { *v62 = 1; } v114[0] = (int)v10[31].setTag; sub_489B3C((int)v99, v108, (unsigned int *)v114); } else if ( v10[22].~CCDictionary == (void (__fastcall *)(cocos2d::CCDictionary *__hidden))&stru_4EC.st_size ) { setTag = (unsigned int *)v10[40].setTag; copyWithZone = (unsigned int *)v10[41].copyWithZone; for ( i = setTag == copyWithZone; !i; i = copyWithZone == setTag ) { v56 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( &v111, setTag); sub_488790((int)v100, v56, setTag + 2); setTag += 4; } } } } } std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_Hashtable( v113, 10); while ( v110 ) { v100[0] = v109[1]; sub_488790((int)v101, v113, v100); v13 = (unsigned int)v109[1] % v108[1]; for ( j = *(int **)(v108[0] + 4 * v13); (int *)*j != v109; j = (int *)*j ) ; std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_erase( v108, v13, j, v109); v12 = std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( &v102, v100); if ( sub_46C6B4(&v111, v100[0]) ) { for ( k = (_DWORD *)std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( &v111, v100)[2]; k; k = (_DWORD *)*k ) { v101[0] = k[1]; if ( !sub_46C3EE(v113, v101[0]) ) sub_488790((int)v114, v108, v101); v16 = std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( &v102, v101); if ( *v12 ) *v16 = 1; if ( v12[1] ) v16[1] = 1; if ( v12[2] ) v16[2] = 1; if ( v12[3] ) v16[3] = 1; } v17 = v100[0] % v112; v18 = sub_46C700(&v111, v100[0] % v112, v100); if ( v18 ) std::_Hashtable>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_erase( &v111, v17, v18, *v18); } } v88 = (_DWORD *)v113[2]; LABEL_35: if ( v88 ) { v99[0] = v88[1]; v89 = std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( &v102, (unsigned int *)v99); GroupParent = GJBaseGameLayer::getGroupParent(a1, v99[0]); Group = GJBaseGameLayer::getGroup(a1, v99[0]); for ( m = 1; ; m = v85 + 1 ) { v85 = m; v21 = m - 1; if ( m == 3 ) break; if ( m == 4 ) { if ( !v89[3] ) goto LABEL_77; v21 = 1; } else { if ( m == 2 ) { v22 = (unsigned __int8)v89[1]; v23 = 0; goto LABEL_106; } if ( !*v89 ) goto LABEL_75; v21 = 0; } v23 = v21; LABEL_47: v100[0] = GJBaseGameLayer::getSpecialKey(a1, v99[0], v23, v21); v82 = cocos2d::CCDictionary::create(); v84 = cocos2d::CCDictionary::create(); std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_Hashtable( v114, 10); v24 = cocos2d::CCArray::count(Group); v25 = v115; v26 = ceilf((float)v24 / v115); v98 = v116; v27 = v26; v28 = (unsigned int)ceil((double)(unsigned int)(v114[3] + 1) / v25); if ( v28 < (unsigned int)v27 ) v28 = (unsigned int)v27; v29 = sub_773A14(&v115, v28); if ( v29 == v114[1] ) v116 = v98; else std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_rehash( (int)v114, v29); if ( Group ) { v30 = Group->data; if ( v30->num ) { v31 = v30->arr; v32 = &v31[v30->num] + 0x3FFFFFFF; while ( v31 <= v32 ) { v34 = (int)*v31++; v33 = v34; if ( !v34 ) break; v101[0] = *(_DWORD *)(v33 + 772); *std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( v114, v101) = *(_DWORD *)(v33 + 732); } if ( !v23 ) { v35 = Group->data; if ( v35->num ) { v90 = v35->arr; v96 = &v90[v35->num] + 0x3FFFFFFF; while ( v90 <= v96 ) { v68 = (GameObject *)*v90++; if ( !v68 ) break; if ( v68->m_hasGroupParentsString ) { v92 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_parentGroupIDs, v68->m_uniqueID); if ( v92 ) { for ( n = nullptr; (unsigned int)n < cocos2d::CCArray::count(v92); n = (cocos2d::CCObject *)((char *)n + 1) ) { v69 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v92, (unsigned int)n) + 52); if ( !GroupParent || v68 == GroupParent && v69 == v99[0] ) { v70 = 0; v95 = GJBaseGameLayer::getGroup(a1, v69); while ( v70 < cocos2d::CCArray::count(v95) ) { v71 = (GameObject *)cocos2d::CCArray::objectAtIndex(v95, v70); m_uniqueID = v71->m_uniqueID; if ( sub_46C450(v114, m_uniqueID) ) { v101[0] = m_uniqueID; sub_46C4DA(v114, v101); } if ( v71->m_hasGroupParent || v71->m_hasAreaParent || v71 == v68 ) { v72 = cocos2d::CCDictionary::objectForKey(v82, -v69); if ( !v72 || (!HIBYTE(v72[19].m_nLuaID) || v71 == v68) && v71->m_hasAreaParent ) cocos2d::CCDictionary::setObject(v82, v71, -v69); v73 = cocos2d::CCDictionary::objectForKey(v84, -v69); if ( !v73 || (!BYTE2(v73[19].m_nLuaID) || v71 == v68) && v71->m_hasGroupParent ) cocos2d::CCDictionary::setObject(v84, v71, -v69); } ++v70; } v74 = -v69; v75 = cocos2d::CCDictionary::objectForKey(v82, v74); if ( v75 ) { v101[0] = v75[14].m_uOrderOfArrival; *std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( v114, v101) = v74; } } } } } } } } } if ( !v21 ) { v36 = Group->data; if ( v36->num ) { v37 = v36->arr; v38 = &v37[v36->num] + 0x3FFFFFFF; while ( v37 <= v38 ) { v77 = (int)*v37++; v76 = v77; if ( !v77 ) break; v78 = *(_DWORD *)(v76 + 772); if ( sub_46C450(v114, v78) ) { v101[0] = v78; v79 = *std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( v114, v101); if ( v79 > 0 && (*(_BYTE *)(v76 + 998) || *(_BYTE *)(v76 + 999)) ) { v80 = cocos2d::CCDictionary::objectForKey(v82, v79); if ( !v80 || !HIBYTE(v80[19].m_nLuaID) && *(_BYTE *)(v76 + 999) ) cocos2d::CCDictionary::setObject(v82, (cocos2d::CCObject *)v76, v79); v81 = cocos2d::CCDictionary::objectForKey(v84, v79); if ( !v81 || !BYTE2(v81[19].m_nLuaID) && *(_BYTE *)(v76 + 998) ) cocos2d::CCDictionary::setObject(v84, (cocos2d::CCObject *)v76, v79); } } } } } } v39 = (cocos2d::CCArray *)cocos2d::CCDictionary::count(v82); if ( v39 ) { v40 = (cocos2d::CCArray *)cocos2d::CCArray::create(v39); v41 = (cocos2d::CCArray *)cocos2d::CCArray::create(v40); v86 = cocos2d::CCDictionary::create(); v42 = cocos2d::CCDictionary::create(); if ( Group ) { v44 = Group->data; if ( v44->num ) { v45 = (cocos2d::CCArray *)v44->arr; v91 = (cocos2d::CCArray *)((char *)v45 + 4 * v44->num + -4); while ( 1 ) { do { LABEL_70: if ( v45 > v91 ) goto LABEL_67; v47 = (cocos2d::CCObject *)v45->__vftable; v45 = (cocos2d::CCArray *)((char *)v45 + 4); v46 = v47; if ( !v47 ) goto LABEL_67; m_uOrderOfArrival = v46[14].m_uOrderOfArrival; } while ( !sub_46C450(v114, m_uOrderOfArrival) ); v101[0] = m_uOrderOfArrival; v64 = *std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( v114, v101); if ( !v64 ) break; v65 = cocos2d::CCDictionary::objectForKey(v82, v64); if ( v46 == v65 ) { cocos2d::CCArray::addObject(v40, v46); if ( v64 >= 0 ) StickyGroup = GJBaseGameLayer::getStickyGroup(a1, v64); else StickyGroup = GJBaseGameLayer::getGroup(a1, -v64); cocos2d::CCDictionary::setObject(v86, StickyGroup, v46[14].m_uOrderOfArrival); v67 = cocos2d::CCDictionary::objectForKey(v84, v64); cocos2d::CCDictionary::setObject(v42, v67, v46[14].m_uOrderOfArrival); } else if ( !v65 ) { break; } } cocos2d::CCArray::addObject(v41, v46); goto LABEL_70; } } LABEL_67: v43 = cocos2d::CCArray::count(v41); v48 = v43 + cocos2d::CCArray::count(v40); v49 = cocos2d::CCArray::count(a1->m_targetGroupsArray) + 1; v50 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( p_m_targetGroups, v100); *v50 = v49; v50[1] = v48; cocos2d::CCArray::addObject(a1->m_targetGroupsArray, v41); cocos2d::CCArray::addObject(a1->m_targetGroupsArray, v40); cocos2d::CCArray::addObject(a1->m_targetGroupsArray, v86); cocos2d::CCArray::addObject(a1->m_targetGroupsArray, v42); } else { v51 = cocos2d::CCArray::count(Group); v52 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[]( p_m_targetGroups, v100); *v52 = 0; v52[1] = v51; } std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((int)v114); LABEL_75: if ( v85 == 4 ) { LABEL_77: v88 = (_DWORD *)*v88; goto LABEL_35; } LABEL_76: ; } v22 = (unsigned __int8)v89[2]; v21 = 0; v23 = 1; LABEL_106: if ( !v22 ) goto LABEL_76; goto LABEL_47; } std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((int)v113); std::_Hashtable>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((int)&v111); std::_Hashtable,std::__detail::_Identity,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((int)v108); std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::~_Hashtable((int)&v102); }
GD Web Decomp Icon

GD Web Decomp

Raw Source