From cf1858096000f4ee69ad2bb82fcdfd5ed41661c8 Mon Sep 17 00:00:00 2001 From: Nik Date: Sat, 27 Jan 2024 17:05:08 +0100 Subject: [PATCH] includes/hex: Added decompress functions --- includes/hex/dec.pat | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/includes/hex/dec.pat b/includes/hex/dec.pat index 4559557..eb2fb3f 100644 --- a/includes/hex/dec.pat +++ b/includes/hex/dec.pat @@ -2,6 +2,8 @@ #include +#include + /*! Library to allow decoding of more complex values */ @@ -17,4 +19,46 @@ namespace hex::dec { return builtin::hex::dec::demangle(mangled_name); }; + + /** + Decompresses the bytes of a pattern into a section using the zlib algorithm + @param pattern The pattern whose bytes should be decompressed + @param sectionId The section to decompress the data into + @param window_size The window size passed to zlib + @return true if successful, false otherwise + */ + fn zlib_decompress(ref auto pattern, std::mem::SectionId sectionId, u64 window_size = 0) { + return builtin::hex::dec::zlib_decompress(pattern, sectionId, window_size); + }; + + /** + Decompresses the bytes of a pattern into a section using the bzip algorithm + @param pattern The pattern whose bytes should be decompressed + @param sectionId The section to decompress the data into + @return true if successful, false otherwise + */ + fn bzip_decompress(ref auto pattern, std::mem::SectionId sectionId) { + return builtin::hex::dec::bzip_decompress(pattern, sectionId); + }; + + /** + Decompresses the bytes of a pattern into a section using the LZMA algorithm + @param pattern The pattern whose bytes should be decompressed + @param sectionId The section to decompress the data into + @return true if successful, false otherwise + */ + fn lzma_decompress(ref auto pattern, std::mem::SectionId sectionId) { + return builtin::hex::dec::lzma_decompress(pattern, sectionId); + }; + + /** + Decompresses the bytes of a pattern into a section using the zstd algorithm + @param pattern The pattern whose bytes should be decompressed + @param sectionId The section to decompress the data into + @return true if successful, false otherwise + */ + fn zstd_decompress(ref auto pattern, std::mem::SectionId sectionId) { + return builtin::hex::dec::zstd_decompress(pattern, sectionId); + }; + } \ No newline at end of file