// // cocos2d::CCLabelBMFont::createFontChars from 0x5ccdc8 to 0x5cd3ee (1574 bytes) // // 2 xrefs: // > cocos2d::CCLabelBMFont::setString @ 0x5cd44c // > cocos2d::CCLabelBMFont::setFntFile @ 0x5cd4d8 // // 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 cocos2d::CCLabelBMFont::createFontChars(cocos2d::CCLabelBMFont *a1) { unsigned __int16 *m_sString; // r0 cocos2d::CCRect *v3; // r4 float width; // s17 void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r6 cocos2d::CCDirector *v6; // r0 float v7; // r0 float height; // s16 float v9; // s17 cocos2d::CCDirector *v10; // r0 float v11; // s15 cocos2d::CCSize *v12; // r0 float v13; // r1 float v14; // r2 unsigned int v15; // r6 std::set *CharacterSet; // r0 int v17; // r3 int v18; // r1 int v19; // r7 unsigned __int16 v20; // r11 int v21; // r9 int m_nCommonHeight; // r2 int v23; // s17 unsigned __int16 *v24; // r3 int v25; // r4 _DWORD *v26; // r10 int v27; // r0 cocos2d::CCBMFontConfiguration *m_pConfiguration; // r2 int m_nExtraKerning; // r3 cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // r2 int v31; // r8 UT_hash_table *tbl; // r3 int v33; // r1 unsigned int v34; // r6 unsigned int v35; // r10 int v36; // r12 unsigned int v37; // r6 unsigned int v38; // r10 int v39; // r12 UT_hash_handle *hh_head; // r6 int v41; // r0 float x; // s21 cocos2d::CCDirector *v43; // r0 float v44; // r0 float y; // s19 float v46; // s21 cocos2d::CCDirector *v47; // r0 float v48; // r0 float v49; // s16 float v50; // s19 cocos2d::CCDirector *v51; // r0 float v52; // r0 float v53; // s22 float v54; // s16 cocos2d::CCDirector *v55; // r0 float v56; // r0 cocos2d::CCNode *(__fastcall *getChildByTag)(cocos2d::CCNode *__hidden, int); // r3 float v58; // s14 int v59; // r0 float v60; // s22 int v61; // r6 void (*v62)(void); // r3 float v63; // s19 float v64; // s16 float v65; // s21 cocos2d::CCDirector *v66; // r0 float v67; // r0 float v68; // s19 void (__fastcall *v69)(int, cocos2d::CCRect *); // r11 cocos2d::CCDirector *v70; // r0 float v71; // r0 float v72; // s16 float v73; // s19 cocos2d::CCDirector *v74; // r0 float v75; // r0 int v76; // r3 float v77; // s15 float v78; // s16 cocos2d::CCDirector *v79; // r0 float v80; // r0 float v81; // s17 float v82; // s16 cocos2d::CCDirector *v83; // r0 float v84; // s15 int v85; // s16 cocos2d::CCDirector *v86; // r0 float v87; // r0 cocos2d::CCBMFontConfiguration *v88; // r3 float v89; // s16 cocos2d::CCDirector *v90; // r0 float v91; // r0 void (__fastcall *v92)(int, cocos2d::CCTexture2D *, cocos2d::CCRect *); // r10 _BOOL4 m_bIsBatched; // r3 cocos2d::CCTexture2D *m_pSomeTexture; // r1 cocos2d::CCObject *v95; // r2 int v96; // [sp+8h] [bp-7Ch] int v97; // [sp+Ch] [bp-78h] int v98; // [sp+10h] [bp-74h] int v99; // [sp+14h] [bp-70h] int v100; // [sp+18h] [bp-6Ch] UT_hash_table *v101; // [sp+24h] [bp-60h] int v102; // [sp+2Ch] [bp-58h] BYREF cocos2d::CCSize v103; // [sp+30h] [bp-54h] BYREF cocos2d::CCPoint v104; // [sp+38h] [bp-4Ch] BYREF cocos2d::CCRect v105; // [sp+40h] [bp-44h] BYREF cocos2d::CCRect v106; // [sp+50h] [bp-34h] BYREF void *prev; // [sp+60h] [bp-24h] BYREF cocos2d::CCRect v108; // [sp+64h] [bp-20h] BYREF __int16 keylen; // [sp+74h] [bp-10h] __int16 keylen_high; // [sp+76h] [bp-Eh] __int16 hashv; // [sp+78h] [bp-Ch] cocos2d::CCSize::CCSize(&v103, &stru_AC8B78); m_sString = a1->m_sString; if ( !m_sString || (v98 = cocos2d::cc_wcslen(m_sString)) == 0 ) { v3 = (cocos2d::CCRect *)&prev; width = v103.width; setContentSize = a1->setContentSize; v6 = cocos2d::CCDirector::sharedDirector(); v7 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v6)); height = v103.height; v9 = width / v7; v10 = cocos2d::CCDirector::sharedDirector(); v11 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v10)); v12 = (cocos2d::CCSize *)&prev; v13 = v9; v14 = height / v11; goto LABEL_57; } v15 = 0; CharacterSet = cocos2d::CCBMFontConfiguration::getCharacterSet(a1->m_pConfiguration); v17 = 1; v99 = (int)CharacterSet; while ( v15 < v98 - 1 ) { v18 = a1->m_sString[v15++]; if ( v18 == 10 ) ++v17; } v19 = 0; v20 = -1; v21 = 0; m_nCommonHeight = a1->m_pConfiguration->m_nCommonHeight; v23 = v17 * m_nCommonHeight; v96 = v17 * m_nCommonHeight - m_nCommonHeight; cocos2d::CCRect::CCRect(&v105); cocos2d::CCRect::CCRect(&v108); v97 = 0; do { v24 = a1->m_sString; v25 = v24[v19]; if ( v25 == 10 ) { v21 = 0; v96 -= a1->m_pConfiguration->m_nCommonHeight; goto LABEL_53; } LODWORD(v106.origin.x) = v24[v19]; v26 = std::_Rb_tree,std::less,std::allocator>::find( v99, &v106); if ( v26 == (_DWORD *)(v99 + 4) ) { switch ( v25 ) { case 'a': v25 = 65; goto LABEL_39; case 'b': v25 = 66; goto LABEL_39; case 'c': v25 = 67; goto LABEL_39; case 'd': v25 = 68; goto LABEL_39; case 'e': v25 = 69; goto LABEL_39; case 'f': v25 = 70; goto LABEL_39; case 'g': v25 = 71; goto LABEL_39; case 'h': v25 = 72; goto LABEL_39; case 'i': v25 = 73; goto LABEL_39; case 'j': v25 = 74; goto LABEL_39; case 'k': v25 = 75; goto LABEL_39; case 'l': v25 = 76; goto LABEL_39; case 'm': v25 = 77; goto LABEL_39; case 'n': v25 = 78; goto LABEL_39; case 'o': v25 = 79; goto LABEL_39; case 'p': v25 = 80; goto LABEL_39; case 'q': v25 = 81; goto LABEL_39; case 'r': v25 = 82; goto LABEL_39; case 's': v25 = 83; goto LABEL_39; case 't': v25 = 84; goto LABEL_39; case 'u': v25 = 85; goto LABEL_39; case 'v': v25 = 86; goto LABEL_39; case 'w': v25 = 87; goto LABEL_39; case 'x': v25 = 88; goto LABEL_39; case 'y': v25 = 89; goto LABEL_39; case 'z': v25 = 90; LABEL_39: LODWORD(v106.origin.x) = v25; if ( v26 != std::_Rb_tree,std::less,std::allocator>::find( v99, &v106) ) break; goto LABEL_53; default: goto LABEL_53; } } v27 = cocos2d::CCLabelBMFont::kerningAmountForFirst(a1, v20, v25); m_pConfiguration = a1->m_pConfiguration; m_nExtraKerning = a1->m_nExtraKerning; v102 = v25; m_pFontDefDictionary = m_pConfiguration->m_pFontDefDictionary; v100 = m_nExtraKerning; v31 = v27; if ( m_pFontDefDictionary ) { tbl = m_pFontDefDictionary->hh.tbl; v33 = ((unsigned __int8)v102 + 17973517 + (HIBYTE(v102) << 24) + (BYTE2(v102) << 16) + (BYTE1(v102) << 8)) ^ 0x7F76D; v34 = (-1622558010 - v33) ^ (v33 << 8); v35 = (-17973517 - v33 - v34) ^ (v34 >> 13); v36 = (v33 - v34 - v35) ^ (v35 >> 12); v37 = (v34 - v35 - v36) ^ (v36 << 16); v38 = (v35 - v36 - v37) ^ (v37 >> 5); v39 = (v36 - v37 - v38) ^ (v38 >> 3); hh_head = tbl->buckets[((v38 - v39 - ((v37 - v38 - v39) ^ (v39 << 10))) ^ (((v37 - v38 - v39) ^ (v39 << 10)) >> 15)) & (tbl->num_buckets - 1)].hh_head; if ( !hh_head ) goto LABEL_43; do { hh_head = (UT_hash_handle *)((char *)hh_head - tbl->hho); LABEL_43: if ( !hh_head ) break; if ( hh_head[1].keylen == 4 ) { v101 = tbl; v41 = memcmp(hh_head[1].key, &v102, 4u); tbl = v101; if ( !v41 ) { prev = hh_head->prev; cocos2d::CCRect::operator=(&v108, (float *)&hh_head->next); keylen = hh_head->keylen; keylen_high = HIWORD(hh_head->keylen); hashv = hh_head->hashv; cocos2d::CCRect::operator=(&v105, &v108.origin.x); x = v105.origin.x; v43 = cocos2d::CCDirector::sharedDirector(); v44 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v43)); y = v105.origin.y; v46 = x / v44; v47 = cocos2d::CCDirector::sharedDirector(); v48 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v47)); v49 = v105.size.width; v50 = y / v48; v51 = cocos2d::CCDirector::sharedDirector(); v52 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v51)); v53 = v105.size.height; v54 = v49 / v52; v55 = cocos2d::CCDirector::sharedDirector(); v56 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v55)); cocos2d::CCRect::CCRect(&v106, v46, v50, v54, v53 / v56); cocos2d::CCRect::operator=(&v105, &v106.origin.x); getChildByTag = a1->getChildByTag; v58 = a1->m_tImageOffset.y; v105.origin.x = v105.origin.x + a1->m_tImageOffset.x; v105.origin.y = v105.origin.y + v58; v59 = (int)getChildByTag(a1, v19); v60 = (float)(v100 + v31); v61 = v59; if ( v59 ) { v62 = *(void (**)(void))(*(_DWORD *)v59 + 164); } else { v61 = operator new(0x228u); cocos2d::CCSprite::CCSprite((cocos2d::CCSprite *)v61); *(_BYTE *)(v61 + 516) = 0; *(_DWORD *)(v61 + 540) = 0; *(_DWORD *)(v61 + 508) = 0; *(_DWORD *)v61 = &off_AA2538; *(_DWORD *)(v61 + 264) = &off_AA27A4; *(_DWORD *)(v61 + 280) = &off_AA27E4; *(_DWORD *)(v61 + 512) = 0; *(_DWORD *)(v61 + 520) = 0; *(_DWORD *)(v61 + 524) = 0; *(_DWORD *)(v61 + 528) = 0; *(_DWORD *)(v61 + 532) = 0; *(_DWORD *)(v61 + 536) = 0; cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v61 + 544)); v85 = keylen; v86 = cocos2d::CCDirector::sharedDirector(); v87 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v86)); v88 = a1->m_pConfiguration; *(float *)(v61 + 508) = (float)((float)v85 / v87) + v60; v89 = (float)v88->m_nCommonHeight - v108.size.height; v90 = cocos2d::CCDirector::sharedDirector(); v91 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v90)); v92 = *(void (__fastcall **)(int, cocos2d::CCTexture2D *, cocos2d::CCRect *))(*(_DWORD *)v61 + 500); m_bIsBatched = a1->m_bIsBatched; *(float *)(v61 + 512) = (float)(v89 * 0.5) / v91; if ( m_bIsBatched ) m_pSomeTexture = a1->m_pSomeTexture; else m_pSomeTexture = a1->m_pobTextureAtlas->getTexture(a1->m_pobTextureAtlas); v92(v61, m_pSomeTexture, &v105); if ( a1->m_bIsBatched ) cocos2d::CCArray::addObject(a1->m_pTargetArray, (cocos2d::_ccArray *)v61, v95); else a1->addChild_1(a1, (cocos2d::CCNode *)v61, v19, v19); cocos2d::CCObject::release((cocos2d::CCObject *)v61); (*(void (__fastcall **)(int, bool))(*(_DWORD *)v61 + 488))(v61, a1->m_bIsOpacityModifyRGB); (*(void (__fastcall **)(int, cocos2d::ccColor3B *))(*(_DWORD *)v61 + 476))(v61, &a1->m_tDisplayedColor); v62 = *(void (**)(void))(*(_DWORD *)v61 + 452); } v62(); (*(void (__fastcall **)(int, cocos2d::CCRect *, _DWORD, cocos2d::CCSize *))(*(_DWORD *)v61 + 564))( v61, &v105, 0, &v105.size); v63 = (float)((float)v21 + (float)keylen) + (float)(v108.size.width * 0.5); v64 = (float)v96 + (float)(a1->m_pConfiguration->m_nCommonHeight - keylen_high); v65 = v105.size.height * 0.5; v66 = cocos2d::CCDirector::sharedDirector(); v67 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v66)); cocos2d::CCPoint::CCPoint(&v104, v63 + v60, v64 - (float)(v65 * v67)); v68 = v104.x; v69 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v61 + 92); v70 = cocos2d::CCDirector::sharedDirector(); v71 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v70)); v72 = v104.y; v73 = v68 / v71; v74 = cocos2d::CCDirector::sharedDirector(); v75 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v74)); cocos2d::CCPoint::CCPoint(&v106.origin, v73, v72 / v75); v69(v61, &v106); v20 = v25; v21 += hashv + v100 + v31; v76 = v97; if ( v97 < v21 ) v76 = v21; v97 = v76; break; } } hh_head = hh_head[1].hh_next; } while ( hh_head ); } LABEL_53: ++v19; } while ( v19 != v98 ); v3 = &v106; setContentSize = a1->setContentSize; v77 = (float)hashv; v103.height = (float)(unsigned int)v23; v78 = (float)v97; if ( v77 < v108.size.width ) v78 = (float)(v78 + v108.size.width) - v77; v103.width = v78; v79 = cocos2d::CCDirector::sharedDirector(); v80 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v79)); v81 = v103.height; v82 = v78 / v80; v83 = cocos2d::CCDirector::sharedDirector(); v84 = COERCE_FLOAT(cocos2d::CCDirector::getContentScaleFactor(v83)); v12 = (cocos2d::CCSize *)&v106; v13 = v82; v14 = v81 / v84; LABEL_57: cocos2d::CCSize::CCSize(v12, v13, v14); setContentSize(a1, (const cocos2d::CCSize *)v3); }
GD Web Decomp Icon

GD Web Decomp

Raw Source