//
// sub_1002F22C0 from 0x1002f22c0 to 0x1002f2488 (456 bytes)
//
// 14 xrefs:
// > GameObject::addGlow @ 0x1002f21d8
// > sub_1002F2620 @ 0x1002f268c
// > sub_1002F2620 @ 0x1002f27f8
// > sub_1002F2620 @ 0x1002f2840
// > sub_1002F2620 @ 0x1002f28e8
// > sub_1002F2620 @ 0x1002f2940
// > sub_1002F2620 @ 0x1002f2b84
// > sub_1002F2D3C @ 0x1002f2d78
// > sub_1002F2DF0 @ 0x1002f2e2c
// > GameObject::playShineEffect @ 0x1002f9784
// > GameObject::playShineEffect @ 0x1002f9d5c
// > GameObject::playShineEffect @ 0x1002f9d9c
// > GameObject::playShineEffect @ 0x1002f9ddc
// > GameObject::playShineEffect @ 0x1002f9e1c
//
// 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:02:56 +0000
//
void __usercall sub_1002F22C0(std::string *__return_ptr a1@, char *__s@, char *a3@, char *a4@)
{
std::string::size_type v7; // x20
unsigned __int64 size; // x8
std::string *v9; // x27
std::string::size_type v10; // x26
unsigned __int64 v11; // x24
std::string::size_type v12; // x28
void **v13; // x21
signed __int64 v14; // x22
signed __int64 v15; // x9
char *v16; // x25
char *v17; // x0
int v18; // w20
char *v19; // x0
char *v20; // x23
std::string::size_type v21; // x2
const std::string::value_type *p_p; // x3
std::string::size_type v23; // x4
std::string::size_type v24; // x8
void *__p; // [xsp+0h] [xbp-80h] BYREF
std::string::size_type v26; // [xsp+8h] [xbp-78h]
unsigned __int8 v27; // [xsp+17h] [xbp-69h]
void *v28; // [xsp+18h] [xbp-68h] BYREF
signed __int64 v29; // [xsp+20h] [xbp-60h]
char v30; // [xsp+2Fh] [xbp-51h]
sub_100009900(a1, __s);
sub_100009900(&v28, a3);
sub_100009900(&__p, a4);
v7 = 0;
size = HIBYTE(a1->__r_.__value_.__r.__words[2]);
if ( (size & 0x80u) == 0LL )
v9 = a1;
else
v9 = (std::string *)a1->__r_.__value_.__r.__words[0];
if ( (size & 0x80u) != 0LL )
size = a1->__r_.__value_.__l.__size_;
v10 = v30;
v11 = (unsigned __int64)v30 >> 63;
v12 = v29;
if ( v30 >= 0 )
v13 = &v28;
else
v13 = (void **)v28;
if ( v30 >= 0 )
v14 = v30;
else
v14 = v29;
while ( !v14 )
{
LABEL_22:
if ( v7 != -1 )
{
if ( (v11 & 1) != 0 )
v21 = v12;
else
v21 = v10;
if ( (v27 & 0x80u) == 0 )
p_p = (const std::string::value_type *)&__p;
else
p_p = (const std::string::value_type *)__p;
if ( (v27 & 0x80u) == 0 )
v23 = v27;
else
v23 = v26;
std::string::replace(a1, v7, v21, p_p, v23);
v24 = v27;
if ( (v27 & 0x80u) != 0 )
v24 = v26;
v7 += v24;
size = HIBYTE(a1->__r_.__value_.__r.__words[2]);
if ( (size & 0x80u) == 0LL )
v9 = a1;
else
v9 = (std::string *)a1->__r_.__value_.__r.__words[0];
if ( (size & 0x80u) != 0LL )
size = a1->__r_.__value_.__l.__size_;
v10 = v30;
v11 = (unsigned __int64)v30 >> 63;
v12 = v29;
v13 = v30 >= 0 ? &v28 : (void **)v28;
v14 = v30 >= 0 ? v30 : v29;
if ( size >= v7 )
continue;
}
goto LABEL_46;
}
v15 = size - v7;
if ( (__int64)(size - v7) >= v14 )
{
v16 = (char *)v9 + size;
v17 = (char *)v9 + v7;
v18 = *(char *)v13;
do
{
if ( v15 - v14 == -1 )
break;
v19 = (char *)memchr(v17, v18, v15 - v14 + 1);
if ( !v19 )
break;
v20 = v19;
if ( !memcmp(v19, v13, v14) )
{
if ( v20 == v16 )
break;
v7 = v20 - (char *)v9;
goto LABEL_22;
}
v17 = v20 + 1;
v15 = v16 - (v20 + 1);
}
while ( v15 >= v14 );
}
LABEL_46:
if ( ((char)v27 & 0x80000000) == 0 )
{
if ( (v10 & 0x80) == 0 )
return;
LABEL_50:
operator delete(v28);
return;
}
operator delete(__p);
if ( v30 < 0 )
goto LABEL_50;
}