@@ -4,7 +4,7 @@
WRPG_PIAF_MAGIC_HEADER : "WRPGPIAF" <=> 8 bytes (not \0 terminated)
WRPG_PIAF_HEADER_CHECKSUM : unsigned int <=> 4 bytes (This checksum covers the version, number of files and the data size).
WRPG_PIAF_FILETABLE_CHECKSUM : unsigned int <=> 4 bytes (This checksum covers the whole filetable data part).
-WRPG_PIAF_VERSION : unsigned int <=> 4 bytes (Stored in this form : 0xAABBCCDDD, where A = major version, B = minor version, C = hotfix)
+WRPG_PIAF_VERSION : unsigned int <=> 4 bytes (Stored in this form : 0xAABBCCDD, where A = major version, B = minor version, C = hotfix)
WRPG_PIAF_NB_FILES : unsigned int <=> 4 bytes
WRPG_PIAF_DATA_SIZE : unsigned int <=> 4 bytes
<padding> : <filler> <=> 4 bytes
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
// Archive arc(Quirks::solve_absolute_path("samples/one_file.wrf"));
Archive arc(Quirks::solve_absolute_path("data/out.wrf").get());
Texture tex(arc.get("ov.png"));
-
+ printf("%s\n", arc.get("test.txt").get());
uint16_t dungeonTest[] = {
21, 21, 1, 1, 1, 1, 21, 22, 21, 22, 21, 22, 21, 21, 1, 22, 21,
1, 22, 22, 22, 1, 21, 2, 3, 3, 3, 3, 3, 4, 21, 1, 22, 21,
@@ -6,6 +6,7 @@
#include "Quirks.h"
using tinystl::string;
+using WalrusRPG::PIAF::ARCHIVE_VERSION;
using WalrusRPG::PIAF::Archive;
using WalrusRPG::PIAF::File;
using WalrusRPG::PIAF::FileType;
@@ -133,13 +134,13 @@ Archive::Archive(const char *filepath) : file(nullptr), entries(nullptr), files_
// TODO : version checking
version = read_big_endian_value<uint32_t>(&header_container[16]);
- /* if (version != CURRENT_PIAF_VERSION)
- * {
- * exception up;
- * throw up; // haha
- * }
- */
+ if (version != ARCHIVE_VERSION)
+ {
+ // std::exception up;
+ // throw up; // haha
+ }
+
// At this point, the archive header looks unaltered and we finally can parse
// and load the header.
@@ -199,7 +200,6 @@ Archive::~Archive()
if (entries != nullptr)
delete[] entries;
- printf("Delete\n");
if(files_data != nullptr)
{
for(unsigned i = 0; i < nb_files; i++)
@@ -9,6 +9,7 @@ namespace WalrusRPG
namespace PIAF
+ constexpr uint32_t ARCHIVE_VERSION = 0x01000000;
enum FileType : uint32_t
UNKNOWN,