//
// TIFFOpen from 0x6f6770 to 0x6f68b8 (328 bytes)
//
// 1 xrefs:
// > ??> @ 0x589bc
//
// 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
//
_DWORD *__fastcall TIFFOpen(const char *a1, const char *a2)
{
int *v3; // r0
int *v4; // r0
char *v5; // r0
int oflag; // [sp+14h] [bp-10h]
int fd; // [sp+18h] [bp-Ch]
_DWORD *v11; // [sp+1Ch] [bp-8h]
oflag = TIFFgetMode(a2, (int)"TIFFOpen");
if ( oflag == -1 )
return nullptr;
fd = open(a1, oflag, 438);
if ( fd >= 0 )
{
v11 = TIFFFdOpen(fd, a1, a2);
if ( !v11 )
close(fd);
return v11;
}
else
{
if ( *(int *)_errno() > 0 && (v3 = (int *)_errno(), strerror(*v3)) )
{
v4 = (int *)_errno();
v5 = strerror(*v4);
TIFFErrorExt(0, (int)"TIFFOpen", "%s: %s", a1, v5);
}
else
{
TIFFErrorExt(0, (int)"TIFFOpen", "%s: Cannot open", a1);
}
return nullptr;
}
}