Skip to content

Commit

Permalink
Resources|libdoomsday: Read Snowberry metadata, nested data files, au…
Browse files Browse the repository at this point in the history
…toloading

Read the Snowberry metadata (if available) when generating packages out
of classic data files and resource packs. In case the folder structure
implies autoloading, register the appropriate load dependencies into
the packages. This will ultimately make the old FS1 autoload code
obsolete.

If metadata is not available, the file names are checked for suffixes
that look like version numbers.
  • Loading branch information
skyjake committed Jun 4, 2016
1 parent 5f74736 commit b7792c6
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 35 deletions.
Expand Up @@ -64,6 +64,11 @@ class LIBDOOMSDAY_PUBLIC DataBundle : public de::IByteArray
de::File const &asFile() const;
de::File const &sourceFile() const;

/**
* Identifier of the package representing this data bundle (after being identified).
*/
de::String packageId() const;

/**
* Generates appropriate packages according to the contents of the data bundle.
*/
Expand Down
Expand Up @@ -2,7 +2,8 @@
#
# This file contains the identification criteria for common known data
# files from the original games. Each data file is represented by a
# package with the given identifier and version.
# package with the given identifier and version. At least two of the
# criteria must match for successful identification.
#
# When Doomsday locates a WAD file, the lump directory CRC32 and other
# information is printed in the log. These can be used when adding new
Expand Down
8 changes: 8 additions & 0 deletions doomsday/apps/libdoomsday/src/resource/bundles.cpp
Expand Up @@ -31,6 +31,8 @@ using namespace de;

namespace res {

static int const MATCH_MINIMUM_SCORE = 2;

DENG2_PIMPL(Bundles)
, DENG2_OBSERVES(FileIndex, Addition)
{
Expand Down Expand Up @@ -260,6 +262,12 @@ Bundles::MatchResult Bundles::match(DataBundle const &bundle) const
}
}

if (match.bestScore < MATCH_MINIMUM_SCORE)
{
// No go.
return MatchResult();
}

LOG_RES_VERBOSE("Matched: %s %s %s score: %i")
<< match.packageId
<< match.packageVersion.asText()
Expand Down

0 comments on commit b7792c6

Please sign in to comment.