//
// TIFFWriteCheck from 0x9042fc to 0x904598 (668 bytes)
//
// 6 xrefs:
// > TIFFWriteScanline @ 0x902f0c
// > TIFFWriteEncodedStrip @ 0x9033f4
// > TIFFWriteRawStrip @ 0x9038bc
// > TIFFWriteEncodedTile @ 0x903b20
// > TIFFWriteRawTile @ 0x904050
// > ??> @ 0x6b9ac
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:04:18 +0000
//
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;
}
}