Skip to content

Commit

Permalink
Fix extra font detection issue when loading from SD card
Browse files Browse the repository at this point in the history
  • Loading branch information
azihassan committed Oct 29, 2024
1 parent e29611e commit 1027d09
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/dreamcast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on: # yamllint disable-line rule:truthy
branches:
- master
- dreamcast
- fix/ISSUE-15-unpacked-mpqs
paths-ignore:
- '*.md'
- 'docs/**'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/ && \
Expand Down Expand Up @@ -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
Expand All @@ -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"]
13 changes: 9 additions & 4 deletions Source/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1027d09

Please sign in to comment.