//
// cocos2d::CCTMXLayer::setTileGID from 0xdac680 to 0xdac86c (492 bytes)
//
// 2 xrefs:
// > cocos2d::CCTMXLayer::setTileGID @ 0xdac870
// > ??> @ 0x76e28
//
// 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::setTileGID(__int64 a1, unsigned int a2, float *a3, int a4)
{
int v8; // w0
int v9; // w25
unsigned int v10; // w23
__int64 *v11; // x26
cocos2d::CCDirector *v12; // x0
float v13; // s10
cocos2d::CCDirector *v14; // x0
float v15; // s10
float v16; // s8
cocos2d::CCDirector *v17; // x0
cocos2d::CCDirector *v18; // x0
float v19; // s1
float v20; // s9
cocos2d::CCDirector *v21; // x0
cocos2d::CCDirector *v22; // x0
float v23; // s2
float v24; // s8
cocos2d::CCDirector *v25; // x0
cocos2d::CCDirector *v26; // x0
float ContentScaleFactor; // s0
const cocos2d::CCPoint *v28; // x0
float v30; // [xsp+70h] [xbp+70h]
float v31; // [xsp+80h] [xbp+80h]
unsigned int v32; // [xsp+94h] [xbp+94h] BYREF
__int64 v33; // [xsp+98h] [xbp+98h] BYREF
_DWORD v34[2]; // [xsp+A0h] [xbp+A0h] BYREF
float v35[4]; // [xsp+A8h] [xbp+A8h] BYREF
v8 = cocos2d::CCTMXLayer::tileGIDAt(a1, a3, &v32);
if ( v8 != a2 )
{
v9 = a2 | a4;
if ( a2 )
goto LABEL_3;
LABEL_12:
cocos2d::CCTMXLayer::removeTileAt((cocos2d::CCTMXLayer *)a1, (const cocos2d::CCPoint *)a3);
return _stack_chk_guard;
}
if ( v32 == a4 )
return _stack_chk_guard;
v9 = a2 | a4;
if ( !a2 )
goto LABEL_12;
LABEL_3:
if ( v8 )
{
v10 = (unsigned int)(float)(*a3 + (float)(a3[1] * *(float *)(a1 + 356)));
v11 = (__int64 *)(*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 480LL))(a1, v10);
if ( v11 )
{
v12 = (cocos2d::CCDirector *)cocos2d::CCTMXTilesetInfo::rectForGID(
&v33,
*(cocos2d::CCTMXTilesetInfo **)(a1 + 384),
a2);
v13 = *(float *)&v33;
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
v15 = v13 / cocos2d::CCDirector::getContentScaleFactor(v14);
v16 = *((float *)&v33 + 1);
v18 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v17);
v19 = v16 / cocos2d::CCDirector::getContentScaleFactor(v18);
v20 = *(float *)v34;
v30 = v19;
v22 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v23 = v20 / cocos2d::CCDirector::getContentScaleFactor(v22);
v24 = *(float *)&v34[1];
v31 = v23;
v26 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v25);
ContentScaleFactor = cocos2d::CCDirector::getContentScaleFactor(v26);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v35, v15, v30, v31, v24 / ContentScaleFactor);
cocos2d::CCRect::operator=((float *)&v33, v35);
(*(void (__fastcall **)(__int64 *, __int64 *, _QWORD, _DWORD *))(*v11 + 1144))(v11, &v33, 0, v34);
if ( a4 )
{
v28 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64 *))(*v11 + 192))(v11);
cocos2d::CCPoint::CCPoint(v35, v28);
cocos2d::CCTMXLayer::setupTileSprite((unsigned __int8 *)a1, v11, (const cocos2d::CCPoint *)v35, v9);
}
*(_DWORD *)(*(_QWORD *)(a1 + 376) + 4LL * v10) = v9;
}
else
{
cocos2d::CCTMXLayer::updateTileForGID((cocos2d::CCTMXTilesetInfo **)a1, v9, (const cocos2d::CCPoint *)a3);
}
}
else
{
cocos2d::CCTMXLayer::insertTileForGID((cocos2d::CCTMXLayer *)a1, v9, (const cocos2d::CCPoint *)a3);
}
return _stack_chk_guard;
}