//
// EditLevelLayer::textInputClosed from 0x1001dfca0 to 0x1001dff3f (671 bytes)
//
// 2 xrefs:
// > sub_1001DFFF0 @ 0x1001dfffc
// > ??> @ 0x100ade988
//
// 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::textInputClosed(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 v3; // r14
__int64 v4; // rbx
__int64 v5; // rdx
__int64 v6; // rax
__int64 v7; // rbx
std::string::pointer data; // rdi
char *v9; // r14
size_t v10; // rax
std::string::size_type v11; // r15
char *v12; // r12
size_t v13; // r13
std::string __str; // [rsp+0h] [rbp-E0h] BYREF
char *v15[2]; // [rsp+18h] [rbp-C8h] BYREF
char *__s; // [rsp+28h] [rbp-B8h]
std::string v17; // [rsp+30h] [rbp-B0h] BYREF
__int128 v18; // [rsp+50h] [rbp-90h] BYREF
char *v19; // [rsp+60h] [rbp-80h]
std::string v20; // [rsp+70h] [rbp-70h] BYREF
std::string __dst; // [rsp+88h] [rbp-58h] BYREF
__int128 v22; // [rsp+A0h] [rbp-40h] BYREF
void *v23; // [rsp+B0h] [rbp-30h]
v2 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
switch ( v2 )
{
case 3:
CCTextInputNode::getString(&v22, a2);
GameManager::sharedState(&v22, a2, v5);
v7 = v6;
if ( (v22 & 1) != 0 )
{
sub_10001AD30(&v20, v23, *((unsigned __int64 *)&v22 + 1));
}
else
{
v20.__r_.__value_.__r.__words[2] = (std::string::size_type)v23;
*(_OWORD *)&v20.__r_.__value_.__l.0 = v22;
}
std::string::operator=((std::string *)(v7 + 632), &v20);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_37;
data = v20.__r_.__value_.__l.__data_;
break;
case 2:
CCTextInputNode::getString(&v22, a2);
v4 = *(_QWORD *)(a1 + 472);
if ( (v22 & 1) != 0 )
{
sub_10001AD30(&v18, v23, *((unsigned __int64 *)&v22 + 1));
}
else
{
v19 = (char *)v23;
v18 = v22;
}
LevelTools::base64EncodeString(&__str, &v18);
std::string::operator=((std::string *)(v4 + 368), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (v18 & 1) == 0 )
goto LABEL_37;
data = v19;
break;
case 1:
CCTextInputNode::getString(&v22, a2);
v3 = *(_QWORD *)(a1 + 472);
if ( (v22 & 1) != 0 )
{
sub_10001AD30(&v17, v23, *((unsigned __int64 *)&v22 + 1));
}
else
{
v17.__r_.__value_.__r.__words[2] = (std::string::size_type)v23;
*(_OWORD *)&v17.__r_.__value_.__l.0 = v22;
}
std::string::operator=((std::string *)(v3 + 344), &v17);
if ( (*(_BYTE *)&v17.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v17.__r_.__value_.__l.__data_);
CCTextInputNode::getString(v15, a2);
if ( ((__int64)v15[0] & 1) != 0 )
v9 = __s;
else
v9 = (char *)v15 + 1;
v10 = strlen(v9);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v12;
__dst.__r_.__value_.__r.__words[0] = v13 | 1;
__dst.__r_.__value_.__l.__size_ = v11;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v10);
v12 = __dst.__r_.__value_.__s.__data_;
if ( !v10 )
goto LABEL_32;
}
memmove(v12, v9, v11);
LABEL_32:
v12[v11] = 0;
CCTextInputNode::updateLabel(a2, &__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( ((__int64)v15[0] & 1) == 0 )
goto LABEL_37;
data = __s;
break;
default:
return;
}
operator delete(data);
LABEL_37:
if ( (v22 & 1) != 0 )
operator delete(v23);
}