Add Nintendo Switch support

- Bundle resources folder through romfs
- Added Switch-exclusive romfs init/exit code
- Add icon for NRO
- Add Switch-exclusive CMake code for NACP/NRO generation
- Add GitHub Actions Switch workflow
This commit is contained in:
Adrian Graber
2022-10-29 08:25:07 +09:00
committed by kichikuou
parent 76a255619d
commit 05ff59cff2
4 changed files with 53 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
name: Nintendo Switch Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build
run: |
mkdir -p out/switch
cd out/switch
/opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -DCMAKE_BUILD_TYPE=Release ../../src/
make
mkdir system3
mv system3.* system3/
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: system3-switch
path: out/switch/system3
+16
View File
@@ -178,6 +178,22 @@ target_sources(system3 PRIVATE
sys/nact_sys3.cpp
)
if(NINTENDO_SWITCH)
set(RESOURCE_PATH romfs:/)
nx_generate_nacp(system3.nacp
NAME "system3"
AUTHOR "kichikuou"
VERSION "0.8.0"
)
nx_create_nro(system3
NACP system3.nacp
ICON "../switch/icon.jpg"
ROMFS "../resources"
)
endif()
target_compile_definitions(system3 PRIVATE
$<$<CONFIG:Debug>:_DEBUG_CONSOLE>
RESOURCE_PATH="${RESOURCE_PATH}")
+10
View File
@@ -13,6 +13,9 @@
#include <emscripten.h>
#include <emscripten/html5.h>
#endif
#ifdef __SWITCH__
#include <switch.h>
#endif
SDL_Window* g_window;
SDL_Renderer* g_renderer;
@@ -20,6 +23,9 @@ NACT* g_nact;
int main(int argc, char *argv[])
{
#ifdef __SWITCH__
romfsInit();
#endif
Config config(argc, argv);
if (!config.timidity_cfg.empty()) {
@@ -94,6 +100,10 @@ int main(int argc, char *argv[])
SDL_DestroyWindow(g_window);
SDL_Quit();
#ifdef __SWITCH__
romfsExit();
#endif
return 0;
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB