// // cocos2d::CCLabelBMFont::updateLabel from 0x18004e790 to 0x18004f41f (3215 bytes) // // 3 xrefs: // > @ 0x1800f2720 // > @ 0x18014cf68 // > @ 0x1801bbe3c // // This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 11:21:44 +0000 // // Hidden C++ exception states: #wind=4 void __fastcall cocos2d::CCLabelBMFont::updateLabel(cocos2d::CCLabelBMFont *this) { const unsigned __int16 *v2; // rdx float *v3; // r15 int v4; // r12d __int64 v5; // rbx char *v6; // rdi void *v7; // rcx char *v8; // rdi void *v9; // rcx __int64 v10; // r13 char v11; // si float v12; // xmm7_4 float LetterPosXLeft; // xmm6_4 int v14; // edi unsigned int v15; // ebx unsigned int v16; // ebx struct cocos2d::CCSprite *i; // r15 unsigned __int16 v18; // dx unsigned __int16 v19; // di void *v20; // rsi __int64 v21; // r9 char *v22; // rbx __int64 v23; // rdi unsigned __int64 v24; // rcx unsigned __int64 v25; // rcx unsigned __int64 v26; // rax const void *v27; // rdx char *v28; // rcx size_t v29; // r8 void *v30; // rcx const void *v31; // r8 _BYTE *v32; // r9 void *v33; // r15 __int64 v34; // r9 char *v35; // rbx __int64 v36; // rsi unsigned __int64 v37; // rcx unsigned __int64 v38; // rcx unsigned __int64 v39; // rax __int64 v40; // r12 const void *v41; // rdx char *v42; // rcx size_t v43; // r8 void *v44; // rcx float LetterPosXRight; // xmm0_4 _BYTE *v46; // rax _BYTE *v47; // rcx int v48; // ebx signed __int64 v49; // rsi char *v50; // rax _WORD *v51; // rdi int v52; // ebx __int64 v53; // r8 _WORD *v54; // rdx __int64 v55; // rcx void *v56; // rcx void *v57; // rcx void *v58; // rcx int v59; // esi int v60; // r13d int v61; // eax char *v62; // rdi __int64 v63; // rax char *v64; // rbx __int64 v65; // rcx __int64 v66; // r15 __int16 v67; // ax __int64 v68; // rsi unsigned __int64 v69; // r12 unsigned __int64 v70; // rcx unsigned __int64 v71; // rcx unsigned __int64 v72; // rax __int64 v73; // r13 char *v74; // rdx char *v75; // rcx char *v76; // r8 void *v77; // rcx __int64 v78; // r12 __int64 v79; // rdx __int64 v80; // rax __int64 v81; // rdi float *v82; // rbx float v83; // xmm7_4 float v84; // xmm6_4 float v85; // xmm6_4 int v86; // edi __int64 v87; // r15 __int64 v88; // rsi float *v89; // rbx float *v90; // rax char *v91; // rax void *Block_8[2]; // [rsp+38h] [rbp-89h] BYREF char *v93; // [rsp+48h] [rbp-79h] void *Src[2]; // [rsp+50h] [rbp-71h] BYREF char *v95; // [rsp+60h] [rbp-61h] float *v96; // [rsp+68h] [rbp-59h] signed __int64 v97; // [rsp+70h] [rbp-51h] BYREF cocos2d::CCArray *v98; // [rsp+78h] [rbp-49h] BYREF void *v99[12]; // [rsp+80h] [rbp-41h] BYREF __int64 v100; // [rsp+128h] [rbp+67h] BYREF __int64 v101; // [rsp+130h] [rbp+6Fh] BYREF __int64 v102; // [rsp+138h] [rbp+77h] __int64 v103; // [rsp+140h] [rbp+7Fh] (*(void (__fastcall **)(cocos2d::CCLabelBMFont *, _QWORD, _QWORD))(*(_QWORD *)this + 888LL))( this, *((_QWORD *)this + 52), 0); v3 = (float *)((char *)this + 460); v96 = (float *)((char *)this + 460); v4 = 0; if ( *((float *)this + 115) <= 0.0 ) goto LABEL_110; cocos2d::cc_utf16_vec_from_utf16_str(v99, *((_QWORD *)this + 47)); v97 = ((char *)v99[1] - (char *)v99[0]) >> 1; *(_OWORD *)Src = 0; v95 = nullptr; v5 = 2LL * (unsigned int)v97; if ( (_DWORD)v97 ) { v6 = (char *)sub_18000CE80(2LL * (unsigned int)v97); memmove(v6, Src[0], (char *)Src[1] - (char *)Src[0]); v7 = Src[0]; if ( Src[0] ) { if ( (unsigned __int64)(2 * ((v95 - (char *)Src[0]) >> 1)) >= 0x1000 ) { v7 = *((void **)Src[0] - 1); if ( (unsigned __int64)((char *)Src[0] - (char *)v7 - 8) > 0x1F ) LABEL_98: invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free_0(v7); } Src[0] = v6; Src[1] = v6; v95 = &v6[v5]; v3 = (float *)((char *)this + 460); v96 = (float *)((char *)this + 460); } *(_OWORD *)Block_8 = 0; v93 = nullptr; if ( (_DWORD)v97 ) { v8 = (char *)sub_18000CE80(2LL * (unsigned int)v97); memmove(v8, Block_8[0], (char *)Block_8[1] - (char *)Block_8[0]); v9 = Block_8[0]; if ( Block_8[0] ) { if ( (unsigned __int64)(2 * ((v93 - (char *)Block_8[0]) >> 1)) >= 0x1000 ) { v9 = *((void **)Block_8[0] - 1); if ( (unsigned __int64)((char *)Block_8[0] - (char *)v9 - 8) > 0x1F ) LABEL_82: invoke_watson(nullptr, nullptr, nullptr, 0, 0); v3 = (float *)((char *)this + 460); } j_j_free_0(v9); } Block_8[0] = v8; Block_8[1] = v8; v93 = &v8[v5]; v96 = v3; } LODWORD(v10) = 0; LOBYTE(v100) = 0; v11 = 0; v12 = -1.0; LetterPosXLeft = -1.0; v14 = 0; v98 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)this + 480LL))(this); v15 = 0; for ( LODWORD(v102) = 0; v15 < (unsigned int)cocos2d::CCArray::count(v98); v4 = 0 ) { v16 = v14 + v15; for ( i = (struct cocos2d::CCSprite *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *, _QWORD))(*(_QWORD *)this + 472LL))( this, v16); !i; i = (struct cocos2d::CCSprite *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *, _QWORD))(*(_QWORD *)this + 472LL))( this, v16) ) { ++v4; ++v16; } v14 += v4; LODWORD(v103) = v14; if ( (*(unsigned __int8 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)i + 344LL))(i) ) { if ( (unsigned int)v10 >= (unsigned int)v97 ) break; v19 = *((_WORD *)v99[0] + (unsigned int)v10); LOWORD(v101) = v19; if ( !v11 ) { LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(this, i); v11 = 1; } if ( !(_BYTE)v100 ) { v12 = LetterPosXLeft; LOBYTE(v100) = 1; } if ( v19 == 10 ) { cocos2d::cc_utf8_trim_ws(Block_8); v20 = Block_8[1]; if ( Block_8[1] == v93 ) { v23 = ((char *)Block_8[1] - (char *)Block_8[0]) >> 1; if ( v23 == 0x7FFFFFFFFFFFFFFFLL ) goto LABEL_160; v100 = v23 + 1; v24 = (v93 - (char *)Block_8[0]) >> 1; if ( v24 <= 0x7FFFFFFFFFFFFFFFLL - (v24 >> 1) ) { v26 = (v24 >> 1) + v24; v25 = v23 + 1; if ( v26 >= v23 + 1 ) v25 = v26; if ( v25 > 0x7FFFFFFFFFFFFFFFLL ) LABEL_159: Concurrency::cancel_current_task(); } else { v25 = 0x7FFFFFFFFFFFFFFFLL; } v101 = 2 * v25; v22 = (char *)sub_18000CE80(2 * v25); *(_WORD *)&v22[2 * v23] = 10; v27 = Block_8[0]; v28 = v22; if ( v20 == Block_8[1] ) { v29 = (char *)Block_8[1] - (char *)Block_8[0]; } else { memmove(v22, Block_8[0], (size_t)v20 - (unsigned __int64)Block_8[0]); v29 = (char *)Block_8[1] - (char *)v20; v28 = &v22[2 * v23 + 2]; v27 = v20; } memmove(v28, v27, v29); v30 = Block_8[0]; if ( Block_8[0] ) { if ( (unsigned __int64)(2 * ((v93 - (char *)Block_8[0]) >> 1)) >= 0x1000 ) { v30 = *((void **)Block_8[0] - 1); if ( (unsigned __int64)((char *)Block_8[0] - (char *)v30 - 8) > 0x1F ) goto LABEL_82; } j_j_free_0(v30); } Block_8[0] = v22; v21 = (__int64)&v22[2 * v100]; v93 = &v22[v101]; } else { *(_WORD *)Block_8[1] = 10; v21 = (__int64)Block_8[1] + 2; v22 = (char *)Block_8[0]; } Block_8[1] = (void *)v21; sub_180048300((__int64)Src, (_BYTE *)Src[1], v22, (v21 - (__int64)v22) >> 1); v32 = Block_8[1]; v31 = Block_8[0]; if ( Block_8[0] != Block_8[1] ) { v32 = Block_8[0]; Block_8[1] = Block_8[0]; } v11 = 0; LOBYTE(v100) = 0; LetterPosXLeft = -1.0; v12 = -1.0; v10 = (unsigned int)(v4 + v10); if ( (unsigned int)v10 >= (unsigned int)v97 ) goto LABEL_84; v19 = *((_WORD *)v99[0] + v10); LOWORD(v101) = v19; } if ( cocos2d::isspace_unicode((cocos2d *)v19, v18) ) { v33 = Block_8[1]; if ( Block_8[1] == v93 ) { v36 = ((char *)Block_8[1] - (char *)Block_8[0]) >> 1; if ( v36 == 0x7FFFFFFFFFFFFFFFLL ) LABEL_160: std::vector::_Xlen(); v101 = v36 + 1; v37 = (v93 - (char *)Block_8[0]) >> 1; if ( v37 <= 0x7FFFFFFFFFFFFFFFLL - (v37 >> 1) ) { v39 = (v37 >> 1) + v37; v38 = v36 + 1; if ( v39 >= v36 + 1 ) v38 = v39; if ( v38 > 0x7FFFFFFFFFFFFFFFLL ) goto LABEL_159; } else { v38 = 0x7FFFFFFFFFFFFFFFLL; } v40 = 2 * v38; v35 = (char *)sub_18000CE80(2 * v38); *(_WORD *)&v35[2 * v36] = v19; v41 = Block_8[0]; v42 = v35; if ( v33 == Block_8[1] ) { v43 = (char *)Block_8[1] - (char *)Block_8[0]; } else { memmove(v35, Block_8[0], (size_t)v33 - (unsigned __int64)Block_8[0]); v43 = (char *)Block_8[1] - (char *)v33; v42 = &v35[2 * v36 + 2]; v41 = v33; } memmove(v42, v41, v43); v44 = Block_8[0]; if ( Block_8[0] ) { if ( (unsigned __int64)(2 * ((v93 - (char *)Block_8[0]) >> 1)) >= 0x1000 ) { v44 = *((void **)Block_8[0] - 1); if ( (unsigned __int64)((char *)Block_8[0] - (char *)v44 - 8) > 0x1F ) goto LABEL_82; } j_j_free_0(v44); } Block_8[0] = v35; v34 = (__int64)&v35[2 * v101]; v93 = &v35[v40]; } else { *(_WORD *)Block_8[1] = v19; v34 = (__int64)Block_8[1] + 2; v35 = (char *)Block_8[0]; } Block_8[1] = (void *)v34; sub_180048300((__int64)Src, (_BYTE *)Src[1], v35, (v34 - (__int64)v35) >> 1); if ( Block_8[0] != Block_8[1] ) Block_8[1] = Block_8[0]; v11 = 0; LetterPosXLeft = -1.0; } else { LetterPosXRight = cocos2d::CCLabelBMFont::getLetterPosXRight(this, i, 0.0); if ( (float)(LetterPosXRight - v12) <= *v96 ) { sub_18004DE80((const void **)Block_8, &v101); } else { if ( *((_BYTE *)this + 472) ) { cocos2d::cc_utf8_trim_ws(Block_8); LOWORD(v100) = 10; sub_18004DE80((const void **)Block_8, &v100); sub_180048300((__int64)Src, (_BYTE *)Src[1], Block_8[0], ((char *)Block_8[1] - (char *)Block_8[0]) >> 1); if ( Block_8[0] != Block_8[1] ) Block_8[1] = Block_8[0]; v11 = 0; LetterPosXLeft = -1.0; v12 = -1.0; v48 = v102 - 1; LOBYTE(v100) = 0; v14 = v103; goto LABEL_80; } sub_18004DE80((const void **)Block_8, &v101); if ( (unsigned int)cocos2d::cc_utf8_find_last_not_char(Src, 32) == -1 ) { v47 = Src[0]; v46 = Src[1]; if ( Src[0] != Src[1] ) { v46 = Src[0]; Src[1] = Src[0]; } } else { cocos2d::cc_utf8_trim_ws(Src); v46 = Src[1]; v47 = Src[0]; } if ( (v46 - v47) >> 1 ) { LOWORD(v100) = 10; sub_18004DE80((const void **)Src, &v100); } LOBYTE(v100) = 0; v12 = -1.0; } } LODWORD(v10) = v10 + 1; v14 = v103; } v48 = v102; LABEL_80: v15 = v48 + 1; LODWORD(v102) = v15; } v32 = Block_8[1]; v31 = Block_8[0]; LABEL_84: sub_180048300((__int64)Src, (_BYTE *)Src[1], v31, (v32 - (_BYTE *)v31) >> 1); v49 = ((char *)Src[1] - (char *)Src[0]) >> 1; v50 = (char *)sub_1800E4C6C(saturated_mul((int)v49 + 1LL, 2u)); v51 = v50; v52 = 0; if ( (int)v49 >= 8 ) { v53 = (int)v49 - 1; v54 = Src[0]; if ( v50 <= (char *)Src[0] + 2 * v53 && &v50[2 * v53] >= Src[0] ) goto LABEL_90; memcpy(v50, Src[0], 2LL * (int)v49); do ++v52; while ( v52 < (int)v49 ); } v54 = Src[0]; LABEL_90: v55 = v52; if ( v52 < (__int64)(int)v49 ) { while ( 1 ) { v51[v55] = v54[v55]; if ( ++v55 >= (int)v49 ) break; v54 = Src[0]; } } v51[(int)v49] = 0; (*(void (__fastcall **)(cocos2d::CCLabelBMFont *, _WORD *, _QWORD))(*(_QWORD *)this + 888LL))(this, v51, 0); if ( v51 ) j_j_free_0(v51); v56 = Block_8[0]; if ( Block_8[0] ) { if ( (unsigned __int64)(2 * ((v93 - (char *)Block_8[0]) >> 1)) >= 0x1000 ) { v56 = *((void **)Block_8[0] - 1); if ( (unsigned __int64)((char *)Block_8[0] - (char *)v56 - 8) > 0x1F ) goto LABEL_98; } j_j_free_0(v56); *(_OWORD *)Block_8 = 0; v93 = nullptr; } v57 = Src[0]; if ( Src[0] ) { if ( (unsigned __int64)(2 * ((v95 - (char *)Src[0]) >> 1)) >= 0x1000 ) { v57 = *((void **)Src[0] - 1); if ( (unsigned __int64)((char *)Src[0] - (char *)v57 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free_0(v57); *(_OWORD *)Src = 0; v95 = nullptr; } v58 = v99[0]; if ( v99[0] ) { if ( (unsigned __int64)(2 * (((char *)v99[2] - (char *)v99[0]) >> 1)) >= 0x1000 ) { v58 = *((void **)v99[0] - 1); if ( (unsigned __int64)((char *)v99[0] - (char *)v58 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free_0(v58); } LABEL_110: if ( *((_DWORD *)this + 114) ) { v59 = 0; LODWORD(v100) = 0; v60 = 0; LODWORD(v101) = 0; v61 = cocos2d::cc_wcslen(*((cocos2d **)this + 47), v2); *(_OWORD *)Src = 0; v95 = nullptr; v62 = nullptr; if ( v61 >= 0 ) { v102 = v61; v63 = 0; v103 = 0; v64 = (char *)Src[1]; v65 = v102; while ( 1 ) { v66 = *((_QWORD *)this + 47); v67 = *(_WORD *)(v66 + 2 * v63); if ( v67 != 10 ) { if ( v67 ) break; } v78 = (v64 - v62) >> 1; if ( (_DWORD)v78 ) { v79 = (unsigned int)(v59 + v78 + v60 - 1); if ( (int)v79 >= 0 ) { v80 = (*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)this + 472LL))(this, v79); v81 = v80; if ( v80 ) { v82 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v80 + 200LL))(v80); v83 = (float)(*(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v81 + 320LL))(v81) * 0.5) + *v82; if ( *((_DWORD *)this + 114) != 1 ) { if ( *((_DWORD *)this + 114) == 2 ) { v84 = *(float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)this + 320LL))(this); LABEL_139: v85 = v84 - v83; if ( v85 != 0.0 ) { v86 = v59 + v60; v87 = (unsigned int)v78; do { if ( v86 >= 0 ) { v88 = (*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *, _QWORD))(*(_QWORD *)this + 472LL))( this, (unsigned int)v86); if ( v88 ) { v89 = kmVec2Fill((float *)&v97, v85, 0.0); v90 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v88 + 200LL))(v88); cocos2d::CCSize::operator+(v90, (float *)&v98, v89); (*(void (__fastcall **)(__int64, cocos2d::CCArray **))(*(_QWORD *)v88 + 184LL))(v88, &v98); } } ++v86; --v87; } while ( v87 ); v59 = v100; } } v59 += v78; LODWORD(v100) = v59; LODWORD(v101) = ++v60; v62 = (char *)Src[0]; v64 = (char *)Src[1]; v65 = v102; if ( Src[0] != Src[1] ) { v64 = (char *)Src[0]; Src[1] = Src[0]; } goto LABEL_150; } v84 = *(float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)this + 320LL))(this) * 0.5; v83 = v83 * 0.5; goto LABEL_139; } v64 = (char *)Src[1]; v65 = v102; LABEL_149: v62 = (char *)Src[0]; } } else { LODWORD(v101) = ++v60; } LABEL_150: v63 = v103 + 1; v103 = v63; if ( v63 > v65 ) goto LABEL_151; } if ( v64 == v95 ) { v68 = (v64 - v62) >> 1; if ( v68 == 0x7FFFFFFFFFFFFFFFLL ) std::vector::_Xlen(); v69 = v68 + 1; v70 = (v95 - v62) >> 1; if ( v70 <= 0x7FFFFFFFFFFFFFFFLL - (v70 >> 1) ) { v72 = (v70 >> 1) + v70; v71 = v68 + 1; if ( v72 >= v69 ) v71 = v72; if ( v71 > 0x7FFFFFFFFFFFFFFFLL ) Concurrency::cancel_current_task(); } else { v71 = 0x7FFFFFFFFFFFFFFFLL; } v73 = 2 * v71; v62 = (char *)sub_18000CE80(2 * v71); *(_WORD *)&v62[2 * v68] = *(_WORD *)(v66 + 2 * v103); v74 = (char *)Src[0]; v75 = v62; if ( v64 == Src[1] ) { v76 = (char *)((char *)Src[1] - (char *)Src[0]); } else { memmove(v62, Src[0], v64 - (char *)Src[0]); v76 = (char *)((char *)Src[1] - (char *)v64); v75 = &v62[2 * v68 + 2]; v74 = v64; } memmove(v75, v74, (size_t)v76); v77 = Src[0]; if ( Src[0] ) { if ( (unsigned __int64)(2 * ((v95 - (char *)Src[0]) >> 1)) >= 0x1000 ) { v77 = *((void **)Src[0] - 1); if ( (unsigned __int64)((char *)Src[0] - (char *)v77 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free_0(v77); } Src[0] = v62; v64 = &v62[2 * v69]; Src[1] = v64; v95 = &v62[v73]; v60 = v101; v59 = v100; v65 = v102; goto LABEL_150; } *(_WORD *)v64 = v67; v64 = (char *)Src[1] + 2; Src[1] = (char *)Src[1] + 2; goto LABEL_149; } LABEL_151: if ( v62 ) { v91 = v62; if ( (unsigned __int64)(2 * ((v95 - v62) >> 1)) >= 0x1000 ) { v62 = *((char **)v62 - 1); if ( (unsigned __int64)(v91 - v62 - 8) > 0x1F ) invoke_watson(nullptr, nullptr, nullptr, 0, 0); } j_j_free_0(v62); } } }