SpelunkyWad 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SpelunkyWad --version 2.0.0                
NuGet\Install-Package SpelunkyWad -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpelunkyWad" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpelunkyWad --version 2.0.0                
#r "nuget: SpelunkyWad, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SpelunkyWad as a Cake Addin
#addin nuget:?package=SpelunkyWad&version=2.0.0

// Install SpelunkyWad as a Cake Tool
#tool nuget:?package=SpelunkyWad&version=2.0.0                

SpelunkyWad

SpelunkyWad is a C# library for reading from and writing to WAD and WIX files in the Spelunky format.

Overview

Spelunky stores the majority of its game data within WAD and WIX files. WAD files are uncompressed binary files with each entry packed next to each other. WIX files are uncompressed text files with each entry listed with its name, offset, and length within the corresponding WAD file. WIX files can contain named groups and each entry must belong to a particular group.

The contents of WAD and WIX files can be freely created, updated and deleted. Groups can be added and removed, and entries can be added and removed as well. An individual entry provides its data through a stream property allowing for flexibility for manipulating said data.

Included is also a command-line application which can be used to perform a few basic operations on WAD and WIX files, namely the creation of custom archives and the extraction of existing archives.

Example

Reading an archive from a WAD file and a WIX file.

using (var wadStream = new FileStream("archive.wad", FileMode.Open))
using (var wixStream = new FileStream("archive.wix", FileMode.Open))
{
	var archive = ArchiveReader.Read(wadStream, wixStream);

	foreach (var group in archive.Groups)
	{
		// Process the group...

		foreach (var entry in group.Entries)
		{
			// Process the entry...
		}
	}
}

Writing an archive to a WAD file and a WIX file.


var archive = new Archive();

// Add groups and entries...

using (var wadStream = new FileStream("archive.wad", FileMode.Create))
using (var wixStream = new FileStream("archive.wix", FileMode.Create))
{
	ArchiveWriter.Write(archive, wadStream, wixStream);
}

Notes

Entries are not loaded into memory when an archive is read. Instead, their streams point towards the specific region in the WAD file which encapsulates their contents. Due to this, it is important to keep the underlying WAD and WIX streams open for the duration the archive is being used. It is also important to ensure that if the same streams are used for both a read operation and write operation, that both are seeked to the beginning before the write operation.

As a side effect, the initial stream for each entry will only support read operations and cannot be written to. This is to avoid inadvertently modifying the underlying streams outside the context of a write operation. In order to perform an in-place replacement of the contents of an entry, replace the stream instance entirely.

In some official Spelunky archives, entries are occasionally duplicated in different groups but with the same name as well as same offset and length. While the library does support reading duplicate entries, it will not write duplicate entries; each entry will be written separately regardless if the data is duplicated.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 299 12/28/2021
2.0.0 263 12/23/2021