diff --git a/soh/.SRCINFO b/soh/.SRCINFO index c92962f..1f17731 100644 --- a/soh/.SRCINFO +++ b/soh/.SRCINFO @@ -1,5 +1,5 @@ pkgbase = soh - pkgver = 7.1.1 + pkgver = 8.0.0 pkgrel = 1 url = https://shipofharkinian.com/ arch = x86_64 @@ -20,12 +20,18 @@ pkgbase = soh depends = glew depends = zenity depends = libpng - source = Shipwright-7.1.1.tar.gz::https://github.com/HarbourMasters/Shipwright/archive/refs/tags/7.1.1.tar.gz - source = libultraship-1.2.1.tar.gz::https://github.com/Kenix3/libultraship/archive/refs/tags/1.2.1.tar.gz + source = Shipwright-8.0.0.tar.gz::https://github.com/HarbourMasters/Shipwright/archive/refs/tags/8.0.0.tar.gz + source = libultraship-1.3.1.tar.gz::https://github.com/Kenix3/libultraship/archive/refs/tags/1.3.1.tar.gz + source = ZAPDTR-eff29036118349e142ee8efca80fd975a2a2b6ff.tar.gz::https://github.com/HarbourMasters/ZAPDTR/archive/eff29036118349e142ee8efca80fd975a2a2b6ff.tar.gz + source = OTRExporter-0d8f5570a8e57f302ec6633d65615ee21ab39454.tar.gz::https://github.com/HarbourMasters/OTRExporter/archive/0d8f5570a8e57f302ec6633d65615ee21ab39454.tar.gz source = soh.desktop - sha256sums = cd792c61c9c88471c475d4e9b6f7860f854f12ed589e429f00348d36b77dc474 - sha256sums = 3fbe3a0eeb24e4b2e948670afbd3055b6080b9364f6091559e89240e542d3cfb + source = OTRExporter-fix-paths-period-split.patch::https://github.com/HarbourMasters/OTRExporter/pull/12.patch + sha256sums = f4c7d8ee191174e4cc54d54b44d117f11d6e425da8e1f695a190bc911eb879ac + sha256sums = 9cd9bb014d0feef889e440df1b636853c62cc097b6b61c370fc195fe082e2ae0 + sha256sums = 6438cd1c7abad6ea9b65326892a1b220384bdce78e9d1a324c132d68c982111c + sha256sums = 1628262dfdce10b8584b671ea6a4cb0483c35876cf9f4dd279fc3a7d60a1379f sha256sums = 25aebd34f6ad49073d8a5ce6915b6fa290470fc6d62a8143abe07a25707ff4a2 + sha256sums = 388738f3d48f4bdbe144a55cba91fd77383dcb066f190d2c6f221f3bc4a69903 pkgname = soh pkgdesc = An unofficial port of The Legend of Zelda Ocarina of Time for PC, Wii U, and Switch diff --git a/soh/OTRExporter-fix-paths-period-split.patch b/soh/OTRExporter-fix-paths-period-split.patch new file mode 100644 index 0000000..0fb1d5d --- /dev/null +++ b/soh/OTRExporter-fix-paths-period-split.patch @@ -0,0 +1,56 @@ +From fb11cb1fc70f944feab290981b9e8d37e5ae6efc Mon Sep 17 00:00:00 2001 +From: AltoXorg <56553686+Alto1772@users.noreply.github.com> +Date: Thu, 9 Nov 2023 11:45:03 +0800 +Subject: [PATCH] Use substr method to determine file extension + +Alternatively use the "find_last_of" & "substr" methods on this +conveniently and performance wise. + +This fixes the "." problem where we are working currently on a +directory that contains ".", which prior to this will get rid of any +occurences of this character from the original path (when using +std::accumulate without a binary operation). +--- + OTRExporter/Main.cpp | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/OTRExporter/Main.cpp b/OTRExporter/Main.cpp +index b6a09cb..4fc3c48 100644 +--- a/OTRExporter/Main.cpp ++++ b/OTRExporter/Main.cpp +@@ -174,15 +174,18 @@ static void ExporterProgramEnd() + + for (const auto& item : lst) + { +- std::vector splitPath = StringHelper::Split(item, "."); ++ size_t filenameSepAt = item.find_last_of("/\\"); ++ const std::string filename = item.substr(filenameSepAt + 1); + +- if (splitPath.size() >= 3) ++ if (std::count(filename.begin(), filename.end(), '.') >= 2) + { +- const std::string extension = splitPath.at(splitPath.size() - 1); +- const std::string format = splitPath.at(splitPath.size() - 2); +- splitPath.pop_back(); +- splitPath.pop_back(); +- std::string afterPath = std::accumulate(splitPath.begin(), splitPath.end(), std::string("")); ++ size_t extensionSepAt = filename.find_last_of("."); ++ size_t formatSepAt = filename.find_last_of(".", extensionSepAt - 1); ++ ++ const std::string extension = filename.substr(extensionSepAt + 1); ++ const std::string format = filename.substr(formatSepAt + 1, extensionSepAt - formatSepAt - 1); ++ std::string afterPath = item.substr(0, filenameSepAt + formatSepAt + 1); ++ + if (extension == "png" && (format == "rgba32" || format == "rgb5a1" || format == "i4" || format == "i8" || format == "ia4" || format == "ia8" || format == "ia16" || format == "ci4" || format == "ci8")) + { + ZTexture tex(nullptr); +@@ -208,8 +211,7 @@ static void ExporterProgramEnd() + + if (item.find("accessibility") != std::string::npos) + { +- std::string extension = splitPath.at(splitPath.size() - 1); +- splitPath.pop_back(); ++ std::string extension = filename.substr(filename.find_last_of(".") + 1); + if (extension == "json") + { + const auto &fileData = DiskFile::ReadAllBytes(item); diff --git a/soh/PKGBUILD b/soh/PKGBUILD index 06dd1fd..d406042 100644 --- a/soh/PKGBUILD +++ b/soh/PKGBUILD @@ -1,11 +1,14 @@ # Maintainer: AltoXorg _reponame=Shipwright -#_lus_commit=0a57812968539176bbeaa76c61532d0d6dec4881 -_lus_tag=1.2.1 +#_lus_commit=c75ff3653f699cb1a8c017b10e4b3986259d8cf0 +_lus_tag=1.3.1 +_ZAPDTR_commit=eff29036118349e142ee8efca80fd975a2a2b6ff +_OTRExporter_commit=0d8f5570a8e57f302ec6633d65615ee21ab39454 + pkgbase=soh pkgname=(soh soh-otr-exporter) -pkgver=7.1.1 +pkgver=8.0.0 pkgrel=1 arch=("x86_64" "i686") url="https://shipofharkinian.com/" @@ -14,25 +17,42 @@ _depends_soh_otr_exporter=("libpng") depends=("${_depends_soh[@]}" "${_depends_soh_otr_exporter[@]}") makedepends=("cmake" "ninja" "python" "curl" "lsb-release" "libxrandr" "libxinerama" "libxi" "glu" "boost") source=("${_reponame}-${pkgver}.tar.gz::https://github.com/HarbourMasters/${_reponame}/archive/refs/tags/${pkgver}.tar.gz" - #"libultraship-${_lus_commit}.tar.gz::https://github.com/Kenix3/libultraship/archive/${_lus_commit}.tar.gz" + #"libultraship-${_lus_commit:0:8}.tar.gz::https://github.com/Kenix3/libultraship/archive/${_lus_commit}.tar.gz" "libultraship-${_lus_tag}.tar.gz::https://github.com/Kenix3/libultraship/archive/refs/tags/${_lus_tag}.tar.gz" - "soh.desktop") -sha256sums=('cd792c61c9c88471c475d4e9b6f7860f854f12ed589e429f00348d36b77dc474' - '3fbe3a0eeb24e4b2e948670afbd3055b6080b9364f6091559e89240e542d3cfb' - '25aebd34f6ad49073d8a5ce6915b6fa290470fc6d62a8143abe07a25707ff4a2') - + "ZAPDTR-${_ZAPDTR_commit}.tar.gz::https://github.com/HarbourMasters/ZAPDTR/archive/${_ZAPDTR_commit}.tar.gz" + "OTRExporter-${_OTRExporter_commit}.tar.gz::https://github.com/HarbourMasters/OTRExporter/archive/${_OTRExporter_commit}.tar.gz" + "soh.desktop" + "OTRExporter-fix-paths-period-split.patch::https://github.com/HarbourMasters/OTRExporter/pull/12.patch") +sha256sums=('f4c7d8ee191174e4cc54d54b44d117f11d6e425da8e1f695a190bc911eb879ac' + '9cd9bb014d0feef889e440df1b636853c62cc097b6b61c370fc195fe082e2ae0' + '6438cd1c7abad6ea9b65326892a1b220384bdce78e9d1a324c132d68c982111c' + '1628262dfdce10b8584b671ea6a4cb0483c35876cf9f4dd279fc3a7d60a1379f' + '25aebd34f6ad49073d8a5ce6915b6fa290470fc6d62a8143abe07a25707ff4a2' + '388738f3d48f4bdbe144a55cba91fd77383dcb066f190d2c6f221f3bc4a69903') + +# NOTE: If compiling complains about missing headers, set __generate_headers below to 1 # Changable options for debugging: +__debug=0 # Build with debug flag __generate_headers=0 # Generate OTR (unnecessary) and asset headers. **requires rom** +if [ "$__debug" = 1 ]; then + options=(debug strip) +fi + SHIP_PREFIX=/opt/soh prepare() { cd "${srcdir}/${_reponame}-${pkgver}" - # Symlink libultraship - rm -r libultraship - #ln -sf ../libultraship-${_lus_commit} libultraship - ln -sf ../libultraship-${_lus_tag} libultraship + rm -r libultraship ZAPDTR OTRExporter + #cp -r ../libultraship-${_lus_commit:0:8} libultraship + cp -r ../libultraship-${_lus_tag} libultraship + cp -r ../ZAPDTR-${_ZAPDTR_commit} ZAPDTR + cp -r ../OTRExporter-${_OTRExporter_commit} OTRExporter + + cd OTRExporter + patch -Np1 -i ../../OTRExporter-fix-paths-period-split.patch + cd .. if [ "$__generate_headers" = 1 ]; then # check for any roms in the directory where PKGBUILD resides @@ -51,25 +71,26 @@ prepare() { build() { cd "${srcdir}/${_reponame}-${pkgver}" + if [ "$__debug" = 1 ]; then + BUILD_TYPE=Debug + else + BUILD_TYPE=Release + fi + CFLAGS="${CFLAGS/-Werror=format-security/}" \ CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" \ - cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release \ + cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DNON_PORTABLE=On -DCMAKE_INSTALL_PREFIX=$SHIP_PREFIX . - cmake --build build --target ZAPD --config Release + cmake --build build --target ZAPD --config $BUILD_TYPE if [ "$__generate_headers" = 1 ]; then cmake --build build --target ExtractAssetsHeaders else - rm -f soh.otr || true - rm -rf Extract || true - mkdir Extract - cp -r OTRExporter/assets Extract/assets - - build/ZAPD/ZAPD.out botr -se OTR --norom + cmake --build build --target GenerateSohOtr fi - cmake --build build --target soh --config Release + cmake --build build --target soh --config $BUILD_TYPE } package_soh() { @@ -107,10 +128,6 @@ package_soh-otr-exporter() { install -dm755 "${pkgdir}/usr/bin" ln -s ${SHIP_PREFIX}/assets/extractor/ZAPD.out "${pkgdir}/usr/bin/ZAPD" - # Change the external xml folder path so that it always points to this package's install path - find "${pkgdir}/${SHIP_PREFIX}/assets/extractor" -maxdepth 1 -name Config_\*.xml -exec \ - sed -i "/ExternalXMLFolder/s,assets/extractor,${SHIP_PREFIX}/&," {} + - install -dm755 "${pkgdir}/usr/share/licenses/soh-otr-exporter" install -Dm644 "OTRExporter/LICENSE" "${pkgdir}/usr/share/licenses/soh-otr-exporter/LICENSE" } diff --git a/soh/lus-install-paths.patch b/soh/lus-install-paths.patch deleted file mode 100644 index 1f65c87..0000000 --- a/soh/lus-install-paths.patch +++ /dev/null @@ -1,140 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 64e000e..cee7da9 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -9,7 +9,10 @@ endif() - - #=================== Top-Level =================== - -+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/install_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/install_config.h @ONLY) -+ - set(Source_Files__TopLevel -+ ${CMAKE_CURRENT_BINARY_DIR}/install_config.h - ${CMAKE_CURRENT_SOURCE_DIR}/Context.h - ${CMAKE_CURRENT_SOURCE_DIR}/Context.cpp - ) -@@ -351,7 +354,7 @@ endif() - #=================== Packages & Includes =================== - - target_include_directories(libultraship -- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../extern -+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../extern ${CMAKE_CURRENT_BINARY_DIR} - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../extern/spdlog/include ${CMAKE_CURRENT_SOURCE_DIR}/../extern/stb - ) - -diff --git a/src/Context.cpp b/src/Context.cpp -index cddeaf3..a239ce6 100644 ---- a/src/Context.cpp -+++ b/src/Context.cpp -@@ -12,6 +12,7 @@ - #elif defined(__WIIU__) - #include "port/wiiu/WiiUImpl.h" - #endif -+#include "install_config.h" - - namespace LUS { - std::weak_ptr Context::mContext; -@@ -254,6 +255,18 @@ std::string Context::GetShortName() { - } - - std::string Context::GetAppBundlePath() { -+#ifdef CMAKE_INSTALL_PREFIX -+ static const std::string fpath = CMAKE_INSTALL_PREFIX; -+ static int exists = -1; -+ -+ if (exists == -1) { -+ exists = fpath.size() > 0 && std::filesystem::is_directory(fpath); -+ } -+ -+ if (exists) { -+ return fpath; -+ } -+#else - #ifdef __APPLE__ - FolderManager folderManager; - return folderManager.getMainBundlePath(); -@@ -264,6 +277,7 @@ std::string Context::GetAppBundlePath() { - if (fpath != NULL) { - return std::string(fpath); - } -+#endif - #endif - - return "."; -@@ -277,6 +291,13 @@ std::string Context::GetAppDirectoryPath() { - } - #endif - -+ char *prefpath = SDL_GetPrefPath(NULL, "soh"); -+ if (prefpath != NULL) { -+ std::string ret(prefpath); -+ SDL_free(prefpath); -+ return ret; -+ } -+ - return "."; - } - -@@ -287,4 +308,21 @@ std::string Context::GetPathRelativeToAppBundle(const std::string path) { - std::string Context::GetPathRelativeToAppDirectory(const std::string path) { - return GetAppDirectoryPath() + "/" + path; - } -+ -+std::string Context::FindFileFromAllAppDirectories(const std::string path) { -+ std::string fpath; -+ -+ // app configuration dir (eg. ~/.local/share) -+ fpath = GetPathRelativeToAppDirectory(path); -+ if (std::filesystem::exists(fpath)) { -+ return fpath; -+ } -+ // app install dir (eg. /usr/) -+ fpath = GetPathRelativeToAppBundle(path); -+ if (std::filesystem::exists(fpath)) { -+ return fpath; -+ } -+ // current dir -+ return "./" + std::string(path); -+} - } // namespace LUS -diff --git a/src/Context.h b/src/Context.h -index 4ba7468..e1269c2 100644 ---- a/src/Context.h -+++ b/src/Context.h -@@ -29,6 +29,7 @@ class Context { - static std::string GetAppDirectoryPath(); - static std::string GetPathRelativeToAppDirectory(const std::string path); - static std::string GetPathRelativeToAppBundle(const std::string path); -+ static std::string FindFileFromAllAppDirectories(const std::string path); - - Context(std::string name, std::string shortName, std::string configFilePath); - ~Context(); -diff --git a/src/install_config.h.in b/src/install_config.h.in -new file mode 100644 -index 0000000..029753c ---- /dev/null -+++ b/src/install_config.h.in -@@ -0,0 +1 @@ -+#cmakedefine CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -diff --git a/src/public/libultra/os.cpp b/src/public/libultra/os.cpp -index 2025557..8bedf13 100644 ---- a/src/public/libultra/os.cpp -+++ b/src/public/libultra/os.cpp -@@ -14,8 +14,8 @@ int32_t osContInit(OSMesgQueue* mq, uint8_t* controllerBits, OSContStatus* statu - } - - #ifndef __SWITCH__ -- const char* controllerDb = "gamecontrollerdb.txt"; -- int mappingsAdded = SDL_GameControllerAddMappingsFromFile(controllerDb); -+ std::string controllerDb = LUS::Context::GetPathRelativeToAppBundle("gamecontrollerdb.txt"); -+ int mappingsAdded = SDL_GameControllerAddMappingsFromFile(controllerDb.c_str()); - if (mappingsAdded >= 0) { - SPDLOG_INFO("Added SDL game controllers from \"{}\" ({})", controllerDb, mappingsAdded); - } else { -@@ -78,4 +78,4 @@ int32_t osRecvMesg(OSMesgQueue* mq, OSMesg* msg, int32_t flag) { - mq->validCount--; - return 0; - } --} -\ No newline at end of file -+}