//
// TIFFWriteCheck from 0xed8f00 to 0xed9094 (404 bytes)
//
// 6 xrefs:
// > TIFFWriteRawStrip @ 0xed932c
// > TIFFWriteRawTile @ 0xed9540
// > TIFFWriteScanline @ 0xed992c
// > TIFFWriteEncodedStrip @ 0xed9bc8
// > TIFFWriteEncodedTile @ 0xed9e8c
// > ??> @ 0x93e50
//
// 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:11:44 +0000
//
__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;
}