//
// CCTextInputNode::updateBlinkLabelToChar from 0x1400568b0 to 0x140056f05 (1621 bytes)
//
// 12 xrefs:
// > CCTextInputMenu::onClear @ 0x14004ddae
// > CCTextInputNode::insertAtCursor @ 0x140055335
// > CCTextInputNode::onTextFieldDeleteBackward @ 0x140055c77
// > CCTextInputNode::updateLabel @ 0x14005655b
// > CCTextInputNode::onTextFieldInsertText @ 0x1400576f7
// > CCTextInputNode::onTextFieldInsertText @ 0x140057b57
// > CCTextInputNode::onTextFieldAttachWithIME @ 0x140057d72
// > CCTextInputNode::updateCursorPosition @ 0x140058984
// > CCTextInputNode::updateCursorPosition @ 0x1400589c2
// > ThreadDescPopup::textChanged @ 0x1400fd6ce
// > SoundPackDescPopup::textChanged @ 0x140199d9e
// > ??> @ 0x1409103b8
//
// 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:25:40 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall CCTextInputNode::updateBlinkLabelToChar(__int64 a1, int a2)
{
bool v4; // si
size_t v5; // r12
_BYTE *v6; // rax
size_t v7; // r8
_QWORD *v8; // rbx
int v9; // r10d
int v10; // r9d
int v11; // r11d
__int64 v12; // r8
unsigned __int8 v13; // cl
int v14; // eax
__int64 v15; // rcx
_QWORD *v16; // rcx
_QWORD *v17; // rax
float v18; // xmm10_4
cocos2d::CCLabelBMFont *Object; // r14
cocos2d::CCArray *v20; // rdi
unsigned int v21; // ebx
cocos2d::CCArray *v22; // rax
signed int v23; // eax
__int64 v24; // rsi
__int64 (__fastcall *v25)(cocos2d::CCLabelBMFont *); // rdi
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // rax
__int64 v29; // rbx
__int64 v30; // rax
__int64 v31; // rax
float v32; // xmm10_4
cocos2d::CCArray *v33; // rax
cocos2d::CCArray *v34; // rbx
struct cocos2d::CCSprite *v35; // rbx
float v36; // xmm6_4
double v37; // xmm0_8
float v38; // xmm7_4
float LetterPosXLeft; // xmm8_4
double v40; // xmm0_8
float v41; // xmm7_4
float v42; // xmm6_4
double v43; // xmm0_8
float v44; // xmm8_4
_BYTE *v45; // rax
_QWORD *v46; // rcx
size_t v47; // rdi
size_t v48; // r8
int v49; // ebx
float v50; // xmm11_4
double v51; // xmm0_8
float *v52; // rsi
float *v53; // rdi
float *v54; // rbx
float v55; // xmm6_4
double v56; // xmm0_8
float v57; // xmm9_4
float v58; // xmm6_4
float v59; // xmm9_4
__int64 *v60; // rdi
__int64 v61; // rbx
float v62; // xmm10_4
__int64 v63; // rax
__int64 *v64; // rdi
__int64 v65; // rbx
__int64 v66; // rax
__int64 v67; // rax
bool v68; // [rsp+28h] [rbp-B9h]
char v69[8]; // [rsp+2Ch] [rbp-B5h] BYREF
char v70[4]; // [rsp+34h] [rbp-ADh] BYREF
_QWORD v71[3]; // [rsp+38h] [rbp-A9h] BYREF
__int64 v72; // [rsp+50h] [rbp-91h]
_QWORD Buf1[3]; // [rsp+58h] [rbp-89h] BYREF
size_t v74; // [rsp+70h] [rbp-71h]
unsigned __int64 v75; // [rsp+78h] [rbp-69h]
__int128 Buf2; // [rsp+80h] [rbp-61h] BYREF
__int64 v77; // [rsp+90h] [rbp-51h]
__int64 v78; // [rsp+98h] [rbp-49h]
if ( (*(_QWORD *)(a1 + 616) || *(_QWORD *)(a1 + 632)) && *(_QWORD *)(a1 + 584) )
{
v4 = 0;
v68 = 0;
v5 = -1;
if ( *(_BYTE *)(a1 + 640) )
{
v6 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a1 + 592) + 600LL) + 8LL))(*(_QWORD *)(a1 + 592) + 600LL);
*(_OWORD *)&v71[1] = 0;
v72 = 0;
Buf1[0] = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003D230(&v71[1], v6, v7);
if ( a2 > 0 )
{
v8 = &v71[1];
v9 = 0;
v10 = 0;
if ( Buf1[0] > 0xFu )
v8 = (_QWORD *)v71[1];
v11 = v72;
v12 = 0;
while ( 1 )
{
if ( v12 >= (int)v72 )
{
LABEL_21:
if ( v9 < (int)v72 )
v11 = v9;
if ( v11 > 0 )
{
v16 = &v71[1];
if ( Buf1[0] > 0xFu )
v16 = (_QWORD *)v71[1];
if ( *((_BYTE *)v16 + v11 - 1) == 10 )
{
v4 = 1;
goto LABEL_33;
}
}
goto LABEL_34;
}
v13 = *((_BYTE *)v8 + v12);
if ( v13 < 0x80u )
break;
if ( (v13 & 0xE0) == 0xC0 )
{
v14 = 2;
v15 = 2;
}
else if ( (v13 & 0xF0) == 0xE0 )
{
v14 = 3;
v15 = 3;
}
else
{
if ( (v13 & 0xF8) != 0xF0 )
break;
v14 = 4;
v15 = 4;
}
LABEL_20:
v9 += v14;
v12 += v15;
if ( ++v10 >= a2 )
goto LABEL_21;
}
v15 = 1;
v14 = 1;
goto LABEL_20;
}
if ( a2 < 0 && v72 )
{
v17 = &v71[1];
if ( Buf1[0] > 0xFu )
v17 = (_QWORD *)v71[1];
v4 = *((_BYTE *)v17 + v72 - 1) == 10;
LABEL_33:
v68 = v4;
}
LABEL_34:
sub_14003D310((__int64)&v71[1]);
}
if ( *(int *)(a1 + 520) > 0 && a2 >= 0 )
a2 = CCTextInputNode::rawToDisplayIndex((_QWORD *)a1, a2);
v18 = 0.0;
Object = *(cocos2d::CCLabelBMFont **)(a1 + 616);
if ( !Object )
{
if ( a2 >= 0
&& (v20 = *(cocos2d::CCArray **)(*(_QWORD *)(*(_QWORD *)(a1 + 632) + 616LL) + 648LL),
v21 = 0,
cocos2d::CCArray::count(v20)) )
{
while ( 1 )
{
Object = cocos2d::CCArray::objectAtIndex(v20, v21);
v22 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 480LL))(Object);
v23 = cocos2d::CCArray::count(v22);
if ( a2 <= v23 && (!v4 || a2 != v23) )
break;
a2 -= v23;
if ( ++v21 >= cocos2d::CCArray::count(v20) )
goto LABEL_45;
}
}
else
{
LABEL_45:
Object = cocos2d::CCArray::lastObject(*(cocos2d::CCArray **)(*(_QWORD *)(*(_QWORD *)(a1 + 632) + 616LL) + 648LL));
a2 = -1;
*(_DWORD *)(*(_QWORD *)(a1 + 592) + 760LL) = -1;
}
v24 = *(_QWORD *)(a1 + 632);
v25 = *(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 504LL);
v26 = (*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 200LL))(Object);
v27 = v25(Object);
cocos2d::CCNode::convertToWorldSpace(v27, v70, v26);
v29 = v28;
v30 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v24 + 504LL))(v24);
cocos2d::CCNode::convertToWorldSpace(v30, v69, &unk_140909B60);
v32 = *(float *)(v29 + 4) - *(float *)(v31 + 4);
v18 = v32
- *(float *)((*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 200LL))(Object) + 4);
}
v33 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 480LL))(Object);
v34 = v33;
if ( a2 < 0 || cocos2d::CCArray::count(v33) <= a2 )
{
v40 = (*(double (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 128LL))(Object);
v41 = *(float *)&v40;
v42 = *(float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 320LL))(Object);
v43 = (*(double (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 168LL))(Object);
LetterPosXLeft = *(float *)&v43 * v42;
v38 = v41 + v41;
}
else
{
v35 = cocos2d::CCArray::objectAtIndex(v34, a2);
v36 = *(float *)(a1 + 472);
v37 = (*(double (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 128LL))(Object);
v38 = *(float *)&v37 * v36;
LetterPosXLeft = cocos2d::CCLabelBMFont::getLetterPosXLeft(Object, v35);
}
v44 = LetterPosXLeft + v38;
Buf2 = 0;
v77 = 0;
v78 = 15;
LOBYTE(Buf2) = 0;
v45 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a1 + 592) + 600LL) + 8LL))(*(_QWORD *)(a1 + 592) + 600LL);
*(_OWORD *)&Buf1[1] = 0;
v74 = 0;
v75 = 0;
do
++v5;
while ( v45[v5] );
sub_14003D230(&Buf1[1], v45, v5);
v46 = &Buf1[1];
if ( v75 > 0xF )
v46 = (_QWORD *)Buf1[1];
v47 = v74;
v48 = v74;
if ( v74 )
v48 = 0;
v49 = memcmp(v46, &Buf2, v48);
if ( !v49 )
v49 = v47 != 0;
sub_14003D310((__int64)&Buf1[1]);
sub_14003D310((__int64)&Buf2);
if ( !v49 )
v44 = 2.0;
if ( v68 && a2 <= 0 )
v44 = 2.0;
if ( *(_QWORD *)(a1 + 616) )
{
v50 = 1.0;
}
else
{
v51 = (*(double (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 632) + 168LL))(*(_QWORD *)(a1 + 632));
v50 = *(float *)&v51;
}
v52 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 320LL))(Object);
v53 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 200LL))(Object);
v54 = (float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 320LL))(Object);
v55 = (float)(1.0
- *(float *)(*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 296LL))(Object))
* *v54;
v56 = (*(double (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 168LL))(Object);
v57 = (float)(*(float *)&v56 * v55) + *v53;
v58 = *v52;
v59 = (float)((float)(v57
- (float)((*(float (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 168LL))(Object)
* v58))
+ v44)
* v50;
if ( !*(_QWORD *)(a1 + 616) )
v59 = v59 + *(float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 632) + 200LL))(*(_QWORD *)(a1 + 632));
v60 = *(__int64 **)(a1 + 584);
v61 = *v60;
v62 = v18
+ *(float *)((*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 200LL))(Object) + 4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, v59, v62);
(*(void (__fastcall **)(__int64 *, __int64))(v61 + 184))(v60, v63);
if ( !*(_QWORD *)(a1 + 616) )
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 168LL))(Object);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 584) + 160LL))(*(_QWORD *)(a1 + 584));
v64 = *(__int64 **)(a1 + 584);
v65 = *v64;
v66 = (*(__int64 (__fastcall **)(cocos2d::CCLabelBMFont *))(*(_QWORD *)Object + 296LL))(Object);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, 0.5, *(float *)(v66 + 4));
(*(void (__fastcall **)(__int64 *, __int64))(v65 + 288))(v64, v67);
if ( *(_QWORD *)(a1 + 656) )
CCTextInputNode::scrollToCursor(a1);
}
}