diff --git a/src/Archive/Formats/BSPArchive.h b/src/Archive/Formats/BSPArchive.h deleted file mode 100644 index 549a0cf4b..000000000 --- a/src/Archive/Formats/BSPArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class BSPArchive : public Archive -{ -public: - BSPArchive() : Archive("bsp") {} - ~BSPArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isBSPArchive(const MemChunk& mc); - static bool isBSPArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/DatArchive.h b/src/Archive/Formats/DatArchive.h deleted file mode 100644 index 88dedda18..000000000 --- a/src/Archive/Formats/DatArchive.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class DatArchive : public TreelessArchive -{ -public: - DatArchive() : TreelessArchive("dat") {} - ~DatArchive() override = default; - - // Dat specific - void updateNamespaces(); - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Entry addition/removal - shared_ptr addEntry( - shared_ptr entry, - unsigned position = 0xFFFFFFFF, - ArchiveDir* dir = nullptr) override; - shared_ptr addEntry(shared_ptr entry, string_view add_namespace) override; - bool removeEntry(ArchiveEntry* entry, bool set_deleted = true) override; - - // Entry moving - bool swapEntries(ArchiveEntry* entry1, ArchiveEntry* entry2) override; - bool moveEntry(ArchiveEntry* entry, unsigned position = 0xFFFFFFFF, ArchiveDir* dir = nullptr) override; - - // Entry modification - bool renameEntry(ArchiveEntry* entry, string_view name, bool force = false) override; - - // Detection - string detectNamespace(unsigned index, ArchiveDir* dir = nullptr) const override; - string detectNamespace(ArchiveEntry* entry) const override; - - static bool isDatArchive(const MemChunk& mc); - static bool isDatArchive(const string& filename); - -private: - int sprites_[2]; - int flats_[2]; - int walls_[2]; -}; -} // namespace slade diff --git a/src/Archive/Formats/GobArchive.h b/src/Archive/Formats/GobArchive.h deleted file mode 100644 index 71c16c2ee..000000000 --- a/src/Archive/Formats/GobArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class GobArchive : public TreelessArchive -{ -public: - GobArchive() : TreelessArchive("gob") {} - ~GobArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isGobArchive(const MemChunk& mc); - static bool isGobArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/GrpArchive.h b/src/Archive/Formats/GrpArchive.h deleted file mode 100644 index c89e05ec3..000000000 --- a/src/Archive/Formats/GrpArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class GrpArchive : public TreelessArchive -{ -public: - GrpArchive() : TreelessArchive("grp") {} - ~GrpArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isGrpArchive(const MemChunk& mc); - static bool isGrpArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/HogArchive.h b/src/Archive/Formats/HogArchive.h deleted file mode 100644 index 9de5b258f..000000000 --- a/src/Archive/Formats/HogArchive.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class HogArchive : public TreelessArchive -{ -public: - HogArchive() : TreelessArchive("hog") {} - ~HogArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Entry addition/removal - shared_ptr addEntry( - shared_ptr entry, - unsigned position = 0xFFFFFFFF, - ArchiveDir* dir = nullptr) override; - shared_ptr addEntry(shared_ptr entry, string_view add_namespace) override; - - // Entry modification - bool renameEntry(ArchiveEntry* entry, string_view name, bool force = false) override; - - // Static functions - static bool isHogArchive(const MemChunk& mc); - static bool isHogArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/LfdArchive.h b/src/Archive/Formats/LfdArchive.h deleted file mode 100644 index 6b205b00f..000000000 --- a/src/Archive/Formats/LfdArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class LfdArchive : public TreelessArchive -{ -public: - LfdArchive() : TreelessArchive("lfd") {} - ~LfdArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isLfdArchive(const MemChunk& mc); - static bool isLfdArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/LibArchive.h b/src/Archive/Formats/LibArchive.h deleted file mode 100644 index 444355fe6..000000000 --- a/src/Archive/Formats/LibArchive.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class LibArchive : public TreelessArchive -{ -public: - LibArchive() : TreelessArchive("lib") {} - ~LibArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - static bool isLibArchive(const MemChunk& mc); - static bool isLibArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/PakArchive.h b/src/Archive/Formats/PakArchive.h deleted file mode 100644 index 81247b7f7..000000000 --- a/src/Archive/Formats/PakArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class PakArchive : public Archive -{ -public: - PakArchive() : Archive("pak") {} - ~PakArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isPakArchive(const MemChunk& mc); - static bool isPakArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/ResArchive.h b/src/Archive/Formats/ResArchive.h deleted file mode 100644 index fe3c4d1fb..000000000 --- a/src/Archive/Formats/ResArchive.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class ResArchive : public Archive -{ -public: - ResArchive() : Archive("res") {} - ~ResArchive() override = default; - - // Opening/writing - bool readDirectory(const MemChunk& mc, size_t dir_offset, size_t num_lumps, shared_ptr parent); - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isResArchive(const MemChunk& mc); - static bool isResArchive(const MemChunk& mc, size_t& d_o, size_t& n_l); - static bool isResArchive(const string& filename); - -private: - static constexpr int RESDIRENTRYSIZE = 39; // The size of a res entry in the res directory -}; -} // namespace slade diff --git a/src/Archive/Formats/RffArchive.h b/src/Archive/Formats/RffArchive.h deleted file mode 100644 index 163aff197..000000000 --- a/src/Archive/Formats/RffArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class RffArchive : public TreelessArchive -{ -public: - RffArchive() : TreelessArchive("rff") {} - ~RffArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isRffArchive(const MemChunk& mc); - static bool isRffArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/SiNArchive.h b/src/Archive/Formats/SiNArchive.h deleted file mode 100644 index 3c3da98e8..000000000 --- a/src/Archive/Formats/SiNArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class SiNArchive : public Archive -{ -public: - SiNArchive() : Archive("sin") {} - ~SiNArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isSiNArchive(const MemChunk& mc); - static bool isSiNArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/TarArchive.h b/src/Archive/Formats/TarArchive.h deleted file mode 100644 index 920d1ac8c..000000000 --- a/src/Archive/Formats/TarArchive.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class TarArchive : public Archive -{ -public: - TarArchive() : Archive("tar") {} - ~TarArchive() override = default; - - // Opening/writing - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Static functions - static bool isTarArchive(const MemChunk& mc); - static bool isTarArchive(const string& filename); -}; -} // namespace slade diff --git a/src/Archive/Formats/WadArchive.h b/src/Archive/Formats/WadArchive.h deleted file mode 100644 index f7d61ffe8..000000000 --- a/src/Archive/Formats/WadArchive.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class WadArchive : public TreelessArchive -{ -public: - WadArchive() : TreelessArchive("wad") {} - ~WadArchive() override = default; - - // Wad specific - bool isIWAD() const { return iwad_; } - bool isWritable() override; - void updateNamespaces(); - - // Opening - bool open(const MemChunk& mc, bool detect_types) override; - - // Writing/Saving - bool write(MemChunk& mc) override; // Write to MemChunk - bool write(string_view filename) override; // Write to File - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Entry addition/removal - shared_ptr addEntry( - shared_ptr entry, - unsigned position = 0xFFFFFFFF, - ArchiveDir* dir = nullptr) override; - shared_ptr addEntry(shared_ptr entry, string_view add_namespace) override; - bool removeEntry(ArchiveEntry* entry, bool set_deleted = true) override; - - // Entry modification - bool renameEntry(ArchiveEntry* entry, string_view name, bool force = false) override; - - // Entry moving - bool swapEntries(ArchiveEntry* entry1, ArchiveEntry* entry2) override; - bool moveEntry(ArchiveEntry* entry, unsigned position = 0xFFFFFFFF, ArchiveDir* dir = nullptr) override; - - // Detection - MapDesc mapDesc(ArchiveEntry* maphead) const override; - vector detectMaps() const override; - string detectNamespace(ArchiveEntry* entry) const override; - string detectNamespace(unsigned index, ArchiveDir* dir = nullptr) const override; - void detectIncludes(); - bool hasFlatHack() override; - - // Search - ArchiveEntry* findFirst(SearchOptions& options) const override; - ArchiveEntry* findLast(SearchOptions& options) const override; - vector findAll(SearchOptions& options) const override; - - // Static functions - static bool isWadArchive(const MemChunk& mc); - static bool isWadArchive(const string& filename); - - static bool exportEntriesAsWad(string_view filename, vector entries) - { - WadArchive wad; - - // Add entries to wad archive - for (size_t a = 0; a < entries.size(); a++) - { - // Add each entry to the wad archive - wad.addEntry(std::make_shared(*entries[a]), entries.size(), nullptr); - } - - return wad.save(filename); - } - - friend class WadJArchive; - -private: - // Struct to hold namespace info - struct NSPair - { - ArchiveEntry* start; // eg. P_START - size_t start_index; - ArchiveEntry* end; // eg. P_END - size_t end_index; - string name; // eg. "P" (since P or PP is a special case will be set to "patches") - - NSPair(ArchiveEntry* start, ArchiveEntry* end) : start{ start }, start_index{ 0 }, end{ end }, end_index{ 0 } {} - }; - - bool iwad_ = false; - vector namespaces_; -}; -} // namespace slade diff --git a/src/Archive/Formats/WolfArchive.h b/src/Archive/Formats/WolfArchive.h deleted file mode 100644 index 064634ca9..000000000 --- a/src/Archive/Formats/WolfArchive.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class WolfArchive : public TreelessArchive -{ -public: - WolfArchive() : TreelessArchive("wolf") {} - ~WolfArchive() override = default; - - // Opening - bool open(string_view filename, bool detect_types) override; // Open from File - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - - bool openAudio(MemChunk& head, const MemChunk& data); - bool openGraph(const MemChunk& head, const MemChunk& data, MemChunk& dict, bool detect_types); - bool openMaps(MemChunk& head, const MemChunk& data, bool detect_types); - - // Writing/Saving - bool write(MemChunk& mc) override; // Write to MemChunk - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Entry addition/removal - shared_ptr addEntry( - shared_ptr entry, - unsigned position = 0xFFFFFFFF, - ArchiveDir* dir = nullptr) override; - shared_ptr addEntry(shared_ptr entry, string_view add_namespace) override; - - // Entry modification - bool renameEntry(ArchiveEntry* entry, string_view name, bool force = false) override { return false; } - - static bool isWolfArchive(const MemChunk& mc); - static bool isWolfArchive(const string& filename); - -private: - struct WolfHandle - { - uint32_t offset; - uint16_t size; - }; - - uint16_t spritestart_ = 0; - uint16_t soundstart_ = 0; -}; -} // namespace slade diff --git a/src/Archive/Formats/ZipArchive.h b/src/Archive/Formats/ZipArchive.h deleted file mode 100644 index e6a69ce90..000000000 --- a/src/Archive/Formats/ZipArchive.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "Archive/Archive.h" - -namespace slade -{ -class ZipArchive : public Archive -{ -public: - ZipArchive(); - ~ZipArchive() override; - - // Opening - bool open(string_view filename, bool detect_types) override; // Open from File - bool open(const MemChunk& mc, bool detect_types) override; // Open from MemChunk - - // Writing/Saving - bool write(MemChunk& mc) override; // Write to MemChunk - bool write(string_view filename) override; // Write to File - - // Misc - bool loadEntryData(const ArchiveEntry* entry, MemChunk& out) override; - - // Entry addition/removal - shared_ptr addEntry(shared_ptr entry, string_view add_namespace) override; - - // Detection - MapDesc mapDesc(ArchiveEntry* maphead) const override; - vector detectMaps() const override; - - // Search - ArchiveEntry* findFirst(SearchOptions& options) const override; - ArchiveEntry* findLast(SearchOptions& options) const override; - vector findAll(SearchOptions& options) const override; - - // Static functions - static bool isZipArchive(const MemChunk& mc); - static bool isZipArchive(const string& filename); - -private: - string temp_file_; - - void generateTempFileName(string_view filename); -}; -} // namespace slade