//
// cocos2d::CCTMXTiledMap::tilesetForLayer from 0x1800b1e90 to 0x1800b1fab (283 bytes)
//
// 5 xrefs:
// > cocos2d::CCTMXTiledMap::buildWithMapInfo @ 0x1800b17cf
// > cocos2d::CCTMXTiledMap::parseLayer @ 0x1800b1d20
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c2694
// > ??> @ 0x1801c26a0
//
// 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
//
struct cocos2d::CCTMXTilesetInfo *__fastcall cocos2d::CCTMXTiledMap::tilesetForLayer(
cocos2d::CCTMXTiledMap *this,
struct cocos2d::CCTMXLayerInfo *a2,
struct cocos2d::CCTMXMapInfo *a3)
{
cocos2d::CCArray *v5; // rax
cocos2d::CCArray *v6; // rbx
unsigned int *v7; // rax
__int64 v8; // rcx
unsigned __int64 v9; // rbx
unsigned __int64 v10; // r11
int v11; // r9d
int v12; // edx
float v13; // xmm0_4
int v14; // eax
float v16; // [rsp+38h] [rbp+10h] BYREF
float v17; // [rsp+3Ch] [rbp+14h]
cocos2d::cc_timeval::operator=(&v16, (_DWORD *)a2 + 24);
v5 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(struct cocos2d::CCTMXMapInfo *))(*(_QWORD *)a3 + 88LL))(a3);
v6 = v5;
if ( v5 )
{
if ( (unsigned int)cocos2d::CCArray::count(v5) )
{
v7 = *((unsigned int **)v6 + 7);
v8 = *v7;
if ( (_DWORD)v8 )
{
v9 = *((_QWORD *)v7 + 2);
v10 = v9 + 8 * (v8 - 1);
if ( v10 >= v9 )
{
while ( *(_QWORD *)v10 )
{
v11 = 0;
if ( v17 > 0.0 )
{
while ( 1 )
{
v12 = 0;
if ( v16 > 0.0 )
break;
LABEL_12:
if ( v17 <= (float)++v11 )
goto LABEL_13;
}
v13 = 0.0;
while ( 1 )
{
v14 = *(_DWORD *)(*((_QWORD *)a2 + 13)
+ 4LL * (unsigned int)(int)(float)(v13 + (float)((float)v11 * v16)));
if ( v14 )
{
if ( (v14 & 0x1FFFFFFFu) >= *(_DWORD *)(*(_QWORD *)v10 + 88LL) )
return *(struct cocos2d::CCTMXTilesetInfo **)v10;
}
v13 = (float)++v12;
if ( v16 <= (float)v12 )
goto LABEL_12;
}
}
LABEL_13:
v10 -= 8LL;
if ( v10 < v9 )
return nullptr;
}
}
}
}
}
return nullptr;
}