Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pionere/devilutionX into …
Browse files Browse the repository at this point in the history
…amiga
  • Loading branch information
pionere committed Feb 11, 2024
2 parents 0395556 + 8a65a8d commit 444b120
Show file tree
Hide file tree
Showing 32 changed files with 358 additions and 152 deletions.
183 changes: 179 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,11 @@ jobs:
artifact: 'hellfire-nightly-vita.vpk'
- name: diablo-vita
cmakeargs: '-DNONET=ON -D USE_PATCH=ON'
artifact: 'diablo-nightly-vita.vpk'
artifact: 'diablo-nightly-vitap.vpk'
- name: hellfire-vita
cmakeargs: '-DNONET=ON -D USE_PATCH=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-vita.vpk'
runs-on: ubuntu-22.04
artifact: 'hellfire-nightly-vitap.vpk'
runs-on: ubuntu-latest
container: vitasdk/vitasdk:latest
steps:
- name: Checkout
Expand All @@ -792,7 +792,182 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ./build/devilutionx.vpk
path: build/devilutionx.vpk

# n3ds-builds
build_n3ds:
needs: build_check
if: ${{ needs.build_check.outputs.should_run != 'false' }}
name: Nightly-Nintendo 3DS
strategy:
fail-fast: false
matrix:
#name: [diablo, hellfire]
include:
- name: diablo
cmakeargs: '-DNONET=ON'
artifact: 'diablo-nightly-3ds.3dsx'
cia: 'diablo-nightly-3ds.cia'
- name: hellfire
cmakeargs: '-DNONET=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-3ds.3dsx'
cia: 'hellfire-nightly-3ds.cia'
- name: diablo-3ds
cmakeargs: '-DNONET=ON -D USE_PATCH=ON'
artifact: 'diablo-nightly-3dsp.3dsx'
cia: 'diablo-nightly-3dsp.cia'
- name: hellfire-3ds
cmakeargs: '-DNONET=ON -D USE_PATCH=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-3dsp.3dsx'
cia: 'hellfire-nightly-3dsp.cia'
runs-on: ubuntu-latest
container: devkitpro/devkitarm:latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install dependencies
run: |
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
ffmpeg \
gettext
- name: Get external dependencies
run: |
wget https://github.com/diasurgical/bannertool/releases/download/1.2.0/bannertool.zip
unzip -j "bannertool.zip" "linux-x86_64/bannertool" -d "/opt/devkitpro/tools/bin"
wget https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v0.18/makerom-v0.18-ubuntu_x86_64.zip
unzip "makerom-v0.18-ubuntu_x86_64.zip" "makerom" -d "/opt/devkitpro/tools/bin"
chmod a+x /opt/devkitpro/tools/bin/makerom
- name: Configure CMake
run: |
cmake -S. -Bbuild -GNinja \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.cmakeargs }} -DNINTENDO_3DS=ON \
-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake
- name: Build DevilutionX
run: cmake --build build -j$(nproc)

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build/devilutionx.3dsx

- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.cia }}
path: build/devilutionx.cia

# switch-builds
build_switch:
needs: build_check
if: ${{ needs.build_check.outputs.should_run != 'false' }}
name: Nightly-Nintendo Switch
strategy:
fail-fast: false
matrix:
#name: [diablo, hellfire]
include:
- name: diablo
cmakeargs: '-DNONET=ON'
artifact: 'diablo-nightly-switch.nro'
- name: hellfire
cmakeargs: '-DNONET=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-switch.nro'
- name: diablo-switch
cmakeargs: '-DNONET=ON -D USE_PATCH=ON'
artifact: 'diablo-nightly-switchp.nro'
- name: hellfire-switch
cmakeargs: '-DNONET=ON -D USE_PATCH=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-switchp.nro'
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# - name: Create Build Environment
# run: brew bundle install
- name: Install dependencies
shell: bash
run: |
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
gettext
- name: Configure CMake
run: |
cmake -S . -B build \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.cmakeargs }} \
-D CMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
- name: Build DevilutionX
run: cmake --build build -j$(nproc)

- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ./build/devilutionx.nro

# amiga-builds
build_amiga:
needs: build_check
if: ${{ needs.build_check.outputs.should_run != 'false' }}
name: Nightly-Amiga M68K
strategy:
fail-fast: false
matrix:
#name: [diablo, hellfire]
include:
- name: diablo
cmakeargs: '-DNONET=ON'
artifact: 'diablo-nightly-amiga'
- name: hellfire
cmakeargs: '-DNONET=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-amiga'
- name: diablo-amiga
cmakeargs: '-DNONET=ON -D USE_PATCH=ON'
artifact: 'diablo-nightly-amigap'
- name: hellfire-amiga
cmakeargs: '-DNONET=ON -D USE_PATCH=ON -DHELLFIRE=ON'
artifact: 'hellfire-nightly-amigap'
runs-on: ubuntu-latest
container: amigadev/crosstools:m68k-amigaos-gcc10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run prep.sh script
run: Packaging/amiga/prep.sh

- name: Configure CMake
run: |
cmake -S. -Bbuild -GNinja \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.cmakeargs }} \
-DM68K_COMMON="-s -ffast-math -O3" \
-DM68K_CPU=68040 \
-DM68K_FPU=hard
- name: Build DevilutionX
run: cmake --build build

- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ./build/devilutionx

# Releases
release:
Expand Down
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,15 @@ if(USE_PATCH AND NOT ANDROID)

if(NINTENDO_SWITCH)
list(APPEND devil_patcher_SRCS
Source/platform/switch/docking.cpp
Source/platform/switch/romfs.cpp)
tools/patcher/platform/switch/docking.cpp
tools/patcher/platform/switch/romfs.cpp)
endif()

if(NINTENDO_3DS)
list(APPEND devil_patcher_SRCS
Source/platform/ctr/system.cpp
Source/platform/ctr/display.cpp
Source/platform/ctr/messagebox.cpp)
tools/patcher/platform/ctr/system.cpp
tools/patcher/platform/ctr/display.cpp
tools/patcher/platform/ctr/messagebox.cpp)
endif()

set(PATCHER_SOURCES ${devil_patcher_SRCS})
Expand Down Expand Up @@ -1023,6 +1023,9 @@ if(NINTENDO_3DS)
#target_include_directories(${BIN_TARGET} PRIVATE ${TREMOR_INCLUDE_DIRS})
#target_link_libraries(${BIN_TARGET} PRIVATE 3ds::ogg 3ds::mikmod 3ds::mad 3ds::freetype 3ds::bzip2 3ds::png)
target_link_libraries(${BIN_TARGET} PRIVATE 3ds::citro3d 3ds::ctrulib)
if(DEVIL_PATCHER)
target_link_libraries(${DEVIL_PATCHER} PRIVATE 3ds::citro3d 3ds::ctrulib)
endif()
endif()

if(GPERF)
Expand Down
110 changes: 32 additions & 78 deletions Packaging/amiga/prep.sh
Original file line number Diff line number Diff line change
@@ -1,78 +1,32 @@
#!/usr/bin/env bash

# exit when any command fails
set -euo pipefail

#set compiler params
export TARGET='m68k-amigaos'
export SYSROOT=/opt/$TARGET
export M68K_CPU=68040
export M68K_FPU=hard
export M68K_CPU_FPU="-m${M68K_CPU} -m${M68K_FPU}-float"
export M68K_COMMON="-s -ffast-math -fomit-frame-pointer"
export M68K_CFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}"
export M68K_CXXFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}"

PARALLELISM="$(getconf _NPROCESSORS_ONLN)"

declare -ra CMAKE_FLAGS=(
-DM68K_CPU="$M68K_CPU"
-DM68K_FPU="$M68K_FPU"
-DM68K_COMMON="$M68K_COMMON"
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="${SYSROOT}/usr"
)

mkdir -p deps
mkdir -p ${SYSROOT}/usr/lib
mkdir -p ${SYSROOT}/usr/include
cd deps

# ZLIB
wget https://www.zlib.net/zlib-1.2.11.tar.gz -O zlib-1.2.11.tar.gz
tar -xvf zlib-1.2.11.tar.gz
mkdir -p zlib-1.2.11/build
cd zlib-1.2.11
cmake -S. -Bbuild "${CMAKE_FLAGS[@]}" -O3 -fno-exceptions -w -noixemul -DBIG_ENDIAN -DAMIGA -fpermissive -std=c++14"
cmake --build build -j"$PARALLELISM" --config Release --target install
cd ..
# SDL1.2
wget https://github.com/AmigaPorts/libSDL12/archive/master.tar.gz -O SDL-1.2.tar.gz
tar -xvf SDL-1.2.tar.gz
cd libSDL12-master
make PREFX=${SYSROOT} PREF=${SYSROOT} -j"$PARALLELISM"
mkdir -p ${SYSROOT}/usr/lib
mkdir -p ${SYSROOT}/usr/include
cp -fvr libSDL.a ${SYSROOT}/usr/lib/
cp -fvr include/* ${SYSROOT}/usr/include/
cd ..
# SDL_mixer
#wget https://github.com/SDL-mirror/SDL_mixer/archive/SDL-1.2.tar.gz -O SDL_mixer-SDL-1.2.tar.gz
#tar -xvf SDL_mixer-SDL-1.2.tar.gz
#cd SDL_mixer-SDL-1.2
#./autogen.sh
#SDL_LIBS='-lSDL -ldebug' SDL_CFLAGS="-I${SYSROOT}/usr/include/SDL -noixemul" CFLAGS="${M68K_CFLAGS}" CXXFLAGS="${M68K_CXXFLAGS}" ./configure --disable-sdltest --disable-shared --enable-static --host=${TARGET} --prefix="${SYSROOT}/usr"
#make -j$(getconf _NPROCESSORS_ONLN)
#make install
#cd ..
# FreeType
#wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz -O freetype-2.10.1.tar.gz
#tar -xvf freetype-2.10.1.tar.gz
#mkdir -p freetype-2.10.1/build
#cd freetype-2.10.1
#cmake -S. -Bbuild -DUNIX=1 -DM68K_CPU="$M68K_CPU" -DM68K_FPU="$M68K_FPU" -DM68K_COMMON="${M68K_COMMON}"
#cmake --build build -j"$PARALLELISM" --config Release --target install
#cd ..
# SDL_ttf
#wget https://github.com/SDL-mirror/SDL_ttf/archive/SDL-1.2.tar.gz -O SDL_ttf-SDL-1.2.tar.gz
#tar -xvf SDL_ttf-SDL-1.2.tar.gz
#cd SDL_ttf-SDL-1.2
#./autogen.sh
#LDFLAGS="-L${SYSROOT}/usr/lib" SDL_LIBS='-lSDL -ldebug' SDL_CFLAGS="-L${SYSROOT}/usr/lib -I${SYSROOT}/usr/include/SDL -noixemul" CFLAGS="${M68K_CFLAGS}" CXXFLAGS="${M68K_CXXFLAGS}" FT2_CFLAGS="-L${SYSROOT}/usr/lib -I${SYSROOT}/usr/include/freetype2" FT2_LIBS="-lfreetype -lzlib" ./configure --disable-shared --enable-static --host=${TARGET} --prefix=${SYSROOT}/usr
#make -j$(getconf _NPROCESSORS_ONLN)
#make install
#!/usr/bin/env bash

# exit when any command fails
set -euo pipefail

#set compiler params
export TARGET='m68k-amigaos'
export SYSROOT=/opt/$TARGET
export M68K_CPU=68040
export M68K_FPU=hard
export M68K_CPU_FPU="-m${M68K_CPU} -m${M68K_FPU}-float"
export M68K_COMMON="-s -ffast-math -fomit-frame-pointer"
export M68K_CFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}"
export M68K_CXXFLAGS="${M68K_CPU_FPU} ${M68K_COMMON}"

PARALLELISM="$(getconf _NPROCESSORS_ONLN)"

mkdir -p deps
mkdir -p ${SYSROOT}/usr/lib
mkdir -p ${SYSROOT}/usr/include
cd deps

# SDL1.2
wget https://github.com/AmigaPorts/libSDL12/archive/master.tar.gz -O SDL-1.2.tar.gz
tar -xvf SDL-1.2.tar.gz
cd libSDL12-master
make PREFX=${SYSROOT} PREF=${SYSROOT} -j"$PARALLELISM"
mkdir -p ${SYSROOT}/usr/lib
mkdir -p ${SYSROOT}/usr/include
cp -fvr libSDL.a ${SYSROOT}/usr/lib/
cp -fvr include/* ${SYSROOT}/usr/include/
cd ..
2 changes: 1 addition & 1 deletion Source/mpqapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ static bool mpqapi_write_file_contents(const char* pszName, const BYTE* pbData,
goto on_error;
#else
// Ensure we do not seekp beyond EOF by filling the missing space.
std::streampos stream_end;
long stream_end;
if (!cur_archive.stream.seekp(0, SEEK_END) || !cur_archive.stream.tellp(&stream_end))
goto on_error;
std::size_t curSize = stream_end - cur_archive.stream_begin;
Expand Down
2 changes: 2 additions & 0 deletions Source/platform/ctr/asio/net/if.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef TCPIP
#include <stddef.h>
#include <errno.h>
#include <net/if.h>
Expand All @@ -20,3 +21,4 @@ struct if_nameindex *if_nameindex()
void if_freenameindex(struct if_nameindex *__ptr)
{
}
#endif
2 changes: 2 additions & 0 deletions Source/platform/ctr/asio/sys/socket.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef TCPIP
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/uio.h>
Expand Down Expand Up @@ -106,3 +107,4 @@ int socketpair(int domain, int type, int protocol, int socket_vector[2])
{
return ENOTSUP;
}
#endif
2 changes: 2 additions & 0 deletions Source/platform/ctr/asio/sys/uio.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef TCPIP
#include <sys/uio.h>
#include <sys/types.h>
#include <errno.h>
Expand All @@ -11,3 +12,4 @@ ssize_t writev(int __fd, const struct iovec *__iovec, int __count)
{
return ENOTSUP;
}
#endif
Loading

0 comments on commit 444b120

Please sign in to comment.