//
// cocos2d::CCSprite::setTexture from 0x18008fc80 to 0x18008fdca (330 bytes)
//
// 7 xrefs:
// > ??> @ 0x1800f1e48
// > ??> @ 0x1800f2330
// > ??> @ 0x1800f2ee0
// > ??> @ 0x18010a320
// > ??> @ 0x18010d368
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c00e4
//
// 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 11:22:07 +0000
//
// 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 + 3);
if ( v4 )
{
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v4 + 320) + 16LL))(v4 + 320);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v5 + 96LL))(v5);
(*(void (__fastcall **)(struct cocos2d::CCTexture2D *))(*(_QWORD *)a2 + 96LL))(a2);
}
if ( !a2 )
{
v6 = cocos2d::CCTextureCache::sharedTextureCache();
a2 = cocos2d::CCTextureCache::textureForKey(v6, "cc_2x2_white_image");
if ( !a2 )
{
v7 = (cocos2d::CCImage *)sub_1800E4AC0(0x50u);
v8 = v7 ? cocos2d::CCImage::CCImage(v7) : nullptr;
cocos2d::CCImage::initWithImageData(v8, byte_1801AD080, 16, 4, 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 + 3) && *((struct cocos2d::CCTexture2D **)this + 9) != a2 )
{
if ( a2 )
cocos2d::CCObject::retain(a2);
v10 = *((cocos2d::CCObject **)this + 9);
if ( v10 )
cocos2d::CCObject::release(v10);
*((_QWORD *)this + 9) = a2;
(*(void (__fastcall **)(char *))(*((_QWORD *)this - 43) + 1064LL))((char *)this - 344);
}
}