//
// cocos2d::CCParticleSystemQuad::initTexCoordsWithRect from 0x18006a830 to 0x18006aa0c (476 bytes)
//
// 5 xrefs:
// > cocos2d::CCParticleSystemQuad::setTextureWithRect @ 0x18006ad48
// > cocos2d::CCParticleSystemQuad::setTotalParticles @ 0x18006ae92
// > cocos2d::CCParticleSystemQuad::updateTexCoords @ 0x18006b3f1
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3ce4
//
// 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::CCParticleSystemQuad::initTexCoordsWithRect(
cocos2d::CCParticleSystemQuad *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 ContentScaleFactor; // xmm0_4
cocos2d::CCTexture2D *m_pTexture; // rcx
float width; // xmm9_4
float height; // xmm1_4
cocos2d::CCParticleBatchNode *m_pBatchNode; // rcx
float v16; // xmm8_4
float v17; // xmm7_4
float v18; // xmm9_4
float v19; // xmm7_4
float v20; // xmm6_4
cocos2d::ccV3F_C4B_T2F_Quad *m_pQuads; // r9
unsigned int m_uAtlasIndex; // r8d
unsigned int m_uTotalParticles; // edx
float *p_v; // rax
__int64 v25; // rcx
cocos2d::CCRect v26; // [rsp+30h] [rbp-58h] BYREF
cocos2d::CCRect::operator=((float *)&this->m_tTextureRect.origin, (float *)&a2->origin);
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();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v10);
cocos2d::CCRect::CCRect(&v26, ContentScaleFactor * a2->origin.x, v9, v7, v5);
m_pTexture = this->m_pTexture;
width = a2->size.width;
height = a2->size.height;
if ( m_pTexture )
{
width = (float)((int (__fastcall *)(cocos2d::CCTexture2D *))m_pTexture->getPixelsWide)(m_pTexture);
height = (float)((int (__fastcall *)(cocos2d::CCTexture2D *))this->m_pTexture->getPixelsHigh)(this->m_pTexture);
}
m_pBatchNode = this->m_pBatchNode;
v16 = v26.origin.x / width;
v17 = v26.size.width / width;
v18 = v26.origin.y / height;
v19 = v17 + v16;
v20 = (float)(v26.origin.y / height) + (float)(v26.size.height / height);
if ( m_pBatchNode )
{
m_pQuads = (cocos2d::ccV3F_C4B_T2F_Quad *)((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))m_pBatchNode->m_pTextureAtlas->getQuads)(m_pBatchNode->m_pTextureAtlas);
m_uAtlasIndex = this->m_uAtlasIndex;
m_uTotalParticles = m_uAtlasIndex + this->m_uTotalParticles;
}
else
{
m_pQuads = this->m_pQuads;
m_uAtlasIndex = 0;
m_uTotalParticles = this->m_uTotalParticles;
}
if ( m_uAtlasIndex < m_uTotalParticles )
{
p_v = &m_pQuads[m_uAtlasIndex].bl.texCoords.v;
v25 = m_uTotalParticles - m_uAtlasIndex;
do
{
*(p_v - 1) = v16;
*p_v = v20;
p_v[11] = v19;
p_v[12] = v20;
*(p_v - 7) = v16;
*(p_v - 6) = v18;
p_v[5] = v19;
p_v[6] = v18;
p_v += 24;
--v25;
}
while ( v25 );
}
}