Skip to content

Commit

Permalink
Merge pull request #17 from azihassan/fix/ISSUE-15-unpacked-mpqs
Browse files Browse the repository at this point in the history
[ISSUE-15] Switch to unpacked MPQs
  • Loading branch information
azihassan authored Oct 22, 2024
2 parents aa2f9e2 + 51ab7b7 commit 25c05e8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/dreamcast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on: # yamllint disable-line rule:truthy
branches:
- master
- dreamcast
- fix/ISSUE-15-unpacked-mpqs
paths-ignore:
- '*.md'
- 'docs/**'
Expand All @@ -32,6 +33,28 @@ jobs:
with:
fetch-depth: 0

- name: Build unpack_and_minify_mpq
run: |
git clone https://github.com/diasurgical/devilutionx-mpq-tools/ && \
cd devilutionx-mpq-tools && \
cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
cmake --build build-rel && \
cmake --install build-rel
- name: Download and unpack spawn.mpq
run: |
#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
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 && \
rm fonts.mpq
- name: Uninstall kos-ports SDL 1.2
run: |
source /opt/toolchains/dc/kos/environ.sh && \
Expand All @@ -47,20 +70,12 @@ jobs:
cp /opt/toolchains/dc/kos/addons/lib/dreamcast/libSDL.a /usr/lib/ && \
cp include/* /usr/include/SDL/
- name: Download spawn.mpq
run: |
curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/spawn.mpq
- name: Download fonts.mpq
run: |
curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/fonts.mpq
- name: Configure CMake
run: |
source /opt/toolchains/dc/kos/environ.sh && \
#uncomment when using packed mpq or save files
#uncomment when using packed save files
#without this, cmake can't find the kos-ports bzip2 & zlib libraries
export CMAKE_PREFIX_PATH=/opt/toolchains/dc/kos-ports/libbz2/inst/:/opt/toolchains/dc/kos-ports/zlib/inst/ && \
#export CMAKE_PREFIX_PATH=/opt/toolchains/dc/kos-ports/libbz2/inst/:/opt/toolchains/dc/kos-ports/zlib/inst/ && \
kos-cmake \
-S . \
-DCMAKE_BUILD_TYPE=Release \
Expand All @@ -73,12 +88,12 @@ jobs:
- name: Generate .cdi
run: |
source /opt/toolchains/dc/kos/environ.sh && \
mv spawn.mpq build/data/ && \
mv fonts.mpq build/data/fonts/ && \
mv data/spawn build/data/spawn && \
mv data/fonts/fonts/fonts/ build/data/fonts/ && \
mkdcdisc -e build/devilutionx.elf -o build/devilutionx.cdi --name 'Diablo 1' -d build/data/
- name: Prepare elf package
run: rm build/data/spawn.mpq && rm build/data/fonts/fonts.mpq
run: rm -rf build/data/spawn && rm -rf build/data/fonts/fonts/

- name: Upload .elf Package
if: ${{ !env.ACT }}
Expand Down Expand Up @@ -117,4 +132,3 @@ jobs:
with:
file: ./build/devilutionx-dreamcast.zip
overwrite: true
...
1 change: 1 addition & 0 deletions CMake/platforms/dreamcast.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(DEVILUTIONX_GAMEPAD_TYPE Nintendo)

set(NOSOUND ON)
set(DEVILUTIONX_STATIC_ZLIB ON)
set(UNPACKED_MPQS ON)
set(UNPACKED_SAVES ON)
set(DEVILUTIONX_SYSTEM_LIBFMT OFF)
set(DEVILUTIONX_STATIC_LUA ON)
Expand Down
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM alpine-kallistios:no-gdb

RUN echo "Building unpack_and_minify_mpq..."
RUN git clone https://github.com/diasurgical/devilutionx-mpq-tools/ && \
cd devilutionx-mpq-tools && \
cmake -S. -Bbuild-rel -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && \
cmake --build build-rel && \
cmake --install build-rel

RUN echo "Cloning project..."
WORKDIR /opt/toolchains/dc/kos/
RUN git clone -b dreamcast https://github.com/azihassan/devilutionX.git
Expand All @@ -18,26 +25,30 @@ RUN git clone -b SDL-dreamhal--GLDC https://github.com/GPF/SDL-1.2 && \
cp include/* /usr/include/SDL/

WORKDIR /opt/toolchains/dc/kos/devilutionX
RUN echo "Downloading spawn.mpq..."
RUN curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/spawn.mpq
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 && \
rm spawn.mpq

RUN echo "Downloading fonts.mpq..."
RUN curl -LO https://github.com/diasurgical/devilutionx-assets/releases/download/v4/fonts.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 && \
rm fonts.mpq

RUN echo "Configuring CMake..."
RUN source /opt/toolchains/dc/kos/environ.sh && \
#uncomment when using packed save files
#without this, cmake can't find the kos-ports bzip2 & zlib libraries
export CMAKE_PREFIX_PATH=/opt/toolchains/dc/kos-ports/libbz2/inst/:/opt/toolchains/dc/kos-ports/zlib/inst/ && \
#export CMAKE_PREFIX_PATH=/opt/toolchains/dc/kos-ports/libbz2/inst/:/opt/toolchains/dc/kos-ports/zlib/inst/ && \
kos-cmake -S. -Bbuild

RUN echo "Compiling..."
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 spawn.mpq build/data/ && \
mv fonts.mpq build/data/fonts && \
mv data/spawn build/data/spawn && \
mv data/fonts/fonts/fonts/ build/data/fonts && \
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"]

0 comments on commit 25c05e8

Please sign in to comment.