//
// cocos2d::cc_utf16_vec_from_utf16_str from 0x1006604b0 to 0x10066062c (380 bytes)
//
// 1 xrefs:
// > cocos2d::CCLabelBMFont::updateLabel @ 0x1005da25b
//
// 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::vector *__fastcall cocos2d::cc_utf16_vec_from_utf16_str(
std::vector *__return_ptr retstr,
const unsigned __int16 *a2)
{
std::vector *v2; // r15
__int64 v3; // rbx
unsigned __int16 *v5; // r12
unsigned __int16 *v6; // r13
unsigned __int16 *v7; // r14
unsigned __int16 *value; // rax
signed __int64 v9; // r12
__int64 v10; // r14
__int64 v11; // r15
unsigned __int64 v12; // rax
unsigned __int16 *v14; // [rsp+0h] [rbp-50h]
unsigned __int16 *__src; // [rsp+18h] [rbp-38h]
v2 = retstr;
if ( *a2 )
{
v3 = 0;
while ( a2[++v3] != 0 )
;
*(_OWORD *)&retstr->__begin_ = 0;
retstr->__end_cap_.__value_ = nullptr;
v5 = nullptr;
v6 = nullptr;
do
{
value = v2->__end_cap_.__value_;
if ( v5 < value )
{
*v5 = *a2;
v7 = v5 + 1;
}
else
{
v9 = (char *)v5 - (char *)v6;
v10 = v9 >> 1;
__src = v6;
if ( v9 >> 1 <= -2 )
{
retstr->__begin_ = v6;
sub_1005DB640();
}
v11 = v10 + 1;
v12 = (char *)value - (char *)v6;
if ( v12 > v10 + 1 )
v11 = v12;
if ( v12 >= 0x7FFFFFFFFFFFFFFELL )
v11 = 0x7FFFFFFFFFFFFFFFLL;
if ( v11 )
{
if ( v11 < 0 )
{
retstr->__begin_ = v6;
sub_100054850();
}
v6 = (unsigned __int16 *)operator new(2 * v11);
}
else
{
v6 = nullptr;
}
v14 = &v6[v11];
v6[v10] = *a2;
v7 = &v6[v10 + 1];
memcpy(v6, __src, v9);
v2 = retstr;
retstr->__end_ = v7;
retstr->__end_cap_.__value_ = v14;
if ( __src )
operator delete(__src);
}
v2->__end_ = v7;
++a2;
v5 = v7;
--v3;
}
while ( v3 );
}
else
{
*(_OWORD *)&retstr->__end_ = 0;
v6 = nullptr;
}
v2->__begin_ = v6;
return v2;
}