From 696862b1a3025b9f054a26889f4aec42d0675f30 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 02:03:41 +1000 Subject: Replaced narccomp with knarc --- Makefile | 16 +- tools/knarc/Makefile | 7 + tools/knarc/Narc.cpp | 536 ++++++++++++++++++++++++++++++++++++++++++++ tools/knarc/Narc.h | 86 +++++++ tools/knarc/Source.cpp | 109 +++++++++ tools/narccomp/Makefile | 13 -- tools/narccomp/narccomp.cpp | 261 --------------------- 7 files changed, 745 insertions(+), 283 deletions(-) create mode 100644 tools/knarc/Makefile create mode 100644 tools/knarc/Narc.cpp create mode 100644 tools/knarc/Narc.h create mode 100644 tools/knarc/Source.cpp delete mode 100644 tools/narccomp/Makefile delete mode 100644 tools/narccomp/narccomp.cpp diff --git a/Makefile b/Makefile index 4cb2b845..39594cc8 100644 --- a/Makefile +++ b/Makefile @@ -26,9 +26,9 @@ endif ifeq ($(OS),Windows_NT) EXE := .exe -WINE := +WINE := else -EXE := +EXE := WINE := wine endif @@ -170,9 +170,9 @@ MWCCARM = tools/mwccarm/$(MWCCVERSION)/mwccarm.exe # have to use mwldarm for now. # TODO: Is there a hack workaround to let us go back to GNU LD? Ideally, the # only dependency should be MWCCARM. +KNARC = tools/knarc/knarc$(EXE) MWLDARM = tools/mwccarm/$(MWCCVERSION)/mwldarm.exe MWASMARM = tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe -NARCCOMP = tools/narccomp/narccomp$(EXE) SCANINC = tools/scaninc/scaninc$(EXE) AS = $(WINE) $(MWASMARM) @@ -308,13 +308,11 @@ DUMMY != mkdir -p $(ALL_DIRS) %.png: ; %.pal: ; -%.narc: members = $(wildcard $(@D)/$*/*) -%.narc: $$(members) - $(NARCCOMP) -o $@ -p 255 $^ +%.narc: + $(KNARC) -d $(basename $@)/ -p $@ -%.arc: members = $(wildcard $(@D)/$*/*) -%.arc: $$(members) - $(NARCCOMP) -o $@ -p 255 $^ +%.arc: + $(KNARC) -d $(basename $@)/ -p $@ files/poketool/personal/pms.narc: ; diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile new file mode 100644 index 00000000..a466912c --- /dev/null +++ b/tools/knarc/Makefile @@ -0,0 +1,7 @@ +all: knarc + +knarc: Source.cpp Narc.cpp + g++ -std=c++17 -o knarc Source.cpp Narc.cpp + +clean: + rm knarc diff --git a/tools/knarc/Narc.cpp b/tools/knarc/Narc.cpp new file mode 100644 index 00000000..5e2713dd --- /dev/null +++ b/tools/knarc/Narc.cpp @@ -0,0 +1,536 @@ +#include "Narc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +void Narc::AlignDword(ofstream& ofs, uint8_t paddingChar) +{ + if ((ofs.tellp() % 4) != 0) + { + for (int i = 4 - (ofs.tellp() % 4); i-- > 0; ) + { + ofs.write(reinterpret_cast(&paddingChar), sizeof(uint8_t)); + } + } +} + +bool Narc::Cleanup(ifstream& ifs, const NarcError& e) +{ + ifs.close(); + + error = e; + + return false; +} + +bool Narc::Cleanup(ofstream& ofs, const NarcError& e) +{ + ofs.close(); + + error = e; + + return false; +} + +vector Narc::OrderedDirectoryIterator(const filesystem::path& path, bool recursive) const +{ + vector v; + + for (const auto& de : filesystem::directory_iterator(path)) + { + v.push_back(de); + } + + sort(v.begin(), v.end(), [](const filesystem::directory_entry& a, const filesystem::directory_entry& b) + { + // I fucking hate C++ + string aStr = a.path().filename().string(); + string bStr = b.path().filename().string(); + + for (size_t i = 0; i < aStr.size(); ++i) + { + aStr[i] = tolower(aStr[i]); + } + + for (size_t i = 0; i < bStr.size(); ++i) + { + bStr[i] = tolower(bStr[i]); + } + + return aStr < bStr; + }); + + if (recursive) + { + size_t vSize = v.size(); + + for (size_t i = 0; i < vSize; ++i) + { + if (v[i].is_directory()) + { + vector temp = OrderedDirectoryIterator(v[i], true); + + v.insert(v.end(), temp.begin(), temp.end()); + } + } + } + + return v; +} + +NarcError Narc::GetError() const +{ + return error; +} + +bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& directory) +{ + ofstream ofs(fileName, ios::binary); + + if (!ofs.good()) { return Cleanup(ofs, NarcError::InvalidOutputFile); } + + vector fatEntries; + uint16_t directoryCounter = 1; + + for (const auto& de : OrderedDirectoryIterator(directory, true)) + { + if (de.is_directory()) + { + ++directoryCounter; + } + else + { + fatEntries.push_back(FileAllocationTableEntry + { + .Start = 0x0, + .End = 0x0 + }); + + if (fatEntries.size() > 1) + { + fatEntries.back().Start = fatEntries.rbegin()[1].End; + + if ((fatEntries.rbegin()[1].End % 4) != 0) + { + fatEntries.back().Start += 4 - (fatEntries.rbegin()[1].End % 4); + } + } + + fatEntries.back().End = fatEntries.back().Start + static_cast(de.file_size()); + } + } + + FileAllocationTable fat + { + .Id = 0x46415442, + .ChunkSize = sizeof(FileAllocationTable) + ((uint32_t)fatEntries.size() * sizeof(FileAllocationTableEntry)), + .FileCount = static_cast(fatEntries.size()), + .Reserved = 0x0 + }; + + map subTables; + vector paths; + + directoryCounter = 0; + + for (const auto& de : OrderedDirectoryIterator(directory, true)) + { + if (!subTables.count(de.path().parent_path())) + { + subTables.insert({ de.path().parent_path(), "" }); + paths.push_back(de.path().parent_path()); + } + + if (de.is_directory()) + { + ++directoryCounter; + + subTables[de.path().parent_path()] += static_cast(0x80 + de.path().filename().string().size()); + subTables[de.path().parent_path()] += de.path().filename().string(); + subTables[de.path().parent_path()] += (0xF000 + directoryCounter) & 0xFF; + subTables[de.path().parent_path()] += (0xF000 + directoryCounter) >> 8; + } + else + { + subTables[de.path().parent_path()] += static_cast(de.path().filename().string().size()); + subTables[de.path().parent_path()] += de.path().filename().string(); + } + } + + for (auto& subTable : subTables) + { + subTable.second += '\0'; + } + + vector fntEntries; + + if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + { + fntEntries.push_back( + { + .Offset = (directoryCounter + 1) * sizeof(FileNameTableEntry), + .FirstFileId = 0x0, + .Utility = static_cast(directoryCounter + 1) + }); + + for (uint16_t i = 0; i < directoryCounter; ++i) + { + fntEntries.push_back( + { + .Offset = fntEntries.back().Offset + subTables[paths[i]].size(), + .FirstFileId = fntEntries.back().FirstFileId, + .Utility = 0x0 + }); + + for (size_t j = 0; j < (subTables[paths[i]].size() - 1); ++j) + { + if (static_cast(subTables[paths[i]][j]) <= 0x7F) + { + j += static_cast(subTables[paths[i]][j]); + ++fntEntries.back().FirstFileId; + } + else if (static_cast(subTables[paths[i]][j]) <= 0xFF) + { + j += static_cast(subTables[paths[i]][j]) - 0x80 + 0x2; + } + } + + fntEntries.back().Utility = 0xF000 + (find(paths.begin(), paths.end(), paths[i + 1].parent_path()) - paths.begin()); + } + } + else + { + fntEntries.push_back( + { + .Offset = 0x4, + .FirstFileId = 0x0, + .Utility = 0x1 + }); + } + + FileNameTable fnt + { + .Id = 0x464E5442, + .ChunkSize = sizeof(FileNameTable) + (fntEntries.size() * sizeof(FileNameTableEntry)) + }; + + if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + { + for (const auto& subTable : subTables) + { + fnt.ChunkSize += subTable.second.size(); + } + } + + if ((fnt.ChunkSize % 4) != 0) + { + fnt.ChunkSize += 4 - (fnt.ChunkSize % 4); + } + + FileImages fi + { + .Id = 0x46494D47, + .ChunkSize = sizeof(FileImages) + fatEntries.back().End + }; + + if ((fi.ChunkSize % 4) != 0) + { + fi.ChunkSize += 4 - (fi.ChunkSize % 4); + } + + Header header + { + .Id = 0x4352414E, + .ByteOrderMark = 0xFFFE, + .Version = 0x100, + .FileSize = sizeof(Header) + fat.ChunkSize + fnt.ChunkSize + fi.ChunkSize, + .ChunkSize = sizeof(Header), + .ChunkCount = 0x3 + }; + + ofs.write(reinterpret_cast(&header), sizeof(Header)); + ofs.write(reinterpret_cast(&fat), sizeof(FileAllocationTable)); + + for (auto& entry : fatEntries) + { + ofs.write(reinterpret_cast(&entry), sizeof(FileAllocationTableEntry)); + } + + ofs.write(reinterpret_cast(&fnt), sizeof(FileNameTable)); + + for (auto& entry : fntEntries) + { + ofs.write(reinterpret_cast(&entry), sizeof(FileNameTableEntry)); + } + + if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + { + for (const auto& path : paths) + { + ofs << subTables[path]; + } + } + + AlignDword(ofs, 0xFF); + + ofs.write(reinterpret_cast(&fi), sizeof(FileImages)); + + for (const auto& de : OrderedDirectoryIterator(directory, true)) + { + if (de.is_directory()) + { + continue; + } + + ifstream ifs(de.path(), ios::binary | ios::ate); + + if (!ifs.good()) + { + ifs.close(); + + return Cleanup(ofs, NarcError::InvalidInputFile); + } + + streampos length = ifs.tellg(); + unique_ptr buffer = make_unique(static_cast(length)); + + ifs.seekg(0); + ifs.read(buffer.get(), length); + ifs.close(); + + ofs.write(buffer.get(), length); + + AlignDword(ofs, 0xFF); + } + + ofs.close(); + + return error == NarcError::None ? true : false; +} + +bool Narc::Unpack(const filesystem::path& fileName, const filesystem::path& directory) +{ + ifstream ifs(fileName, ios::binary); + + if (!ifs.good()) { return Cleanup(ifs, NarcError::InvalidInputFile); } + + Header header; + ifs.read(reinterpret_cast(&header), sizeof(Header)); + + if (header.Id != 0x4352414E) { return Cleanup(ifs, NarcError::InvalidHeaderId); } + if (header.ByteOrderMark != 0xFFFE) { return Cleanup(ifs, NarcError::InvalidByteOrderMark); } + if ((header.Version != 0x0100) && (header.Version != 0x0000)) { return Cleanup(ifs, NarcError::InvalidVersion); } + if (header.ChunkSize != 0x10) { return Cleanup(ifs, NarcError::InvalidHeaderSize); } + if (header.ChunkCount != 0x3) { return Cleanup(ifs, NarcError::InvalidChunkCount); } + + FileAllocationTable fat; + ifs.read(reinterpret_cast(&fat), sizeof(FileAllocationTable)); + + if (fat.Id != 0x46415442) { return Cleanup(ifs, NarcError::InvalidFileAllocationTableId); } + if (fat.Reserved != 0x0) { return Cleanup(ifs, NarcError::InvalidFileAllocationTableReserved); } + + unique_ptr fatEntries = make_unique(fat.FileCount); + + for (uint16_t i = 0; i < fat.FileCount; ++i) + { + ifs.read(reinterpret_cast(&fatEntries.get()[i]), sizeof(FileAllocationTableEntry)); + } + + FileNameTable fnt; + vector FileNameTableEntries; + ifs.read(reinterpret_cast(&fnt), sizeof(FileNameTable)); + + if (fnt.Id != 0x464E5442) { return Cleanup(ifs, NarcError::InvalidFileNameTableId); } + + vector fntEntries; + + do + { + fntEntries.push_back(FileNameTableEntry()); + + ifs.read(reinterpret_cast(&fntEntries.back().Offset), sizeof(uint32_t)); + ifs.read(reinterpret_cast(&fntEntries.back().FirstFileId), sizeof(uint16_t)); + ifs.read(reinterpret_cast(&fntEntries.back().Utility), sizeof(uint16_t)); + } while (static_cast(ifs.tellg()) < (header.ChunkSize + fat.ChunkSize + sizeof(FileNameTable) + fntEntries[0].Offset)); + + unique_ptr fileNames = make_unique(0xFFFF); + + for (size_t i = 0; i < fntEntries.size(); ++i) + { + ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + sizeof(FileNameTable) + fntEntries[i].Offset); + + uint16_t fileId = 0x0000; + + for (uint8_t length = 0x80; length != 0x00; ifs.read(reinterpret_cast(&length), sizeof(uint8_t))) + { + if (length <= 0x7F) + { + for (uint8_t j = 0; j < length; ++j) + { + uint8_t c; + ifs.read(reinterpret_cast(&c), sizeof(uint8_t)); + + fileNames.get()[fntEntries[i].FirstFileId + fileId] += c; + } + + ++fileId; + } + else if (length == 0x80) + { + // Reserved + } + else if (length <= 0xFF) + { + length -= 0x80; + string directoryName; + + for (uint8_t j = 0; j < length; ++j) + { + uint8_t c; + ifs.read(reinterpret_cast(&c), sizeof(uint8_t)); + + directoryName += c; + } + + uint16_t directoryId; + ifs.read(reinterpret_cast(&directoryId), sizeof(uint16_t)); + + fileNames.get()[directoryId] = directoryName; + } + else + { + return Cleanup(ifs, NarcError::InvalidFileNameTableEntryId); + } + } + } + + if ((ifs.tellg() % 4) != 0) + { + ifs.seekg(4 - (ifs.tellg() % 4), ios::cur); + } + + FileImages fi; + ifs.read(reinterpret_cast(&fi), sizeof(FileImages)); + + if (fi.Id != 0x46494D47) { return Cleanup(ifs, NarcError::InvalidFileImagesId); } + + filesystem::create_directory(directory); + filesystem::current_path(directory); + + if (fnt.ChunkSize == 0x10) + { + for (uint16_t i = 0; i < fat.FileCount; ++i) + { + ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + fnt.ChunkSize + 8 + fatEntries.get()[i].Start); + + unique_ptr buffer = make_unique(fatEntries.get()[i].End - fatEntries.get()[i].Start); + ifs.read(buffer.get(), fatEntries.get()[i].End - fatEntries.get()[i].Start); + + ostringstream oss; + oss << fileName.stem().string() << "_" << setfill('0') << setw(8) << i << ".bin"; + + ofstream ofs(oss.str(), ios::binary); + + if (!ofs.good()) + { + ofs.close(); + + return Cleanup(ifs, NarcError::InvalidOutputFile); + } + + ofs.write(buffer.get(), fatEntries.get()[i].End - fatEntries.get()[i].Start); + ofs.close(); + } + } + else + { + filesystem::path absolutePath = filesystem::absolute(filesystem::current_path()); + + for (size_t i = 0; i < fntEntries.size(); ++i) + { + filesystem::current_path(absolutePath); + stack directories; + + for (uint16_t j = fntEntries[i].Utility; j > 0xF000; j = fntEntries[j - 0xF000].Utility) + { + directories.push(fileNames.get()[j]); + } + + for (; !directories.empty(); directories.pop()) + { + filesystem::create_directory(directories.top()); + filesystem::current_path(directories.top()); + } + + if (fntEntries[i].Utility >= 0xF000) + { + filesystem::create_directory(fileNames.get()[0xF000 + i]); + filesystem::current_path(fileNames.get()[0xF000 + i]); + } + + ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + sizeof(FileNameTable) + fntEntries[i].Offset); + + uint16_t fileId = 0x0000; + + for (uint8_t length = 0x80; length != 0x00; ifs.read(reinterpret_cast(&length), sizeof(uint8_t))) + { + if (length <= 0x7F) + { + streampos savedPosition = ifs.tellg(); + + ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + fnt.ChunkSize + 8 + fatEntries.get()[fntEntries[i].FirstFileId + fileId].Start); + + unique_ptr buffer = make_unique(fatEntries.get()[fntEntries[i].FirstFileId + fileId].End - fatEntries.get()[fntEntries[i].FirstFileId + fileId].Start); + ifs.read(buffer.get(), fatEntries.get()[fntEntries[i].FirstFileId + fileId].End - fatEntries.get()[fntEntries[i].FirstFileId + fileId].Start); + + ofstream ofs(fileNames.get()[fntEntries[i].FirstFileId + fileId], ios::binary); + + if (!ofs.good()) + { + ofs.close(); + + return Cleanup(ifs, NarcError::InvalidOutputFile); + } + + ofs.write(buffer.get(), fatEntries.get()[fntEntries[i].FirstFileId + fileId].End - fatEntries.get()[fntEntries[i].FirstFileId + fileId].Start); + ofs.close(); + + ifs.seekg(savedPosition); + ifs.seekg(length, ios::cur); + + ++fileId; + } + else if (length == 0x80) + { + // Reserved + } + else if (length <= 0xFF) + { + ifs.seekg(static_cast(length) - 0x80 + 0x2, ios::cur); + } + else + { + return Cleanup(ifs, NarcError::InvalidFileNameTableEntryId); + } + } + } + } + + ifs.close(); + + return error == NarcError::None ? true : false; +} diff --git a/tools/knarc/Narc.h b/tools/knarc/Narc.h new file mode 100644 index 00000000..d9de52bb --- /dev/null +++ b/tools/knarc/Narc.h @@ -0,0 +1,86 @@ +#pragma once + +#include +#include +#include +#include +#include + +enum class NarcError +{ + None, + InvalidInputFile, + InvalidHeaderId, + InvalidByteOrderMark, + InvalidVersion, + InvalidHeaderSize, + InvalidChunkCount, + InvalidFileAllocationTableId, + InvalidFileAllocationTableReserved, + InvalidFileNameTableId, + InvalidFileNameTableEntryId, + InvalidFileImagesId, + InvalidOutputFile +}; + +struct Header +{ + uint32_t Id; + uint16_t ByteOrderMark; + uint16_t Version; + uint32_t FileSize; + uint16_t ChunkSize; + uint16_t ChunkCount; +}; + +struct FileAllocationTable +{ + uint32_t Id; + uint32_t ChunkSize; + uint16_t FileCount; + uint16_t Reserved; +}; + +struct FileAllocationTableEntry +{ + uint32_t Start; + uint32_t End; +}; + +struct FileNameTable +{ + uint32_t Id; + uint32_t ChunkSize; +}; + +struct FileNameTableEntry +{ + uint32_t Offset; + uint16_t FirstFileId; + uint16_t Utility; +}; + +struct FileImages +{ + uint32_t Id; + uint32_t ChunkSize; +}; + +class Narc +{ + public: + NarcError GetError() const; + + bool Pack(const std::filesystem::path& fileName, const std::filesystem::path& directory); + bool Unpack(const std::filesystem::path& fileName, const std::filesystem::path& directory); + + private: + NarcError error = NarcError::None; + + void AlignDword(std::ofstream& ofs, uint8_t paddingChar); + + bool Cleanup(std::ifstream& ifs, const NarcError& e); + bool Cleanup(std::ofstream& ofs, const NarcError& e); + + std::vector OrderedDirectoryIterator(const std::filesystem::path& path, bool recursive) const; +}; diff --git a/tools/knarc/Source.cpp b/tools/knarc/Source.cpp new file mode 100644 index 00000000..3678997c --- /dev/null +++ b/tools/knarc/Source.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include + +#include "Narc.h" + +using namespace std; + +void PrintError(NarcError error) +{ + switch (error) + { + case NarcError::None: cout << "ERROR: No error???" << endl; break; + case NarcError::InvalidInputFile: cout << "ERROR: Invalid input file" << endl; break; + case NarcError::InvalidHeaderId: cout << "ERROR: Invalid header ID" << endl; break; + case NarcError::InvalidByteOrderMark: cout << "ERROR: Invalid byte order mark" << endl; break; + case NarcError::InvalidVersion: cout << "ERROR: Invalid NARC version" << endl; break; + case NarcError::InvalidHeaderSize: cout << "ERROR: Invalid header size" << endl; break; + case NarcError::InvalidChunkCount: cout << "ERROR: Invalid chunk count" << endl; break; + case NarcError::InvalidFileAllocationTableId: cout << "ERROR: Invalid file allocation table ID" << endl; break; + case NarcError::InvalidFileAllocationTableReserved: cout << "ERROR: Invalid file allocation table reserved section" << endl; break; + case NarcError::InvalidFileNameTableId: cout << "ERROR: Invalid file name table ID" << endl; break; + case NarcError::InvalidFileNameTableEntryId: cout << "ERROR: Invalid file name table entry ID" << endl; break; + case NarcError::InvalidFileImagesId: cout << "ERROR: Invalid file images ID" << endl; break; + case NarcError::InvalidOutputFile: cout << "ERROR: Invalid output file" << endl; break; + default: cout << "ERROR: Unknown error???" << endl; break; + } +} + +int main(int argc, char* argv[]) +{ + if (argc != 5) + { + cout << "OVERVIEW: Knarc" << endl << endl; + cout << "USAGE: knarc [options] " << endl << endl; + cout << "OPTIONS:" << endl; + cout << "\t-d\tDirectory to pack from/unpack to" << endl; + cout << "\t-p\tPack" << endl; + cout << "\t-u\tUnpack" << endl; + + return 1; + } + + string directory = ""; + string fileName = ""; + bool pack = false; + + for (int i = 1; i < argc; ++i) + { + if (!strcmp(argv[i], "-d")) + { + if (i == (argc - 1)) + { + cerr << "ERROR: No directory specified" << endl; + + return 1; + } + + directory = argv[++i]; + } + else if (!strcmp(argv[i], "-p")) + { + if (i == (argc - 1)) + { + cerr << "ERROR: No NARC specified to pack to" << endl; + + return 1; + } + + fileName = argv[++i]; + pack = true; + } + else if (!strcmp(argv[i], "-u")) + { + if (i == (argc - 1)) + { + cerr << "ERROR: No NARC specified to unpack from" << endl; + + return 1; + } + + fileName = argv[++i]; + } + } + + Narc narc; + + if (pack) + { + if (!narc.Pack(fileName, directory)) + { + PrintError(narc.GetError()); + + return 1; + } + } + else + { + if (!narc.Unpack(fileName, directory)) + { + PrintError(narc.GetError()); + + return 1; + } + } + + return 0; +} diff --git a/tools/narccomp/Makefile b/tools/narccomp/Makefile deleted file mode 100644 index b484e7a1..00000000 --- a/tools/narccomp/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -CXX = g++ -CXXFLAGS := -O3 -std=c++11 - -.PHONY: all clean - -all: narccomp - @: - -clean: - $(RM) narccomp narccomp.exe - -narccomp: narccomp.cpp - $(CXX) $(CXXFLAGS) -o $@ $^ diff --git a/tools/narccomp/narccomp.cpp b/tools/narccomp/narccomp.cpp deleted file mode 100644 index 2cbbeb4c..00000000 --- a/tools/narccomp/narccomp.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -struct Options -{ - fstream outfile; - map infiles; - unsigned char padval; - bool keep_names; - string host_root; - string nitro_root; - Options(int const & argc, char ** const & argv) : - // Default values - padval(255), - keep_names(false) - { - char last_opt = 0; - string outfname; // Use this to avoid clobbering an existing file in the event of an error - for (string arg : vector(argv + 1, argv + argc)) - { - if (last_opt != 0) { - switch (last_opt) - { - case 'p': - { - // Padding - unsigned long x; - stringstream is(arg); - is >> x; - if (x >= 256) { - stringstream ss; - ss << "Invalid value for -p: " << x << endl; - throw invalid_argument(ss.str()); - } - padval = x; - break; - } - case 'o': - // Outfile - if (!outfname.empty()) { - throw invalid_argument("Can't output more than one file\n"); - } - outfname = arg; - break; - case 'r': - // Not fully implemented - if (!host_root.empty()) { - throw invalid_argument("Duplicate settings for option -r\n"); - } - host_root = arg; - break; - case 'R': - // Not fully implemented - if (!nitro_root.empty()) { - throw invalid_argument("Duplicate settings for option -R\n"); - } - nitro_root = arg; - break; - default: - stringstream ss; - ss << "Unrecognized option: -" << (char)last_opt << endl; - throw invalid_argument(ss.str()); - } - last_opt = 0; - } - else if (arg[0] == '-') { - if (arg[1] == 0 || arg[2] != 0) { - stringstream ss; - ss << "Unrecognized option: " << arg << endl; - throw invalid_argument(ss.str()); - } - switch (arg[1]) { - case 'h': - cout << "Usage: " << argv[0] << " [-p PADVAL] [-h] -o OUTFILE FILE [FILE ...]" << endl; - cout << endl; - cout << " FILE [FILE ...] List of files to be packed into the archive." << endl; - cout << " -o OUTFILE The destination archive, in NARC format" << endl; - cout << " -p PADVAL Pad archive members to word with this character. Default: 255" << endl; - cout << " -h Print this message and exit" << endl; - exit(0); - case 'k': - throw invalid_argument("'-k': not implemented\n"); -// if (keep_names) { -// throw invalid_argument("'-k' specified more than once\n"); -// } -// keep_names = true; -// break; - default: - last_opt = arg[1]; - } - } - else - { - fstream file; - stringstream uss; - - if (!infiles[arg].empty()) { - stringstream ss; - ss << "Duplicate file: " << arg << endl; - throw invalid_argument(ss.str()); - } - file.open(arg, ios_base::in | ios_base::binary); - uss << file.rdbuf(); - file.close(); - infiles[arg] = uss.str(); - } - } - if (outfname.empty()) { - throw invalid_argument("Must specify an output file (-o OUTFILE)\n"); - } - if (infiles.empty()) { - throw invalid_argument("No input files\n"); - } - outfile.open(outfname, ios_base::binary | ios_base::out); - } -}; - -struct FatbEntry -{ - uint32_t start; - uint32_t end; -}; - -struct FatbHeader -{ - char magic[4]; - uint32_t chunk_size; - uint16_t file_count; - char padding[2]; - FatbHeader(uint16_t numfiles) : - chunk_size(sizeof(FatbHeader) + sizeof(FatbEntry) * numfiles), - file_count(numfiles) - { strncpy(magic, "BTAF", 4); memset(padding, 0, 2); } -}; - -struct FntbDirHeader -{ - uint32_t offset; - uint16_t first_file; - uint16_t id_or_count; -}; - -struct FntbHeader -{ - char magic[4]; - uint32_t chunk_size; - FntbHeader() : - chunk_size(sizeof(FntbHeader) + sizeof(FntbDirHeader)) - { strncpy(magic, "BTNF", 4); } - string set_names(Options*& opt, FntbDirHeader*& dirHeader) { - throw runtime_error("not implemented\n"); -// typedef struct NitroFS { -// bool is_dir; -// vector children; -// } nitrofs_t; -// map fs; -// fs[opt->nitro_root].is_dir = true; -// string host_root; -// for (auto pair : opt->infiles) { -// string fname = pair.first; -// fname = fname.replace(0, opt->host_root.size(), opt->nitro_root); -// int pos; -// while ((pos = fname.find("//")) != fname.npos) { -// fname = fname.replace(pos, 2, 1, '/'); -// } -// } -// return nullptr; - } -}; - -#define FNT_END 0 -#define FNT_LENGTH_MASK 0x7F -#define FNT_IS_DIR_MASK 0x80 - -struct FimgHeader -{ - char magic[4]; - uint32_t chunk_size; - FimgHeader(size_t image_size) : - chunk_size(sizeof(FimgHeader) + image_size) - { strncpy(magic, "GMIF", 4); } -}; - -struct NarcHeader -{ - char magic[4]; // NARC - uint16_t bom; - uint16_t version; - uint32_t size; - uint16_t chunk_size; - uint16_t num_chunks; - NarcHeader(uint16_t numfiles, size_t image_size) : - bom(0xFFFE), - version(0x0100), - size(sizeof(NarcHeader) + sizeof(FatbHeader) + sizeof(FatbEntry) * numfiles + sizeof(FntbHeader) + sizeof(FntbDirHeader) + sizeof(FimgHeader) + image_size), - chunk_size(sizeof(NarcHeader)), - num_chunks(3) - { strncpy(magic, "NARC", 4); } -}; - -int main(int argc, char ** argv) -{ - try - { - auto opt = new Options(argc, argv); - size_t nfiles = opt->infiles.size(); - auto fatb = new FatbEntry[nfiles]; - FatbEntry *entry = fatb; - for (auto pair : opt->infiles) - { - entry->start = (entry == fatb ? 0 : (entry[-1].end + 3) & ~3); - entry->end = entry->start + pair.second.size(); - entry++; - } - size_t image_size = (fatb[nfiles - 1].end + 3) & ~3; - FntbHeader fntbHeader; - auto fntbDir = new FntbDirHeader; - *fntbDir = (FntbDirHeader) {4, 0, 1}; // dummy - stringstream fnt; - if (opt->keep_names) - { - fntbHeader.set_names(opt, fntbDir); - } - NarcHeader narcHeader(nfiles, (fatb[nfiles - 1].end + 3) & ~3); - FatbHeader fatbHeader(nfiles); - FimgHeader fimgHeader((fatb[nfiles - 1].end + 3) & ~3); - opt->outfile.write((char *) &narcHeader, sizeof(NarcHeader)); - opt->outfile.write((char *) &fatbHeader, sizeof(FatbHeader)); - opt->outfile.write((char *) fatb, sizeof(FatbEntry) * nfiles); - opt->outfile.write((char *) &fntbHeader, sizeof(FntbHeader)); - opt->outfile.write((char *) fntbDir, sizeof(FntbDirHeader)); - opt->outfile.write((char *) &fimgHeader, sizeof(FimgHeader)); - char padding[4]; - memset(padding, opt->padval, 4); - for (auto pair : opt->infiles) - { - stringstream uss(pair.second); - opt->outfile.write(pair.second.c_str(), pair.second.size()); - opt->outfile.write(padding, (4 - pair.second.size()) & 3); - } - opt->outfile.close(); - return 0; - } catch (invalid_argument e) { - cerr << "Invalid exception: " << e.what() << endl; - return 1; - } catch (runtime_error e) { - cerr << "Runtime error: " << e.what() << endl; - return 2; - } catch (exception e) { - cerr << "unhandled exception caught" << endl; - return 3; - } -} -- cgit v1.2.3 From d419d521b3d0c65aef90299ef1a183382a055ed4 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 02:12:10 +1000 Subject: Added .gitignore for compiled binary --- tools/knarc/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/knarc/.gitignore diff --git a/tools/knarc/.gitignore b/tools/knarc/.gitignore new file mode 100644 index 00000000..20bde9af --- /dev/null +++ b/tools/knarc/.gitignore @@ -0,0 +1 @@ +knarc -- cgit v1.2.3 From 0eb4920e8ee15cdc5bc42fbbb7927d34e3014cf1 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 13:05:55 -0400 Subject: Update Makefile to support g++8. --- tools/knarc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index a466912c..da52e871 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,7 +1,7 @@ all: knarc knarc: Source.cpp Narc.cpp - g++ -std=c++17 -o knarc Source.cpp Narc.cpp + g++8 -std=c++17 -o knarc Source.cpp Narc.cpp clean: - rm knarc + rm knarc \ No newline at end of file -- cgit v1.2.3 From cafc25c1fe5a7c856e111ac06fa3389988d04aa5 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 13:07:05 -0400 Subject: Attempt to fix travis. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5ce0b5e9..0a8b0971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ addons: - binutils-arm-none-eabi - wine32 - wine-stable + - gcc-8 + - g++-8 cache: apt: true install: -- cgit v1.2.3 From e6cf189c302f8a0659dddccd38b1819239618e0b Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 03:26:25 +1000 Subject: My turn to try and fix Travis --- .travis.yml | 4 +++- tools/knarc/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a8b0971..c3e24b01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ dist: bionic -sudo: false +sudo: require language: c env: global: @@ -29,6 +29,8 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: + - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc + - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ - make notifications: diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index da52e871..a466912c 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,7 +1,7 @@ all: knarc knarc: Source.cpp Narc.cpp - g++8 -std=c++17 -o knarc Source.cpp Narc.cpp + g++ -std=c++17 -o knarc Source.cpp Narc.cpp clean: - rm knarc \ No newline at end of file + rm knarc -- cgit v1.2.3 From dda7198000177b869882d486b3527076fad95d2e Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 03:41:19 +1000 Subject: Changed GCC 8 to GCC 9 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3e24b01..8b1410a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ addons: - binutils-arm-none-eabi - wine32 - wine-stable - - gcc-8 - - g++-8 + - gcc-9 + - g++-9 cache: apt: true install: @@ -29,8 +29,8 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: - - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc - - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ + - sudo ln -s /usr/bin/gcc-9 /usr/local/bin/gcc + - sudo ln -s /usr/bin/g++-9 /usr/local/bin/g++ - make notifications: -- cgit v1.2.3 From e80bd72182be2db282150e1522ed6d30e151c5c7 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 03:44:31 +1000 Subject: Changed GCC 9 back to GCC 8 and added fs flag --- .travis.yml | 8 ++++---- tools/knarc/Makefile | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b1410a5..c3e24b01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ addons: - binutils-arm-none-eabi - wine32 - wine-stable - - gcc-9 - - g++-9 + - gcc-8 + - g++-8 cache: apt: true install: @@ -29,8 +29,8 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: - - sudo ln -s /usr/bin/gcc-9 /usr/local/bin/gcc - - sudo ln -s /usr/bin/g++-9 /usr/local/bin/g++ + - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc + - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ - make notifications: diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index a466912c..db803d8b 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,7 +1,7 @@ all: knarc knarc: Source.cpp Narc.cpp - g++ -std=c++17 -o knarc Source.cpp Narc.cpp + g++ -std=c++17 -lstdc++fs -o knarc Source.cpp Narc.cpp clean: rm knarc -- cgit v1.2.3 From 2efa529b4d644f8a283785b191ccce90a47cd93e Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 03:57:08 +1000 Subject: Added &gcc9 addon --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3e24b01..e5573ca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: c env: global: - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" -addons: +addons: &gcc9 apt: packages: - gcc-multilib @@ -12,8 +12,8 @@ addons: - binutils-arm-none-eabi - wine32 - wine-stable - - gcc-8 - - g++-8 + - gcc-9 + - g++-9 cache: apt: true install: @@ -29,8 +29,8 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: - - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc - - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ + - sudo ln -s /usr/bin/gcc-9 /usr/local/bin/gcc + - sudo ln -s /usr/bin/g++-9 /usr/local/bin/g++ - make notifications: -- cgit v1.2.3 From 24764e2481b702655329fb810ed1ae34067cd4ed Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:24:18 -0400 Subject: Change order of linked files. --- tools/knarc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index db803d8b..3f0e6492 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,7 +1,7 @@ all: knarc knarc: Source.cpp Narc.cpp - g++ -std=c++17 -lstdc++fs -o knarc Source.cpp Narc.cpp + g++ -std=c++17 -o knarc Source.cpp Narc.cpp -lstdc++fs clean: rm knarc -- cgit v1.2.3 From 095ec6748161ae816806ab09d9a353d25384eab2 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:24:49 -0400 Subject: Update .travis.yml --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e5573ca0..232716fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: c env: global: - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" -addons: &gcc9 +addons: apt: packages: - gcc-multilib @@ -12,8 +12,7 @@ addons: &gcc9 - binutils-arm-none-eabi - wine32 - wine-stable - - gcc-9 - - g++-9 + - gcc-8 cache: apt: true install: -- cgit v1.2.3 From aae365a639011638127c4895c5f86963053bc281 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:25:02 -0400 Subject: Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 232716fc..e7a0c84a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: - - sudo ln -s /usr/bin/gcc-9 /usr/local/bin/gcc - - sudo ln -s /usr/bin/g++-9 /usr/local/bin/g++ + - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc + - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ - make notifications: -- cgit v1.2.3 From 7860c28c3fbf0686c5b4bcf50a9ebe3ca725fe6f Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:34:31 -0400 Subject: Force g++-8 usage. --- tools/knarc/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index 3f0e6492..3a31e6dc 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,7 +1,15 @@ -all: knarc +CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch -lstdc++fs + +SRCS := Source.cpp Narc.cpp +HEADERS := Narc.h -knarc: Source.cpp Narc.cpp - g++ -std=c++17 -o knarc Source.cpp Narc.cpp -lstdc++fs +.PHONY: all clean + +all: knarc + @: + +knarc: $(SRCS) $(HEADERS) + g++-8 $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: - rm knarc + $(RM) knarc knarc.exe -- cgit v1.2.3 From 79de470b79bbb90fcc4d19d95296e6fa494b0954 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:40:46 -0400 Subject: Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e7a0c84a..c3e24b01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ addons: - wine32 - wine-stable - gcc-8 + - g++-8 cache: apt: true install: -- cgit v1.2.3 From 3c8f606c611e465eb36cefba675d9f025c371d2c Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:48:27 -0400 Subject: Add test repository and bump to gcc9. --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3e24b01..73c8210a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,18 @@ env: - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" addons: apt: + sources: + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + - sourceline: 'ppa:ubuntu-toolchain-r/test' packages: - gcc-multilib - linux-libc-dev - binutils-arm-none-eabi - wine32 - wine-stable - - gcc-8 - - g++-8 + - gcc-9 + - g++-9 cache: apt: true install: @@ -29,8 +33,6 @@ install: - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 script: - - sudo ln -s /usr/bin/gcc-8 /usr/local/bin/gcc - - sudo ln -s /usr/bin/g++-8 /usr/local/bin/g++ - make notifications: -- cgit v1.2.3 From 98a0ac436c01d867566bfdd4ecda2e8603f2278d Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 14:49:52 -0400 Subject: Update Makefile. --- tools/knarc/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index 3a31e6dc..4e5e7971 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -1,3 +1,5 @@ +CXX ?= g++-9 + CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch -lstdc++fs SRCS := Source.cpp Narc.cpp @@ -9,7 +11,7 @@ all: knarc @: knarc: $(SRCS) $(HEADERS) - g++-8 $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) + $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: $(RM) knarc knarc.exe -- cgit v1.2.3 From a6c4e1cf0379619c2f332ff96b38fe60587adb70 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 05:03:33 +1000 Subject: .travis.yml needs to be recommitted --- .travis.yml | 42 ---------------------------------- .vscode/settings.json | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 42 deletions(-) delete mode 100644 .travis.yml create mode 100644 .vscode/settings.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 73c8210a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: bionic -sudo: require -language: c -env: - global: - - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" -addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - gcc-multilib - - linux-libc-dev - - binutils-arm-none-eabi - - wine32 - - wine-stable - - gcc-9 - - g++-9 -cache: - apt: true -install: - # These files are only accessible from Travis CI IP Addresses to prevent piracy. - - wget http://private.martmists.com/mwccarm.zip - - wget http://private.martmists.com/baserom.nds - - wget http://private.martmists.com/nitro.zip - - unzip mwccarm.zip - - mv mwccarm tools - - unzip nitro.zip - - mv NITRO\ SDK\ v3.0/tools/bin tools - - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM7-TS.lcf.template arm7 - - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 - -script: - - make - -notifications: - email: false - -after_success: - - .travis/calcrom/webhook.sh pokediamond diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1936a01e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,62 @@ +{ + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "map": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "ratio": "cpp", + "regex": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "filesystem": "cpp" + } +} \ No newline at end of file -- cgit v1.2.3 From 78af155b6ccada593d1864cf5490c868ec02f88e Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 05:04:18 +1000 Subject: Readded .travis.yml --- .travis.yml | 42 ++++++++++++++++++++++++++++++++++ .vscode/settings.json | 62 --------------------------------------------------- 2 files changed, 42 insertions(+), 62 deletions(-) create mode 100644 .travis.yml delete mode 100644 .vscode/settings.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..73c8210a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,42 @@ +dist: bionic +sudo: require +language: c +env: + global: + - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" +addons: + apt: + sources: + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + - sourceline: 'ppa:ubuntu-toolchain-r/test' + packages: + - gcc-multilib + - linux-libc-dev + - binutils-arm-none-eabi + - wine32 + - wine-stable + - gcc-9 + - g++-9 +cache: + apt: true +install: + # These files are only accessible from Travis CI IP Addresses to prevent piracy. + - wget http://private.martmists.com/mwccarm.zip + - wget http://private.martmists.com/baserom.nds + - wget http://private.martmists.com/nitro.zip + - unzip mwccarm.zip + - mv mwccarm tools + - unzip nitro.zip + - mv NITRO\ SDK\ v3.0/tools/bin tools + - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM7-TS.lcf.template arm7 + - mv NITRO\ SDK\ v3.0/include/nitro/specfiles/ARM9-TS.lcf.template arm9 + +script: + - make + +notifications: + email: false + +after_success: + - .travis/calcrom/webhook.sh pokediamond diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 1936a01e..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "files.associations": { - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "codecvt": "cpp", - "condition_variable": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "forward_list": "cpp", - "map": "cpp", - "unordered_map": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "fstream": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "new": "cpp", - "ostream": "cpp", - "ratio": "cpp", - "regex": "cpp", - "shared_mutex": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "typeinfo": "cpp", - "valarray": "cpp", - "filesystem": "cpp" - } -} \ No newline at end of file -- cgit v1.2.3 From 4513e527985db05be4d9723f87dcc6f350e22143 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 05:09:40 +1000 Subject: Fixed indentation error --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73c8210a..5103240b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,14 @@ addons: - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - gcc-multilib - - linux-libc-dev - - binutils-arm-none-eabi - - wine32 - - wine-stable - - gcc-9 - - g++-9 + packages: + - gcc-multilib + - linux-libc-dev + - binutils-arm-none-eabi + - wine32 + - wine-stable + - gcc-9 + - g++-9 cache: apt: true install: -- cgit v1.2.3 From d20e69e76fa290e29b570fe051ea8a12548db97a Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 05:17:22 +1000 Subject: Changed filesystem to experimental/filesystem --- tools/knarc/Makefile | 4 ++-- tools/knarc/Narc.cpp | 52 +++++++++++++++++++++++++------------------------- tools/knarc/Narc.h | 8 ++++---- tools/knarc/Source.cpp | 1 - 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile index 4e5e7971..336fad3f 100644 --- a/tools/knarc/Makefile +++ b/tools/knarc/Makefile @@ -9,9 +9,9 @@ HEADERS := Narc.h all: knarc @: - + knarc: $(SRCS) $(HEADERS) - $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) + $(CXX) $(SRCS) -o $@ $(LDFLAGS) $(CXXFLAGS) clean: $(RM) knarc knarc.exe diff --git a/tools/knarc/Narc.cpp b/tools/knarc/Narc.cpp index 5e2713dd..4cdb4b63 100644 --- a/tools/knarc/Narc.cpp +++ b/tools/knarc/Narc.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,16 +46,16 @@ bool Narc::Cleanup(ofstream& ofs, const NarcError& e) return false; } -vector Narc::OrderedDirectoryIterator(const filesystem::path& path, bool recursive) const +vector Narc::OrderedDirectoryIterator(const experimental::filesystem::path& path, bool recursive) const { - vector v; + vector v; - for (const auto& de : filesystem::directory_iterator(path)) + for (const auto& de : experimental::filesystem::directory_iterator(path)) { v.push_back(de); } - sort(v.begin(), v.end(), [](const filesystem::directory_entry& a, const filesystem::directory_entry& b) + sort(v.begin(), v.end(), [](const experimental::filesystem::directory_entry& a, const experimental::filesystem::directory_entry& b) { // I fucking hate C++ string aStr = a.path().filename().string(); @@ -80,9 +80,9 @@ vector Narc::OrderedDirectoryIterator(const filesys for (size_t i = 0; i < vSize; ++i) { - if (v[i].is_directory()) + if (is_directory(v[i])) { - vector temp = OrderedDirectoryIterator(v[i], true); + vector temp = OrderedDirectoryIterator(v[i], true); v.insert(v.end(), temp.begin(), temp.end()); } @@ -97,7 +97,7 @@ NarcError Narc::GetError() const return error; } -bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& directory) +bool Narc::Pack(const experimental::filesystem::path& fileName, const experimental::filesystem::path& directory) { ofstream ofs(fileName, ios::binary); @@ -108,7 +108,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct for (const auto& de : OrderedDirectoryIterator(directory, true)) { - if (de.is_directory()) + if (is_directory(de)) { ++directoryCounter; } @@ -130,7 +130,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct } } - fatEntries.back().End = fatEntries.back().Start + static_cast(de.file_size()); + fatEntries.back().End = fatEntries.back().Start + static_cast(file_size(de)); } } @@ -142,8 +142,8 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct .Reserved = 0x0 }; - map subTables; - vector paths; + map subTables; + vector paths; directoryCounter = 0; @@ -155,7 +155,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct paths.push_back(de.path().parent_path()); } - if (de.is_directory()) + if (is_directory(de)) { ++directoryCounter; @@ -178,7 +178,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct vector fntEntries; - if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { fntEntries.push_back( { @@ -228,7 +228,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct .ChunkSize = sizeof(FileNameTable) + (fntEntries.size() * sizeof(FileNameTableEntry)) }; - if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { for (const auto& subTable : subTables) { @@ -277,7 +277,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct ofs.write(reinterpret_cast(&entry), sizeof(FileNameTableEntry)); } - if (!regex_match(filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { for (const auto& path : paths) { @@ -291,7 +291,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct for (const auto& de : OrderedDirectoryIterator(directory, true)) { - if (de.is_directory()) + if (is_directory(de)) { continue; } @@ -322,7 +322,7 @@ bool Narc::Pack(const filesystem::path& fileName, const filesystem::path& direct return error == NarcError::None ? true : false; } -bool Narc::Unpack(const filesystem::path& fileName, const filesystem::path& directory) +bool Narc::Unpack(const experimental::filesystem::path& fileName, const experimental::filesystem::path& directory) { ifstream ifs(fileName, ios::binary); @@ -428,8 +428,8 @@ bool Narc::Unpack(const filesystem::path& fileName, const filesystem::path& dire if (fi.Id != 0x46494D47) { return Cleanup(ifs, NarcError::InvalidFileImagesId); } - filesystem::create_directory(directory); - filesystem::current_path(directory); + experimental::filesystem::create_directory(directory); + experimental::filesystem::current_path(directory); if (fnt.ChunkSize == 0x10) { @@ -458,11 +458,11 @@ bool Narc::Unpack(const filesystem::path& fileName, const filesystem::path& dire } else { - filesystem::path absolutePath = filesystem::absolute(filesystem::current_path()); + experimental::filesystem::path absolutePath = experimental::filesystem::absolute(experimental::filesystem::current_path()); for (size_t i = 0; i < fntEntries.size(); ++i) { - filesystem::current_path(absolutePath); + experimental::filesystem::current_path(absolutePath); stack directories; for (uint16_t j = fntEntries[i].Utility; j > 0xF000; j = fntEntries[j - 0xF000].Utility) @@ -472,14 +472,14 @@ bool Narc::Unpack(const filesystem::path& fileName, const filesystem::path& dire for (; !directories.empty(); directories.pop()) { - filesystem::create_directory(directories.top()); - filesystem::current_path(directories.top()); + experimental::filesystem::create_directory(directories.top()); + experimental::filesystem::current_path(directories.top()); } if (fntEntries[i].Utility >= 0xF000) { - filesystem::create_directory(fileNames.get()[0xF000 + i]); - filesystem::current_path(fileNames.get()[0xF000 + i]); + experimental::filesystem::create_directory(fileNames.get()[0xF000 + i]); + experimental::filesystem::current_path(fileNames.get()[0xF000 + i]); } ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + sizeof(FileNameTable) + fntEntries[i].Offset); diff --git a/tools/knarc/Narc.h b/tools/knarc/Narc.h index d9de52bb..515a1cc2 100644 --- a/tools/knarc/Narc.h +++ b/tools/knarc/Narc.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include #include @@ -71,8 +71,8 @@ class Narc public: NarcError GetError() const; - bool Pack(const std::filesystem::path& fileName, const std::filesystem::path& directory); - bool Unpack(const std::filesystem::path& fileName, const std::filesystem::path& directory); + bool Pack(const std::experimental::filesystem::path& fileName, const std::experimental::filesystem::path& directory); + bool Unpack(const std::experimental::filesystem::path& fileName, const std::experimental::filesystem::path& directory); private: NarcError error = NarcError::None; @@ -82,5 +82,5 @@ class Narc bool Cleanup(std::ifstream& ifs, const NarcError& e); bool Cleanup(std::ofstream& ofs, const NarcError& e); - std::vector OrderedDirectoryIterator(const std::filesystem::path& path, bool recursive) const; + std::vector OrderedDirectoryIterator(const std::experimental::filesystem::path& path, bool recursive) const; }; diff --git a/tools/knarc/Source.cpp b/tools/knarc/Source.cpp index 3678997c..51bb5320 100644 --- a/tools/knarc/Source.cpp +++ b/tools/knarc/Source.cpp @@ -1,5 +1,4 @@ #include -#include #include #include -- cgit v1.2.3 From 6e113814ff5d7c21d09132d02b0b1ab6a4a8373d Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Sun, 7 Jun 2020 15:26:42 -0400 Subject: Revert .travis.yml. --- .travis.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5103240b..5ce0b5e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,17 @@ dist: bionic -sudo: require +sudo: false language: c env: global: - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" addons: apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - gcc-multilib - - linux-libc-dev - - binutils-arm-none-eabi - - wine32 - - wine-stable - - gcc-9 - - g++-9 + packages: + - gcc-multilib + - linux-libc-dev + - binutils-arm-none-eabi + - wine32 + - wine-stable cache: apt: true install: -- cgit v1.2.3 From 19d0c085f76ac5830e38339248d2f70b58ee54b2 Mon Sep 17 00:00:00 2001 From: kr3nshaw <20672068+kr3nshaw@users.noreply.github.com> Date: Mon, 8 Jun 2020 05:54:51 +1000 Subject: Added preprocessor macros to switch experimental on and off --- tools/knarc/Narc.cpp | 49 ++++++++++++++++++++++++++++--------------------- tools/knarc/Narc.h | 15 +++++++++++---- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/knarc/Narc.cpp b/tools/knarc/Narc.cpp index 4cdb4b63..506e050f 100644 --- a/tools/knarc/Narc.cpp +++ b/tools/knarc/Narc.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -15,6 +14,14 @@ #include #include +#if __GNUC__ <= 7 +#include +namespace fs = std::experimental::filesystem; +#else +#include +namespace fs = std::filesystem; +#endif + using namespace std; void Narc::AlignDword(ofstream& ofs, uint8_t paddingChar) @@ -46,16 +53,16 @@ bool Narc::Cleanup(ofstream& ofs, const NarcError& e) return false; } -vector Narc::OrderedDirectoryIterator(const experimental::filesystem::path& path, bool recursive) const +vector Narc::OrderedDirectoryIterator(const fs::path& path, bool recursive) const { - vector v; + vector v; - for (const auto& de : experimental::filesystem::directory_iterator(path)) + for (const auto& de : fs::directory_iterator(path)) { v.push_back(de); } - sort(v.begin(), v.end(), [](const experimental::filesystem::directory_entry& a, const experimental::filesystem::directory_entry& b) + sort(v.begin(), v.end(), [](const fs::directory_entry& a, const fs::directory_entry& b) { // I fucking hate C++ string aStr = a.path().filename().string(); @@ -82,7 +89,7 @@ vector Narc::OrderedDirectoryIterator { if (is_directory(v[i])) { - vector temp = OrderedDirectoryIterator(v[i], true); + vector temp = OrderedDirectoryIterator(v[i], true); v.insert(v.end(), temp.begin(), temp.end()); } @@ -97,7 +104,7 @@ NarcError Narc::GetError() const return error; } -bool Narc::Pack(const experimental::filesystem::path& fileName, const experimental::filesystem::path& directory) +bool Narc::Pack(const fs::path& fileName, const fs::path& directory) { ofstream ofs(fileName, ios::binary); @@ -142,8 +149,8 @@ bool Narc::Pack(const experimental::filesystem::path& fileName, const experiment .Reserved = 0x0 }; - map subTables; - vector paths; + map subTables; + vector paths; directoryCounter = 0; @@ -178,7 +185,7 @@ bool Narc::Pack(const experimental::filesystem::path& fileName, const experiment vector fntEntries; - if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(fs::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { fntEntries.push_back( { @@ -228,7 +235,7 @@ bool Narc::Pack(const experimental::filesystem::path& fileName, const experiment .ChunkSize = sizeof(FileNameTable) + (fntEntries.size() * sizeof(FileNameTableEntry)) }; - if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(fs::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { for (const auto& subTable : subTables) { @@ -277,7 +284,7 @@ bool Narc::Pack(const experimental::filesystem::path& fileName, const experiment ofs.write(reinterpret_cast(&entry), sizeof(FileNameTableEntry)); } - if (!regex_match(experimental::filesystem::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) + if (!regex_match(fs::directory_iterator(directory)->path().string(), regex(".*_\\d{4,8}\\.bin"))) { for (const auto& path : paths) { @@ -322,7 +329,7 @@ bool Narc::Pack(const experimental::filesystem::path& fileName, const experiment return error == NarcError::None ? true : false; } -bool Narc::Unpack(const experimental::filesystem::path& fileName, const experimental::filesystem::path& directory) +bool Narc::Unpack(const fs::path& fileName, const fs::path& directory) { ifstream ifs(fileName, ios::binary); @@ -428,8 +435,8 @@ bool Narc::Unpack(const experimental::filesystem::path& fileName, const experime if (fi.Id != 0x46494D47) { return Cleanup(ifs, NarcError::InvalidFileImagesId); } - experimental::filesystem::create_directory(directory); - experimental::filesystem::current_path(directory); + fs::create_directory(directory); + fs::current_path(directory); if (fnt.ChunkSize == 0x10) { @@ -458,11 +465,11 @@ bool Narc::Unpack(const experimental::filesystem::path& fileName, const experime } else { - experimental::filesystem::path absolutePath = experimental::filesystem::absolute(experimental::filesystem::current_path()); + fs::path absolutePath = fs::absolute(fs::current_path()); for (size_t i = 0; i < fntEntries.size(); ++i) { - experimental::filesystem::current_path(absolutePath); + fs::current_path(absolutePath); stack directories; for (uint16_t j = fntEntries[i].Utility; j > 0xF000; j = fntEntries[j - 0xF000].Utility) @@ -472,14 +479,14 @@ bool Narc::Unpack(const experimental::filesystem::path& fileName, const experime for (; !directories.empty(); directories.pop()) { - experimental::filesystem::create_directory(directories.top()); - experimental::filesystem::current_path(directories.top()); + fs::create_directory(directories.top()); + fs::current_path(directories.top()); } if (fntEntries[i].Utility >= 0xF000) { - experimental::filesystem::create_directory(fileNames.get()[0xF000 + i]); - experimental::filesystem::current_path(fileNames.get()[0xF000 + i]); + fs::create_directory(fileNames.get()[0xF000 + i]); + fs::current_path(fileNames.get()[0xF000 + i]); } ifs.seekg(static_cast(header.ChunkSize) + fat.ChunkSize + sizeof(FileNameTable) + fntEntries[i].Offset); diff --git a/tools/knarc/Narc.h b/tools/knarc/Narc.h index 515a1cc2..4516d2d5 100644 --- a/tools/knarc/Narc.h +++ b/tools/knarc/Narc.h @@ -1,11 +1,18 @@ #pragma once #include -#include #include #include #include +#if __GNUC__ <= 7 +#include +namespace fs = std::experimental::filesystem; +#else +#include +namespace fs = std::filesystem; +#endif + enum class NarcError { None, @@ -71,8 +78,8 @@ class Narc public: NarcError GetError() const; - bool Pack(const std::experimental::filesystem::path& fileName, const std::experimental::filesystem::path& directory); - bool Unpack(const std::experimental::filesystem::path& fileName, const std::experimental::filesystem::path& directory); + bool Pack(const fs::path& fileName, const fs::path& directory); + bool Unpack(const fs::path& fileName, const fs::path& directory); private: NarcError error = NarcError::None; @@ -82,5 +89,5 @@ class Narc bool Cleanup(std::ifstream& ifs, const NarcError& e); bool Cleanup(std::ofstream& ofs, const NarcError& e); - std::vector OrderedDirectoryIterator(const std::experimental::filesystem::path& path, bool recursive) const; + std::vector OrderedDirectoryIterator(const fs::path& path, bool recursive) const; }; -- cgit v1.2.3