//
// cocos2d::CCTMXLayer::insertTileForGID from 0xdabce8 to 0xdabec8 (480 bytes)
//
// 2 xrefs:
// > cocos2d::CCTMXLayer::setTileGID @ 0xdac828
// > ??> @ 0x9ae28
//
// This function is hookable on this platform (idp: arm, 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 13:08:35 +0000
//
__int64 *__fastcall cocos2d::CCTMXLayer::insertTileForGID(
cocos2d::CCTMXLayer *this,
unsigned int a2,
const cocos2d::CCPoint *a3)
{
cocos2d::CCDirector *v6; // x0
float v7; // s10
cocos2d::CCDirector *v8; // x0
float v9; // s10
float v10; // s8
cocos2d::CCDirector *v11; // x0
cocos2d::CCDirector *v12; // x0
float v13; // s1
float v14; // s9
cocos2d::CCDirector *v15; // x0
cocos2d::CCDirector *v16; // x0
float v17; // s2
float v18; // s8
cocos2d::CCDirector *v19; // x0
cocos2d::CCDirector *v20; // x0
float ContentScaleFactor; // s0
__int64 v22; // x21
__int64 *v23; // x23
unsigned int v24; // w25
cocos2d::CCArray *v25; // x0
__int64 v26; // x0
unsigned int *v27; // x0
unsigned int v28; // w1
__int64 *v29; // x0
__int64 *i; // x2
__int64 v31; // x20
unsigned int v32; // w1
float v34; // [xsp+60h] [xbp+60h]
float v35; // [xsp+70h] [xbp+70h]
__int64 v36; // [xsp+88h] [xbp+88h] BYREF
float v37; // [xsp+90h] [xbp+90h]
float v38; // [xsp+94h] [xbp+94h]
float v39[4]; // [xsp+98h] [xbp+98h] BYREF
v6 = (cocos2d::CCDirector *)cocos2d::CCTMXTilesetInfo::rectForGID(
&v36,
*((cocos2d::CCTMXTilesetInfo **)this + 48),
a2);
v7 = *(float *)&v36;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v6);
v9 = v7 / cocos2d::CCDirector::getContentScaleFactor(v8);
v10 = *((float *)&v36 + 1);
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
v13 = v10 / cocos2d::CCDirector::getContentScaleFactor(v12);
v14 = v37;
v34 = v13;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
v17 = v14 / cocos2d::CCDirector::getContentScaleFactor(v16);
v18 = v38;
v35 = v17;
v20 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v19);
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v20);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, v9, v34, v35, v18 / ContentScaleFactor);
cocos2d::CCRect::operator=((float *)&v36, v39);
v22 = (__int64)(float)(*(float *)a3 + (float)(*((float *)a3 + 1) * *((float *)this + 89)));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, (const cocos2d::CCRect *)&v36);
v23 = (__int64 *)cocos2d::CCTMXLayer::reusedTileWithRect((__int64)this, (__int64)v39);
cocos2d::CCPoint::CCPoint(v39, a3);
cocos2d::CCTMXLayer::setupTileSprite((unsigned __int8 *)this, v23, (const cocos2d::CCPoint *)v39, a2);
v24 = cocos2d::CCTMXLayer::atlasIndexForNewZ(this, v22);
cocos2d::CCSpriteBatchNode::insertQuadFromSprite(this, (cocos2d::CCSprite *)v23, v24);
cocos2d::ccCArrayInsertValueAtIndex(*((_QWORD *)this + 58), v22, v24);
v25 = *((cocos2d::CCArray **)this + 26);
if ( v25 )
{
if ( (unsigned int)cocos2d::CCArray::count(v25) )
{
v26 = *((_QWORD *)this + 26);
if ( v26 )
{
v27 = *(unsigned int **)(v26 + 56);
v28 = *v27;
if ( *v27 )
{
v29 = *((__int64 **)v27 + 2);
for ( i = &v29[v28 - 1]; i >= v29; ++v29 )
{
v31 = *v29;
if ( !*v29 )
break;
v32 = *(_DWORD *)(v31 + 360);
if ( v24 <= v32 )
*(_DWORD *)(v31 + 360) = v32 + 1;
}
}
}
}
}
*(_DWORD *)(*((_QWORD *)this + 47) + 4 * v22) = a2;
return v23;
}