//
// TIFFRGBAImageOK from 0xc51070 to 0xc513b0 (832 bytes)
//
// 4 xrefs:
// > TIFFReadRGBAImageOriented @ 0xc53164
// > TIFFReadRGBAStrip @ 0xc532c0
// > TIFFReadRGBATile @ 0xc53510
// > ??> @ 0xa7250
//
// 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 TIFFRGBAImageOK(__int64 a1, char *s)
{
unsigned __int16 *v2; // x22
unsigned int v5; // w20
int v7; // w23
int v8; // w3
int v9; // w3
int v10; // w5
unsigned int v11; // w6
unsigned __int16 v12; // [xsp+4Ch] [xbp+4Ch] BYREF
unsigned __int16 v13; // [xsp+4Eh] [xbp+4Eh] BYREF
if ( !*(_DWORD *)(a1 + 696) )
{
strcpy(s, "Sorry, requested compression method is not configured");
return 0;
}
v2 = (unsigned __int16 *)(a1 + 56);
switch ( *(_WORD *)(a1 + 116) )
{
case 1:
case 2:
case 4:
case 8:
case 0x10:
v7 = *(unsigned __int16 *)(a1 + 130) - *(unsigned __int16 *)(a1 + 212);
v5 = TIFFGetField(a1, 262, &v12);
if ( !v5 )
{
if ( v7 != 1 )
{
if ( v7 != 3 )
{
sprintf(s, "Missing needed %s tag", "PhotometricInterpretation");
return v5;
}
return 1;
}
v12 = 1;
v8 = 1;
goto LABEL_21;
}
v8 = v12;
if ( v12 == 5 )
{
TIFFGetFieldDefaulted(a1, 332, &v13);
if ( v13 == 1 )
{
v5 = 1;
if ( v2[37] <= 3u )
{
v5 = 0;
sprintf(s, "Sorry, can not handle separated image with %s=%d", "Samples/pixel", v2[37]);
}
}
else
{
v5 = 0;
sprintf(s, "Sorry, can not handle separated image with %s=%d", "InkSet", v13);
}
return v5;
}
if ( v12 > 5u )
{
if ( v12 == 8 )
return 1;
if ( v12 <= 8u )
{
if ( v12 == 6 )
return 1;
}
else
{
if ( v12 == 32844 )
{
if ( v2[32] == 34676 )
return 1;
v5 = 0;
sprintf(s, "Sorry, LogL data must have %s=%d", "Compression", 34676);
return v5;
}
if ( v12 == 32845 )
{
if ( (unsigned __int16)(v2[32] + 30860) <= 1u )
{
v9 = v2[57];
if ( v9 != 1 )
{
v5 = 0;
sprintf(s, "Sorry, can not handle LogLuv images with %s=%d", "Planarconfiguration", v9);
return v5;
}
return 1;
}
v5 = 0;
sprintf(s, "Sorry, LogLuv data must have %s=%d or %d", "Compression", 34676, 34677);
return v5;
}
}
LABEL_28:
v5 = 0;
sprintf(s, "Sorry, can not handle image with %s=%d", "PhotometricInterpretation", v12);
return v5;
}
if ( v12 == 2 )
{
if ( v7 <= 2 )
{
v5 = 0;
sprintf(s, "Sorry, can not handle RGB image with %s=%d", "Color channels", v7);
return v5;
}
return 1;
}
if ( v12 >= 2u && v12 != 3 )
goto LABEL_28;
LABEL_21:
if ( v2[57] == 1 )
{
v10 = v2[37];
if ( v10 != 1 )
{
v11 = v2[30];
if ( v11 <= 7 )
{
v5 = 0;
sprintf(
s,
"Sorry, can not handle contiguous data with %s=%d, and %s=%d and Bits/Sample=%d",
"PhotometricInterpretation",
v8,
"Samples/pixel",
v10,
v11);
return v5;
}
}
}
return 1;
default:
v5 = 0;
sprintf(s, "Sorry, can not handle images with %d-bit samples", *(unsigned __int16 *)(a1 + 116));
return v5;
}
}