//
// TIFFWriteCheck from 0xc62d40 to 0xc62ed4 (404 bytes)
//
// 6 xrefs:
// > TIFFWriteRawStrip @ 0xc6316c
// > TIFFWriteRawTile @ 0xc63380
// > TIFFWriteScanline @ 0xc6376c
// > TIFFWriteEncodedStrip @ 0xc63a08
// > TIFFWriteEncodedTile @ 0xc63ccc
// > ??> @ 0x6d8c0
//
// 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
//
__int64 __fastcall TIFFWriteCheck(__int64 a1, int a2, __int64 a3)
{
__int64 v4; // x0
char *v5; // x3
unsigned int v6; // w20
__int64 v8; // x0
unsigned __int64 v9; // x0
unsigned __int64 v10; // x0
int v11; // w1
const char *v12; // x3
if ( *(_DWORD *)(a1 + 12) )
{
if ( ((*(_DWORD *)(a1 + 16) >> 10) & 1) != a2 )
{
v4 = *(_QWORD *)(a1 + 952);
if ( a2 )
v5 = "Can not write tiles to a stripped image";
else
v5 = "Can not write scanlines to a tiled image";
v6 = 0;
TIFFErrorExt(v4, a3, v5);
return v6;
}
TIFFFillStriles();
v8 = *(_QWORD *)(a1 + 56);
if ( (v8 & 2) == 0 )
{
v6 = 0;
TIFFErrorExt(*(_QWORD *)(a1 + 952), a3, "Must set \"ImageWidth\" before writing data");
return v6;
}
if ( *(_WORD *)(a1 + 130) == 1 )
{
if ( (v8 & 0x100000) == 0 )
*(_WORD *)(a1 + 170) = 1;
}
else if ( (v8 & 0x100000) == 0 )
{
v6 = 0;
TIFFErrorExt(*(_QWORD *)(a1 + 952), a3, "Must set \"PlanarConfiguration\" before writing data");
return v6;
}
if ( !*(_QWORD *)(a1 + 232) )
{
v6 = TIFFSetupStrips(a1);
if ( !v6 )
{
v11 = *(_DWORD *)(a1 + 16);
*(_DWORD *)(a1 + 228) = 0;
if ( (v11 & 0x400) != 0 )
v12 = "tile";
else
v12 = "strip";
TIFFErrorExt(*(_QWORD *)(a1 + 952), a3, "No space for %s arrays", v12);
return v6;
}
}
if ( (*(_DWORD *)(a1 + 16) & 0x400) != 0 )
{
v10 = TIFFTileSize(a1);
*(_QWORD *)(a1 + 688) = v10;
if ( !v10 )
return 0;
}
else
{
*(_QWORD *)(a1 + 688) = -1;
}
v9 = TIFFScanlineSize(a1);
*(_QWORD *)(a1 + 856) = v9;
if ( v9 )
{
v6 = 1;
*(_DWORD *)(a1 + 16) |= 0x40u;
return v6;
}
return 0;
}
TIFFErrorExt(*(_QWORD *)(a1 + 952), a3, "File not open for writing");
return 0;
}