UNPKG

zelda64

Version:

Zelda64.js is a library that can compress, decompress and patch Nintendo 64 Zelda game ROMs.

37 lines (36 loc) 1.29 kB
/** * The Decompressor class implements the algorithm for inflating a Nintendo 64 Zelda ROM. */ export default class Decompressor { private readonly _buffer; private readonly _in; /** * Constructs a Decompressor instance * @param buffer Instance of ArrayBuffer containing the input ROM. */ constructor(buffer: ArrayBuffer); /** * Writes a DMA record to the output buffer. * @param out A Writer instance to write the resulting DMA record to. * @param index The target index in the output DMA table. * @param record The DMA record to write. * @private */ private _writeDmaRecord; /** * Inflates the input ROM and returns the decompressed ROM buffer. * @returns ArrayBuffer containing the decompressed ROM. */ inflate(): { data: ArrayBuffer; exclusions: number[]; }; /** * Performs decompression on the source data and writes the decompressed data to the destination buffer. * @param src Array starting at the source data. * @param dst Array starting at the destination where decompressed data should be written. * @param size The size of the decompressed data. * @private */ private static _decompress; }