Jazz2::Compatibility::AssetConverter class

Converts original Jazz Jackrabbit 2 data into the formats the game loads.

The same conversion the game performs on its first run, factored out so it can also be driven offline by the AssetPacker tool. Everything is expressed in terms of an input and an output directory, so it does not depend on the resource cache (and through it, on the renderer).

Public types

struct ConversionOptions
What is converted out of the source directory, and what of it is carried over.
enum class Result { Success, CannotWriteTarget, UnsupportedVersion }
Outcome of converting the source assets.

Public static variables

static StringView SourcePackage constexpr
Name of the package the first-run conversion writes its sprites and sounds into.
static StringView PrebakedPackage constexpr
Name of the same package in a content tree prepared ahead of time.

Public static functions

static auto ConvertSourceAssets(StringView animsPath, StringView sourcePath, StringView targetPath, JJ2Version& version, StringView packageName = SourcePackage) -> Result
Converts.
static auto ConvertSourceAssets(StringView animsPath, StringView sourcePath, Death::IO::PakWriter& pakWriter, JJ2Version& version) -> Result
Converts the same into a package that is already open, and is not finalized here.
static void ConvertLevels(StringView sourcePath, StringView targetPath, bool recreateAll)
Converts every episode, level and used tileset into the output directory.
static void ConvertLevels(StringView sourcePath, StringView targetPath, bool recreateAll, const ConversionOptions& options)
Converts the episodes, levels and used tilesets that options allow into the output directory.

Enum documentation

enum class Jazz2::Compatibility::AssetConverter::Result

Outcome of converting the source assets.

Enumerators
Success

Everything was converted

CannotWriteTarget

The output .pak file could not be opened for writing

UnsupportedVersion

The provided Jazz Jackrabbit 2 version is not supported

Function documentation

static Result Jazz2::Compatibility::AssetConverter::ConvertSourceAssets(StringView animsPath, StringView sourcePath, StringView targetPath, JJ2Version& version, StringView packageName = SourcePackage)

Converts.

Parameters
animsPath
sourcePath
targetPath
version
packageName Which package to write, SourcePackage or PrebakedPackage

Anims.j2a (and Data.j2d, if present) into a package

static Result Jazz2::Compatibility::AssetConverter::ConvertSourceAssets(StringView animsPath, StringView sourcePath, Death::IO::PakWriter& pakWriter, JJ2Version& version)

Converts the same into a package that is already open, and is not finalized here.

For a caller that has more to put in the same package — AssetPacker embeds the game's own assets alongside the converted ones, after these, so that what the original data provides is what a path present in both resolves to.

Variable documentation

static StringView Jazz2::Compatibility::AssetConverter::PrebakedPackage constexpr

Name of the same package in a content tree prepared ahead of time.

A tree prepared by AssetPacker is loaded instead of being converted, and this is how the game tells one apart from a Cache it built itself: the name is the marker, so it is what a prepared tree gets instead of SourcePackage. See ContentResolver::IsContentPrebaked().