Skip to content

Commit

Permalink
soh: update to 8.0.0 + more
Browse files Browse the repository at this point in the history
+ OTRExporter and ZAPDTR as a submodule (archive)
+ fix paths when building on inside a dir with "."
+ add debug option
+ remove external xml folder patch
  • Loading branch information
Alto1772 committed Nov 9, 2023
1 parent eb957a8 commit 60d75d0
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 171 deletions.
16 changes: 11 additions & 5 deletions soh/.SRCINFO
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgbase = soh
pkgver = 7.1.1
pkgver = 8.0.0
pkgrel = 1
url = https://shipofharkinian.com/
arch = x86_64
Expand All @@ -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
Expand Down
56 changes: 56 additions & 0 deletions soh/OTRExporter-fix-paths-period-split.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From fb11cb1fc70f944feab290981b9e8d37e5ae6efc Mon Sep 17 00:00:00 2001
From: AltoXorg <[email protected]>
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<std::string> 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);
69 changes: 43 additions & 26 deletions soh/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Maintainer: AltoXorg <atrl101 AT yahoo DOT com>

_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/"
Expand All @@ -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
Expand All @@ -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() {
Expand Down Expand Up @@ -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"
}
140 changes: 0 additions & 140 deletions soh/lus-install-paths.patch

This file was deleted.

0 comments on commit 60d75d0

Please sign in to comment.