// // TIFFClientOpen from 0x6dfa0c to 0x6e0728 (3356 bytes) // // 3 xrefs: // > cocos2d::CCImage::_initWithTiffData @ 0x5e1d32 // > TIFFFdOpen @ 0x6f6720 // > @ 0x4dcfc // // 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 TIFFClientOpen( const char *a1, const char *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10) { size_t v10; // r0 __int16 v11; // r3 int v13; // r3 __int64 v19; // [sp+18h] [bp-1Ch] BYREF __int16 v20; // [sp+20h] [bp-14h] _DWORD *v21; // [sp+24h] [bp-10h] int v22; // [sp+28h] [bp-Ch] const char *i; // [sp+2Ch] [bp-8h] v20 = 1; v22 = TIFFgetMode(a2, (int)"TIFFClientOpen"); if ( v22 == -1 ) return nullptr; v10 = strlen(a1); v21 = (_DWORD *)TIFFmalloc(v10 + 697); if ( !v21 ) { TIFFErrorExt(a3, (int)"TIFFClientOpen", "%s: Out of memory (TIFF structure)", a1); return nullptr; } TIFFmemset(v21, 0, 696); *v21 = v21 + 174; strcpy((char *)*v21, a1); v21[2] = v22 & 0xFFFFFDBF; *((_WORD *)v21 + 224) = -1; *((_QWORD *)v21 + 57) = 0; v21[113] = -1; v21[111] = -1; v21[157] = a3; if ( !a4 || !a5 || !a6 || !a7 || !a8 ) { TIFFErrorExt(a3, (int)"TIFFClientOpen", "One of the client procedures is NULL pointer."); return nullptr; } v21[158] = a4; v21[159] = a5; v21[160] = a6; v21[161] = a7; v21[162] = a8; if ( a9 ) v21[155] = a9; else v21[155] = sub_6DF8EC; if ( a10 ) v21[156] = a10; else v21[156] = sub_6DF918; TIFFSetDefaultCompressionState(v21); v21[3] = 1; if ( !v22 ) v21[3] |= 0x800u; if ( !v22 || v22 == 2 ) v21[3] |= 0x8000u; for ( i = a2; *i; ++i ) { switch ( *i ) { case '8': if ( (v22 & 0x40) != 0 ) v21[3] |= 0x80000u; break; case 'B': v21[3] = v21[3] & 0xFFFFFFFC | 1; break; case 'C': if ( !v22 ) v21[3] |= 0x8000u; break; case 'H': v21[3] = v21[3] & 0xFFFFFFFC | 1; break; case 'L': v21[3] = v21[3] & 0xFFFFFFFC | 2; break; case 'M': if ( !v22 ) v21[3] |= 0x800u; break; case 'b': if ( (v22 & 0x40) != 0 ) v21[3] |= 0x80u; break; case 'c': if ( !v22 ) v21[3] &= ~0x8000u; break; case 'h': v21[3] |= 0x10000u; break; case 'm': if ( !v22 ) v21[3] &= ~0x800u; break; default: continue; } } if ( (v22 & 0x200) == 0 && ((int (__fastcall *)(_DWORD, _DWORD *, int))v21[158])(v21[157], v21 + 106, 8) == 8 ) { if ( *((_WORD *)v21 + 212) != 19789 && *((_WORD *)v21 + 212) != 18761 && *((_WORD *)v21 + 212) != 20549 ) { TIFFErrorExt( v21[157], (int)a1, "Not a TIFF or MDI file, bad magic number %d (0x%x)", *((unsigned __int16 *)v21 + 212), *((unsigned __int16 *)v21 + 212)); goto LABEL_100; } if ( *((_WORD *)v21 + 212) == 19789 ) v21[3] |= 0x80u; if ( (v21[3] & 0x80) != 0 ) TIFFSwabShort((char *)v21 + 426); if ( *((_WORD *)v21 + 213) != 42 && *((_WORD *)v21 + 213) != 43 ) { TIFFErrorExt( v21[157], (int)a1, "Not a TIFF file, bad version number %d (0x%x)", *((unsigned __int16 *)v21 + 213), *((unsigned __int16 *)v21 + 213)); goto LABEL_100; } if ( *((_WORD *)v21 + 213) == 42 ) { if ( (v21[3] & 0x80) != 0 ) TIFFSwabLong(v21 + 107); *((_WORD *)v21 + 220) = 8; } else { if ( ((int (__fastcall *)(_DWORD, _DWORD *, int))v21[158])(v21[157], v21 + 108, 8) != 8 ) goto LABEL_44; if ( (v21[3] & 0x80) != 0 ) { TIFFSwabShort(v21 + 107); TIFFSwabLong8(v21 + 108); } if ( *((_WORD *)v21 + 214) != 8 ) { TIFFErrorExt( v21[157], (int)a1, "Not a TIFF file, bad BigTIFF offsetsize %d (0x%x)", *((unsigned __int16 *)v21 + 214), *((unsigned __int16 *)v21 + 214)); goto LABEL_100; } if ( *((_WORD *)v21 + 215) ) { TIFFErrorExt( v21[157], (int)a1, "Not a TIFF file, bad BigTIFF unused %d (0x%x)", *((unsigned __int16 *)v21 + 215), *((unsigned __int16 *)v21 + 215)); goto LABEL_100; } *((_WORD *)v21 + 220) = 16; v21[3] |= 0x80000u; } v21[3] |= 0x200u; v21[147] = 0; v21[151] = v21[147]; v21[148] = 0; v21[149] = 0; v21[150] = 0; v13 = *(unsigned __int8 *)a2; if ( v13 == 97 ) { if ( !TIFFDefaultDirectory(v21) ) goto LABEL_100; return v21; } else { if ( v13 != 114 ) goto LABEL_100; if ( (v21[3] & 0x80000) != 0 ) *((_QWORD *)v21 + 3) = *((_QWORD *)v21 + 54); else *((_QWORD *)v21 + 3) = (unsigned int)v21[107]; if ( (v21[3] & 0x800) != 0 ) { if ( ((int (__fastcall *)(_DWORD, _DWORD *, __int64 *))v21[155])(v21[157], v21 + 153, &v19) ) { v21[154] = v19; if ( v21[154] != v19 ) _assert2(); } else { v21[3] &= ~0x800u; } } if ( (v21[3] & 0x10000) != 0 ) { return v21; } else { if ( !TIFFReadDirectory((int)v21) ) goto LABEL_100; v21[152] = -1; v21[3] |= 0x10u; return v21; } } } else { if ( !v21[2] ) { LABEL_44: TIFFErrorExt(v21[157], (int)a1, "Cannot read TIFF header"); LABEL_100: v21[2] = 0; TIFFCleanup((int)v21); return nullptr; } if ( (v21[3] & 0x80) != 0 ) v11 = 19789; else v11 = 18761; *((_WORD *)v21 + 212) = v11; if ( (v21[3] & 0x80000) != 0 ) { *((_WORD *)v21 + 213) = 43; *((_WORD *)v21 + 214) = 8; *((_WORD *)v21 + 215) = 0; *((_QWORD *)v21 + 54) = 0; if ( (v21[3] & 0x80) != 0 ) { TIFFSwabShort((char *)v21 + 426); TIFFSwabShort(v21 + 107); } *((_WORD *)v21 + 220) = 16; } else { *((_WORD *)v21 + 213) = 42; v21[107] = 0; if ( (v21[3] & 0x80) != 0 ) TIFFSwabShort((char *)v21 + 426); *((_WORD *)v21 + 220) = 8; } ((void (__fastcall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))v21[160])(v21[157], v21[160], 0, 0, 0); if ( ((int (__fastcall *)(_DWORD, _DWORD *, _DWORD))v21[159])(v21[157], v21 + 106, *((unsigned __int16 *)v21 + 220)) != *((unsigned __int16 *)v21 + 220) ) { TIFFErrorExt(v21[157], (int)a1, "Error writing TIFF header"); goto LABEL_100; } if ( *((_WORD *)v21 + 212) == 19789 ) v21[3] |= 0x80u; if ( !TIFFDefaultDirectory(v21) ) goto LABEL_100; *((_QWORD *)v21 + 2) = 0; v21[8] = 0; *((_WORD *)v21 + 18) = 0; *((_WORD *)v21 + 19) = 0; return v21; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source