//
// cocos2d::CCParticleSystemQuad::initTexCoordsWithRect from 0x1002537ec to 0x10025393c (336 bytes)
//
// 2 xrefs:
// > cocos2d::CCParticleSystemQuad::setTextureWithRect @ 0x1002539ac
// > cocos2d::CCParticleSystemQuad::setTotalParticles @ 0x100253fe4
//
// 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 *a1,
const cocos2d::CCRect *a2)
{
float x; // s8
cocos2d::CCDirector *v5; // x0
float v6; // s8
float y; // s9
cocos2d::CCDirector *v8; // x0
float v9; // s9
float width; // s10
cocos2d::CCDirector *v11; // x0
float v12; // s10
float height; // s11
cocos2d::CCDirector *v14; // x0
float v15; // s0
cocos2d::CCTexture2D *m_pTexture; // x0
unsigned int v17; // w20
float32x2_t size; // d8
float32x2_t v19; // d9
float32x2_t v20; // d10
cocos2d::CCParticleBatchNode *m_pBatchNode; // x8
cocos2d::ccV3F_C4B_T2F_Quad *m_pQuads; // x0
unsigned int m_uTotalParticles; // w9
float32x2_t v24; // d0
float32x2_t v25; // d1
unsigned __int64 v26; // x9
__int64 p_v; // x8
float32x2_t v28[2]; // [xsp+0h] [xbp-40h] BYREF
sub_100022BB0(&a1->m_tTextureRect.origin.y, (__int64)a2);
x = a2->origin.x;
v5 = cocos2d::CCDirector::sharedDirector();
v6 = x * sub_1001765E4((__int64)v5);
y = a2->origin.y;
v8 = cocos2d::CCDirector::sharedDirector();
v9 = y * sub_1001765E4((__int64)v8);
width = a2->size.width;
v11 = cocos2d::CCDirector::sharedDirector();
v12 = width * sub_1001765E4((__int64)v11);
height = a2->size.height;
v14 = cocos2d::CCDirector::sharedDirector();
v15 = sub_1001765E4((__int64)v14);
sub_100022990((float *)v28, v6, v9, v12, height * v15);
m_pTexture = a1->m_pTexture;
if ( m_pTexture )
{
v17 = ((__int64 (__fastcall *)(cocos2d::CCTexture2D *))m_pTexture->getPixelsWide)(m_pTexture);
size = vcvt_f32_u32((uint32x2_t)__PAIR64__(
((__int64 (__fastcall *)(cocos2d::CCTexture2D *))a1->m_pTexture->getPixelsHigh)(a1->m_pTexture),
v17));
}
else
{
size = (float32x2_t)a2->size;
}
v19 = v28[0];
v20 = v28[1];
m_pBatchNode = a1->m_pBatchNode;
if ( m_pBatchNode )
{
m_pQuads = (cocos2d::ccV3F_C4B_T2F_Quad *)((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))m_pBatchNode->m_pTextureAtlas->getQuads)(m_pBatchNode->m_pTextureAtlas);
LODWORD(m_pBatchNode) = a1->m_uAtlasIndex;
m_uTotalParticles = a1->m_uTotalParticles + (_DWORD)m_pBatchNode;
}
else
{
m_pQuads = a1->m_pQuads;
m_uTotalParticles = a1->m_uTotalParticles;
}
if ( (unsigned int)m_pBatchNode < m_uTotalParticles )
{
v24 = vdiv_f32(v19, size);
v25 = vadd_f32(v24, vdiv_f32(v20, size));
v26 = m_uTotalParticles - (unsigned __int64)(unsigned int)m_pBatchNode;
p_v = (__int64)&m_pQuads[(unsigned int)m_pBatchNode].bl.texCoords.v;
do
{
*(_DWORD *)(p_v - 4) = v24.i32[0];
*(_DWORD *)p_v = v25.i32[1];
*(float32x2_t *)(p_v + 44) = v25;
*(float32x2_t *)(p_v - 28) = v24;
*(_DWORD *)(p_v + 20) = v25.i32[0];
*(_DWORD *)(p_v + 24) = v24.i32[1];
p_v += 96;
--v26;
}
while ( v26 );
}
}