// // MultilineBitmapFont::initWithFont from 0x58aa50 to 0x58b358 (2312 bytes) // // 2 xrefs: // > MultilineBitmapFont::createWithFont @ 0x58b448 // > @ 0xbe0b0 // // 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 // bool __fastcall MultilineBitmapFont::initWithFont( MultilineBitmapFont *a1, const char *a2, _QWORD *a3, float *a4, int a5, bool a6, float a7, float a8) { int v13; // w22 std::array *p_m_fontWidths; // x19 cocos2d::CCDirector *v15; // x0 cocos2d::CCArray *ContentScaleFactor; // x0 float v17; // s0 float v18; // s9 cocos2d::CCObject *v19; // x0 cocos2d::CCArray *v20; // x0 cocos2d::CCObject *v21; // x0 cocos2d::CCArray *v22; // x0 cocos2d::CCObject *v23; // x0 BitmapFontCache *v24; // x0 FontObject *v25; // x20 int v26; // w1 int v27; // w20 int v28; // w25 void *v29; // x0 cocos2d::CCLabelBMFont *v30; // x20 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19 float m_maxWidth; // s13 float width; // s12 float v34; // s0 cocos2d::CCLabelBMFont_vtbl *v35; // x2 long double v36; // q0 void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19 __int64 v38; // x0 void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19 float x; // s12 float v41; // s12 __int64 v42; // x0 void (__fastcall *v43)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19 float *v44; // x0 void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19 float v46; // s13 float y; // s12 __int64 v48; // x0 int v49; // w28 int v50; // w24 unsigned int i; // w19 cocos2d::CCArray *m_characters; // x22 cocos2d::CCArray *v53; // x0 cocos2d::CCObject *v54; // x0 __int64 v55; // x2 void *v56; // x0 float v57; // s0 int v58; // w20 int v59; // w19 float v60; // s0 float v61; // s0 float v62; // s1 __int64 v63; // x0 int v64; // w19 __int64 v65; // x21 int v66; // w22 int v67; // w19 int v68; // w22 int v69; // w19 __int64 v70; // x0 __int64 v71; // x1 int v72; // w2 int v73; // w0 char v74; // w4 char v75; // w3 void (__fastcall *v76)(__int64, cocos2d::CCPoint *); // x2 int v77; // w0 float v78; // s0 __int64 v79; // x0 float v80; // s12 unsigned int *v81; // x3 int v82; // w1 unsigned int *v83; // x3 int v84; // w1 bool v85; // [xsp+9Bh] [xbp+9Bh] int v89; // [xsp+B4h] [xbp+B4h] int v91; // [xsp+D0h] [xbp+D0h] __int64 v92; // [xsp+D8h] [xbp+D8h] __int64 v93; // [xsp+E8h] [xbp+E8h] BYREF cocos2d::CCPoint v94; // [xsp+F0h] [xbp+F0h] BYREF v85 = a1->init(a1); if ( !v85 ) return 0; a1->m_disableColor = a6; v13 = 0; p_m_fontWidths = &a1->m_fontWidths; v15 = cocos2d::CCDirector::sharedDirector(); ContentScaleFactor = (cocos2d::CCArray *)cocos2d::CCDirector::getContentScaleFactor(v15); v18 = v17 * a8; v19 = (cocos2d::CCObject *)cocos2d::CCArray::create(ContentScaleFactor); a1->m_specialDescriptors = (cocos2d::CCArray *)v19; cocos2d::CCObject::retain(v19); v21 = (cocos2d::CCObject *)cocos2d::CCArray::create(v20); a1->m_characters = (cocos2d::CCArray *)v21; cocos2d::CCObject::retain(v21); v23 = (cocos2d::CCObject *)cocos2d::CCArray::create(v22); a1->m_lines = (cocos2d::CCArray *)v23; cocos2d::CCObject::retain(v23); v24 = BitmapFontCache::sharedFontCache(); v25 = BitmapFontCache::fontWithConfigFile(v24, a2, a7); do { v26 = v13++; p_m_fontWidths->__elems_[0] = FontObject::getFontWidth(v25, v26); p_m_fontWidths = (std::array *)((char *)p_m_fontWidths + 4); } while ( v13 != 300 ); if ( !a1->m_disableColor ) { sub_D18D28(&v93, a3); MultilineBitmapFont::readColorInfo(a1, &v93, (__int64 *)&v94); sub_D163D4(a3, &v94); if ( (__int64 *)(*(_QWORD *)&v94 - 24LL) != &qword_124B6B0 ) sub_4DB248((void *)(*(_QWORD *)&v94 - 24LL)); if ( (__int64 *)(v93 - 24) != &qword_124B6B0 ) sub_4DB248((void *)(v93 - 24)); } v27 = -1; if ( *(_QWORD *)(*a3 - 24LL) ) { v28 = 0; v89 = 0; v91 = 0; do { sub_D18D28(&v94, a3); MultilineBitmapFont::stringWithMaxWidth((__int64)a1, &v94, (__int64)&v93, v18, a7); v29 = (void *)(*(_QWORD *)&v94 - 24LL); if ( (__int64 *)(*(_QWORD *)&v94 - 24LL) != &qword_124B6B0 ) { v81 = (unsigned int *)(*(_QWORD *)&v94 - 8LL); if ( &pthread_create ) { do v82 = __ldaxr(v81); while ( __stlxr(v82 - 1, v81) ); } else { v82 = *(_DWORD *)(*(_QWORD *)&v94 - 8LL); *(_DWORD *)(*(_QWORD *)&v94 - 8LL) = v82 - 1; } if ( v82 <= 0 ) operator delete(v29); } v30 = cocos2d::CCLabelBMFont::create(); setPosition = v30->setPosition; cocos2d::CCPoint::CCPoint(&v94, 0.0, (float)v89); setPosition(v30, &v94); v30->setScale(v30, a7); cocos2d::CCArray::addObject(a1->m_lines, v30); m_maxWidth = a1->m_maxWidth; width = v30->getContentSize(v30)->width; if ( m_maxWidth < (float)(width * v30->getScale(v30)) ) { v80 = v30->getContentSize(v30)->width; v34 = v80 * v30->getScale(v30); } else { v34 = a1->m_maxWidth; } v35 = v30->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; a1->m_maxWidth = v34; v35->setAnchorPoint(v30, (const cocos2d::CCPoint *)a4); *(float *)&v36 = v30->getAnchorPoint(v30)->x; if ( *(float *)&v36 == 0.5 ) { setAnchorPoint = v30->setAnchorPoint; v38 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v30->getAnchorPoint)(v30, *(float *)&v36); cocos2d::CCPoint::CCPoint(&v94, 0.0, *(float *)(v38 + 4)); setAnchorPoint(v30, &v94); v39 = v30->setPosition; x = v30->getPosition(v30)->x; v41 = roundf(x - (float)(v30->getContentSize(v30)->width * 0.5)); v42 = (__int64)v30->getPosition(v30); cocos2d::CCPoint::CCPoint(&v94, v41, *(float *)(v42 + 4)); v39(v30, &v94); } if ( *(float *)(((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, long double))v30->getAnchorPoint)(v30, v36) + 4) == 0.5 ) { v43 = v30->setAnchorPoint; v44 = (float *)v30->getAnchorPoint(v30); cocos2d::CCPoint::CCPoint(&v94, *v44, 0.0); v43(v30, &v94); v45 = v30->setPosition; v46 = v30->getPosition(v30)->x; y = v30->getPosition(v30)->y; v48 = (__int64)v30->getContentSize(v30); cocos2d::CCPoint::CCPoint(&v94, v46, roundf(y - (float)(*(float *)(v48 + 4) * 0.5))); v45(v30, &v94); } v92 = *(_QWORD *)(v93 - 24); qsort( a1->m_specialDescriptors->data->arr, a1->m_specialDescriptors->data->num, 8u, (int (*)(const void *, const void *))textSectionCompare); v49 = v28 + v92; v50 = 0; while ( 1 ) { if ( !(unsigned int)cocos2d::CCArray::count(a1->m_specialDescriptors) || (v63 = cocos2d::CCArray::objectAtIndex(a1->m_specialDescriptors, 0), v64 = *(_DWORD *)(v63 + 60), v65 = v63, v64 < v28) ) { v28 += v92; goto LABEL_18; } if ( v64 > v49 ) break; v66 = *(_DWORD *)(v63 + 64); if ( v66 == -1 || v49 >= v66 ) { cocos2d::CCArray::removeObjectAtIndex(a1->m_specialDescriptors, 0, 1); } else { v66 = v28 + v92; *(_DWORD *)(v63 + 60) = v49 + 1; } v67 = v64 - v28; if ( v67 == 1 ) v67 = 0; v68 = v66 - v28; ++v50; v69 = v67 - (v30->getChildByTag(v30, v67) == nullptr); if ( *(_DWORD *)(v65 + 64) == -1 ) { v79 = (__int64)v30->getChildByTag(v30, v69); if ( v79 && *(_DWORD *)(v65 + 56) == 4 ) *(_DWORD *)(v79 + 612) = *(_DWORD *)(v65 + 76); } else { for ( ; v68 >= v69; ++v69 ) { v70 = (__int64)v30->getChildByTag(v30, v69); v71 = v70; if ( v70 ) { v72 = *(_DWORD *)(v65 + 56); switch ( v72 ) { case 2: v73 = *(_DWORD *)(v65 + 72); *(_BYTE *)(v71 + 604) = 1; *(_DWORD *)(v71 + 608) = v73; break; case 3: v77 = *(_DWORD *)(v65 + 84); *(float *)(v71 + 620) = (float)*(int *)(v65 + 80); if ( v77 <= 0 ) v78 = 0.0; else v78 = 1.0 / (float)v77; *(float *)(v71 + 616) = v78; *(_DWORD *)(v71 + 628) = v50; break; case 1: v74 = *(_BYTE *)(v65 + 69); v75 = *(_BYTE *)(v65 + 70); v76 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v70 + 944LL); LOBYTE(v94.x) = *(_BYTE *)(v65 + 68); BYTE1(v94.x) = v74; BYTE2(v94.x) = v75; v76(v70, &v94); break; } } } } } v28 += v92; LABEL_18: a1->addChild(a1, v30); for ( i = 0; i < v30->getChildrenCount(v30); ++i ) { m_characters = a1->m_characters; v53 = v30->getChildren(v30); v54 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v53, i); cocos2d::CCArray::addObject(m_characters, v54); } v55 = (int)v92; if ( (unsigned __int64)(int)v92 > *(_QWORD *)(*a3 - 24LL) ) v55 = *(_QWORD *)(*a3 - 24LL); sub_D174B8(a3, 0, v55, 0); ++v91; v56 = (void *)(v93 - 24); if ( (__int64 *)(v93 - 24) != &qword_124B6B0 ) { v83 = (unsigned int *)(v93 - 8); if ( &pthread_create ) { do v84 = __ldaxr(v83); while ( __stlxr(v84 - 1, v83) ); } else { v84 = *(_DWORD *)(v93 - 8); *(_DWORD *)(v93 - 8) = v84 - 1; } if ( v84 <= 0 ) operator delete(v56); } v89 -= a5; } while ( *(_QWORD *)(*a3 - 24LL) ); v27 = v91 - 1; } cocos2d::CCObject::release(a1->m_specialDescriptors); a1->m_specialDescriptors = nullptr; v57 = *a4; v58 = a5 * v27; a1->m_height = v58; v59 = (int)(float)(v18 + 0.0); a1->m_width = v59; if ( v57 == 0.0 ) { v60 = -0.0; } else if ( v57 == 1.0 ) { v60 = -(float)-v59; } else { v60 = -(float)(v59 / -2); } cocos2d::CCPoint::CCPoint(&v94, v60, (float)v58); cocos2d::CCPoint::operator=(&a1->m_position, v61, v62); return v85; }
GD Web Decomp Icon

GD Web Decomp

Raw Source