//
// cocos2d::CCTMXLayer::initWithTilesetInfo from 0x1800ac160 to 0x1800ac41b (699 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::create @ 0x1800ac11c
// > ??> @ 0x180140498
// > ??> @ 0x1801404a8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b80e8
//
// 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
//
char __fastcall cocos2d::CCTMXLayer::initWithTilesetInfo(
cocos2d::CCTMXLayer *this,
struct cocos2d::CCTMXTilesetInfo *a2,
struct cocos2d::CCTMXLayerInfo *a3,
struct cocos2d::CCTMXMapInfo *a4)
{
struct cocos2d::CCTexture2D *v8; // rax
float v9; // xmm7_4
float v10; // xmm6_4
char *v11; // rbx
cocos2d::CCTextureCache *v12; // rax
unsigned int *p_m_uID; // rdx
cocos2d::CCTMXLayer_vtbl *v14; // rbx
struct cocos2d::CCDictionary *v15; // rax
struct cocos2d::CCDictionary *v16; // rax
cocos2d::CCDirector *v17; // rax
cocos2d::CCTMXLayer_vtbl *v18; // rbx
cocos2d::CCDirector *v19; // rax
float ContentScaleFactor; // xmm0_4
float v21; // xmm6_4
cocos2d::CCDirector *v22; // rax
float v23; // xmm0_4
float *v24; // rax
_QWORD *v25; // rax
float v26; // xmm2_4
cocos2d::CCTMXLayer_vtbl *v27; // rdi
float v28; // xmm1_4
float v29; // xmm6_4
float *v30; // rbx
cocos2d::CCDirector *v31; // rax
float v32; // xmm6_4
cocos2d::CCDirector *v33; // rax
float v34; // xmm0_4
float *v35; // rax
float v37; // [rsp+20h] [rbp-68h] BYREF
float v38; // [rsp+28h] [rbp-60h] BYREF
float v39[4]; // [rsp+30h] [rbp-58h] BYREF
float v40; // [rsp+98h] [rbp+10h] BYREF
float v41; // [rsp+9Ch] [rbp+14h]
float v42; // [rsp+A0h] [rbp+18h] BYREF
float v43; // [rsp+A4h] [rbp+1Ch]
cocos2d::cc_timeval::operator=(&v40, &a3[1].m_unknown2);
v8 = nullptr;
v9 = v41 * v40;
v10 = (float)((float)(v41 * v40) * 0.34999999) + 1.0;
if ( a2 )
{
v11 = (char *)&a2[2];
if ( *(_QWORD *)&a2[2].m_uAutoReleaseCount > 0xFu )
v11 = *(char **)v11;
v12 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = cocos2d::CCTextureCache::addImage(v12, v11, 0);
}
if ( !cocos2d::CCSpriteBatchNode::initWithTexture(this, v8, (int)v10) )
return 0;
if ( (unsigned int *)((char *)this + 408) != &a3[1].m_uID )
{
p_m_uID = &a3[1].m_uID;
if ( *(_QWORD *)&a3[1].m_uIndexInArray > 0xFu )
p_m_uID = *(unsigned int **)&a3[1].m_uID;
sub_180010050((void **)this + 51, p_m_uID, *(_QWORD *)&a3[1].m_uAutoReleaseCount);
}
cocos2d::CCSize::operator=((_DWORD *)this + 90, &v40);
v14 = this->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
*((_QWORD *)this + 47) = *(_QWORD *)&a3[1].m_uOrderOfArrival;
*((_DWORD *)this + 111) = HIDWORD(a3[2].__vftable);
*((_DWORD *)this + 112) = a3[2].m_uID;
*((_BYTE *)this + 440) = BYTE1(a3[2].__vftable);
v15 = (struct cocos2d::CCDictionary *)((__int64 (__fastcall *)(struct cocos2d::CCTMXLayerInfo *))a3->getProperties)(a3);
v16 = cocos2d::CCDictionary::createWithDictionary(v15);
((void (__fastcall *)(cocos2d::CCTMXLayer *, struct cocos2d::CCDictionary *))v14->setProperties)(this, v16);
v17 = cocos2d::CCDirector::sharedDirector();
*((float *)this + 120) = cocos2d::CCDirector::getContentScaleFactor(v17);
*((_QWORD *)this + 48) = a2;
if ( a2 )
cocos2d::CCObject::retain(a2);
cocos2d::CCSize::operator=((_DWORD *)this + 92, &a4[1].m_nLuaID);
*((_DWORD *)this + 98) = a4[1].cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCTMXLayer::calculateLayerOffset(
(const struct cocos2d::CCPoint *)this,
&v42,
(cocos2d::CCSize *)&a3[2].m_nLuaID);
v18 = this->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v19 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v19);
v21 = v43 / ContentScaleFactor;
v22 = cocos2d::CCDirector::sharedDirector();
v23 = cocos2d::CCDirector::getContentScaleFactor(v22);
v24 = kmVec2Fill(&v37, v42 / v23, v21);
((void (__fastcall *)(cocos2d::CCTMXLayer *, float *))v18->setPosition_0)(this, v24);
v25 = sub_18009E2A0((int)v9);
v26 = *((float *)this + 91) * *((float *)this + 93);
v27 = this->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v28 = *((float *)this + 90) * *((float *)this + 92);
*((_QWORD *)this + 59) = v25;
v29 = kmVec2Fill(&v37, v28, v26)[1];
v30 = kmVec2Fill(&v38, *((float *)this + 90) * *((float *)this + 92), *((float *)this + 91) * *((float *)this + 93));
v31 = cocos2d::CCDirector::sharedDirector();
v32 = v29 / cocos2d::CCDirector::getContentScaleFactor(v31);
v33 = cocos2d::CCDirector::sharedDirector();
v34 = cocos2d::CCDirector::getContentScaleFactor(v33);
v35 = kmVec2Fill(v39, *v30 / v34, v32);
((void (__fastcall *)(cocos2d::CCTMXLayer *, float *))v27->setContentSize)(this, v35);
*((_BYTE *)this + 456) = 0;
*((_DWORD *)this + 113) = 0;
return 1;
}