summaryrefslogtreecommitdiff
path: root/tools/ZAPD
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2023-09-08 03:17:54 -0700
committerGitHub <noreply@github.com>2023-09-08 20:17:54 +1000
commitc8304925da305f5d8fa43fc4ca93f95afd36bcab (patch)
tree20484e4f173112001523d851bedceab8d9cfad2e /tools/ZAPD
parent4fa13e4132cf8adb2f07bb34927e62e525c8cc79 (diff)
Subrepo Updates (#1368)
* git subrepo pull --force tools/asm-processor subrepo: subdir: "tools/asm-processor" merged: "fed1e3ddb" upstream: origin: "git@github.com:simonlindholm/asm-processor.git" branch: "main" commit: "fed1e3ddb" git-subrepo: version: "0.4.6" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "110b9eb" * git subrepo pull tools/asm-differ subrepo: subdir: "tools/asm-differ" merged: "4ed847317" upstream: origin: "https://github.com/simonlindholm/asm-differ" branch: "main" commit: "4ed847317" git-subrepo: version: "0.4.6" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "110b9eb" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "7f398831f" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "7f398831f" git-subrepo: version: "0.4.6" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "110b9eb" * git subrepo pull (merge) --force tools/fado subrepo: subdir: "tools/fado" merged: "8ce048376" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "8ce048376" git-subrepo: version: "0.4.6" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "110b9eb"
Diffstat (limited to 'tools/ZAPD')
-rw-r--r--tools/ZAPD/.gitrepo4
-rw-r--r--tools/ZAPD/Makefile17
-rw-r--r--tools/ZAPD/ZAPD/GameConfig.cpp1
-rw-r--r--tools/ZAPD/ZAPDUtils/Utils/Directory.h9
-rw-r--r--tools/ZAPD/ZAPDUtils/Utils/File.h27
-rw-r--r--tools/ZAPD/ZAPDUtils/Utils/Path.h5
6 files changed, 52 insertions, 11 deletions
diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo
index d021bc57e..c8d51d0cf 100644
--- a/tools/ZAPD/.gitrepo
+++ b/tools/ZAPD/.gitrepo
@@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/zeldaret/ZAPD.git
branch = master
- commit = 505024b33eb1fcd00e3e9bb71f1355fa2ae6e9cf
- parent = 387d3597142ebdbebe1fbb99858ea831aa2752b4
+ commit = 7f398831fbcf67210b37882b5017093a1d187d5c
+ parent = 71e36ae371f89b5f86a6d59c7ebc24b8a55ee43e
method = merge
cmdver = 0.4.6
diff --git a/tools/ZAPD/Makefile b/tools/ZAPD/Makefile
index c97b7ce23..36331937a 100644
--- a/tools/ZAPD/Makefile
+++ b/tools/ZAPD/Makefile
@@ -8,6 +8,18 @@ COPYCHECK_ARGS ?=
LLD ?= 0
WERROR ?= 0
+# On MacOS 10.14, use boost::filesystem, because
+# the system doesn't supply std::filesystem.
+ifneq ($(OS),Windows_NT)
+ ifeq ($(shell uname -s),Darwin)
+ MACOS_VERSION := $(shell sw_vers -productVersion | cut -d . -f 1,2)
+ ifeq ($(MACOS_VERSION),10.14)
+ USE_BOOST_FS ?= 1
+ endif
+ endif
+endif
+USE_BOOST_FS ?= 0
+
# Use clang++ if available, else use g++
ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0)
CXX := clang++
@@ -46,6 +58,11 @@ endif
LDFLAGS := -lm -ldl -lpng
+ifneq ($(USE_BOOST_FS),0)
+ CXXFLAGS += -DUSE_BOOST_FS
+ LDFLAGS += -lboost_filesystem
+endif
+
# Use LLD if available. Set LLD=0 to not use it
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
LLD := 1
diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp
index b27e81600..638480875 100644
--- a/tools/ZAPD/ZAPD/GameConfig.cpp
+++ b/tools/ZAPD/ZAPD/GameConfig.cpp
@@ -2,6 +2,7 @@
#include <functional>
#include <string_view>
+#include <unordered_map>
#include "Utils/Directory.h"
#include "Utils/File.h"
diff --git a/tools/ZAPD/ZAPDUtils/Utils/Directory.h b/tools/ZAPD/ZAPDUtils/Utils/Directory.h
index eaa6a26ab..2e782624e 100644
--- a/tools/ZAPD/ZAPDUtils/Utils/Directory.h
+++ b/tools/ZAPD/ZAPDUtils/Utils/Directory.h
@@ -4,7 +4,10 @@
#include <string>
#include <vector>
-#if __has_include(<filesystem>)
+#ifdef USE_BOOST_FS
+#include <boost/filesystem.hpp>
+namespace fs = boost::filesystem;
+#elif __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
@@ -17,7 +20,11 @@ namespace fs = std::experimental::filesystem;
class Directory
{
public:
+#ifdef USE_BOOST_FS
+ static std::string GetCurrentDirectory() { return fs::current_path().string(); }
+#else
static std::string GetCurrentDirectory() { return fs::current_path().u8string(); }
+#endif
static bool Exists(const fs::path& path) { return fs::exists(path); }
diff --git a/tools/ZAPD/ZAPDUtils/Utils/File.h b/tools/ZAPD/ZAPDUtils/Utils/File.h
index bf2bb694e..707b1600f 100644
--- a/tools/ZAPD/ZAPDUtils/Utils/File.h
+++ b/tools/ZAPD/ZAPDUtils/Utils/File.h
@@ -1,6 +1,11 @@
#pragma once
+#ifdef USE_BOOST_FS
+#include <boost/filesystem/fstream.hpp>
+#else
#include <fstream>
+#endif
+
#include <string>
#include <vector>
#include "Directory.h"
@@ -8,16 +13,24 @@
class File
{
+#ifdef USE_BOOST_FS
+ typedef fs::ifstream ifstream;
+ typedef fs::ofstream ofstream;
+#else
+ typedef std::ifstream ifstream;
+ typedef std::ofstream ofstream;
+#endif
+
public:
static bool Exists(const fs::path& filePath)
{
- std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
+ ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
return file.good();
}
static std::vector<uint8_t> ReadAllBytes(const fs::path& filePath)
{
- std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
+ ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
int32_t fileSize = (int32_t)file.tellg();
file.seekg(0);
char* data = new char[fileSize];
@@ -31,7 +44,7 @@ public:
static std::string ReadAllText(const fs::path& filePath)
{
- std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
+ ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
if (!file.is_open())
return "";
int32_t fileSize = (int32_t)file.tellg();
@@ -56,28 +69,28 @@ public:
static void WriteAllBytes(const fs::path& filePath, const std::vector<uint8_t>& data)
{
- std::ofstream file(filePath, std::ios::binary);
+ ofstream file(filePath, std::ios::binary);
file.write((char*)data.data(), data.size());
file.close();
};
static void WriteAllBytes(const std::string& filePath, const std::vector<char>& data)
{
- std::ofstream file(filePath, std::ios::binary);
+ ofstream file(filePath, std::ios::binary);
file.write((char*)data.data(), data.size());
file.close();
};
static void WriteAllBytes(const std::string& filePath, const char* data, int dataSize)
{
- std::ofstream file(filePath, std::ios::binary);
+ ofstream file(filePath, std::ios::binary);
file.write((char*)data, dataSize);
file.close();
};
static void WriteAllText(const fs::path& filePath, const std::string& text)
{
- std::ofstream file(filePath, std::ios::out);
+ ofstream file(filePath, std::ios::out);
file.write(text.c_str(), text.size());
file.close();
}
diff --git a/tools/ZAPD/ZAPDUtils/Utils/Path.h b/tools/ZAPD/ZAPDUtils/Utils/Path.h
index 0f7ef2743..90f55380b 100644
--- a/tools/ZAPD/ZAPDUtils/Utils/Path.h
+++ b/tools/ZAPD/ZAPDUtils/Utils/Path.h
@@ -4,7 +4,10 @@
#include <string>
#include "Utils/StringHelper.h"
-#if __has_include(<filesystem>)
+#ifdef USE_BOOST_FS
+#include <boost/filesystem.hpp>
+namespace fs = boost::filesystem;
+#elif __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else