//
// TIFFRGBAImageOK from 0x6c98ec to 0x6c9d6c (1152 bytes)
//
// 4 xrefs:
// > TIFFReadRGBAImageOriented @ 0x6cab34
// > TIFFReadRGBAStrip @ 0x6d6be8
// > TIFFReadRGBATile @ 0x6d6e4c
// > ??> @ 0x583fc
//
// 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 TIFFRGBAImageOK(int a1, char *a2)
{
unsigned int v3; // r3
unsigned __int16 v7; // [sp+1Ch] [bp-10h] BYREF
unsigned __int16 v8; // [sp+1Eh] [bp-Eh] BYREF
unsigned __int16 *v9; // [sp+20h] [bp-Ch]
int v10; // [sp+24h] [bp-8h]
v9 = (unsigned __int16 *)(a1 + 40);
if ( *(_DWORD *)(a1 + 500) )
{
v3 = v9[22];
if ( v3 > 0x10 || ((1 << v3) & 0x10116) == 0 )
{
sprintf(a2, "Sorry, can not handle images with %d-bit samples", v9[22]);
return 0;
}
v10 = v9[29] - v9[58];
if ( !TIFFGetField(a1, 262, &v8) )
{
if ( v10 == 1 )
{
v8 = 1;
}
else
{
if ( v10 != 3 )
{
sprintf(a2, "Missing needed %s tag", "PhotometricInterpretation");
return 0;
}
v8 = 2;
}
}
if ( v8 == 5 )
{
TIFFGetFieldDefaulted(a1, 0x14Cu, &v7);
if ( v7 != 1 )
{
sprintf(a2, "Sorry, can not handle separated image with %s=%d", "InkSet", v7);
return 0;
}
if ( v9[29] <= 3u )
{
sprintf(a2, "Sorry, can not handle separated image with %s=%d", "Samples/pixel", v9[29]);
return 0;
}
}
else if ( v8 > 5u )
{
if ( v8 != 8 )
{
if ( v8 > 8u )
{
if ( v8 == 32844 )
{
if ( v9[24] != 34676 )
{
sprintf(a2, "Sorry, LogL data must have %s=%d", "Compression", 34676);
return 0;
}
}
else
{
if ( v8 != 32845 )
goto LABEL_42;
if ( v9[24] != 34676 && v9[24] != 34677 )
{
sprintf(a2, "Sorry, LogLuv data must have %s=%d or %d", "Compression", 34676, 34677);
return 0;
}
if ( v9[43] != 1 )
{
sprintf(a2, "Sorry, can not handle LogLuv images with %s=%d", "Planarconfiguration", v9[43]);
return 0;
}
}
}
else if ( v8 != 6 )
{
goto LABEL_42;
}
}
}
else if ( v8 == 2 )
{
if ( v10 <= 2 )
{
sprintf(a2, "Sorry, can not handle RGB image with %s=%d", "Color channels", v10);
return 0;
}
}
else
{
if ( v8 >= 4u )
{
LABEL_42:
sprintf(a2, "Sorry, can not handle image with %s=%d", "PhotometricInterpretation", v8);
return 0;
}
if ( v9[43] == 1 && v9[29] != 1 && v9[22] <= 7u )
{
sprintf(
a2,
"Sorry, can not handle contiguous data with %s=%d, and %s=%d and Bits/Sample=%d",
"PhotometricInterpretation",
v8,
"Samples/pixel",
v9[29],
v9[22]);
return 0;
}
}
return 1;
}
strcpy(a2, "Sorry, requested compression method is not configured");
return 0;
}