//
// cocos2d::CCTMXLayer::initWithTilesetInfo from 0x1800af950 to 0x1800afc11 (705 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXLayer::create @ 0x1800af90c
// > ??> @ 0x18014973c
// > ??> @ 0x18014974c
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c23ac
//
// 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 11:22:19 +0000
//
char __fastcall cocos2d::CCTMXLayer::initWithTilesetInfo(
void **this,
struct cocos2d::CCTMXTilesetInfo *a2,
struct cocos2d::CCTMXLayerInfo *a3,
struct cocos2d::CCTMXMapInfo *a4)
{
struct cocos2d::CCTexture2D *v8; // rax
float v9; // xmm7_4
const char *v10; // rbx
cocos2d::CCTextureCache *v11; // rax
char *v12; // rdx
void (__fastcall **v13)(void **, struct cocos2d::CCDictionary *); // rbx
struct cocos2d::CCDictionary *v14; // rax
struct cocos2d::CCDictionary *v15; // rax
cocos2d::CCDirector *v16; // rax
void (__fastcall **v17)(void **, float *); // rbx
cocos2d::CCDirector *v18; // rax
float ContentScaleFactor; // xmm0_4
float v20; // xmm6_4
cocos2d::CCDirector *v21; // rax
float v22; // xmm0_4
float *v23; // rax
cocos2d::CCDirector *v24; // rax
float v25; // xmm0_4
float v26; // xmm7_4
cocos2d::CCDirector *v27; // rax
float v28; // xmm0_4
float *v29; // rax
void (__fastcall **v30)(void **, float *); // rbx
float *v31; // rax
float v33; // [rsp+20h] [rbp-68h] BYREF
float v34; // [rsp+28h] [rbp-60h] BYREF
float v35[4]; // [rsp+30h] [rbp-58h] BYREF
float v36; // [rsp+98h] [rbp+10h] BYREF
float v37; // [rsp+9Ch] [rbp+14h]
float v38; // [rsp+A0h] [rbp+18h] BYREF
float v39; // [rsp+A4h] [rbp+1Ch]
cocos2d::cc_timeval::operator=(&v36, (_DWORD *)a3 + 24);
v8 = nullptr;
v9 = v37 * v36;
if ( a2 )
{
v10 = (char *)a2 + 112;
if ( *((_QWORD *)a2 + 17) > 0xFu )
v10 = *(const char **)v10;
v11 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = cocos2d::CCTextureCache::addImage(v11, v10, 0);
}
if ( !cocos2d::CCSpriteBatchNode::initWithTexture(
(cocos2d::CCSpriteBatchNode *)this,
v8,
(int)(float)((float)(v9 * 0.34999999) + 1.0)) )
return 0;
if ( this + 51 != (void **)((char *)a3 + 64) )
{
v12 = (char *)a3 + 64;
if ( *((_QWORD *)a3 + 11) > 0xFu )
v12 = *((char **)a3 + 8);
sub_1800101E0(this + 51, v12, *((_QWORD *)a3 + 10));
}
cocos2d::CCSize::operator=((_DWORD *)this + 90, &v36);
v13 = (void (__fastcall **)(void **, struct cocos2d::CCDictionary *))*this;
*(this + 47) = *((void **)a3 + 13);
*((_DWORD *)this + 111) = *((_DWORD *)a3 + 29);
*((_DWORD *)this + 112) = *((_DWORD *)a3 + 30);
*((_BYTE *)this + 440) = *((_BYTE *)a3 + 113);
v14 = (struct cocos2d::CCDictionary *)(*(__int64 (__fastcall **)(struct cocos2d::CCTMXLayerInfo *))(*(_QWORD *)a3 + 72LL))(a3);
v15 = cocos2d::CCDictionary::createWithDictionary(v14);
v13[114](this, v15);
v16 = cocos2d::CCDirector::sharedDirector();
*((float *)this + 120) = cocos2d::CCDirector::getContentScaleFactor(v16);
*(this + 48) = a2;
if ( a2 )
cocos2d::CCObject::retain(a2);
cocos2d::CCSize::operator=((_DWORD *)this + 92, (_DWORD *)a4 + 19);
*((_DWORD *)this + 98) = *((_DWORD *)a4 + 16);
cocos2d::CCTMXLayer::calculateLayerOffset((__int64)this, &v38, (float *)a3 + 31);
v17 = (void (__fastcall **)(void **, float *))*this;
v18 = cocos2d::CCDirector::sharedDirector();
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v18);
v20 = v39 / ContentScaleFactor;
v21 = cocos2d::CCDirector::sharedDirector();
v22 = cocos2d::CCDirector::getContentScaleFactor(v21);
v23 = kmVec2Fill(&v33, v38 / v22, v20);
v17[23](this, v23);
*(this + 59) = sub_1800A1F30((int)v9);
v24 = cocos2d::CCDirector::sharedDirector();
v25 = cocos2d::CCDirector::getContentScaleFactor(v24);
v26 = kmVec2Fill(&v33, *((float *)this + 90) * *((float *)this + 92), *((float *)this + 93) * *((float *)this + 91))[1]
/ v25;
v27 = cocos2d::CCDirector::sharedDirector();
v28 = cocos2d::CCDirector::getContentScaleFactor(v27);
v29 = kmVec2Fill(&v34, *((float *)this + 90) * *((float *)this + 92), *((float *)this + 93) * *((float *)this + 91));
v30 = (void (__fastcall **)(void **, float *))*this;
v31 = kmVec2Fill(v35, *v29 / v28, v26);
v30[39](this, v31);
*((_BYTE *)this + 456) = 0;
*((_DWORD *)this + 113) = 0;
return 1;
}