// // TIFFRGBAImageBegin from 0x6c9fe8 to 0x6ca98c (2468 bytes) // // 4 xrefs: // > TIFFReadRGBAImageOriented @ 0x6cab64 // > TIFFReadRGBAStrip @ 0x6d6c1c // > TIFFReadRGBATile @ 0x6d6e80 // > @ 0x5841c // // 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 TIFFRGBAImageBegin(int a1, int a2, int a3, char *a4) { unsigned int v4; // r3 int v5; // r3 _BOOL4 v7; // r3 unsigned __int16 v12; // [sp+26h] [bp-26h] BYREF int v13; // [sp+28h] [bp-24h] BYREF int v14; // [sp+2Ch] [bp-20h] BYREF int v15; // [sp+30h] [bp-1Ch] BYREF unsigned __int16 v16; // [sp+36h] [bp-16h] BYREF unsigned __int16 v17; // [sp+38h] [bp-14h] BYREF unsigned __int16 v18; // [sp+3Ah] [bp-12h] BYREF _WORD *v19; // [sp+3Ch] [bp-10h] BYREF int v20; // [sp+40h] [bp-Ch] int v21; // [sp+44h] [bp-8h] *(_DWORD *)(a1 + 84) = 0; *(_DWORD *)(a1 + 88) = 0; *(_DWORD *)(a1 + 36) = 0; *(_DWORD *)(a1 + 40) = 0; *(_DWORD *)(a1 + 44) = 0; *(_WORD *)(a1 + 30) = 4; *(_DWORD *)a1 = a2; *(_DWORD *)(a1 + 4) = a3; TIFFGetFieldDefaulted(a2, 0x102u, a1 + 24); v4 = *(unsigned __int16 *)(a1 + 24); if ( v4 > 0x10 || ((1 << v4) & 0x10116) == 0 ) { sprintf(a4, "Sorry, can not handle images with %d-bit samples", *(unsigned __int16 *)(a1 + 24)); LABEL_77: TIFFfree(*(_DWORD *)(a1 + 36)); TIFFfree(*(_DWORD *)(a1 + 40)); TIFFfree(*(_DWORD *)(a1 + 44)); *(_DWORD *)(a1 + 44) = 0; *(_DWORD *)(a1 + 40) = *(_DWORD *)(a1 + 44); *(_DWORD *)(a1 + 36) = *(_DWORD *)(a1 + 40); return 0; } *(_DWORD *)(a1 + 12) = 0; TIFFGetFieldDefaulted(a2, 0x115u, a1 + 26); TIFFGetFieldDefaulted(a2, 0x152u, &v18, &v19); if ( v18 ) { if ( *v19 ) { if ( (unsigned __int16)*v19 <= 2u ) *(_DWORD *)(a1 + 12) = (unsigned __int16)*v19; } else if ( *(unsigned __int16 *)(a1 + 26) > 3u ) { *(_DWORD *)(a1 + 12) = 1; } } if ( !TIFFGetField(a2, 262, a1 + 32) ) *(_WORD *)(a1 + 32) = 0; if ( !v18 && *(_WORD *)(a1 + 26) == 4 && *(_WORD *)(a1 + 32) == 2 ) { *(_DWORD *)(a1 + 12) = 1; v18 = 1; } v20 = *(unsigned __int16 *)(a1 + 26) - v18; TIFFGetFieldDefaulted(a2, 0x103u, &v16); TIFFGetFieldDefaulted(a2, 0x11Cu, &v17); if ( !TIFFGetField(a2, 262, a1 + 32) ) { if ( v20 == 1 ) { *(_WORD *)(a1 + 32) = !sub_6C9F78(a2); } else { if ( v20 != 3 ) { sprintf(a4, "Missing needed %s tag", "PhotometricInterpretation"); goto LABEL_77; } *(_WORD *)(a1 + 32) = 2; } } v5 = *(unsigned __int16 *)(a1 + 32); if ( v5 == 5 ) { TIFFGetFieldDefaulted(a2, 0x14Cu, &v12); if ( v12 != 1 ) { sprintf(a4, "Sorry, can not handle separated image with %s=%d", "InkSet", v12); goto LABEL_77; } if ( *(unsigned __int16 *)(a1 + 26) <= 3u ) { sprintf(a4, "Sorry, can not handle separated image with %s=%d", "Samples/pixel", *(unsigned __int16 *)(a1 + 26)); goto LABEL_77; } } else if ( *(unsigned __int16 *)(a1 + 32) > 5u ) { if ( v5 != 8 ) { if ( *(unsigned __int16 *)(a1 + 32) > 8u ) { if ( v5 == 32844 ) { if ( v16 != 34676 ) { sprintf(a4, "Sorry, LogL data must have %s=%d", "Compression", 34676); goto LABEL_77; } TIFFSetField(a2, 65560, 3); *(_WORD *)(a1 + 32) = 1; *(_WORD *)(a1 + 24) = 8; } else { if ( v5 != 32845 ) goto LABEL_67; if ( v16 != 34676 && v16 != 34677 ) { sprintf(a4, "Sorry, LogLuv data must have %s=%d or %d", "Compression", 34676, 34677); goto LABEL_77; } if ( v17 != 1 ) { sprintf(a4, "Sorry, can not handle LogLuv images with %s=%d", "Planarconfiguration", v17); return 0; } TIFFSetField(a2, 65560, 3); *(_WORD *)(a1 + 32) = 2; *(_WORD *)(a1 + 24) = 8; } } else { if ( v5 != 6 ) goto LABEL_67; if ( v17 == 1 && v16 == 7 ) { TIFFSetField(a2, 65538, 1); *(_WORD *)(a1 + 32) = 2; } } } } else if ( v5 == 2 ) { if ( v20 <= 2 ) { sprintf(a4, "Sorry, can not handle RGB image with %s=%d", "Color channels", v20); goto LABEL_77; } } else { if ( *(unsigned __int16 *)(a1 + 32) > 2u ) { if ( v5 != 3 ) { LABEL_67: sprintf( a4, "Sorry, can not handle image with %s=%d", "PhotometricInterpretation", *(unsigned __int16 *)(a1 + 32)); goto LABEL_77; } if ( !TIFFGetField(a2, 320, &v15, &v14, &v13) ) { strcpy(a4, "Missing required \"Colormap\" tag"); goto LABEL_77; } v21 = 1 << *(_WORD *)(a1 + 24); *(_DWORD *)(a1 + 36) = TIFFmalloc(2 * v21); *(_DWORD *)(a1 + 40) = TIFFmalloc(2 * v21); *(_DWORD *)(a1 + 44) = TIFFmalloc(2 * v21); if ( !*(_DWORD *)(a1 + 36) || !*(_DWORD *)(a1 + 40) || !*(_DWORD *)(a1 + 44) ) { strcpy(a4, "Out of memory for colormap copy"); goto LABEL_77; } TIFFmemcpy(*(_DWORD *)(a1 + 36), v15, 2 * v21); TIFFmemcpy(*(_DWORD *)(a1 + 40), v14, 2 * v21); TIFFmemcpy(*(_DWORD *)(a1 + 44), v13, 2 * v21); } if ( v17 == 1 && *(_WORD *)(a1 + 26) != 1 && *(unsigned __int16 *)(a1 + 24) <= 7u ) { sprintf( a4, "Sorry, can not handle contiguous data with %s=%d, and %s=%d and Bits/Sample=%d", "PhotometricInterpretation", *(unsigned __int16 *)(a1 + 32), "Samples/pixel", *(unsigned __int16 *)(a1 + 26), *(unsigned __int16 *)(a1 + 24)); goto LABEL_77; } } *(_DWORD *)(a1 + 56) = 0; *(_DWORD *)(a1 + 60) = 0; *(_DWORD *)(a1 + 64) = 0; *(_DWORD *)(a1 + 68) = 0; *(_DWORD *)(a1 + 72) = 0; *(_DWORD *)(a1 + 76) = 0; *(_DWORD *)(a1 + 80) = 0; TIFFGetField(a2, 256, a1 + 16); TIFFGetField(a2, 257, a1 + 20); TIFFGetFieldDefaulted(a2, 0x112u, a1 + 28); v7 = v17 != 2 || *(unsigned __int16 *)(a1 + 26) <= 1u; *(_DWORD *)(a1 + 8) = v7; if ( *(_DWORD *)(a1 + 8) ) { if ( !sub_6D5E60(a1) ) { LABEL_74: strcpy(a4, "Sorry, can not handle image"); goto LABEL_77; } } else if ( !sub_6D6548(a1) ) { goto LABEL_74; } return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source