diff --git a/src/ox/fs/filestore.hpp b/src/ox/fs/filestore.hpp index 63093c0dc..6f3dbe39b 100644 --- a/src/ox/fs/filestore.hpp +++ b/src/ox/fs/filestore.hpp @@ -12,10 +12,11 @@ namespace ox { namespace fs { -template +template struct FileStoreHeader { + typedef InodeId InodeId_t; typedef FsT FsSize_t; - const static auto VERSION = 2; + const static auto VERSION = 4; uint16_t version; uint16_t fsType; @@ -28,7 +29,7 @@ template class FileStore { public: - typedef uint16_t InodeId_t; + typedef typename Header::InodeId_t InodeId_t; typedef typename Header::FsSize_t FsSize_t; const static auto VERSION = Header::VERSION; @@ -597,9 +598,9 @@ uint8_t *FileStore
::format(uint8_t *buffer, typename Header::FsSize_t si return (uint8_t*) buffer; } -typedef FileStore> FileStore16; -typedef FileStore> FileStore32; -typedef FileStore> FileStore64; +typedef FileStore> FileStore16; +typedef FileStore> FileStore32; +typedef FileStore> FileStore64; } } diff --git a/src/ox/fs/filesystem.cpp b/src/ox/fs/filesystem.cpp index 23040f868..b4a3a758a 100644 --- a/src/ox/fs/filesystem.cpp +++ b/src/ox/fs/filesystem.cpp @@ -11,19 +11,26 @@ namespace ox { namespace fs { FileSystem *createFileSystem(void *buff) { + auto version = ((FileStore16*) buff)->version(); auto type = ((FileStore16*) buff)->fsType(); FileSystem *fs = nullptr; - switch (type) { - case ox::fs::OxFS_16: - fs = new FileSystem16(buff); - break; - case ox::fs::OxFS_32: - fs = new FileSystem32(buff); - break; - case ox::fs::OxFS_64: - fs = new FileSystem64(buff); + switch (version) { + case 4: + switch (type) { + case ox::fs::OxFS_16: + fs = new FileSystem16(buff); + break; + case ox::fs::OxFS_32: + fs = new FileSystem32(buff); + break; + case ox::fs::OxFS_64: + fs = new FileSystem64(buff); + break; + } break; + default: + return nullptr; } return fs; diff --git a/src/ox/fs/oxfstool.cpp b/src/ox/fs/oxfstool.cpp index 972efa39e..ee9ee5295 100644 --- a/src/ox/fs/oxfstool.cpp +++ b/src/ox/fs/oxfstool.cpp @@ -236,7 +236,7 @@ int write(int argc, char **args, bool expand) { free(srcBuff); } else { err = 1; - fprintf(stderr, "Could not load source file.\n"); + fprintf(stderr, "Could not load source file: %s.\n", srcPath); } }