//
// cocos2d::CCSprite::setTextureCoords from 0x18008cbd0 to 0x18008cdef (543 bytes)
//
// 7 xrefs:
// > ??> @ 0x1800ebc90
// > ??> @ 0x1800ec168
// > ??> @ 0x1800ecce8
// > ??> @ 0x180103ba0
// > ??> @ 0x180106b98
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5e38
//
// 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 cocos2d::CCSprite::setTextureCoords(cocos2d::CCSprite *this, const struct cocos2d::CCRect *a2)
{
cocos2d::CCDirector *v4; // rax
float v5; // xmm8_4
cocos2d::CCDirector *v6; // rax
float v7; // xmm7_4
cocos2d::CCDirector *v8; // rax
float v9; // xmm6_4
cocos2d::CCDirector *v10; // rax
float v11; // xmm0_4
cocos2d::CCTexture2D *m_pobTexture; // rbx
float v13; // xmm6_4
int v14; // eax
float v15; // xmm3_4
float v16; // xmm5_4
bool m_bFlipX; // al
float v18; // xmm4_4
float v19; // xmm1_4
float v20; // xmm2_4
GLfloat v21; // xmm0_4
GLfloat v22; // xmm5_4
GLfloat v23; // xmm6_4
GLfloat v24; // xmm7_4
cocos2d::CCRect v25; // [rsp+30h] [rbp-48h] BYREF
v4 = cocos2d::CCDirector::sharedDirector();
v5 = cocos2d::CCDirector::getContentScaleFactor(v4) * a2->size.height;
v6 = cocos2d::CCDirector::sharedDirector();
v7 = cocos2d::CCDirector::getContentScaleFactor(v6) * a2->size.width;
v8 = cocos2d::CCDirector::sharedDirector();
v9 = cocos2d::CCDirector::getContentScaleFactor(v8) * a2->origin.y;
v10 = cocos2d::CCDirector::sharedDirector();
v11 = cocos2d::CCDirector::getContentScaleFactor(v10) * a2->origin.x;
cocos2d::CCRect::CCRect(&v25, v11, v9, v7, v5);
if ( this->m_pobBatchNode )
m_pobTexture = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pobTextureAtlas->getTexture)(this->m_pobTextureAtlas);
else
m_pobTexture = this->m_pobTexture;
if ( m_pobTexture )
{
v13 = (float)((int (__fastcall *)(cocos2d::CCTexture2D *))m_pobTexture->getPixelsWide)(m_pobTexture);
v14 = ((__int64 (__fastcall *)(cocos2d::CCTexture2D *))m_pobTexture->getPixelsHigh)(m_pobTexture);
v15 = v25.origin.x / v13;
v16 = (float)v14;
m_bFlipX = this->m_bFlipX;
if ( this->m_bRectRotated )
{
v18 = v25.origin.y / v16;
v19 = (float)(v25.size.width + v25.origin.y) / v16;
v20 = (float)(v25.size.height + v25.origin.x) / v13;
if ( m_bFlipX )
{
v18 = (float)(v25.size.width + v25.origin.y) / v16;
v19 = v25.origin.y / v16;
}
if ( this->m_bFlipY )
{
v15 = (float)(v25.size.height + v25.origin.x) / v13;
v20 = v25.origin.x / v13;
}
v21 = v19;
v22 = v20;
v23 = v15;
v24 = v18;
}
else
{
v18 = v25.origin.y / v16;
v19 = (float)(v25.origin.y + v25.size.height) / v16;
v20 = (float)(v25.size.width + v25.origin.x) / v13;
if ( m_bFlipX )
{
v15 = (float)(v25.size.width + v25.origin.x) / v13;
v20 = v25.origin.x / v13;
}
if ( this->m_bFlipY )
{
v18 = (float)(v25.origin.y + v25.size.height) / v16;
v19 = v25.origin.y / v16;
}
v21 = v18;
v22 = v15;
v23 = v20;
v24 = v19;
}
this->m_sQuad.bl.texCoords.u = v15;
this->m_sQuad.bl.texCoords.v = v24;
this->m_sQuad.br.texCoords.u = v23;
this->m_sQuad.br.texCoords.v = v19;
this->m_sQuad.tl.texCoords.u = v22;
this->m_sQuad.tl.texCoords.v = v18;
this->m_sQuad.tr.texCoords.u = v20;
this->m_sQuad.tr.texCoords.v = v21;
this->m_fTextureLeft = v15;
this->m_fTextureRight = v20;
this->m_fTextureBottom = v19;
this->m_fTextureTop = v18;
}
}