Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-15] Switch to unpacked MPQs #18

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading