//
// cocos2d::CCAtlasNode::initWithTexture from 0x100316270 to 0x10031640c (412 bytes)
//
// 6 xrefs:
// > cocos2d::CCAtlasNode::create @ 0x1003161c4
// > cocos2d::CCAtlasNode::initWithTileFile @ 0x10031625c
// > cocos2d::CCLabelAtlas::create @ 0x1008799dc
// > cocos2d::CCLabelAtlas::initWithString_1 @ 0x100879a8d
// > cocos2d::CCLabelAtlas::initWithString @ 0x100879b08
// > cocos2d::CCLabelAtlas::initWithString_2 @ 0x100879fe5
//
// 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 12:28:40 +0000
//
bool __fastcall cocos2d::CCAtlasNode::initWithTexture(_DWORD *a1, __int64 a2, int a3, int a4, unsigned int a5)
{
void *v6; // r12
__int64 v7; // r14
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
_QWORD *ContentSizeInPixels; // rax
__m128d si128; // xmm2
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
_QWORD v18[5]; // [rsp+8h] [rbp-28h] BYREF
a1[90] = a3;
a1[91] = a4;
*((_WORD *)a1 + 184) = -1;
*((_BYTE *)a1 + 370) = -1;
*((_BYTE *)a1 + 384) = 1;
*(_QWORD *)(a1 + 97) = 0x30300000001LL;
v6 = operator new(0x70u);
cocos2d::CCTextureAtlas::CCTextureAtlas(v6);
*((_QWORD *)a1 + 47) = v6;
cocos2d::CCTextureAtlas::initWithTexture(v6, a2, a5);
v7 = *((_QWORD *)a1 + 47);
if ( v7 )
{
v8 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v7 + 96LL))(*((_QWORD *)a1 + 47));
if ( !(unsigned __int8)cocos2d::CCTexture2D::hasPremultipliedAlpha(v8) )
*(_QWORD *)(a1 + 97) = 0x30300000302LL;
v9 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)a1 + 47) + 96LL))(*((_QWORD *)a1 + 47));
*((_BYTE *)a1 + 384) = cocos2d::CCTexture2D::hasPremultipliedAlpha(v9);
v10 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)a1 + 47) + 96LL))(*((_QWORD *)a1 + 47));
(*(void (__fastcall **)(_QWORD *, __int64))(*(_QWORD *)v10 + 144LL))(v18, v10);
if ( *((_BYTE *)a1 + 404) == 1 )
{
v11 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)a1 + 47) + 96LL))(*((_QWORD *)a1 + 47));
ContentSizeInPixels = (_QWORD *)cocos2d::CCTexture2D::getContentSizeInPixels(v11);
sub_100278660(v18, ContentSizeInPixels);
}
si128 = (__m128d)_mm_load_si128((const __m128i *)&xmmword_100A061F0);
_mm_storel_ps(
(double *)a1 + 44,
(__m128)_mm_cvttps_epi32(
_mm_div_ps(
(__m128)v18[0],
_mm_cvtpd_ps(_mm_sub_pd((__m128d)_mm_or_si128(_mm_cvtepu32_epi64(*(__m64 *)(a1 + 90)), (__m128i)si128), si128)))));
a1[99] = a5;
v14 = cocos2d::CCShaderCache::sharedShaderCache();
v15 = cocos2d::CCShaderCache::programForKey(v14, "ShaderPositionTexture_uColor");
(*(void (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)a1 + 664LL))(a1, v15);
v16 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 656LL))(a1);
a1[100] = glGetUniformLocation(*(_DWORD *)(v16 + 56), "u_color");
}
return v7 != 0;
}