Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resources|libdoomsday: Identifying data files and indexing WAD files
DoomsdayApp checks all the configured and known locations for WAD files and populates the /local/wads folder. Currently this is done in addition to the client's FS1-based code for doing the same task (that is slated to be retired later). DataBundle checks the indexed data files (WADs and other formats) against the databundles.dei registry, which defines the criteria for generating packages out of known files. res::LumpDirectory is a new class in libdoomsday for parsing a WAD file's lump directory and performing basic lookup operations in it.
- Loading branch information
Showing
20 changed files
with
1,249 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
doomsday/apps/libdoomsday/include/doomsday/resource/bundles.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** @file bundles.h Data bundle indexing. | ||
* | ||
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef LIBDOOMSDAY_RESOURCE_BUNDLES_H | ||
#define LIBDOOMSDAY_RESOURCE_BUNDLES_H | ||
|
||
#include "databundle.h" | ||
#include <de/Info> | ||
|
||
namespace res { | ||
|
||
/** | ||
* Index for data bundles. | ||
*/ | ||
class Bundles | ||
{ | ||
public: | ||
typedef QList<de::Info::BlockElement const *> BlockElements; | ||
|
||
DENG2_ERROR(InvalidError); | ||
|
||
public: | ||
Bundles(); | ||
|
||
/** | ||
* Returns the collection of information for identifying known data files. | ||
* @return Info document. | ||
*/ | ||
de::Info const &identityRegistry() const; | ||
|
||
BlockElements formatEntries(DataBundle::Format format) const; | ||
|
||
void identify(); | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
} // namespace res | ||
|
||
#endif // LIBDOOMSDAY_RESOURCE_BUNDLES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
doomsday/apps/libdoomsday/include/doomsday/resource/lumpdirectory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** @file lumpdirectory.h | ||
* | ||
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef LIBDOOMSDAY_RESOURCE_LUMPDIRECTORY_H | ||
#define LIBDOOMSDAY_RESOURCE_LUMPDIRECTORY_H | ||
|
||
#include "../libdoomsday.h" | ||
#include <de/File> | ||
|
||
namespace res { | ||
|
||
/** | ||
* Directory of WAD lumps. | ||
* | ||
* Utility for accessing the lump directory of a WAD file. The information is | ||
* presented as it exists in the file without any modifications. | ||
*/ | ||
class LIBDOOMSDAY_PUBLIC LumpDirectory | ||
{ | ||
public: | ||
enum Type { Invalid, Iwad, Pwad }; | ||
|
||
struct Entry | ||
{ | ||
de::Block name; ///< Name of the lump. | ||
de::duint32 offset; ///< Position in the file, in bytes. | ||
de::duint32 size; ///< Size of the lump. | ||
}; | ||
|
||
typedef de::dsize Pos; | ||
|
||
DENG2_ERROR(OffsetError); | ||
|
||
public: | ||
/** | ||
* Reads the lump directory from a byte array. | ||
* | ||
* @param wadData Data of a WAD file. No reference to the data is kept | ||
* afterwards. | ||
*/ | ||
LumpDirectory(de::IByteArray const &wadData); | ||
|
||
bool isValid() const; | ||
|
||
Type type() const; | ||
|
||
/** | ||
* Returns the number of lumps. | ||
*/ | ||
Pos count() const; | ||
|
||
Entry const &entry(Pos pos) const; | ||
|
||
/** | ||
* Returns the CRC32 of the directory entries. This is not influenced by | ||
* the contents of the lumps. | ||
*/ | ||
de::duint32 crc32() const; | ||
|
||
bool has(de::Block const &lumpName) const; | ||
|
||
de::duint32 lumpSize(de::Block const &lumpName) const; | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
} // namespace res | ||
|
||
#endif // LIBDOOMSDAY_RESOURCE_LUMPDIRECTORY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.