From 875bc0b1c21aac75e55947ff421f2a8cc9f36c29 Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Tue, 7 May 2019 13:52:25 -0500 Subject: Switch: fix build, add build instructions, avoid using delete() --- backends/platform/sdl/switch/README.SWITCH | 41 ++++++++++++++++++++++++++++ backends/platform/sdl/switch/switch-main.cpp | 2 +- backends/platform/sdl/switch/switch.cpp | 10 ------- backends/platform/sdl/switch/switch.h | 1 - backends/platform/sdl/switch/switch.mk | 22 +++++++-------- configure | 2 +- 6 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 backends/platform/sdl/switch/README.SWITCH diff --git a/backends/platform/sdl/switch/README.SWITCH b/backends/platform/sdl/switch/README.SWITCH new file mode 100644 index 0000000000..c19cd80fe5 --- /dev/null +++ b/backends/platform/sdl/switch/README.SWITCH @@ -0,0 +1,41 @@ +ScummVM-Switch README +============================================================================== + +Installation +============ + - Copy the relevant game datafiles to your sd card (location doesn't matter). + - Install ScummVM like any other homebrew. + - After installation you should have a file `/switch/scummvm/scummvm.nro` + - Run ScummVM and use the launcher to add games and run them. + - Press the plus key to return to the launcher and play another game. + +Notes +===== + - This README may be outdated, for more up-to-date instructions and notes see + the Switch Port Wiki: https://wiki.scummvm.org/index.php/Nintendo_Switch + +Building the source code +======================== +To build ScummVM for Switch: + +- Obtain the ScummVM source code from https://github.com/scummvm/scummvm + +- Install devkitPro for Switch (https://switchbrew.org/wiki/Setting_up_Development_Environment) + +- Ensure your $DEVKITPRO variable is set via `export DEVKITPRO="/opt/devkitpro"` + +- Ensure your $DEVKITA64 variable is set via `export DEVKITA64="/opt/devkitpro/devkitA64"` + +- Ensure devkitPro binaries are in your path via `export PATH="$DEVKITA64/bin:$DEVKITPRO/tools/bin:$PATH"` + +- Install libraries via `sudo -E dkp-pacman -S switch-portlibs` (or just `pacman -S switch-portlibs`) + +- Create a subdirectory somewhere outside the source folder for your ScummVM build and cd into it + +- Execute the command `configure --host=switch` + +- Execute the command `make scummvm_switch.zip` + +Port Authors +============ +cpasjuste diff --git a/backends/platform/sdl/switch/switch-main.cpp b/backends/platform/sdl/switch/switch-main.cpp index 411d5608be..a44b2fb76e 100644 --- a/backends/platform/sdl/switch/switch-main.cpp +++ b/backends/platform/sdl/switch/switch-main.cpp @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { int res = scummvm_main(argc, argv); // Free OSystem - delete (OSystem_Switch *)g_system; + g_system->destroy(); #ifdef __SWITCH_DEBUG__ socketExit(); diff --git a/backends/platform/sdl/switch/switch.cpp b/backends/platform/sdl/switch/switch.cpp index 7ce3372d8d..391b101aa2 100644 --- a/backends/platform/sdl/switch/switch.cpp +++ b/backends/platform/sdl/switch/switch.cpp @@ -87,16 +87,6 @@ void OSystem_Switch::initBackend() { OSystem_SDL::initBackend(); } -bool OSystem_Switch::hasFeature(Feature f) { - - if (f == kFeatureDisplayLogFile) - return false; - if (f == kFeatureOpenUrl) - return false; - - return OSystem_SDL::hasFeature(f); -} - void OSystem_Switch::logMessage(LogMessageType::Type type, const char *message) { printf("%s\n", message); } diff --git a/backends/platform/sdl/switch/switch.h b/backends/platform/sdl/switch/switch.h index 6578463897..b9e0b063f6 100644 --- a/backends/platform/sdl/switch/switch.h +++ b/backends/platform/sdl/switch/switch.h @@ -33,7 +33,6 @@ public: virtual void init() override; virtual void initBackend() override; - virtual bool hasFeature(Feature f) override; virtual void logMessage(LogMessageType::Type type, const char *message) override; protected: diff --git a/backends/platform/sdl/switch/switch.mk b/backends/platform/sdl/switch/switch.mk index 9c978a7917..998333e3f8 100644 --- a/backends/platform/sdl/switch/switch.mk +++ b/backends/platform/sdl/switch/switch.mk @@ -1,19 +1,19 @@ scummvm.nro: $(EXECUTABLE) - mkdir -p $(srcdir)/switch_release/scummvm/data - mkdir -p $(srcdir)/switch_release/scummvm/doc - nacptool --create "ScummVM" "Cpasjuste" "2.12" $(srcdir)/switch_release/scummvm.nacp - elf2nro $(EXECUTABLE) $(srcdir)/switch_release/scummvm/scummvm.nro --icon=$(srcdir)/dists/switch/icon.jpg --nacp=$(srcdir)/switch_release/scummvm.nacp + mkdir -p ./switch_release/scummvm/data + mkdir -p ./switch_release/scummvm/doc + nacptool --create "ScummVM" "Cpasjuste" "2.12" ./switch_release/scummvm.nacp + elf2nro $(EXECUTABLE) ./switch_release/scummvm/scummvm.nro --icon=$(srcdir)/dists/switch/icon.jpg --nacp=./switch_release/scummvm.nacp scummvm_switch.zip: scummvm.nro - rm -f $(srcdir)/switch_release/scummvm.nacp - cp $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(srcdir)/switch_release/scummvm/data - cp $(srcdir)/backends/vkeybd/packs/vkeybd_small.zip $(srcdir)/switch_release/scummvm/data - cp $(DIST_FILES_THEMES) $(srcdir)/switch_release/scummvm/data + rm -f ./switch_release/scummvm.nacp + cp $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip ./switch_release/scummvm/data + cp $(srcdir)/backends/vkeybd/packs/vkeybd_small.zip ./switch_release/scummvm/data + cp $(DIST_FILES_THEMES) ./switch_release/scummvm/data ifdef DIST_FILES_ENGINEDATA - cp $(DIST_FILES_ENGINEDATA) $(srcdir)/switch_release/scummvm/data + cp $(DIST_FILES_ENGINEDATA) ./switch_release/scummvm/data endif - cp $(DIST_FILES_DOCS) $(srcdir)/switch_release/scummvm/doc/ - cd $(srcdir)/switch_release && zip -r ../scummvm_switch.zip . && cd .. + cp $(DIST_FILES_DOCS) ./switch_release/scummvm/doc/ + cd ./switch_release && zip -r ../scummvm_switch.zip . && cd .. .PHONY: scummvm.nro scummvm_switch.zip diff --git a/configure b/configure index d5883e9695..f241dbb6d0 100755 --- a/configure +++ b/configure @@ -1688,7 +1688,7 @@ samsungtv) ;; switch) _host_os=switch - _host_cpu=arm + _host_cpu=aarch64 _host_alias=aarch64-none-elf test "x$prefix" = xNONE && prefix=. datarootdir='${prefix}/data' -- cgit v1.2.3