From 1027d0990375e042329655a5b47a6597b31a6940 Mon Sep 17 00:00:00 2001 From: Azi Hassan Date: Tue, 29 Oct 2024 02:19:48 +0100 Subject: [PATCH] Fix extra font detection issue when loading from SD card --- .github/workflows/dreamcast.yml | 9 ++++----- Dockerfile | 16 +++++++++++----- Source/init.cpp | 13 +++++++++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dreamcast.yml b/.github/workflows/dreamcast.yml index c1a44efef56..3c929007ed4 100644 --- a/.github/workflows/dreamcast.yml +++ b/.github/workflows/dreamcast.yml @@ -6,7 +6,6 @@ on: # yamllint disable-line rule:truthy branches: - master - dreamcast - - fix/ISSUE-15-unpacked-mpqs paths-ignore: - '*.md' - 'docs/**' @@ -46,13 +45,13 @@ jobs: #devilutionx-assets spawn.mpq fails with unpack_and_minify_mpq #curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/spawn.mpq curl -LO https://raw.githubusercontent.com/d07RiV/diabloweb/3a5a51e84d5dab3cfd4fef661c46977b091aaa9c/spawn.mpq - unpack_and_minify_mpq spawn.mpq --output-dir data + unpack_and_minify_mpq spawn.mpq rm spawn.mpq - name: Download and unpack fonts.mpq run: | curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/fonts.mpq && \ - unpack_and_minify_mpq fonts.mpq --output-dir data/fonts && \ + unpack_and_minify_mpq fonts.mpq && \ rm fonts.mpq - name: Uninstall kos-ports SDL 1.2 @@ -88,8 +87,8 @@ jobs: - name: Generate .cdi run: | source /opt/toolchains/dc/kos/environ.sh && \ - mv data/spawn build/data/spawn && \ - mv data/fonts/fonts/fonts/ build/data/fonts/ && \ + mv spawn build/data/spawn && \ + mv fonts/fonts/ build/data/fonts/ && \ mkdcdisc -e build/devilutionx.elf -o build/devilutionx.cdi --name 'Diablo 1' -d build/data/ - name: Prepare elf package diff --git a/Dockerfile b/Dockerfile index 84f0f0beff3..6c327a9fa6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine-kallistios:no-gdb +FROM azihassan/kallistios:fdffe33635239d46bcccf0d5c4d59bb7d2d91f38 RUN echo "Building unpack_and_minify_mpq..." RUN git clone https://github.com/diasurgical/devilutionx-mpq-tools/ && \ @@ -27,14 +27,19 @@ RUN git clone -b SDL-dreamhal--GLDC https://github.com/GPF/SDL-1.2 && \ WORKDIR /opt/toolchains/dc/kos/devilutionX RUN echo "Downloading and unpacking spawn.mpq..." RUN curl -LO https://raw.githubusercontent.com/d07RiV/diabloweb/3a5a51e84d5dab3cfd4fef661c46977b091aaa9c/spawn.mpq && \ - unpack_and_minify_mpq spawn.mpq --output-dir data && \ + unpack_and_minify_mpq spawn.mpq && \ rm spawn.mpq RUN echo "Downloading and unpacking fonts.mpq..." RUN curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/fonts.mpq && \ - unpack_and_minify_mpq fonts.mpq --output-dir data/fonts && \ + unpack_and_minify_mpq fonts.mpq && \ rm fonts.mpq +#WORKDIR /opt/toolchains/dc/kos/devilutionX +#RUN echo "Copying and unpacking diabdat.mpq..." +#COPY DIABDAT.MPQ . +#RUN unpack_and_minify_mpq DIABDAT.MPQ + RUN echo "Configuring CMake..." RUN source /opt/toolchains/dc/kos/environ.sh && \ #uncomment when using packed save files @@ -47,8 +52,9 @@ RUN source /opt/toolchains/dc/kos/environ.sh && cd build && kos-make RUN echo "Generating CDI" RUN source /opt/toolchains/dc/kos/environ.sh && \ - mv data/spawn build/data/spawn && \ - mv data/fonts/fonts/fonts/ build/data/fonts && \ + mv spawn build/data/spawn && \ + mv fonts/fonts/ build/data/fonts/ && \ + #mv diabdat build/data/diabdat && \ mkdcdisc -e build/devilutionx.elf -o build/devilutionx.cdi --name 'Diablo 1' -d build/data/ ENTRYPOINT ["sh", "-c", "source /opt/toolchains/dc/kos/environ.sh && \"$@\"", "-s"] diff --git a/Source/init.cpp b/Source/init.cpp index 57357ae06e8..360947149b9 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -219,11 +219,16 @@ bool IsDevilutionXMpqOutOfDate(MpqArchive &archive) #ifdef UNPACKED_MPQS bool AreExtraFontsOutOfDate(const std::string &path) { -#ifdef __DREAMCAST__ - // handle ISO 9660 trailing period - const std::string versionPath = path + "fonts" DIRECTORY_SEPARATOR_STR "VERSION."; -#else +#ifndef __DREAMCAST__ const std::string versionPath = path + "fonts" DIRECTORY_SEPARATOR_STR "VERSION"; +#else + std::string versionPath = path + "fonts" DIRECTORY_SEPARATOR_STR "VERSION"; + if (!FileExists(versionPath)) { + Log("{} not found, appending trailing period", versionPath); + // handle ISO 9660 trailing period + versionPath += "."; + Log("New versionPath: {}", versionPath); + } #endif if (versionPath.size() + 1 > AssetRef::PathBufSize)