// // GJSmartTemplate::getPrefab_1 from 0x100425020 to 0x10042594f (2351 bytes) // // 7 xrefs: // > GJSmartTemplate::scanForPrefab @ 0x100423f19 // > GJSmartTemplate::scanForPrefab @ 0x100424059 // > GJSmartTemplate::scanForPrefab @ 0x100424179 // > GJSmartTemplate::scanForPrefab @ 0x1004242e2 // > GJSmartTemplate::getPrefab_1 @ 0x1004257ef // > GJSmartTemplate::getPrefab_1 @ 0x10042585e // > GJSmartTemplate::getPrefab @ 0x100425f0f // // 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 GJSmartTemplate::getPrefab_1(__int64 a1, std::string *a2, char a3, unsigned __int8 a4, __m128 a5) { bool v7; // zf __int64 v8; // r14 __int64 result; // rax __int64 *v10; // rdx __int64 v11; // rcx __int64 *v12; // rax __int64 v13; // rax double v14; // xmm0_8 std::string::pointer data; // rdi unsigned int v16; // r15d cocos2d::CCString *v17; // rax const char *CString; // r12 size_t v19; // rax std::string::size_type v20; // rbx char *v21; // r14 std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v22; // r12 __int64 v23; // rax size_t v24; // r13 __int64 Prefab_1; // rbx char v26; // r14 __int64 v27; // rbx unsigned __int8 v28[16]; // [rsp+8h] [rbp-288h] BYREF void *v29; // [rsp+18h] [rbp-278h] std::string v30; // [rsp+20h] [rbp-270h] BYREF std::string v31; // [rsp+38h] [rbp-258h] BYREF unsigned __int8 v32[16]; // [rsp+50h] [rbp-240h] BYREF void *v33; // [rsp+60h] [rbp-230h] std::string v34; // [rsp+68h] [rbp-228h] BYREF __int64 v35; // [rsp+80h] [rbp-210h] __int64 *v36; // [rsp+88h] [rbp-208h] __int64 *v37; // [rsp+90h] [rbp-200h] __int64 *v38; // [rsp+98h] [rbp-1F8h] __int64 *v39; // [rsp+A0h] [rbp-1F0h] __int64 *v40; // [rsp+A8h] [rbp-1E8h] __int64 *v41; // [rsp+B0h] [rbp-1E0h] __int64 *v42; // [rsp+B8h] [rbp-1D8h] __int128 v43; // [rsp+C0h] [rbp-1D0h] BYREF void *__p; // [rsp+D0h] [rbp-1C0h] __int128 v45; // [rsp+E0h] [rbp-1B0h] BYREF void *v46; // [rsp+F0h] [rbp-1A0h] std::string v47; // [rsp+100h] [rbp-190h] BYREF std::string v48; // [rsp+120h] [rbp-170h] BYREF std::string v49; // [rsp+140h] [rbp-150h] BYREF std::string v50; // [rsp+160h] [rbp-130h] BYREF std::string v51; // [rsp+180h] [rbp-110h] BYREF __int128 v52; // [rsp+1A0h] [rbp-F0h] BYREF void *v53; // [rsp+1B0h] [rbp-E0h] __int128 v54; // [rsp+1C0h] [rbp-D0h] BYREF void *v55; // [rsp+1D0h] [rbp-C0h] cocos2d::CCArray *v56; // [rsp+1D8h] [rbp-B8h] __int64 v57; // [rsp+1E0h] [rbp-B0h] __int64 v58; // [rsp+1E8h] [rbp-A8h] __int64 v59; // [rsp+1F0h] [rbp-A0h] __int64 v60; // [rsp+1F8h] [rbp-98h] std::string v61; // [rsp+200h] [rbp-90h] BYREF int v62; // [rsp+224h] [rbp-6Ch] __int64 *v63; // [rsp+228h] [rbp-68h] std::string *__str; // [rsp+230h] [rbp-60h] std::string __dst; // [rsp+238h] [rbp-58h] BYREF std::string v66; // [rsp+250h] [rbp-40h] BYREF v63 = (__int64 *)a1; v7 = (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) == 0; __str = a2; if ( v7 ) { __p = a2->__r_.__value_.__l.__data_; a5 = *(__m128 *)&a2->__r_.__value_.__l.0; v43 = *(_OWORD *)&a2->__r_.__value_.__l.0; } else { sub_100006B70(&v43, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_, *(double *)a5.i64); } v8 = cocos2d::CCDictionary::objectForKey_1(v63[7], (char *)&v43); if ( (v43 & 1) != 0 ) operator delete(__p); if ( !v8 || !(unsigned int)sub_100720070(v8) ) { result = 0; if ( a3 ) return result; v10 = v63 + 7; v57 = a4; v62 = 3 * a4 + 4; v37 = v63 + 13; v38 = v63 + 11; v39 = v63 + 9; v40 = v63 + 12; v41 = v63 + 10; v42 = v63 + 8; v11 = 0; v36 = v63 + 7; LABEL_12: v58 = v11; v12 = v10; switch ( (int)v11 ) { case 1: v12 = v42; break; case 2: v12 = v41; break; case 3: v12 = v40; break; case 4: v12 = v39; break; case 5: v12 = v38; break; case 6: v12 = v37; break; default: break; } v59 = *v12; v13 = 0; while ( 1 ) { v14 = 0.0; memset(&v66, 0, sizeof(v66)); v35 = v13; switch ( (int)v13 ) { case 1: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v61, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v61 = *__str; GJSmartTemplate::getSimplifiedKey(&__dst, &v61); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; *(_WORD *)&__dst.__r_.__value_.__l.0 = 0; if ( (*(_BYTE *)&v61.__r_.__value_.__s.0 & 1) != 0 ) { data = v61.__r_.__value_.__l.__data_; goto LABEL_75; } goto LABEL_76; case 2: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v47, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v47 = *__str; GJSmartTemplate::getVerySimplifiedKey((__int64)&__dst, &v47); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 ) { data = v47.__r_.__value_.__l.__data_; goto LABEL_75; } goto LABEL_76; case 3: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v48, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v48 = *__str; GJSmartTemplate::getSimplifiedKey(&v30, &v48); GJSmartTemplate::getVerySimplifiedKey((__int64)&__dst, &v30); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v30.__r_.__value_.__l.__data_); if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 ) { data = v48.__r_.__value_.__l.__data_; goto LABEL_75; } goto LABEL_76; case 4: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v49, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v49 = *__str; GJSmartTemplate::getSimplifiedKey(&v31, &v49); GJSmartTemplate::getNoCornerKey(&__dst, (__int64)&v49, (unsigned __int8 *)&v31); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; if ( (*(_BYTE *)&v31.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v31.__r_.__value_.__l.__data_); if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 ) { data = v49.__r_.__value_.__l.__data_; goto LABEL_75; } goto LABEL_76; case 5: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v50, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v50 = *__str; GJSmartTemplate::getVerySimplifiedKey((__int64)v32, &v50); GJSmartTemplate::getNoCornerKey(&__dst, (__int64)&v50, v32); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; if ( (v32[0] & 1) != 0 ) operator delete(v33); if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) != 0 ) { data = v50.__r_.__value_.__l.__data_; goto LABEL_75; } goto LABEL_76; case 6: if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) sub_100006B70(&v51, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, 0.0); else v51 = *__str; GJSmartTemplate::getSimplifiedKey(&v34, &v51); GJSmartTemplate::getVerySimplifiedKey((__int64)v28, &v34); GJSmartTemplate::getNoCornerKey(&__dst, (__int64)&v34, v28); if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v66.__r_.__value_.__l.__data_); v66 = __dst; v14 = *(double *)__dst.__r_.__value_.__r.__words; if ( (v28[0] & 1) != 0 ) { operator delete(v29); if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 ) { LABEL_73: operator delete(v34.__r_.__value_.__l.__data_); if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) == 0 ) goto LABEL_76; goto LABEL_74; } } else if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 ) { goto LABEL_73; } if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) == 0 ) goto LABEL_76; LABEL_74: data = v51.__r_.__value_.__l.__data_; LABEL_75: operator delete(data); LABEL_76: if ( (_DWORD)v58 ) { if ( !v59 ) goto LABEL_109; if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) == 0 ) { if ( !(*(_BYTE *)&v66.__r_.__value_.__l.0 >> 1) ) goto LABEL_109; LABEL_84: v56 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey_1(v59, (char *)&v66); if ( !v56 ) goto LABEL_109; v16 = 0; while ( 2 ) { if ( v16 >= (unsigned int)sub_100720070(v56) ) goto LABEL_109; v17 = cocos2d::CCArray::stringAtIndex(v56, v16); CString = cocos2d::CCString::getCString(v17); v19 = strlen(CString); if ( v19 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100006BF0(v14); v20 = v19; if ( v19 >= 0x17 ) { v23 = v19 | 7; v24 = 26; if ( (v20 | 7) != 0x17 ) v24 = v23 + 1; v21 = (char *)operator new(v24); __dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v21; __dst.__r_.__value_.__r.__words[0] = v24 | 1; __dst.__r_.__value_.__l.__size_ = v20; } else { __dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v19); v21 = __dst.__r_.__value_.__s.__data_; if ( !v19 ) { __dst.__r_.__value_.__s.__data_[0] = 0; v22 = __dst.__r_.__value_.__s.0; if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 ) goto LABEL_92; LABEL_97: sub_100006B70(&v54, __dst.__r_.__value_.__l.__data_, __dst.__r_.__value_.__l.__size_, v14); goto LABEL_98; } } memmove(v21, CString, v20); v21[v20] = 0; v22 = __dst.__r_.__value_.__s.0; if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 ) goto LABEL_97; LABEL_92: v55 = __dst.__r_.__value_.__l.__data_; v14 = *(double *)__dst.__r_.__value_.__r.__words; v54 = *(_OWORD *)&__dst.__r_.__value_.__l.0; LABEL_98: Prefab_1 = GJSmartTemplate::getPrefab_1(v63, &v54, 1, v57); if ( (v54 & 1) != 0 ) { operator delete(v55); if ( (*(_BYTE *)&v22 & 1) != 0 ) goto LABEL_102; } else if ( (*(_BYTE *)&v22 & 1) != 0 ) { LABEL_102: operator delete(__dst.__r_.__value_.__l.__data_); } ++v16; if ( Prefab_1 ) goto LABEL_107; continue; } } if ( v66.__r_.__value_.__l.__size_ ) goto LABEL_84; } else { if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) { sub_100006B70(&v52, v66.__r_.__value_.__l.__data_, v66.__r_.__value_.__l.__size_, v14); } else { v53 = v66.__r_.__value_.__l.__data_; v52 = *(_OWORD *)&v66.__r_.__value_.__l.0; } Prefab_1 = GJSmartTemplate::getPrefab_1(v63, &v52, 1, v57); if ( (v52 & 1) != 0 ) operator delete(v53); if ( Prefab_1 ) { LABEL_107: v26 = 0; v60 = Prefab_1; if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) goto LABEL_110; goto LABEL_111; } } LABEL_109: v26 = 1; if ( (*(_BYTE *)&v66.__r_.__value_.__s.0 & 1) != 0 ) LABEL_110: operator delete(v66.__r_.__value_.__l.__data_); LABEL_111: if ( !v26 ) return v60; v13 = (unsigned int)(v35 + 1); if ( (_DWORD)v13 == v62 ) { v11 = (unsigned int)(v58 + 1); result = 0; v10 = v36; if ( (_DWORD)v11 == v62 ) return result; goto LABEL_12; } break; default: std::string::operator=(&v66, __str); goto LABEL_76; } } } if ( (*(_BYTE *)&__str->__r_.__value_.__s.0 & 1) != 0 ) { sub_100006B70(&v45, __str->__r_.__value_.__l.__data_, __str->__r_.__value_.__l.__size_, *(double *)a5.i64); } else { v46 = __str->__r_.__value_.__l.__data_; a5 = *(__m128 *)&__str->__r_.__value_.__l.0; v45 = *(_OWORD *)&__str->__r_.__value_.__l.0; } result = GJSmartTemplate::getRandomPrefab((__int64)v63, (__int64)&v45, a5); if ( (v45 & 1) != 0 ) { v27 = result; operator delete(v46); return v27; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source