mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-10 18:21:14 +00:00
Switch port (#731)
* - Set defaults if ini exists, but empty. - Create a new dictionary object, not use null object. * Switch Port Todo: Fix: Misc crashes when interacting on island. Todo: Fix: Joystick pointer is slow to move. Todo: Fix: Touch doesn't behave. * Fix: base GetPathInfo fixup in the SDL implementation, with check for null SDL_PathInfo. Fix: Disable imgui shell functions. Todo: Display imgui debug if enabled. * Fix: Correction to suite style guidelines * - Switch build homebrew NRO - CI/CD to build Switch * Fix typo in CI * clang-format fix * Clang-format against isleapp.cpp * Use correct docker container for CI/CD * Remove SDL fixups and use an SDL3 port with fixes. Fixes crash bug and world issues! * Fix: use Clang-Format 17 instead of 21 --------- Co-authored-by: SnepOMatic (Rhew) <github@rhew.co.uk>
This commit is contained in:
parent
39d2f52987
commit
c2b0211304
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -46,6 +46,7 @@ jobs:
|
||||
- { name: 'iOS', os: 'macos-15', generator: 'Xcode', dx5: false, config: false, brew: true, werror: true, clang-tidy: false, cmake-args: '-DCMAKE_SYSTEM_NAME=iOS', ios: true }
|
||||
- { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' }
|
||||
- { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' }
|
||||
- { name: 'Nintendo Switch', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, nx: true, werror: true, clang-tidy: false, container: 'devkitpro/devkita64:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake' }
|
||||
- { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true}
|
||||
- { name: 'Android', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, android: true, werror: true, clang-tidy: false,}
|
||||
- { name: 'Vita', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, vita: true, werror: true, clang-tidy: false, cmake-args: '--toolchain /usr/local/vitasdk/share/vita.toolchain.cmake'}
|
||||
@ -190,7 +191,7 @@ jobs:
|
||||
run: cmake --build build --verbose --config Release
|
||||
|
||||
- name: Package (CPack)
|
||||
if: ${{ !matrix.n3ds && !matrix.android && !matrix.vita }}
|
||||
if: ${{ !matrix.n3ds && !matrix.nx && !matrix.android && !matrix.vita }}
|
||||
run: |
|
||||
cd build
|
||||
success=0
|
||||
@ -238,6 +239,13 @@ jobs:
|
||||
mkdir dist
|
||||
mv *.3dsx dist/
|
||||
mv *.cia dist/
|
||||
|
||||
- name: Package (Switch)
|
||||
if: ${{ matrix.nx }}
|
||||
run: |
|
||||
cd build
|
||||
mkdir dist
|
||||
mv *.nro dist/
|
||||
|
||||
- name: Package (Vita)
|
||||
if: ${{ matrix.vita }}
|
||||
@ -265,6 +273,7 @@ jobs:
|
||||
build/dist/*.AppImage
|
||||
build/dist/*.3dsx
|
||||
build/dist/*.cia
|
||||
build/dist/*.nro
|
||||
build/dist/*.apk
|
||||
build/dist/*.vpk
|
||||
|
||||
|
||||
@ -18,6 +18,14 @@ if (EMSCRIPTEN)
|
||||
set(SDL_PTHREADS ON CACHE BOOL "Enable SDL pthreads" FORCE)
|
||||
endif()
|
||||
|
||||
if (NINTENDO_SWITCH)
|
||||
set(CMAKE_TOOLCHAIN_FILE "${DEVKITPRO}/cmake/Switch.cmake" CACHE PATH "toolchain file")
|
||||
add_compile_definitions(__SWITCH__)
|
||||
add_compile_definitions(SDL_PLATFORM_SWITCH)
|
||||
add_compile_definitions(SDL_VIDEO_DRIVER_SWITCH)
|
||||
add_compile_definitions(IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
@ -50,7 +58,7 @@ cmake_dependent_option(ISLE_DEBUG "Enable imgui debug" ON "NOT VITA" OFF)
|
||||
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
|
||||
cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF)
|
||||
cmake_dependent_option(ISLE_EXTENSIONS "Use extensions" ON "NOT ISLE_USE_DX5;NOT WINDOWS_STORE" OFF)
|
||||
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT WINDOWS_STORE;NOT VITA" OFF)
|
||||
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT NINTENDO_SWITCH;NOT WINDOWS_STORE;NOT VITA" OFF)
|
||||
cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF)
|
||||
cmake_dependent_option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON "NOT VITA" OFF)
|
||||
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
|
||||
@ -85,6 +93,18 @@ if (DOWNLOAD_DEPENDENCIES)
|
||||
GIT_TAG "main"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
elseif (NINTENDO_SWITCH)
|
||||
FetchContent_Declare(
|
||||
SDL3
|
||||
# Official repo missing Threads support?
|
||||
#GIT_REPOSITORY "https://github.com/devkitPro/SDL.git"
|
||||
#GIT_TAG "switch-sdl-3.2"
|
||||
#GIT_REPOSITORY "https://github.com/vs49688/SDL.git"
|
||||
GIT_REPOSITORY "https://github.com/SnepOMatic/SDL3-Switch.git"
|
||||
GIT_TAG "switch-sdl-3.2.14"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON CACHE BOOL "Disable PCH globally" FORCE)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
SDL3
|
||||
@ -178,7 +198,8 @@ target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec"
|
||||
add_library(lego1
|
||||
LEGO1/main.cpp
|
||||
)
|
||||
target_precompile_headers(lego1 PRIVATE "LEGO1/lego1_pch.h")
|
||||
target_include_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/LEGO1")
|
||||
target_precompile_headers(lego1 PRIVATE "<lego1_pch.h>")
|
||||
set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL")
|
||||
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
|
||||
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/extensions/include>")
|
||||
@ -585,6 +606,11 @@ if (ISLE_BUILD_APP)
|
||||
ISLE/3ds/config.cpp
|
||||
)
|
||||
endif()
|
||||
if(NINTENDO_SWITCH)
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/switch/config.cpp
|
||||
)
|
||||
endif()
|
||||
if(WINDOWS_STORE)
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/xbox_one_series/config.cpp
|
||||
@ -880,6 +906,39 @@ if(NINTENDO_3DS)
|
||||
endif()
|
||||
install(FILES "$<TARGET_FILE_DIR:isle>/isle.3dsx" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
if(NINTENDO_SWITCH)
|
||||
find_program(NACPTOOL NAMES nacptool)
|
||||
find_program(ELF2NRO NAMES elf2nro)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "isle.nacp"
|
||||
COMMAND "${NACPTOOL}"
|
||||
--create
|
||||
"LEGO Island"
|
||||
"isledecomp/isle-portable"
|
||||
"${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.0"
|
||||
"isle.nacp"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "isle.nro"
|
||||
COMMAND "${ELF2NRO}"
|
||||
"$<TARGET_FILE:isle>"
|
||||
"$<TARGET_FILE_DIR:isle>/isle.nro"
|
||||
"--icon=${CMAKE_SOURCE_DIR}/packaging/switch/isle.jpg"
|
||||
"--nacp=${CMAKE_BINARY_DIR}/isle.nacp"
|
||||
DEPENDS "${CMAKE_SOURCE_DIR}/packaging/switch/isle.jpg" "${CMAKE_BINARY_DIR}/isle.nacp"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(switch-nro
|
||||
ALL
|
||||
DEPENDS "${CMAKE_BINARY_DIR}/isle.nro"
|
||||
COMMENT "Build switch NRO from ELF"
|
||||
)
|
||||
|
||||
endif()
|
||||
if(WINDOWS_STORE)
|
||||
install(
|
||||
DIRECTORY
|
||||
|
||||
@ -65,6 +65,12 @@
|
||||
#include "3ds/config.h"
|
||||
#endif
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#include "switch/config.h"
|
||||
|
||||
#include <switch.h>
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS_STORE
|
||||
#include "xbox_one_series/config.h"
|
||||
#endif
|
||||
@ -1144,6 +1150,9 @@ bool IsleApp::LoadConfig()
|
||||
#ifdef __3DS__
|
||||
N3DS_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
#ifdef __SWITCH__
|
||||
NX_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
#ifdef WINDOWS_STORE
|
||||
XBONE_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
|
||||
12
ISLE/switch/config.cpp
Normal file
12
ISLE/switch/config.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
|
||||
void NX_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
iniparser_set(p_dictionary, "isle:diskpath", "sdmc:/switch/isle/LEGO/");
|
||||
iniparser_set(p_dictionary, "isle:cdpath", "sdmc:/switch/isle/");
|
||||
iniparser_set(p_dictionary, "isle:savepath", "sdmc:/switch/isle/");
|
||||
iniparser_set(p_dictionary, "isle:Cursor Sensitivity", "16.000000");
|
||||
}
|
||||
8
ISLE/switch/config.h
Normal file
8
ISLE/switch/config.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef NX_CONFIG_H
|
||||
#define NX_CONFIG_H
|
||||
|
||||
#include "dictionary.h"
|
||||
|
||||
void NX_SetupDefaultConfigOverrides(dictionary* p_dictionary);
|
||||
|
||||
#endif // NX_CONFIG_H
|
||||
@ -69,6 +69,12 @@ if(NOT (VITA OR WINDOWS_STORE))
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NINTENDO_SWITCH)
|
||||
# Remove USE_OPENGL1 as incompatible.
|
||||
# Remove everything else as not needed.
|
||||
list(REMOVE_ITEM GRAPHICS_BACKENDS USE_SOFTWARE_RENDER USE_OPENGL1 USE_OPENGLES2) #USE_SDL_GPU
|
||||
endif()
|
||||
|
||||
if(VITA)
|
||||
add_subdirectory(src/d3drm/backends/gxm/shaders)
|
||||
|
||||
|
||||
BIN
packaging/switch/isle.jpg
Normal file
BIN
packaging/switch/isle.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue
Block a user