//
// AnimatedGameObject::displayFrameChanged from 0x100384a64 to 0x100384cb8 (596 bytes)
//
// 2 xrefs:
// > j_AnimatedGameObject::displayFrameChanged @ 0x100384d1c
// > ??> @ 0x1007f5830
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall AnimatedGameObject::displayFrameChanged(__int64 a1, CCSpritePlus *a2, char *a3)
{
CCSpritePlus *Follower; // x19
std::string::size_type v5; // x20
std::string::size_type size; // x8
std::string *p_p; // x28
std::string::size_type v8; // x27
unsigned __int64 v9; // x25
std::string::size_type v10; // x24
void **v11; // x21
signed __int64 v12; // x22
signed __int64 v13; // x9
char *v14; // x26
char *v15; // x0
int v16; // w20
char *v17; // x0
char *v18; // x23
std::string::size_type v19; // x2
const std::string::value_type *v20; // x3
std::string::size_type v21; // x4
std::string::size_type v22; // x8
std::string *v23; // x1
cocos2d::CCSpriteFrameCache *v24; // x0
void **v25; // x1
cocos2d::CCSpriteFrame *v26; // x0
std::string __p; // [xsp+0h] [xbp-B0h] BYREF
void *v28[2]; // [xsp+18h] [xbp-98h] BYREF
char v29; // [xsp+2Fh] [xbp-81h]
void *v30; // [xsp+30h] [xbp-80h] BYREF
std::string::size_type v31; // [xsp+38h] [xbp-78h]
unsigned __int8 v32; // [xsp+47h] [xbp-69h]
void *v33; // [xsp+48h] [xbp-68h] BYREF
signed __int64 v34; // [xsp+50h] [xbp-60h]
char v35; // [xsp+5Fh] [xbp-51h]
Follower = CCSpritePlus::getFollower(a2);
if ( a3[23] < 0 )
a3 = *(char **)a3;
sub_100009900(&__p, a3);
sub_100009900(&v33, "_001.png");
sub_100009900(&v30, "_glow_001.png");
v5 = 0;
size = HIBYTE(__p.__r_.__value_.__r.__words[2]);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __p.__r_.__value_.__l.__size_;
v8 = v35;
v9 = (unsigned __int64)v35 >> 63;
v10 = v34;
if ( v35 >= 0 )
v11 = &v33;
else
v11 = (void **)v33;
if ( v35 >= 0 )
v12 = v35;
else
v12 = v34;
while ( !v12 )
{
LABEL_24:
if ( v5 != -1 )
{
if ( (v9 & 1) != 0 )
v19 = v10;
else
v19 = v8;
if ( (v32 & 0x80u) == 0 )
v20 = (const std::string::value_type *)&v30;
else
v20 = (const std::string::value_type *)v30;
if ( (v32 & 0x80u) == 0 )
v21 = v32;
else
v21 = v31;
std::string::replace(&__p, v5, v19, v20, v21);
v22 = v32;
if ( (v32 & 0x80u) != 0 )
v22 = v31;
v5 += v22;
size = HIBYTE(__p.__r_.__value_.__r.__words[2]);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __p.__r_.__value_.__l.__size_;
v8 = v35;
v9 = (unsigned __int64)v35 >> 63;
v10 = v34;
v11 = v35 >= 0 ? &v33 : (void **)v33;
v12 = v35 >= 0 ? v35 : v34;
if ( size >= v5 )
continue;
}
goto LABEL_48;
}
v13 = size - v5;
if ( (__int64)(size - v5) >= v12 )
{
v14 = (char *)p_p + size;
v15 = (char *)p_p + v5;
v16 = *(char *)v11;
do
{
if ( v13 - v12 == -1 )
break;
v17 = (char *)memchr(v15, v16, v13 - v12 + 1);
if ( !v17 )
break;
v18 = v17;
if ( !memcmp(v17, v11, v12) )
{
if ( v18 == v14 )
break;
v5 = v18 - (char *)p_p;
goto LABEL_24;
}
v15 = v18 + 1;
v13 = v14 - (v18 + 1);
}
while ( v13 >= v12 );
}
LABEL_48:
if ( (char)v32 < 0 )
{
operator delete(v30);
if ( (v35 & 0x80) == 0 )
goto LABEL_50;
}
else if ( (v8 & 0x80) == 0 )
{
goto LABEL_50;
}
operator delete(v33);
LABEL_50:
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &__p;
else
v23 = (std::string *)__p.__r_.__value_.__r.__words[0];
sub_100009900(v28, (char *)v23);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v24 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v29 >= 0 )
v25 = v28;
else
v25 = (void **)v28[0];
v26 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v24, (const char *)v25);
((void (__fastcall *)(CCSpritePlus *, cocos2d::CCSpriteFrame *))Follower->setDisplayFrame)(Follower, v26);
if ( v29 < 0 )
operator delete(v28[0]);
}