//
// EditLevelLayer::textChanged from 0x1001e00f0 to 0x1001e027f (399 bytes)
//
// 2 xrefs:
// > sub_1001E02C0 @ 0x1001e02cc
// > ??> @ 0x100ade990
//
// 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 12:26:28 +0000
//
void __fastcall EditLevelLayer::textChanged(__int64 a1, _QWORD *a2)
{
int v3; // eax
unsigned int v4; // eax
std::string *v5; // rdi
__int64 v6; // rbx
const char *data; // r14
size_t v8; // rax
std::string::size_type v9; // r15
char *v10; // r12
size_t v11; // r13
void *v12; // rdi
__int128 v13; // [rsp+0h] [rbp-70h] BYREF
void *__p; // [rsp+10h] [rbp-60h]
std::string __dst; // [rsp+18h] [rbp-58h] BYREF
std::string __str; // [rsp+30h] [rbp-40h] BYREF
v3 = (*(__int64 (__fastcall **)(_QWORD *))(*a2 + 64LL))(a2);
if ( v3 == 1 )
{
v6 = *(_QWORD *)(a1 + 472);
CCTextInputNode::getString(&__str, (__int64)a2);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
data = __str.__r_.__value_.__l.__data_;
else
data = __str.__r_.__value_.__s.__data_;
v8 = strlen(data);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v9 = v8;
if ( v8 >= 0x17 )
{
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v10;
__dst.__r_.__value_.__r.__words[0] = v11 | 1;
__dst.__r_.__value_.__l.__size_ = v9;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v8);
v10 = __dst.__r_.__value_.__s.__data_;
if ( !v8 )
goto LABEL_17;
}
memmove(v10, data, v9);
LABEL_17:
v10[v9] = 0;
std::string::operator=((std::string *)(v6 + 344), &__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_24;
v12 = __dst.__r_.__value_.__l.__data_;
goto LABEL_23;
}
if ( v3 != 2 )
return;
CCTextInputNode::getString(&__str, (__int64)a2);
v4 = EmoteSprite::maxEmotesComment();
v5 = (std::string *)(a1 + 560);
if ( (int)EmoteSprite::effectiveLength(&__str, v4) < 181 )
{
std::string::operator=(v5, &__str);
goto LABEL_24;
}
if ( (*(_BYTE *)&v5->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v13, *(const void **)(a1 + 576), *(_QWORD *)(a1 + 568));
}
else
{
__p = *(void **)(a1 + 576);
v13 = *(_OWORD *)&v5->__r_.__value_.__l.0;
}
CCTextInputNode::setString(a2, (__int64)&v13);
if ( (v13 & 1) == 0 )
goto LABEL_24;
v12 = __p;
LABEL_23:
operator delete(v12);
LABEL_24:
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}