C#: Added xml comments to methods that did not have any (in the main DSDecmp project).

The SupportsDecompression-flag is now also used in the main program, and not just in composite formats.
This commit is contained in:
barubary 2011-11-14 17:33:30 +00:00
parent aff22d28da
commit 4302517e58
13 changed files with 769 additions and 11 deletions

View File

@ -58,7 +58,6 @@
<Compile Include="Formats\Nitro\NitroCFormat.cs" /> <Compile Include="Formats\Nitro\NitroCFormat.cs" />
<Compile Include="Formats\Nitro\RLE.cs" /> <Compile Include="Formats\Nitro\RLE.cs" />
<Compile Include="NewestProgram.cs" /> <Compile Include="NewestProgram.cs" />
<Compile Include="NewProgram.cs" />
<Compile Include="TestProgram.cs" /> <Compile Include="TestProgram.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\IOUtils.cs" /> <Compile Include="Utils\IOUtils.cs" />

View File

@ -5,19 +5,43 @@ using System.IO;
namespace DSDecmp.Formats namespace DSDecmp.Formats
{ {
/// <summary>
/// A format that is composed of multiple formats.
/// When compressing, the input is compressed using the best contained format.
/// When decompressing, all contained formats will try to decompress the file, until one succeeds.
/// </summary>
public abstract class CompositeFormat : CompressionFormat public abstract class CompositeFormat : CompressionFormat
{ {
/// <summary>
/// The actual list of formats this format is somposed of.
/// </summary>
private List<CompressionFormat> formats; private List<CompressionFormat> formats;
#region Constructors
/// <summary>
/// Creates a new composite format based on the given sequence of formats.
/// </summary>
protected CompositeFormat(IEnumerable<CompressionFormat> formats) protected CompositeFormat(IEnumerable<CompressionFormat> formats)
{ {
this.formats = new List<CompressionFormat>(formats); this.formats = new List<CompressionFormat>(formats);
} }
/// <summary>
/// Creates a new composite format based on the given formats.
/// </summary>
protected CompositeFormat(params CompressionFormat[] formats) protected CompositeFormat(params CompressionFormat[] formats)
{ {
this.formats = new List<CompressionFormat>(formats); this.formats = new List<CompressionFormat>(formats);
} }
#endregion
#region Method: Supports
/// <summary>
/// Checks if any of the contained formats supports the given input.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength) public override bool Supports(System.IO.Stream stream, long inLength)
{ {
foreach (CompositeFormat fmt in this.formats) foreach (CompositeFormat fmt in this.formats)
@ -27,7 +51,13 @@ namespace DSDecmp.Formats
} }
return false; return false;
} }
#endregion
#region Method: Decompress
/// <summary>
/// Attempts to decompress the given input by letting all contained formats
/// try to decompress the input.
/// </summary>
public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream) public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{ {
byte[] inputData = new byte[instream.Length]; byte[] inputData = new byte[instream.Length];
@ -57,8 +87,17 @@ namespace DSDecmp.Formats
throw new InvalidDataException("Input cannot be decompressed using the " + this.ShortFormatString + " formats."); throw new InvalidDataException("Input cannot be decompressed using the " + this.ShortFormatString + " formats.");
} }
#endregion
#region Method: Compress & Field: LastUsedCompressFormatString
/// <summary>
/// Gets the ShortFormatString of the last CompressionFormat that was used to compress input.
/// </summary>
public string LastUsedCompressFormatString { get; private set; } public string LastUsedCompressFormatString { get; private set; }
/// <summary>
/// Compresses the given input using the contained format that yields the best results in terms of
/// size reduction.
/// </summary>
public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream) public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{ {
// only read the input data once from the file. // only read the input data once from the file.
@ -110,7 +149,12 @@ namespace DSDecmp.Formats
this.LastUsedCompressFormatString = bestFormatString; this.LastUsedCompressFormatString = bestFormatString;
return minCompSize; return minCompSize;
} }
#endregion
#region Method: ParseCompressionOptions(args)
/// <summary>
/// Handles the compression options for each of the contained compression formats.
/// </summary>
public override int ParseCompressionOptions(string[] args) public override int ParseCompressionOptions(string[] args)
{ {
// try each option on each of the formats. // try each option on each of the formats.
@ -144,5 +188,7 @@ namespace DSDecmp.Formats
} }
return totalOptionCount; return totalOptionCount;
} }
#endregion
} }
} }

View File

@ -13,21 +13,33 @@ namespace DSDecmp.Formats
/// </summary> /// </summary>
public sealed class LZOvl : CompressionFormat public sealed class LZOvl : CompressionFormat
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "LZ-Ovl"; } get { return "LZ-Ovl"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "Reverse LZ format, mainly used in 'overlay' files of NDS games."; } get { return "Reverse LZ format, mainly used in 'overlay' files of NDS games."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "lzovl"; } get { return "lzovl"; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
@ -44,6 +56,10 @@ namespace DSDecmp.Formats
set { lookAhead = value; } set { lookAhead = value; }
} }
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args) public override int ParseCompressionOptions(string[] args)
{ {
if (args.Length > 0) if (args.Length > 0)
@ -56,6 +72,9 @@ namespace DSDecmp.Formats
} }
#region Method: Supports(string file) #region Method: Supports(string file)
/// <summary>
/// Checks if this format supports decompressing the given file.
/// </summary>
public override bool Supports(string file) public override bool Supports(string file)
{ {
using (FileStream fstr = File.OpenRead(file)) using (FileStream fstr = File.OpenRead(file))
@ -70,6 +89,9 @@ namespace DSDecmp.Formats
#endregion #endregion
#region Method: Supports(Stream, long) #region Method: Supports(Stream, long)
/// <summary>
/// Checks if this format supports decompressing the given input.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength) public override bool Supports(System.IO.Stream stream, long inLength)
{ {
// assume the 'inLength' does not include the 12 bytes at the end of arm9.bin // assume the 'inLength' does not include the 12 bytes at the end of arm9.bin
@ -113,6 +135,9 @@ namespace DSDecmp.Formats
#endregion #endregion
#region Method: Decompress(string, string) #region Method: Decompress(string, string)
/// <summary>
/// Decompresses the given input file to the given output file using the LZ-Overlay compression format.
/// </summary>
public override void Decompress(string infile, string outfile) public override void Decompress(string infile, string outfile)
{ {
// make sure the output directory exists // make sure the output directory exists
@ -133,6 +158,9 @@ namespace DSDecmp.Formats
#endregion #endregion
#region Decompression method #region Decompression method
/// <summary>
/// Decompresses the given input using the LZ-Overlay compression scheme.
/// </summary>
public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream) public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{ {
#region Format description #region Format description
@ -325,6 +353,9 @@ namespace DSDecmp.Formats
#endregion #endregion
#region Compression method; delegates to CompressNormal #region Compression method; delegates to CompressNormal
/// <summary>
/// Compresses the input using the LZ-Overlay compression scheme.
/// </summary>
public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream) public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{ {
// don't bother trying to get the optimal not-compressed - compressed ratio for now. // don't bother trying to get the optimal not-compressed - compressed ratio for now.

View File

@ -4,52 +4,88 @@ using System.Text;
namespace DSDecmp.Formats.Nitro namespace DSDecmp.Formats.Nitro
{ {
/// <summary>
/// A composite format with all formats supported natively by the GBA.
/// </summary>
public class CompositeGBAFormat : CompositeFormat public class CompositeGBAFormat : CompositeFormat
{ {
/// <summary>
/// Creates a new instance of the format composed of all native GBA compression formats.
/// </summary>
public CompositeGBAFormat() public CompositeGBAFormat()
: base(new Huffman4(), new Huffman8(), new LZ10()) { } : base(new Huffman4(), new Huffman8(), new LZ10()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "GBA"; } get { return "GBA"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "All formats natively supported by the GBA."; } get { return "All formats natively supported by the GBA."; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "gba*"; } get { return "gba*"; }
} }
} }
/// <summary>
/// A composite format with all formats supported natively by the NDS (but not LZ-Overlay)
/// </summary>
public class CompositeNDSFormat : CompositeFormat public class CompositeNDSFormat : CompositeFormat
{ {
/// <summary>
/// Creates a new instance of the format composed of all native NDS compression formats.
/// </summary>
public CompositeNDSFormat() public CompositeNDSFormat()
: base(new Huffman4(), new Huffman8(), new LZ10(), new LZ11()) { } : base(new Huffman4(), new Huffman8(), new LZ10(), new LZ11()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "NDS"; } get { return "NDS"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "All formats natively supported by the NDS."; } get { return "All formats natively supported by the NDS."; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "nds*"; } get { return "nds*"; }

View File

@ -11,25 +11,66 @@ namespace DSDecmp.Formats.Nitro
/// </summary> /// </summary>
public abstract class Huffman : NitroCFormat public abstract class Huffman : NitroCFormat
{ {
public enum BlockSize : byte { FOURBIT = 0x24, EIGHTBIT = 0x28 } #region Enum: BlockSize
/// <summary>
/// The possible data sizes used in Huffman compression formats on the GBA/NDS.
/// </summary>
public enum BlockSize : byte
{
/// <summary>
/// Each data block is four bits long.
/// </summary>
FOURBIT = 0x24,
/// <summary>
/// Each data block is eight bits long.
/// </summary>
EIGHTBIT = 0x28
}
#endregion
/// <summary> /// <summary>
/// Sets the block size used when using the Huffman format to compress. /// Sets the block size used when using the Huffman format to compress.
/// </summary> /// </summary>
public BlockSize CompressBlockSize { get; set; } public BlockSize CompressBlockSize { get; set; }
/// <summary>
/// Gets if this format supports compression. Always returns true.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
} }
public Huffman(BlockSize blockSize)
#region Internal Constructor(BlockSize)
/// <summary>
/// Creates a new generic instance of the Huffman compression format.
/// </summary>
/// <param name="blockSize">The block size used.</param>
internal Huffman(BlockSize blockSize)
: base((byte)blockSize) : base((byte)blockSize)
{ {
this.CompressBlockSize = blockSize; this.CompressBlockSize = blockSize;
} }
#endregion
#region Decompression method #region Decompression method
/// <summary>
/// Decompresses the given stream, writing the decompressed data to the given output stream.
/// Assumes <code>Supports(instream)</code> returns <code>true</code>.
/// After this call, the input stream will be positioned at the end of the compressed stream,
/// or at the initial position + <code>inLength</code>, whichever comes first.
/// </summary>
/// <param name="instream">The stream to decompress. At the end of this method, the position
/// of this stream is directly after the compressed data.</param>
/// <param name="inLength">The length of the input data. Not necessarily all of the
/// input data may be read (if there is padding, for example), however never more than
/// this number of bytes is read from the input stream.</param>
/// <param name="outstream">The stream to write the decompressed data to.</param>
/// <returns>The length of the output data.</returns>
/// <exception cref="NotEnoughDataException">When the given length of the input data
/// is not enough to properly decompress the input.</exception>
public override long Decompress(Stream instream, long inLength, Stream outstream) public override long Decompress(Stream instream, long inLength, Stream outstream)
{ {
#region GBATEK format specification #region GBATEK format specification
@ -415,6 +456,9 @@ namespace DSDecmp.Formats.Nitro
} }
#endregion #endregion
/// <summary>
/// Generates and returns a string-representation of the huffman tree starting at this node.
/// </summary>
public override string ToString() public override string ToString()
{ {
if (this.isData) if (this.isData)
@ -431,23 +475,38 @@ namespace DSDecmp.Formats.Nitro
#endregion #endregion
} }
public class Huffman4 : Huffman /// <summary>
/// The Huffman compression scheme using 4-bit data blocks.
/// </summary>
public sealed class Huffman4 : Huffman
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "Huffman-4"; } get { return "Huffman-4"; }
} }
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description public override string Description
{ {
get { return "Huffman compression scheme using 4-bit datablocks."; } get { return "Huffman compression scheme using 4-bit datablocks."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "huff4"; } get { return "huff4"; }
} }
/// <summary>
/// Creates a new instance of the 4-bit Huffman compression format.
/// </summary>
public Huffman4() public Huffman4()
: base(BlockSize.FOURBIT) { } : base(BlockSize.FOURBIT) { }
@ -618,23 +677,38 @@ namespace DSDecmp.Formats.Nitro
#endregion #endregion
} }
public class Huffman8 : Huffman /// <summary>
/// The Huffman compression scheme using 8-bit data blocks.
/// </summary>
public sealed class Huffman8 : Huffman
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "Huffman-8"; } get { return "Huffman-8"; }
} }
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description public override string Description
{ {
get { return "Huffman compression scheme using 8-bit datablocks."; } get { return "Huffman compression scheme using 8-bit datablocks."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "huff8"; } get { return "huff8"; }
} }
/// <summary>
/// Creates a new instance of the 4-bit Huffman compression format.
/// </summary>
public Huffman8() public Huffman8()
: base(BlockSize.EIGHTBIT) { } : base(BlockSize.EIGHTBIT) { }
@ -950,26 +1024,44 @@ namespace DSDecmp.Formats.Nitro
#endregion #endregion
} }
/// <summary>
/// Composite compression format representing both Huffman compression schemes.
/// </summary>
public class HuffmanAny : CompositeFormat public class HuffmanAny : CompositeFormat
{ {
/// <summary>
/// Creates a new instance of the general Huffman compression format.
/// </summary>
public HuffmanAny() public HuffmanAny()
: base(new Huffman4(), new Huffman8()) { } : base(new Huffman4(), new Huffman8()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "Huffman"; } get { return "Huffman"; }
} }
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description public override string Description
{ {
get { return "Either the Huffman-4 or Huffman-8 format."; } get { return "Either the Huffman-4 or Huffman-8 format."; }
} }
/// <summary>
/// Gets if this format supports compression. Always returns true.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "huff"; } get { return "huff"; }

View File

@ -10,21 +10,33 @@ namespace DSDecmp.Formats.Nitro
/// </summary> /// </summary>
public sealed class LZ10 : NitroCFormat public sealed class LZ10 : NitroCFormat
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "LZ-10"; } get { return "LZ-10"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "Common LZ-type compression used in many post-GBC Nintendo games."; } get { return "Common LZ-type compression used in many post-GBC Nintendo games."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "lz10"; } get { return "lz10"; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
@ -41,8 +53,15 @@ namespace DSDecmp.Formats.Nitro
set { lookAhead = value; } set { lookAhead = value; }
} }
/// <summary>
/// Creates a new instance of the LZ-10 compression format.
/// </summary>
public LZ10() : base(0x10) { } public LZ10() : base(0x10) { }
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args) public override int ParseCompressionOptions(string[] args)
{ {
if (args.Length > 0) if (args.Length > 0)
@ -201,6 +220,11 @@ namespace DSDecmp.Formats.Nitro
#endregion #endregion
#region Original Compress method #region Original Compress method
/// <summary>
/// Compresses the input using the 'original', unoptimized compression algorithm.
/// This algorithm should yield files that are the same as those found in the games.
/// (delegates to the optimized method if LookAhead is set)
/// </summary>
public unsafe override int Compress(Stream instream, long inLength, Stream outstream) public unsafe override int Compress(Stream instream, long inLength, Stream outstream)
{ {
// make sure the decompressed size fits in 3 bytes. // make sure the decompressed size fits in 3 bytes.

View File

@ -11,21 +11,33 @@ namespace DSDecmp.Formats.Nitro
/// </summary> /// </summary>
public sealed class LZ11 : NitroCFormat public sealed class LZ11 : NitroCFormat
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "LZ-11"; } get { return "LZ-11"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "Variant of the LZ-0x10 format to support longer repetitions."; } get { return "Variant of the LZ-0x10 format to support longer repetitions."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "lz11"; } get { return "lz11"; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
@ -42,8 +54,15 @@ namespace DSDecmp.Formats.Nitro
set { lookAhead = value; } set { lookAhead = value; }
} }
/// <summary>
/// Creates a new instance of the LZ-11 compression format.
/// </summary>
public LZ11() : base(0x11) { } public LZ11() : base(0x11) { }
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args) public override int ParseCompressionOptions(string[] args)
{ {
LookAhead = false; LookAhead = false;
@ -57,6 +76,9 @@ namespace DSDecmp.Formats.Nitro
} }
#region Decompression method #region Decompression method
/// <summary>
/// Decompresses the input using the LZ-11 compression scheme.
/// </summary>
public override long Decompress(Stream instream, long inLength, Stream outstream) public override long Decompress(Stream instream, long inLength, Stream outstream)
{ {
#region Format definition in NDSTEK style #region Format definition in NDSTEK style
@ -268,6 +290,11 @@ namespace DSDecmp.Formats.Nitro
#endregion #endregion
#region Original compression method #region Original compression method
/// <summary>
/// Compresses the input using the 'original', unoptimized compression algorithm.
/// This algorithm should yield files that are the same as those found in the games.
/// (delegates to the optimized method if LookAhead is set)
/// </summary>
public unsafe override int Compress(Stream instream, long inLength, Stream outstream) public unsafe override int Compress(Stream instream, long inLength, Stream outstream)
{ {
// make sure the decompressed size fits in 3 bytes. // make sure the decompressed size fits in 3 bytes.

View File

@ -27,11 +27,18 @@ namespace DSDecmp.Formats.Nitro
/// </summary> /// </summary>
protected byte magicByte; protected byte magicByte;
public NitroCFormat(byte magicByte) /// <summary>
/// Creates a new instance of the Nitro Compression Format base class.
/// </summary>
/// <param name="magicByte">The expected first byte of the file for this format.</param>
protected NitroCFormat(byte magicByte)
{ {
this.magicByte = magicByte; this.magicByte = magicByte;
} }
/// <summary>
/// Checks if the first four bytes match the format used in nitro compression formats.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength) public override bool Supports(System.IO.Stream stream, long inLength)
{ {
long startPosition = stream.Position; long startPosition = stream.Position;

View File

@ -11,28 +11,47 @@ namespace DSDecmp.Formats.Nitro
/// </summary> /// </summary>
public sealed class RLE : NitroCFormat public sealed class RLE : NitroCFormat
{ {
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString public override string ShortFormatString
{ {
get { return "RLE"; } get { return "RLE"; }
} }
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description public override string Description
{ {
get { return "Run-Length Encoding used in some modern Nintendo games."; } get { return "Run-Length Encoding used in some modern Nintendo games."; }
} }
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag public override string CompressionFlag
{ {
get { return "rle"; } get { return "rle"; }
} }
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression public override bool SupportsCompression
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Creates a new instance of the RLE compression format.
/// </summary>
public RLE() : base(0x30) { } public RLE() : base(0x30) { }
#region Method: Decompress
/// <summary>
/// Decompresses the input using the RLE compression scheme.
/// </summary>
public override long Decompress(Stream instream, long inLength, Stream outstream) public override long Decompress(Stream instream, long inLength, Stream outstream)
{ {
/* /*
@ -147,7 +166,12 @@ namespace DSDecmp.Formats.Nitro
return decompressedSize; return decompressedSize;
} }
#endregion Decompress
#region Method: Compress
/// <summary>
/// Compresses the input using the RLE compression scheme.
/// </summary>
public override int Compress(Stream instream, long inLength, Stream outstream) public override int Compress(Stream instream, long inLength, Stream outstream)
{ {
@ -273,5 +297,6 @@ namespace DSDecmp.Formats.Nitro
// the total compressed stream length is the compressed data length + the 4-byte header // the total compressed stream length is the compressed data length + the 4-byte header
return compLen + 4; return compLen + 4;
} }
#endregion Compress
} }
} }

View File

@ -169,6 +169,9 @@ namespace DSDecmp
bool decompressed = false; bool decompressed = false;
foreach (CompressionFormat format in formats) foreach (CompressionFormat format in formats)
{ {
if (!format.SupportsDecompression)
continue;
#region try to decompress using the current format #region try to decompress using the current format
using (MemoryStream inStr = new MemoryStream(inputData), using (MemoryStream inStr = new MemoryStream(inputData),
@ -262,8 +265,19 @@ namespace DSDecmp
#endregion Method: Decompress #endregion Method: Decompress
#region Method: Compress #region Method: Compress
/// <summary>
/// (Attempts to) Compress the given input to the given output, using the given format.
/// </summary>
/// <param name="ioArgs">The I/O arguments from the program input.</param>
/// <param name="format">The desired format to compress with.</param>
private static void Compress(string[] ioArgs, CompressionFormat format) private static void Compress(string[] ioArgs, CompressionFormat format)
{ {
if (!format.SupportsCompression)
{
Console.WriteLine("Cannot compress using " + format.ShortFormatString + "; compression is not supported.");
return;
}
string[] inputFiles; string[] inputFiles;
string outputDir; string outputDir;
bool copyErrors; bool copyErrors;
@ -302,7 +316,11 @@ namespace DSDecmp
outStr.WriteTo(output); outStr.WriteTo(output);
} }
compressed = true; compressed = true;
Console.WriteLine(format.ShortFormatString + "-compressed " + input + " to " + outputFile); if (format is CompositeFormat)
Console.Write((format as CompositeFormat).LastUsedCompressFormatString);
else
Console.Write(format.ShortFormatString);
Console.WriteLine("-compressed " + input + " to " + outputFile);
} }
} }
catch (Exception) { } catch (Exception) { }
@ -346,6 +364,7 @@ namespace DSDecmp
/// Parses the IO arguments of the input. /// Parses the IO arguments of the input.
/// </summary> /// </summary>
/// <param name="ioArgs">The arguments to parse.</param> /// <param name="ioArgs">The arguments to parse.</param>
/// <param name="compress">If the arguments are used for compression. If not, decompression is assumed. (used for default output folder name)</param>
/// <param name="inputFiles">The files to handle as input.</param> /// <param name="inputFiles">The files to handle as input.</param>
/// <param name="outputDir">The directory to save the handled files in. If this is null, /// <param name="outputDir">The directory to save the handled files in. If this is null,
/// the files should be overwritten. If this does not exist, it is the output file /// the files should be overwritten. If this does not exist, it is the output file
@ -452,6 +471,12 @@ namespace DSDecmp
} }
#endregion ParseIOArguments #endregion ParseIOArguments
#region Method: GuessExtension(magic, defaultExt)
/// <summary>
/// Guess the extension of a file by looking at the given magic bytes of a file.
/// If they are alphanumeric (without accents), they could indicate the type of file.
/// If no sensible extension could be found from the magic bytes, the given default extension is returned.
/// </summary>
private static string GuessExtension(byte[] magic, string defaultExt) private static string GuessExtension(byte[] magic, string defaultExt)
{ {
string ext = ""; string ext = "";
@ -469,6 +494,7 @@ namespace DSDecmp
return defaultExt; return defaultExt;
return ext; return ext;
} }
#endregion
/// <summary> /// <summary>
/// Copies the source file to the destination path. /// Copies the source file to the destination path.

View File

@ -247,6 +247,66 @@
Nitro Dcompressor instance. Nitro Dcompressor instance.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.NitroCFormat.#ctor(System.Byte)">
<summary>
Creates a new instance of the Nitro Compression Format base class.
</summary>
<param name="magicByte">The expected first byte of the file for this format.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.NitroCFormat.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if the first four bytes match the format used in nitro compression formats.
</summary>
</member>
<member name="T:DSDecmp.Formats.CompositeFormat">
<summary>
A format that is composed of multiple formats.
When compressing, the input is compressed using the best contained format.
When decompressing, all contained formats will try to decompress the file, until one succeeds.
</summary>
</member>
<member name="F:DSDecmp.Formats.CompositeFormat.formats">
<summary>
The actual list of formats this format is somposed of.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.#ctor(System.Collections.Generic.IEnumerable{DSDecmp.CompressionFormat})">
<summary>
Creates a new composite format based on the given sequence of formats.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.#ctor(DSDecmp.CompressionFormat[])">
<summary>
Creates a new composite format based on the given formats.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if any of the contained formats supports the given input.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Attempts to decompress the given input by letting all contained formats
try to decompress the input.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the given input using the contained format that yields the best results in terms of
size reduction.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.ParseCompressionOptions(System.String[])">
<summary>
Handles the compression options for each of the contained compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.CompositeFormat.LastUsedCompressFormatString">
<summary>
Gets the ShortFormatString of the last CompressionFormat that was used to compress input.
</summary>
</member>
<member name="T:DSDecmp.StreamTooShortException"> <member name="T:DSDecmp.StreamTooShortException">
<summary> <summary>
An exception thrown by the compression or decompression function, indicating that the An exception thrown by the compression or decompression function, indicating that the
@ -264,6 +324,29 @@
newer Nintendo consoles and handhelds. newer Nintendo consoles and handhelds.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.#ctor">
<summary>
Creates a new instance of the LZ-11 compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the input using the LZ-11 compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the 'original', unoptimized compression algorithm.
This algorithm should yield files that are the same as those found in the games.
(delegates to the optimized method if LookAhead is set)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.Nitro.LZ11.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary> <summary>
Variation of the original compression method, making use of Dynamic Programming to 'look ahead' Variation of the original compression method, making use of Dynamic Programming to 'look ahead'
@ -284,6 +367,26 @@
<param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the <param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the
corresponding length will never be anything other than 1.</param> corresponding length will never be anything other than 1.</param>
</member> </member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.LookAhead"> <member name="P:DSDecmp.Formats.Nitro.LZ11.LookAhead">
<summary> <summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -297,6 +400,17 @@
newer Nintendo consoles and handhelds. newer Nintendo consoles and handhelds.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.#ctor">
<summary>
Creates a new instance of the LZ-10 compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.Nitro.LZ10.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary> <summary>
Decompress a stream that is compressed in the LZ-10 format. Decompress a stream that is compressed in the LZ-10 format.
@ -305,6 +419,13 @@
<param name="inLength">The length of the input stream.</param> <param name="inLength">The length of the input stream.</param>
<param name="outstream">The output stream, where the decompressed data is written to.</param> <param name="outstream">The output stream, where the decompressed data is written to.</param>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the 'original', unoptimized compression algorithm.
This algorithm should yield files that are the same as those found in the games.
(delegates to the optimized method if LookAhead is set)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.Nitro.LZ10.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary> <summary>
Variation of the original compression method, making use of Dynamic Programming to 'look ahead' Variation of the original compression method, making use of Dynamic Programming to 'look ahead'
@ -324,6 +445,26 @@
<param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the <param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the
corresponding length will never be anything other than 1.</param> corresponding length will never be anything other than 1.</param>
</member> </member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.LookAhead"> <member name="P:DSDecmp.Formats.Nitro.LZ10.LookAhead">
<summary> <summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -337,6 +478,41 @@
newer Nintendo consoles and handhelds. newer Nintendo consoles and handhelds.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.RLE.#ctor">
<summary>
Creates a new instance of the RLE compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.RLE.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the input using the RLE compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.RLE.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the RLE compression scheme.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="T:DSDecmp.Formats.LZOvl"> <member name="T:DSDecmp.Formats.LZOvl">
<summary> <summary>
The LZ-Overlay compression format. Compresses part of the file from end to start. The LZ-Overlay compression format. Compresses part of the file from end to start.
@ -345,6 +521,37 @@
decompressing arm9.bin. This is done automatically if a file is given instead of a stream. decompressing arm9.bin. This is done automatically if a file is given instead of a stream.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.LZOvl.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Supports(System.String)">
<summary>
Checks if this format supports decompressing the given file.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if this format supports decompressing the given input.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Decompress(System.String,System.String)">
<summary>
Decompresses the given input file to the given output file using the LZ-Overlay compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the given input using the LZ-Overlay compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the LZ-Overlay compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.CompressNormal(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.LZOvl.CompressNormal(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary> <summary>
Compresses the given input stream with the LZ-Ovl compression, but compresses _forward_ Compresses the given input stream with the LZ-Ovl compression, but compresses _forward_
@ -382,6 +589,26 @@
<param name="blocklengths">The lengths of the compressed blocks, as gotten from GetOptimalCompressionLengths.</param> <param name="blocklengths">The lengths of the compressed blocks, as gotten from GetOptimalCompressionLengths.</param>
<returns>The 'optimal' length of the compressed part of the file.</returns> <returns>The 'optimal' length of the compressed part of the file.</returns>
</member> </member>
<member name="P:DSDecmp.Formats.LZOvl.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.LookAhead"> <member name="P:DSDecmp.Formats.LZOvl.LookAhead">
<summary> <summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -389,16 +616,19 @@
implementation. implementation.
</summary> </summary>
</member> </member>
<member name="T:DSDecmp.NewProgram.Formats"> <member name="M:DSDecmp.NewestProgram.Compress(System.String[],DSDecmp.CompressionFormat)">
<summary> <summary>
The formats allowed when compressing a file. (Attempts to) Compress the given input to the given output, using the given format.
</summary> </summary>
<param name="ioArgs">The I/O arguments from the program input.</param>
<param name="format">The desired format to compress with.</param>
</member> </member>
<member name="M:DSDecmp.NewestProgram.ParseIOArguments(System.String[],System.Boolean,System.String[]@,System.String@,System.Boolean@)"> <member name="M:DSDecmp.NewestProgram.ParseIOArguments(System.String[],System.Boolean,System.String[]@,System.String@,System.Boolean@)">
<summary> <summary>
Parses the IO arguments of the input. Parses the IO arguments of the input.
</summary> </summary>
<param name="ioArgs">The arguments to parse.</param> <param name="ioArgs">The arguments to parse.</param>
<param name="compress">If the arguments are used for compression. If not, decompression is assumed. (used for default output folder name)</param>
<param name="inputFiles">The files to handle as input.</param> <param name="inputFiles">The files to handle as input.</param>
<param name="outputDir">The directory to save the handled files in. If this is null, <param name="outputDir">The directory to save the handled files in. If this is null,
the files should be overwritten. If this does not exist, it is the output file the files should be overwritten. If this does not exist, it is the output file
@ -406,6 +636,13 @@
<param name="copyErrors">If files that cannot be handled (properly) should be copied to the output directory.</param> <param name="copyErrors">If files that cannot be handled (properly) should be copied to the output directory.</param>
<returns>True iff parsing of the arguments succeeded.</returns> <returns>True iff parsing of the arguments succeeded.</returns>
</member> </member>
<member name="M:DSDecmp.NewestProgram.GuessExtension(System.Byte[],System.String)">
<summary>
Guess the extension of a file by looking at the given magic bytes of a file.
If they are alphanumeric (without accents), they could indicate the type of file.
If no sensible extension could be found from the magic bytes, the given default extension is returned.
</summary>
</member>
<member name="M:DSDecmp.NewestProgram.Copy(System.String,System.String)"> <member name="M:DSDecmp.NewestProgram.Copy(System.String,System.String)">
<summary> <summary>
Copies the source file to the destination path. Copies the source file to the destination path.
@ -504,12 +741,95 @@
Gets the number of items in this queue. Gets the number of items in this queue.
</summary> </summary>
</member> </member>
<member name="T:DSDecmp.Formats.Nitro.CompositeGBAFormat">
<summary>
A composite format with all formats supported natively by the GBA.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.CompositeGBAFormat.#ctor">
<summary>
Creates a new instance of the format composed of all native GBA compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.CompositeNDSFormat">
<summary>
A composite format with all formats supported natively by the NDS (but not LZ-Overlay)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.CompositeNDSFormat.#ctor">
<summary>
Creates a new instance of the format composed of all native NDS compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman"> <member name="T:DSDecmp.Formats.Nitro.Huffman">
<summary> <summary>
Compressor and decompressor for the Huffman format used in many of the games for the Compressor and decompressor for the Huffman format used in many of the games for the
newer Nintendo consoles and handhelds. newer Nintendo consoles and handhelds.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.#ctor(DSDecmp.Formats.Nitro.Huffman.BlockSize)">
<summary>
Creates a new generic instance of the Huffman compression format.
</summary>
<param name="blockSize">The block size used.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the given stream, writing the decompressed data to the given output stream.
Assumes <code>Supports(instream)</code> returns <code>true</code>.
After this call, the input stream will be positioned at the end of the compressed stream,
or at the initial position + <code>inLength</code>, whichever comes first.
</summary>
<param name="instream">The stream to decompress. At the end of this method, the position
of this stream is directly after the compressed data.</param>
<param name="inLength">The length of the input data. Not necessarily all of the
input data may be read (if there is padding, for example), however never more than
this number of bytes is read from the input stream.</param>
<param name="outstream">The stream to write the decompressed data to.</param>
<returns>The length of the output data.</returns>
<exception cref="T:DSDecmp.NotEnoughDataException">When the given length of the input data
is not enough to properly decompress the input.</exception>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.GetLowest(DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},System.Int32@)"> <member name="M:DSDecmp.Formats.Nitro.Huffman.GetLowest(DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},System.Int32@)">
<summary> <summary>
Gets the tree node with the lowest priority (frequency) from the leaf and node queues. Gets the tree node with the lowest priority (frequency) from the leaf and node queues.
@ -521,6 +841,26 @@
Sets the block size used when using the Huffman format to compress. Sets the block size used when using the Huffman format to compress.
</summary> </summary>
</member> </member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.SupportsCompression">
<summary>
Gets if this format supports compression. Always returns true.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman.BlockSize">
<summary>
The possible data sizes used in Huffman compression formats on the GBA/NDS.
</summary>
</member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.BlockSize.FOURBIT">
<summary>
Each data block is four bits long.
</summary>
</member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.BlockSize.EIGHTBIT">
<summary>
Each data block is eight bits long.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode"> <member name="T:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode">
<summary> <summary>
A single node in a Huffman tree. A single node in a Huffman tree.
@ -551,6 +891,12 @@
The child of this node at side 1 The child of this node at side 1
</summary> </summary>
</member> </member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.index">
<summary>
The index of this node in the array for building the proper ordering.
If -1, this node has not yet been placed in the array.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.#ctor(System.Byte,System.Boolean,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode)"> <member name="M:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.#ctor(System.Byte,System.Boolean,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode)">
<summary> <summary>
Manually creates a new node for a huffman tree. Manually creates a new node for a huffman tree.
@ -572,6 +918,11 @@
<param name="maxStreamPos">The indicated end of the huffman tree. If the stream is past <param name="maxStreamPos">The indicated end of the huffman tree. If the stream is past
this position, the tree is invalid.</param> this position, the tree is invalid.</param>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.ToString">
<summary>
Generates and returns a string-representation of the huffman tree starting at this node.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.Data"> <member name="P:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.Data">
<summary> <summary>
The data contained in this node. May not mean anything when <code>isData == false</code>. The data contained in this node. May not mean anything when <code>isData == false</code>.
@ -620,9 +971,14 @@
Calculates the size of the sub-tree with this node as root. Calculates the size of the sub-tree with this node as root.
</summary> </summary>
</member> </member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.PreOrderTraversal"> <member name="T:DSDecmp.Formats.Nitro.Huffman4">
<summary> <summary>
Returns a seuqnce over the nodes of the sub-tree with this node as root in a pre-order fashion. (Root-Left-Right) The Huffman compression scheme using 4-bit data blocks.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman4.#ctor">
<summary>
Creates a new instance of the 4-bit Huffman compression format.
</summary> </summary>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.Huffman4.Compress(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.Nitro.Huffman4.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
@ -634,6 +990,31 @@
<param name="outstream">The stream to write the decompressed data to.</param> <param name="outstream">The stream to write the decompressed data to.</param>
<returns>The size of the decompressed data.</returns> <returns>The size of the decompressed data.</returns>
</member> </member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman8">
<summary>
The Huffman compression scheme using 8-bit data blocks.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.#ctor">
<summary>
Creates a new instance of the 4-bit Huffman compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.Compress(System.IO.Stream,System.Int64,System.IO.Stream)"> <member name="M:DSDecmp.Formats.Nitro.Huffman8.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary> <summary>
Applies Huffman compression with a datablock size of 8 bits. Applies Huffman compression with a datablock size of 8 bits.
@ -643,5 +1024,69 @@
<param name="outstream">The stream to write the decompressed data to.</param> <param name="outstream">The stream to write the decompressed data to.</param>
<returns>The size of the decompressed data.</returns> <returns>The size of the decompressed data.</returns>
</member> </member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.Insert(DSDecmp.Formats.Nitro.Huffman.HuffTreeNode,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode[],System.Int32)">
<summary>
Inserts the given node into the given array, in such a location that
the offset to both of its children is at most the given maximum, and as large as possible.
In order to do this, the contents of the array may be shifted to the right.
</summary>
<param name="node">The node to insert.</param>
<param name="array">The array to insert the node in.</param>
<param name="maxOffset">The maximum offset between parent and children.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.ShiftRight(DSDecmp.Formats.Nitro.Huffman.HuffTreeNode[],System.Int32,System.Int32)">
<summary>
Shifts the node at the given index one to the right.
If the distance between parent and child becomes too large due to this shift, the parent is shifted as well.
</summary>
<param name="array">The array to shift the node in.</param>
<param name="idx">The index of the node to shift.</param>
<param name="maxOffset">The maximum distance between parent and children.</param>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.HuffmanAny">
<summary>
Composite compression format representing both Huffman compression schemes.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.HuffmanAny.#ctor">
<summary>
Creates a new instance of the general Huffman compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.SupportsCompression">
<summary>
Gets if this format supports compression. Always returns true.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
</members> </members>
</doc> </doc>

Binary file not shown.

Binary file not shown.