//
// sub_100403E28 from 0x100403e28 to 0x1004041f8 (976 bytes)
//
// 1 xrefs:
// > sub_10005863C @ 0x10005866c
//
// 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 11:04:40 +0000
//
void __fastcall sub_100403E28(__int64 a1, __int64 a2, double a3)
{
__int64 v5; // x0
__int64 v6; // x22
_QWORD *v7; // x21
unsigned int i; // w23
_DWORD *v9; // x24
int v10; // w10
int v11; // w11
int v12; // w12
int v13; // w13
std::string *p_str; // x14
std::string::value_type v15; // w15
int v16; // w15
int v17; // w16
std::string::size_type v18; // x2
std::string *v19; // x8
std::string::value_type v20; // w8
std::string::size_type v21; // x3
char v22; // w8
std::string *v23; // x9
double *v24; // x0
__int64 v25; // x24
__n128 v26; // q0
__int64 *Object; // x24
__int64 v28; // x0
__int64 v29; // x0
float32x2_t *v30; // x25
float32x2_t *v31; // x0
__int64 v32; // x25
__int64 v33; // x0
float32x2_t v34; // [xsp+0h] [xbp-D0h] BYREF
__int64 v35; // [xsp+8h] [xbp-C8h] BYREF
std::string __p; // [xsp+10h] [xbp-C0h] BYREF
__int64 v37; // [xsp+30h] [xbp-A0h] BYREF
float32x2_t v38; // [xsp+38h] [xbp-98h] BYREF
float32x2_t __a; // [xsp+40h] [xbp-90h] BYREF
std::string v40; // [xsp+48h] [xbp-88h] BYREF
std::string __str; // [xsp+60h] [xbp-70h] BYREF
if ( !a2 || *(_DWORD *)(a2 + 1028) != 914 )
return;
v5 = *(_QWORD *)(a1 + 14248);
if ( v5 )
EditorUI::deselectAll(v5, a3);
LevelEditorLayer::removeObject(a1, a2, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 2728) + 456LL))(*(_QWORD *)(a1 + 2728), a2);
if ( *(char *)(a2 + 1375) < 0 )
sub_1000097D0(&__str, *(void **)(a2 + 1352), *(_QWORD *)(a2 + 1360));
else
__str = *(std::string *)(a2 + 1352);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 488LL))(a2);
v7 = sub_1002E736C();
for ( i = 0; i < (unsigned int)sub_1002E757C(v6); ++i )
{
v9 = (_DWORD *)sub_1002E75A0(v6, i);
v10 = v9[160];
if ( v10 >= 1 )
{
v11 = 0;
v12 = 0;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
else
v13 = __str.__r_.__value_.__r.__words[1];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
while ( 1 )
{
if ( v11 >= v13 )
{
LABEL_27:
v18 = v11;
goto LABEL_29;
}
v15 = p_str->__r_.__value_.__s.__data_[v11];
if ( (v15 & 0xE0) == 0xC0 )
break;
if ( (v15 & 0xF0) == 0xE0 )
{
v16 = 3;
goto LABEL_25;
}
if ( (v15 & 0xF8) != 0xF0 )
{
v16 = 1;
goto LABEL_25;
}
v17 = 2;
v16 = 4;
LABEL_26:
v12 += v17;
v11 += v16;
if ( v12 >= v10 )
goto LABEL_27;
}
v16 = 2;
LABEL_25:
v17 = 1;
goto LABEL_26;
}
v18 = 0;
LABEL_29:
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v19 = &__str;
else
v19 = (std::string *)__str.__r_.__value_.__r.__words[0];
v20 = v19->__r_.__value_.__s.__data_[v18];
if ( (v20 & 0xE0) == 0xC0 )
{
v21 = 2;
}
else if ( (v20 & 0xF0) == 0xE0 )
{
v21 = 3;
}
else if ( (v20 & 0xF8) == 0xF0 )
{
v21 = 4;
}
else
{
v21 = 1;
}
std::string::basic_string(&v40, &__str, v18, v21, (std::allocator *)&__a);
v22 = HIBYTE(v40.__r_.__value_.__r.__words[2]);
if ( SHIBYTE(v40.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v40.__r_.__value_.__l.__size_ == 1 )
{
v23 = (std::string *)v40.__r_.__value_.__r.__words[0];
LABEL_44:
if ( v23->__r_.__value_.__s.__data_[0] == 32 )
goto LABEL_51;
}
}
else if ( SHIBYTE(v40.__r_.__value_.__r.__words[2]) == 1 )
{
v23 = &v40;
goto LABEL_44;
}
v24 = (double *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v9 + 192LL))(v9);
sub_1000262F4(&__a, v24);
v25 = *(_QWORD *)(a1 + 2728);
cocos2d::CCNode::convertToWorldSpace(a2, (__int64)&__a, &v37);
cocos2d::CCNode::convertToNodeSpace(v25, (__int64)&v37, &v38);
Object = LevelEditorLayer::createObject(a1, 914, (double *)&v38, 0, v26);
sub_1002FF24C((__int64)Object, a2);
if ( SHIBYTE(v40.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__p, v40.__r_.__value_.__l.__data_, v40.__r_.__value_.__l.__size_);
else
__p = v40;
TextGameObject::updateTextObject((__int64)Object, &__p, 0);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
*((_BYTE *)Object + 1149) = 1;
v28 = (*(__int64 (__fastcall **)(__int64 *))(*Object + 488))(Object);
v29 = sub_1002E75A0(v28, 0);
v30 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 192LL))(v29);
v31 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64 *))(*Object + 312))(Object);
sub_10002632C(v30, v31, &v38);
v32 = *(_QWORD *)(a1 + 2728);
sub_10002632C(&__a, &v38, &v34);
cocos2d::CCNode::convertToWorldSpace(a2, (__int64)&v34, &v35);
cocos2d::CCNode::convertToNodeSpace(v32, (__int64)&v35, &v37);
(*(void (__fastcall **)(__int64 *, __int64 *))(*Object + 1368))(Object, &v37);
GJBaseGameLayer::reorderObjectSection(a1, (__int64)Object);
sub_1002E74E0((__int64)v7);
v22 = HIBYTE(v40.__r_.__value_.__r.__words[2]);
LABEL_51:
if ( v22 < 0 )
operator delete(v40.__r_.__value_.__l.__data_);
}
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 528LL))(a2, 0);
v33 = *(_QWORD *)(a1 + 14248);
if ( v33 )
EditorUI::selectObjects(v33, (__int64)v7, 1);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}