//
// EmoteSprite::translateUnicodeEmoji from 0x6df46c to 0x6df78c (800 bytes)
//
// 3 xrefs:
// > CCTextInputNode::insertAtCursor @ 0x6c4bec
// > CCTextInputNode::onTextFieldInsertText @ 0x6c5290
// > ??> @ 0xbdb80
//
// This function is hookable on this platform (idp: arm, 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 12:51:36 +0000
//
__int64 *__usercall EmoteSprite::translateUnicodeEmoji@(__int64 a1@, __int64 *a2@)
{
unsigned __int8 v4; // w0
unsigned __int64 v5; // x1
__int64 v6; // x22
unsigned __int64 v7; // x21
unsigned __int64 v8; // x19
int v9; // w1
unsigned __int64 v10; // x20
size_t v11; // x3
int v13; // w28
unsigned __int8 *v14; // x0
__int64 v15; // x0
char *v16; // x28
size_t v17; // x0
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v4 = *(_BYTE *)a1;
v5 = v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *(_QWORD *)(a1 + 8);
std::string::reserve(a2, v5);
if ( (*(_BYTE *)a1 & 1) != 0 )
{
v6 = *(_QWORD *)(a1 + 16);
v7 = *(_QWORD *)(a1 + 8);
}
else
{
v6 = a1 + 1;
v7 = *(_BYTE *)a1 >> 1;
}
v8 = 0;
while ( v8 < v7 )
{
v9 = *(unsigned __int8 *)(v6 + v8);
if ( (v9 & 0x80) != 0 )
{
if ( v9 >> 5 == 6 )
{
v10 = v8 + 2;
if ( v8 + 2 > v7 )
goto LABEL_20;
v13 = 2;
v11 = 2;
v9 = ((v9 & 0x1F) << 6) | *(_BYTE *)(v6 + v8 + 1) & 0x3F;
}
else if ( v9 >> 4 == 14 )
{
v10 = v8 + 3;
if ( v7 < v8 + 3 )
goto LABEL_20;
v13 = 3;
v11 = 3;
v9 = *(_BYTE *)(v6 + v8 + 2) & 0x3F | ((((v9 & 0xF) << 6) | *(_BYTE *)(v6 + v8 + 1) & 0x3F) << 6);
}
else
{
if ( v9 >> 3 != 30 || (v10 = v8 + 4, v7 < v8 + 4) )
{
LABEL_20:
std::string::push_back(a2, v9);
++v8;
continue;
}
v13 = 4;
v11 = 4;
v9 = *(_BYTE *)(v6 + v8 + 3) & 0x3F
| ((*(_BYTE *)(v6 + v8 + 2) & 0x3F | ((((v9 & 7) << 6) | *(_BYTE *)(v6 + v8 + 1) & 0x3F) << 6)) << 6);
}
if ( v9 == 128565 && v10 + 7 <= v7 )
{
if ( *(unsigned __int8 *)(v6 + v10) == 226 )
{
v14 = (unsigned __int8 *)(v6 + v10);
if ( *(unsigned __int8 *)(v6 + v10 + 1) == 128
&& v14[2] == 141
&& v14[3] == 240
&& v14[4] == 159
&& v14[5] == 146
&& v14[6] == 171 )
{
std::string::append((__int64)a2, ":dizzy:", 7u);
v8 += v13 + 7;
continue;
}
}
goto LABEL_11;
}
}
else
{
v10 = v8 + 1;
if ( v7 < v8 + 1 )
goto LABEL_20;
v11 = 1;
}
if ( v9 == 8419 || (unsigned int)(v9 - 65038) <= 1 || v9 == 8205 )
goto LABEL_14;
LABEL_11:
if ( (unsigned int)(v9 - 127995) > 4 )
{
if ( (unsigned int)v9 > 0x1FFF )
{
if ( (unsigned int)(v9 - 128336) <= 0x17 )
{
v16 = "clock";
LABEL_44:
std::string::push_back(a2, 58);
v17 = strlen(v16);
std::string::append((__int64)a2, v16, v17);
std::string::push_back(a2, 58);
goto LABEL_14;
}
v15 = 0;
while ( v9 != *((_DWORD *)&unk_13F6A50 + 4 * v15) )
{
if ( ++v15 == 188 )
goto LABEL_13;
}
v16 = *((char **)&unk_13F6A50 + 2 * v15 + 1);
if ( v16 )
goto LABEL_44;
}
LABEL_13:
std::string::append((__int64)a2, a1, v8, v11);
}
LABEL_14:
v8 = v10;
}
return a2;
}