diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 9ae6ea3511f..8ff29d76fcb 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -156,3 +156,40 @@ jobs: allowUpdates: true prerelease: true replacesArtifacts: true + build-switch: + name: Make (Nintendo Switch) + runs-on: ubuntu-latest + container: devkitpro/devkita64:latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 50 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y gettext + - name: Build + run: | + export PATH=$DEVKITPRO/tools/bin:$DEVKITPRO/portlibs/switch/bin:$DEVKITPRO/devkitA64/bin:$PATH + make -f Makefile.switch -j 2 + cd files/lang + make -j 2 + env: + FHEROES2_STRICT_COMPILATION: ON + DEVKITPRO: /opt/devkitpro + - name: Create package + if: ${{ github.event_name == 'push' }} + run: | + cp docs/README.txt . + zip fheroes2_switch_sdl2.zip fheroes2.nro LICENSE fheroes2.key changelog.txt README.txt files/lang/*.mo + - uses: ncipollo/release-action@v1 + if: ${{ github.event_name == 'push' }} + with: + artifacts: fheroes2_switch_sdl2.zip + body: ${{ github.event.commits[0].message }} + token: ${{ secrets.GITHUB_TOKEN }} + name: Nintendo Switch build with SDL 2.0 support (latest commit) + tag: fheroes2-switch-sdl2_dev + allowUpdates: true + prerelease: true + replacesArtifacts: true diff --git a/Makefile.switch b/Makefile.switch new file mode 100644 index 00000000000..53056548614 --- /dev/null +++ b/Makefile.switch @@ -0,0 +1,44 @@ +########################################################################### +# Free Heroes of Might and Magic II: https://github.com/ihhub/fheroes2 # +# Copyright (C) 2021 # +# # +# This program is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # +########################################################################### + +TARGET := fheroes2 +MAKE := make + +PROJECT_TITLE := fheroes2 +PROJECT_AUTHOR := fheroes2 resurrection team +PROJECT_VERSION := 0.9.5 + +all: package + +package: $(TARGET).nro + +$(TARGET).nro: $(TARGET).elf $(TARGET).nacp + elf2nro $(TARGET).elf $(TARGET).nro --icon=files/images/platform/switch/icon.png --nacp=$(TARGET).nacp + +$(TARGET).nacp: + nacptool --create "$(PROJECT_TITLE)" "$(PROJECT_AUTHOR)" "$(PROJECT_VERSION)" $(TARGET).nacp + +$(TARGET).elf: + $(MAKE) -f Makefile -C src PLATFORM=switch RELEASE=true + @cp src/dist/$(TARGET) $(TARGET).elf + +clean: + $(MAKE) -f Makefile -C src clean + @rm -rf $(TARGET).elf $(TARGET).nacp $(TARGET).nro diff --git a/Makefile.vita b/Makefile.vita index 3eef56c901d..128b06ba756 100644 --- a/Makefile.vita +++ b/Makefile.vita @@ -23,36 +23,33 @@ MAKE := make PROJECT_TITLE := Free Heroes of Might & Magic II PROJECT_TITLEID := FHOMM0002 -PROJECT := fheroes2 all: package -package: $(PROJECT).vpk +package: $(TARGET).vpk -$(PROJECT).vpk: eboot.bin param.sfo +$(TARGET).vpk: eboot.bin param.sfo vita-pack-vpk -s param.sfo -b eboot.bin \ --add files/images/platform/psv/sce_sys/icon0.png=sce_sys/icon0.png \ --add files/images/platform/psv/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \ --add files/images/platform/psv/sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \ --add files/images/platform/psv/sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \ - $(PROJECT).vpk + $(TARGET).vpk -eboot.bin: $(PROJECT).velf - vita-make-fself $(PROJECT).velf eboot.bin +eboot.bin: $(TARGET).velf + vita-make-fself $(TARGET).velf eboot.bin param.sfo: vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo -$(PROJECT).velf: $(PROJECT).elf +$(TARGET).velf: $(TARGET).elf arm-vita-eabi-strip -g $< vita-elf-create $< $@ -$(PROJECT).elf: +$(TARGET).elf: $(MAKE) -f Makefile -C src FHEROES2_VITA=true RELEASE=true - $(MAKE) -f files/lang/Makefile - @cp src/dist/$(TARGET) ./$(PROJECT).elf + @cp src/dist/$(TARGET) $(TARGET).elf clean: $(MAKE) -f Makefile -C src clean - $(MAKE) -f files/lang/Makefile clean - @rm -rf $(TARGET).velf $(TARGET).elf $(OBJS) $(TARGET).elf.unstripped.elf $(TARGET).vpk eboot.bin sce_sys/param.sfo ./param.sfo + @rm -rf $(TARGET).velf $(TARGET).elf $(TARGET).vpk eboot.bin param.sfo diff --git a/files/images/platform/switch/icon.png b/files/images/platform/switch/icon.png new file mode 100644 index 00000000000..586a6be0fb0 Binary files /dev/null and b/files/images/platform/switch/icon.png differ