// // png_write_bKGD from 0xe62d98 to 0xe6305c (708 bytes) // // 2 xrefs: // > png_write_info @ 0xe5d26c // > @ 0xfbe00 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 13:10:24 +0000 // __int64 __fastcall png_write_bKGD(__int64 a1, unsigned __int8 *a2, int a3) { int v5; // w1 unsigned int v7; // w0 unsigned int v8; // w1 _BYTE v9[2]; // [xsp+48h] [xbp+48h] BYREF _BYTE v10[2]; // [xsp+4Ah] [xbp+4Ah] BYREF _BYTE v11[4]; // [xsp+4Ch] [xbp+4Ch] BYREF _BYTE v12[4]; // [xsp+50h] [xbp+50h] BYREF _BYTE v13[4]; // [xsp+54h] [xbp+54h] BYREF if ( a3 == 3 ) { v7 = *(unsigned __int16 *)(a1 + 672); if ( v7 ) { v8 = *a2; if ( v7 > v8 ) { v9[0] = v8; LABEL_17: *(_DWORD *)(a1 + 1252) = 34; png_save_uint_32(v12, 1); png_save_uint_32(v13, 1649100612); png_write_data(a1); *(_DWORD *)(a1 + 592) = 1649100612; png_reset_crc(a1); png_calculate_crc((_DWORD *)a1, (__int64)v13, 4); *(_DWORD *)(a1 + 1252) = 66; png_write_chunk_data(a1, (__int64)v9, 1); png_write_chunk_end(a1); return _stack_chk_guard; } } else if ( (*(_DWORD *)(a1 + 1104) & 1) != 0 ) { v9[0] = *a2; goto LABEL_17; } png_warning(a1, "Invalid background palette index"); return _stack_chk_guard; } if ( (a3 & 2) != 0 ) { png_save_uint_16(v9, *((_WORD *)a2 + 1)); png_save_uint_16(v10, *((_WORD *)a2 + 2)); png_save_uint_16(v11, *((_WORD *)a2 + 3)); if ( *(_BYTE *)(a1 + 688) == 8 && (unsigned __int8)(v10[0] | v9[0]) | v11[0] ) { png_warning(a1, "Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8"); } else { *(_DWORD *)(a1 + 1252) = 34; png_save_uint_32(v12, 6); png_save_uint_32(v13, 1649100612); png_write_data(a1); *(_DWORD *)(a1 + 592) = 1649100612; png_reset_crc(a1); png_calculate_crc((_DWORD *)a1, (__int64)v13, 4); *(_DWORD *)(a1 + 1252) = 66; png_write_chunk_data(a1, (__int64)v9, 6); png_write_chunk_end(a1); } } else { v5 = *((unsigned __int16 *)a2 + 4); if ( v5 >= 1 << *(_BYTE *)(a1 + 688) ) { png_warning(a1, "Ignoring attempt to write bKGD chunk out-of-range for bit_depth"); } else { png_save_uint_16(v9, v5); *(_DWORD *)(a1 + 1252) = 34; png_save_uint_32(v12, 2); png_save_uint_32(v13, 1649100612); png_write_data(a1); *(_DWORD *)(a1 + 592) = 1649100612; png_reset_crc(a1); png_calculate_crc((_DWORD *)a1, (__int64)v13, 4); *(_DWORD *)(a1 + 1252) = 66; png_write_chunk_data(a1, (__int64)v9, 2); png_write_chunk_end(a1); } } return _stack_chk_guard; }
GD Web Decomp Icon

GD Web Decomp

Raw Source