//
// sub_6F5618 from 0x6f5618 to 0x6f58c0 (680 bytes)
//
// 9 xrefs:
// > TIFFInitZIP @ 0x6f6290
// > TIFFInitZIP @ 0x6f6294
// > TIFFInitZIP @ 0x6f62a0
// > TIFFInitZIP @ 0x6f62a4
// > TIFFInitZIP @ 0x6f62b0
// > TIFFInitZIP @ 0x6f62b4
// > ??> @ 0x6f63a4
// > ??> @ 0x6f63a8
// > ??> @ 0x6f63ac
//
// 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 sub_6F5618(_DWORD *a1, int a2, int a3)
{
int v8; // [sp+18h] [bp-Ch]
int v9; // [sp+1Ch] [bp-8h]
v8 = a1[144];
if ( !v8 )
_assert2();
if ( *(_DWORD *)(v8 + 124) != 1 )
_assert2();
*(_DWORD *)(v8 + 64) = a1[151];
*(_DWORD *)(v8 + 68) = a1[152];
*(_DWORD *)(v8 + 76) = a2;
*(_DWORD *)(v8 + 80) = a3;
if ( *(_DWORD *)(v8 + 80) == a3 )
{
do
{
v9 = j_inflate(v8 + 64, 1);
if ( v9 == 1 )
break;
if ( v9 == -3 )
{
TIFFErrorExt(
a1[157],
(int)"ZIPDecode",
"Decoding error at scanline %lu, %s",
a1[111],
*(const char **)(v8 + 88));
if ( j_inflateSync(v8 + 64) )
return 0;
}
else if ( v9 )
{
TIFFErrorExt(a1[157], (int)"ZIPDecode", "ZLib error: %s", *(const char **)(v8 + 88));
return 0;
}
}
while ( *(_DWORD *)(v8 + 80) );
if ( *(_DWORD *)(v8 + 80) )
{
TIFFErrorExt(
a1[157],
(int)"ZIPDecode",
"Not enough data at scanline %lu (short %llu bytes)",
a1[111],
(unsigned __int64)*(unsigned int *)(v8 + 80));
return 0;
}
else
{
a1[151] = *(_DWORD *)(v8 + 64);
a1[152] = *(_DWORD *)(v8 + 68);
return 1;
}
}
else
{
TIFFErrorExt(a1[157], (int)"ZIPDecode", "ZLib cannot deal with buffers this size");
return 0;
}
}