//
// cocos2d::CCSprite::setTexture from 0x18008ca80 to 0x18008cbb4 (308 bytes)
//
// 7 xrefs:
// > ??> @ 0x1800ebd48
// > ??> @ 0x1800ec220
// > ??> @ 0x1800ecda0
// > ??> @ 0x180103c58
// > ??> @ 0x180106c80
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5e2c
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCSprite::setTexture(cocos2d::CCSprite *this, struct cocos2d::CCTexture2D *a2)
{
__int64 v4; // rcx
__int64 v5; // rax
cocos2d::CCTextureCache *v6; // rax
cocos2d::CCImage *v7; // rax
cocos2d::CCImage *v8; // rsi
cocos2d::CCTextureCache *v9; // rax
cocos2d::CCObject *v10; // rcx
v4 = *(_QWORD *)&this->m_uAutoReleaseCount;
if ( v4 )
{
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v4 + 320) + 16LL))(v4 + 320);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v5 + 96LL))(v5);
((void (__fastcall *)(struct cocos2d::CCTexture2D *))a2->getName)(a2);
}
if ( !a2 )
{
v6 = cocos2d::CCTextureCache::sharedTextureCache();
a2 = cocos2d::CCTextureCache::textureForKey(v6, "cc_2x2_white_image");
if ( !a2 )
{
v7 = (cocos2d::CCImage *)operator new(0x50u);
v8 = v7 ? cocos2d::CCImage::CCImage(v7) : nullptr;
cocos2d::CCImage::initWithImageData(v8, byte_1801A30B0, 16, kFmtRawData, 2, 2, 8);
v9 = cocos2d::CCTextureCache::sharedTextureCache();
a2 = cocos2d::CCTextureCache::addUIImage(v9, v8, "cc_2x2_white_image");
if ( v8 )
cocos2d::CCObject::release(v8);
}
}
if ( !*(_QWORD *)&this->m_uAutoReleaseCount && *(struct cocos2d::CCTexture2D **)&this->m_fVertexZ != a2 )
{
if ( a2 )
cocos2d::CCObject::retain(a2);
v10 = *(cocos2d::CCObject **)&this->m_fVertexZ;
if ( v10 )
cocos2d::CCObject::release(v10);
*(_QWORD *)&this->m_fVertexZ = a2;
(*(void (__fastcall **)(char *))(*((_QWORD *)this - 43) + 1048LL))((char *)this - 344);
}
}