//
// TIFFWriteCheck from 0x6f473c to 0x6f49d8 (668 bytes)
//
// 6 xrefs:
// > TIFFWriteScanline @ 0x6f334c
// > TIFFWriteEncodedStrip @ 0x6f3834
// > TIFFWriteRawStrip @ 0x6f3cfc
// > TIFFWriteEncodedTile @ 0x6f3f60
// > TIFFWriteRawTile @ 0x6f4490
// > ??> @ 0x5893c
//
// 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
//
int __fastcall TIFFWriteCheck(int a1, int a2, int a3)
{
const char *v4; // r12
if ( *(_DWORD *)(a1 + 8) )
{
if ( ((*(_DWORD *)(a1 + 12) & 0x400) != 0) == a2 )
{
TIFFFillStriles();
if ( (*(_DWORD *)(a1 + 40) & 2) != 0 )
{
if ( *(_WORD *)(a1 + 98) == 1 )
{
if ( (*(_DWORD *)(a1 + 40) & 0x100000) == 0 )
*(_WORD *)(a1 + 126) = 1;
}
else if ( (*(_DWORD *)(a1 + 40) & 0x100000) == 0 )
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "Must set \"PlanarConfiguration\" before writing data");
return 0;
}
if ( *(_DWORD *)(a1 + 172) || TIFFSetupStrips(a1) )
{
if ( (*(_DWORD *)(a1 + 12) & 0x400) != 0 )
{
*(_DWORD *)(a1 + 496) = TIFFTileSize((_DWORD *)a1);
if ( !*(_DWORD *)(a1 + 496) )
return 0;
}
else
{
*(_DWORD *)(a1 + 496) = -1;
}
*(_DWORD *)(a1 + 580) = TIFFScanlineSize(a1);
if ( *(_DWORD *)(a1 + 580) )
{
*(_DWORD *)(a1 + 12) |= 0x40u;
return 1;
}
else
{
return 0;
}
}
else
{
*(_DWORD *)(a1 + 168) = 0;
if ( (*(_DWORD *)(a1 + 12) & 0x400) != 0 )
v4 = "tile";
else
v4 = "strip";
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "No space for %s arrays", v4);
return 0;
}
}
else
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "Must set \"ImageWidth\" before writing data");
return 0;
}
}
else
{
if ( a2 )
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "Can not write tiles to a stripped image");
else
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "Can not write scanlines to a tiled image");
return 0;
}
}
else
{
TIFFErrorExt(*(_DWORD *)(a1 + 628), a3, "File not open for writing");
return 0;
}
}