// // cocos2d::CCBMFontConfiguration::parseConfigFile from 0xae4e1c to 0xae5a6c (3152 bytes) // // 2 xrefs: // > cocos2d::CCBMFontConfiguration::initWithFNTfile @ 0xae5a84 // > @ 0xab8d0 // // 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 // std::set *cocos2d::CCBMFontConfiguration::parseConfigFile( cocos2d::CCBMFontConfiguration *a1, const char *a2) { cocos2d::CCFileUtils *v4; // x0 cocos2d::CCString *v5; // x19 __int64 v6; // x26 char *CString; // x0 long double v8; // q0 __int64 v9; // x1 __int64 *v10; // x0 int v11; // w0 int v12; // w28 void *v13; // x0 unsigned __int64 v14; // x2 unsigned __int64 v15; // x3 void *v16; // x0 unsigned __int64 v17; // x2 void *v18; // x0 __int64 v19; // x1 void *v20; // x0 unsigned int *v21; // x1 int v22; // w2 char *v23; // x0 int *p_m_unknown2; // x0 unsigned int *v26; // x1 int v27; // w3 unsigned __int64 v28; // x2 void *v29; // x0 unsigned int *v30; // x1 unsigned __int64 v31; // x2 void *v32; // x0 long double v33; // q0 unsigned int *v34; // x1 unsigned __int64 v35; // x2 void *v36; // x0 unsigned __int64 v37; // x2 void *v38; // x0 unsigned int *p_charID; // x28 void *v40; // x0 cocos2d::tCCFontDefHashElement *v41; // x10 cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // x5 size_t p_hh; // x3 UT_hash_table *tbl; // x9 UT_hash_handle *tail; // x0 std::ptrdiff_t hho; // x2 int v47; // w7 int v48; // w6 int v49; // w0 int v50; // w0 UT_hash_table *v51; // x6 unsigned int v52; // w4 unsigned int v53; // w1 int v54; // w5 int v55; // w0 UT_hash_bucket *buckets; // x6 unsigned int v57; // w2 unsigned int v58; // w1 unsigned int v59; // w0 unsigned int v60; // w0 __int64 v61; // x0 UT_hash_handle *hh_head; // x4 unsigned int v63; // w2 unsigned int expand_mult; // w1 unsigned int num_buckets; // w2 cocos2d::tCCFontDefHashElement *v66; // x0 cocos2d::tCCFontDefHashElement *v67; // x9 cocos2d::tCCFontDefHashElement *v68; // x5 cocos2d::tCCFontDefHashElement *v69; // x10 float x; // w3 float width; // w2 float y; // w7 int v73; // w11 unsigned int v74; // w8 char *v75; // x0 __int64 v76; // x12 __int64 v77; // x13 __int64 v78; // x1 __int64 v79; // x6 __int64 v80; // x2 unsigned int v81; // w3 __int64 v82; // x3 UT_hash_bucket *v83; // x5 UT_hash_table *v84; // x0 unsigned int num_items; // w4 unsigned int nonideal_items; // w3 int v87; // w1 unsigned int v88; // w1 unsigned int *v89; // x1 int v90; // w3 unsigned int *v91; // x1 int v92; // w2 unsigned int *v93; // x1 int v94; // w2 unsigned int *v95; // x1 int v96; // w3 unsigned int *v97; // x1 int v98; // w3 unsigned __int64 v99; // x2 void *v100; // x0 unsigned int *v101; // x3 unsigned int *v102; // x1 int v103; // w3 unsigned int *v104; // x1 int v105; // w3 unsigned int *p_m_sString; // x1 int m_data; // w2 unsigned int *v108; // x1 int v109; // w2 unsigned int *v110; // x1 int v111; // w2 unsigned int *v112; // x1 int v113; // w2 UT_hash_table *v114; // x0 cocos2d::tCCFontDefHashElement *v115; // x10 void *v116; // x0 cocos2d::tCCFontDefHashElement *v117; // x4 _QWORD v118[2]; // [xsp+0h] [xbp+0h] BYREF cocos2d::tCCFontDefHashElement *v119; // [xsp+68h] [xbp+68h] size_t v120; // [xsp+70h] [xbp+70h] cocos2d::tCCFontDefHashElement *v121; // [xsp+78h] [xbp+78h] cocos2d::tCCFontDefHashElement *v122; // [xsp+80h] [xbp+80h] char *v123; // [xsp+88h] [xbp+88h] char v124; // [xsp+90h] [xbp+90h] BYREF cocos2d::CCString *v125; // [xsp+98h] [xbp+98h] BYREF char *v126; // [xsp+A0h] [xbp+A0h] BYREF __int64 v127; // [xsp+A8h] [xbp+A8h] BYREF __int64 v128; // [xsp+B0h] [xbp+B0h] BYREF v4 = cocos2d::CCFileUtils::sharedFileUtils(); ((void (__fastcall *)(cocos2d::CCString **__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v4->createCCArrayWithContentsOfFile)( &v125, v4, a2, 0); v5 = cocos2d::CCString::createWithContentsOfFile((const char *)v125); v6 = operator new(0x30u); *(_DWORD *)(v6 + 8) = 0; *(_QWORD *)(v6 + 16) = 0; *(_QWORD *)(v6 + 40) = 0; *(_QWORD *)(v6 + 24) = v6 + 8; *(_QWORD *)(v6 + 32) = v6 + 8; if ( !v5 ) { v6 = 0; goto LABEL_18; } v123 = &v124; v126 = &byte_124B6C8; CString = (char *)cocos2d::CCString::getCString(v5); sub_D153B8((unsigned int)v118 + 168, CString); LABEL_3: v9 = v127; v10 = (__int64 *)(v127 - 24); while ( *(_QWORD *)(v127 - 24) ) { v11 = sub_D16674(&v127, 10, 0, v8); v12 = v11; if ( v11 == -1 ) { sub_D18EA8(&v126, &v127); sub_D174B8(&v127, 0, *(_QWORD *)(v127 - 24), 0); } else { sub_D14F84(&v128, &v127, 0, v11); sub_D163D4(&v126, &v128); v13 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v91 = (unsigned int *)(v128 - 8); do v92 = __ldaxr(v91); while ( __stlxr(v92 - 1, v91) ); } else { v92 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v92 - 1; } if ( v92 <= 0 ) operator delete(v13); } v14 = v12 + 1; v15 = *(_QWORD *)(v127 - 24); if ( v14 > v15 ) sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v14, v15); sub_D14F84(&v128, &v127, v14, -1); sub_D163D4(&v127, &v128); v16 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v93 = (unsigned int *)(v128 - 8); do v94 = __ldaxr(v93); while ( __stlxr(v94 - 1, v93) ); } else { v94 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v94 - 1; } if ( v94 <= 0 ) operator delete(v16); } } sub_D14F84(&v128, &v126, 0, 9); v17 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "info face"); v18 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_9; if ( &pthread_create ) { v26 = (unsigned int *)(v128 - 8); do v27 = __ldaxr(v26); while ( __stlxr(v27 - 1, v26) ); } else { v27 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v27 - 1; } if ( v27 > 0 ) { LABEL_9: if ( (_DWORD)v17 ) goto LABEL_25; } else { v122 = (cocos2d::tCCFontDefHashElement *)v17; operator delete(v18); if ( (_DWORD)v122 ) { LABEL_25: sub_D14F84(&v128, &v126, 0, 17); v28 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "common lineHeight"); v29 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v95 = (unsigned int *)(v128 - 8); do v96 = __ldaxr(v95); while ( __stlxr(v96 - 1, v95) ); } else { v96 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v96 - 1; } if ( v96 <= 0 ) { v122 = (cocos2d::tCCFontDefHashElement *)v28; operator delete(v29); LODWORD(v28) = (_DWORD)v122; } } if ( (_DWORD)v28 ) { sub_D14F84(&v128, &v126, 0, 7); v31 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "page id"); v32 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v97 = (unsigned int *)(v128 - 8); do v98 = __ldaxr(v97); while ( __stlxr(v98 - 1, v97) ); } else { v98 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v98 - 1; } if ( v98 <= 0 ) { v122 = (cocos2d::tCCFontDefHashElement *)v31; operator delete(v32); LODWORD(v31) = (_DWORD)v122; } } if ( (_DWORD)v31 ) { sub_D14F84(&v128, &v126, 0, 7); v35 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "chars c"); v36 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_42; if ( &pthread_create ) { v89 = (unsigned int *)(v128 - 8); do v90 = __ldaxr(v89); while ( __stlxr(v90 - 1, v89) ); } else { v90 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v90 - 1; } if ( v90 > 0 ) { LABEL_42: if ( !(_DWORD)v35 ) goto LABEL_3; } else { v122 = (cocos2d::tCCFontDefHashElement *)v35; operator delete(v36); if ( !(_DWORD)v122 ) goto LABEL_3; } sub_D14F84(&v128, &v126, 0, 4); v37 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "char"); v38 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v102 = (unsigned int *)(v128 - 8); do v103 = __ldaxr(v102); while ( __stlxr(v103 - 1, v102) ); } else { v103 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v103 - 1; } if ( v103 <= 0 ) { v122 = (cocos2d::tCCFontDefHashElement *)v37; operator delete(v38); LODWORD(v37) = (_DWORD)v122; } } if ( !(_DWORD)v37 ) { v122 = (cocos2d::tCCFontDefHashElement *)malloc(0x58u); p_charID = &v122->fontDef.charID; sub_D18D28(&v128); cocos2d::CCBMFontConfiguration::parseCharacterDefinition((int)a1, &v128, (__int64)p_charID); v40 = (void *)(v128 - 24); v41 = v122; if ( (__int64 *)(v128 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v112 = (unsigned int *)(v128 - 8); do v113 = __ldaxr(v112); while ( __stlxr(v113 - 1, v112) ); } else { v113 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v113 - 1; } if ( v113 <= 0 ) { v122 = v41; operator delete(v40); v41 = v122; } } m_pFontDefDictionary = a1->m_pFontDefDictionary; v41->key = v41->fontDef.charID; v41->hh.next = nullptr; v41->hh.key = v41; v41->hh.keylen = 4; if ( m_pFontDefDictionary ) { p_hh = (size_t)&v41->hh; tbl = m_pFontDefDictionary->hh.tbl; tail = tbl->tail; hho = tbl->hho; tail->next = v41; v41->hh.prev = (char *)tail - hho; tbl->tail = &v41->hh; goto LABEL_48; } a1->m_pFontDefDictionary = v41; v41->hh.prev = nullptr; v122 = v41; v114 = (UT_hash_table *)malloc(0x40u); v115 = v122; v122->hh.tbl = v114; if ( !v114 ) goto LABEL_148; v114->buckets = nullptr; *(_QWORD *)&v114->num_buckets = 0; v114->num_buckets = 32; *(_QWORD *)&v114->num_items = 0; v114->tail = nullptr; v114->hho = 0; *(_QWORD *)&v114->ideal_chain_maxlen = 0; v114->log2_num_buckets = 5; *(_QWORD *)&v114->ineff_expands = 0; *(_QWORD *)&v114->signature = 0; v114->tail = &v115->hh; v114->hho = 32; v122 = (cocos2d::tCCFontDefHashElement *)v114; v119 = v115; v120 = (size_t)&v115->hh; v116 = malloc(0x200u); v117 = v122; *(_QWORD *)&v122->key = v116; if ( !v116 ) LABEL_148: exit(-1); v121 = v117; memset(v116, 0, 0x200u); v41 = v119; tbl = (UT_hash_table *)v122; m_pFontDefDictionary = v119; LODWORD(v121->hh.hh_prev) = -1609490463; p_hh = v120; LABEL_48: ++tbl->num_items; v47 = BYTE2(v41->key); v48 = BYTE1(v41->key); v49 = LOBYTE(v41->key) + 17973517 + (HIBYTE(v41->key) << 24); v41->hh.tbl = tbl; v50 = v49 + (v47 << 16) + (v48 << 8); v51 = m_pFontDefDictionary->hh.tbl; v50 ^= 0x7F76Du; v52 = (-1622558010 - v50) ^ (v50 << 8); v53 = (-17973517 - v50 - v52) ^ (v52 >> 13); v54 = v51->num_buckets - 1; v55 = (v50 - v52 - v53) ^ (v53 >> 12); buckets = v51->buckets; v57 = (v52 - v53 - v55) ^ (v55 << 16); v58 = (v53 - v55 - v57) ^ (v57 >> 5); v59 = v55 - v57 - v58; v60 = (v58 - (v59 ^ (v58 >> 3)) - ((v57 - v58 - (v59 ^ (v58 >> 3))) ^ ((v59 ^ (v58 >> 3)) << 10))) ^ (((v57 - v58 - (v59 ^ (v58 >> 3))) ^ ((v59 ^ (v58 >> 3)) << 10)) >> 15); v41->hh.hashv = v60; v61 = v60 & v54; hh_head = buckets[v61].hh_head; v63 = buckets[v61].count + 1; buckets[v61].count = v63; v41->hh.hh_next = hh_head; v41->hh.hh_prev = nullptr; if ( hh_head ) hh_head->hh_prev = (UT_hash_handle *)p_hh; expand_mult = buckets[v61].expand_mult; buckets[v61].hh_head = (UT_hash_handle *)p_hh; v122 = v41; if ( v63 < 10 * (expand_mult + 1) || tbl->noexpand == 1 ) { LABEL_65: std::_Rb_tree,std::less,std::allocator>::_M_insert_unique( (_QWORD *)v6, p_charID); } else { num_buckets = tbl->num_buckets; v119 = (cocos2d::tCCFontDefHashElement *)tbl; v120 = 32LL * (num_buckets & 0x7FFFFFFF); v66 = (cocos2d::tCCFontDefHashElement *)malloc(v120); v121 = v66; if ( !v66 ) goto LABEL_148; memset(v66, 0, v120); v67 = v119; v68 = v121; v69 = v122; x = v119->fontDef.rect.origin.x; width = v119->fontDef.rect.size.width; y = v119->fontDef.rect.origin.y; v73 = 2 * LODWORD(x) - 1; HIDWORD(v119->hh.prev) = 0; v74 = ((v73 & LODWORD(width)) != 0) + (LODWORD(width) >> (LOBYTE(y) + 1)); LODWORD(v67->hh.prev) = v74; if ( x == 0.0 ) { v75 = *(char **)&v67->key; } else { v75 = *(char **)&v67->key; v76 = 0; v77 = 16 * ((unsigned int)(LODWORD(x) - 1) + 1LL); do { v78 = *(_QWORD *)&v75[v76]; if ( v78 ) { do { v79 = *(_QWORD *)(v78 + 32); v80 = 16LL * ((unsigned int)v73 & *(_DWORD *)(v78 + 52)); v81 = *(_DWORD *)((char *)&v68->fontDef.rect.origin.x + v80) + 1; *(_DWORD *)((char *)&v68->fontDef.rect.origin.x + v80) = v81; if ( v74 < v81 ) { ++HIDWORD(v67->hh.prev); *(_DWORD *)((char *)&v68->fontDef.rect.origin.y + v80) = v81 / v74; } v82 = *(_QWORD *)((char *)&v68->key + v80); *(_QWORD *)(v78 + 32) = v82; *(_QWORD *)(v78 + 24) = 0; if ( v82 ) *(_QWORD *)(v82 + 24) = v78; *(_QWORD *)((char *)&v68->key + v80) = v78; v78 = v79; } while ( v79 ); } v76 += 16; } while ( v76 != v77 ); } v121 = v68; v122 = v69; free(v75); v83 = (UT_hash_bucket *)v121; v84 = v122->hh.tbl; num_items = v84->num_items; nonideal_items = v84->nonideal_items; v87 = v84->log2_num_buckets + 1; v84->num_buckets *= 2; v84->log2_num_buckets = v87; v84->buckets = v83; if ( nonideal_items > num_items >> 1 ) { v88 = v84->ineff_expands + 1; v84->ineff_expands = v88; if ( v88 > 1 ) v84->noexpand = 1; goto LABEL_65; } v84->ineff_expands = 0; std::_Rb_tree,std::less,std::allocator>::_M_insert_unique( (_QWORD *)v6, p_charID); } goto LABEL_3; } sub_D14F84(&v128, &v126, 0, 13); v99 = (unsigned int)sub_D171E0((unsigned int)v118 + 176, "kerning first"); v100 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_96; if ( &pthread_create ) { v104 = (unsigned int *)(v128 - 8); do v105 = __ldaxr(v104); while ( __stlxr(v105 - 1, v104) ); } else { v105 = *(_DWORD *)(v128 - 8); *(_DWORD *)(v128 - 8) = v105 - 1; } if ( v105 > 0 ) { LABEL_96: if ( (_DWORD)v99 ) goto LABEL_3; } else { v122 = (cocos2d::tCCFontDefHashElement *)v99; operator delete(v100); if ( (_DWORD)v122 ) goto LABEL_3; } sub_D18D28(&v128); cocos2d::CCBMFontConfiguration::parseKerningEntry((__int64)a1, &v128); v19 = v128; v20 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_3; v101 = (unsigned int *)(v128 - 8); if ( &pthread_create ) { do v22 = __ldaxr(v101); while ( __stlxr(v22 - 1, v101) ); goto LABEL_14; } } else { *(__n128 *)&v33 = sub_D18D28(&v128); cocos2d::CCBMFontConfiguration::parseImageFileName((__int64)a1, &v128, (__int64)a2, v33); v19 = v128; v20 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_3; if ( &pthread_create ) { v34 = (unsigned int *)(v128 - 8); do v22 = __ldaxr(v34); while ( __stlxr(v22 - 1, v34) ); goto LABEL_14; } } } else { sub_D18D28(&v128); cocos2d::CCBMFontConfiguration::parseCommonArguments((__int64)a1, &v128); v19 = v128; v20 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_3; if ( &pthread_create ) { v30 = (unsigned int *)(v128 - 8); do v22 = __ldaxr(v30); while ( __stlxr(v22 - 1, v30) ); goto LABEL_14; } } goto LABEL_40; } } sub_D18D28(&v128); cocos2d::CCBMFontConfiguration::parseInfoArguments((__int64)a1, &v128); v19 = v128; v20 = (void *)(v128 - 24); if ( (__int64 *)(v128 - 24) == &qword_124B6B0 ) goto LABEL_3; if ( &pthread_create ) { v21 = (unsigned int *)(v128 - 8); do v22 = __ldaxr(v21); while ( __stlxr(v22 - 1, v21) ); goto LABEL_14; } LABEL_40: v22 = *(_DWORD *)(v19 - 8); *(_DWORD *)(v19 - 8) = v22 - 1; LABEL_14: if ( v22 > 0 ) goto LABEL_3; operator delete(v20); v9 = v127; v10 = (__int64 *)(v127 - 24); } if ( v10 != &qword_124B6B0 ) { if ( &pthread_create ) { v110 = (unsigned int *)(v9 - 8); do v111 = __ldaxr(v110); while ( __stlxr(v111 - 1, v110) ); } else { v111 = *(_DWORD *)(v9 - 8); *(_DWORD *)(v9 - 8) = v111 - 1; } if ( v111 <= 0 ) operator delete(v10); } v23 = v126 - 24; if ( v126 - 24 != (char *)&qword_124B6B0 ) { if ( &pthread_create ) { v108 = (unsigned int *)(v126 - 8); do v109 = __ldaxr(v108); while ( __stlxr(v109 - 1, v108) ); } else { v109 = *((_DWORD *)v126 - 2); *((_DWORD *)v126 - 2) = v109 - 1; } if ( v109 <= 0 ) operator delete(v23); } LABEL_18: p_m_unknown2 = &v125[-1].m_unknown2; if ( &v125[-1].m_unknown2 != (int *)&qword_124B6B0 ) { if ( &pthread_create ) { p_m_sString = (unsigned int *)&v125[-1].m_sString; do m_data = __ldaxr(p_m_sString); while ( __stlxr(m_data - 1, p_m_sString) ); } else { m_data = (int)v125[-1].m_sString.m_data.m_data; LODWORD(v125[-1].m_sString.m_data.m_data) = m_data - 1; } if ( m_data <= 0 ) operator delete(p_m_unknown2); } return (std::set *)v6; }
GD Web Decomp Icon

GD Web Decomp

Raw Source