// // png_combine_row from 0xbe1fa0 to 0xbe2514 (1396 bytes) // // 7 xrefs: // > png_progressive_combine_row @ 0xbd02dc // > png_read_row @ 0xbd3a20 // > png_read_row @ 0xbd3a34 // > png_read_row @ 0xbd3ab8 // > png_read_row @ 0xbd3acc // > png_read_row @ 0xbd3bc4 // > @ 0x6c318 // // 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 // unsigned __int64 __fastcall png_combine_row(__int64 a1, char *a2, int a3) { unsigned int v4; // w6 unsigned int v5; // w3 unsigned __int64 v6; // x8 unsigned int v7; // w9 _BYTE *v8; // x5 __int64 v9; // x4 unsigned __int64 v10; // x19 int v11; // w19 char v12; // w20 char *v13; // x21 unsigned __int64 result; // x0 int v15; // w10 size_t v16; // x2 unsigned __int64 v17; // x0 unsigned __int64 v18; // x10 unsigned __int64 v19; // x4 int v20; // w0 int v21; // w3 char v22; // w2 bool v23; // zf unsigned __int64 v24; // t2 unsigned int v25; // w0 unsigned int v26; // w3 __int64 v27; // x19 char *v28; // x8 unsigned __int64 v29; // x21 char *v30; // x19 unsigned __int64 v31; // x5 __int64 v32; // x1 int v33; // t1 int v34; // w0 unsigned __int64 v35; // x3 __int64 v36; // x5 char *v37; // x8 bool v38; // cc int v39; // w0 int v40; // w0 unsigned __int64 v41; // x4 unsigned __int8 *v42; // x5 char *v43; // x1 unsigned __int64 v44; // x21 unsigned __int64 v45; // x20 size_t v46; // x22 unsigned int i; // w23 __int64 v48; // x2 __int16 v49; // t1 v4 = *(_DWORD *)(a1 + 560); v5 = *(unsigned __int8 *)(a1 + 695); v6 = v4; v7 = *(unsigned __int8 *)(a1 + 685); v8 = (_BYTE *)(*(_QWORD *)(a1 + 608) + 1LL); if ( !*(_BYTE *)(a1 + 695) ) png_error(a1, "internal row logic error"); v9 = *(_QWORD *)(a1 + 648); if ( v9 ) { v10 = v5 <= 7 ? (v4 * (unsigned __int64)*(unsigned __int8 *)(a1 + 695) + 7) >> 3 : (v5 >> 3) * (unsigned __int64)v4; if ( v10 != v9 ) png_error(a1, "internal row size calculation error"); } if ( !v4 ) png_error(a1, "internal row width error"); LOBYTE(v11) = (v5 * v4) & 7; if ( (_BYTE)v11 ) { if ( v5 <= 7 ) v17 = ((v4 * (unsigned __int64)*(unsigned __int8 *)(a1 + 695) + 7) >> 3) - 1; else v17 = (v5 >> 3) * (unsigned __int64)v4 - 1; v13 = &a2[v17]; v12 = a2[v17]; if ( (*(_DWORD *)(a1 + 364) & 0x10000) != 0 ) v11 = 255 << v11; else v11 = 255 >> v11; } else { v12 = 0; v13 = nullptr; } if ( !*(_BYTE *)(a1 + 684) ) goto LABEL_14; result = *(unsigned int *)(a1 + 364); if ( (result & 2) == 0 || v7 > 5 ) goto LABEL_14; v15 = v7 & 1; if ( !a3 ) goto LABEL_30; if ( a3 != 1 || (v7 & 1) == 0 ) { LABEL_14: if ( v5 <= 7 ) v16 = (v4 * (unsigned __int64)v5 + 7) >> 3; else v16 = (v5 >> 3) * (unsigned __int64)v4; result = (unsigned __int64)memcpy(a2, v8, v16); LABEL_17: if ( v13 ) { result = (unsigned __int8)(v11 & v12); *v13 = *v13 & ~(_BYTE)v11 | v11 & v12; } return result; } v15 = 1; LABEL_30: v18 = (v15 << (3 - ((v7 + 1) >> 1))) & 7; if ( v4 <= v18 ) return result; if ( v5 <= 7 ) { v19 = 8 / v5; if ( (result & 0x10000) != 0 ) { if ( a3 ) { if ( v5 == 1 ) { v20 = 0; } else if ( v5 == 2 ) { v20 = 1; } else { v20 = 2; } v21 = *((_DWORD *)&unk_F2E0C0 + 3 * v20 + ((unsigned __int8)v7 >> 1)); } else { if ( v5 == 1 ) { v40 = 0; } else if ( v5 == 2 ) { v40 = 1; } else { v40 = 2; } v21 = dword_F2E110[6 * v40 + (unsigned __int8)v7]; } } else if ( a3 ) { if ( v5 == 1 ) { v34 = 0; } else if ( v5 == 2 ) { v34 = 1; } else { v34 = 2; } v21 = *((_DWORD *)&unk_F2E0C0 + 3 * v34 + ((unsigned __int8)v7 >> 1) + 9); } else { if ( v5 == 1 ) { v39 = 0; } else if ( v5 == 2 ) { v39 = 1; } else { v39 = 2; } v21 = *((_DWORD *)&unk_F2E0C0 + 6 * v39 + (unsigned __int8)v7 + 38); } while ( 1 ) { result = (unsigned __int8)v21; v23 = (unsigned __int8)v21 == 0; HIDWORD(v24) = v21; LODWORD(v24) = v21; v21 = v24 >> 8; if ( !v23 ) { if ( (_DWORD)result == 255 ) { result = (unsigned __int8)*v8; *a2 = result; } else { v22 = *a2 & ~(_BYTE)result; result &= *v8; *a2 = v22 | result; } } if ( v6 <= v19 ) break; v6 -= v19; ++a2; ++v8; } goto LABEL_17; } if ( (v5 & 7) != 0 ) png_error(a1, "invalid user transform pixel depth"); v25 = v5 >> 3; v26 = v25; v27 = (unsigned int)v18 * v25; v28 = &a2[v27]; v29 = v25 * (unsigned __int64)v4 - v27; v30 = &v8[v27]; if ( a3 ) { v26 = v25 << ((6 - v7) >> 1); if ( v29 < v26 ) v26 = v29; } v31 = v25 << ((7 - v7) >> 1); switch ( v26 ) { case 2u: while ( 1 ) { *v28 = *v30; result = (unsigned __int8)v30[1]; v28[1] = result; if ( v29 <= (unsigned int)v31 ) break; v29 -= (unsigned int)v31; v30 += (unsigned int)v31; v28 += (unsigned int)v31; if ( v29 <= 1 ) { result = (unsigned __int8)*v30; *v28 = result; return result; } } break; case 3u: v41 = (unsigned int)v31; *v28 = *v30; v28[1] = v30[1]; result = (unsigned __int8)v30[2]; v28[2] = result; if ( v29 > (unsigned int)v31 ) { v42 = (unsigned __int8 *)&v30[(unsigned int)v31]; v43 = &v28[v41]; v44 = v29 - v41; do { v38 = v44 > v41; *v43 = *v42; v44 -= v41; v43[1] = v42[1]; result = v42[2]; v42 += v41; v43[2] = result; v43 += v41; } while ( v38 ); } break; case 1u: result = (unsigned __int8)*v30; v35 = (unsigned int)v31; *v28 = result; if ( v29 > (unsigned int)v31 ) { result = v29 - (unsigned int)v31; v36 = 0; v37 = &v28[v35]; do { v38 = result > v35; v37[v36] = v30[v35 + v36]; result -= v35; v36 += v35; } while ( v38 ); } break; default: if ( v26 > 0xF || (((unsigned int)v30 | (unsigned int)v28) & 1) != 0 || (((unsigned __int8)v26 | (unsigned __int8)v31) & 1) != 0 ) { v45 = (unsigned int)v31; v46 = v26; for ( i = v29 - v31; ; i -= v45 ) { result = (unsigned __int64)memcpy(v28, v30, v46); if ( v29 <= v45 ) break; v29 -= v45; v30 += v45; v28 = (char *)(result + v45); if ( v46 > v29 ) v46 = i; } } else if ( (((unsigned __int8)v30 | (unsigned __int8)v28) & 3) != 0 || (((unsigned __int8)v26 | (unsigned __int8)v31) & 3) != 0 ) { v48 = ((_DWORD)v31 - v26) & 0xFFFFFFFE; while ( 1 ) { result = v26; do { v49 = *(_WORD *)v30; v30 += 2; result -= 2LL; *(_WORD *)v28 = v49; v28 += 2; } while ( result ); if ( v29 <= v31 ) break; v29 -= v31; v28 += v48; v30 += v48; if ( v29 < v26 ) { result = 0; do { v28[result] = v30[result]; ++result; } while ( result != v29 ); return result; } } } else { result = ((_DWORD)v31 - v26) & 0xFFFFFFFC; while ( 1 ) { v32 = v26; do { v33 = *(_DWORD *)v30; v30 += 4; v32 -= 4; *(_DWORD *)v28 = v33; v28 += 4; } while ( v32 ); if ( v29 <= v31 ) break; v29 -= v31; v28 += result; v30 += result; if ( v29 < v26 ) { result = 0; do { v28[result] = v30[result]; ++result; } while ( result != v29 ); return result; } } } break; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source