From 3d0c59e50e64188fded99f4954fc881e1ad301bd Mon Sep 17 00:00:00 2001 From: Andreas Pokorny Date: Sun, 12 Jan 2025 15:38:37 +0100 Subject: [PATCH] feat: adds suyu master --- .../suyu/config/SD865/qt-config.ini | 33 +++++++++++++++++++ packages/emulators/standalone/suyu/package.mk | 26 +++++++++++++++ .../patches/01-no-cross-compile-tzdb.patch | 16 +++++++++ .../suyu/patches/02-force-type-cast.patch | 13 ++++++++ .../suyu/patches/03-set-rom-path.patch | 14 ++++++++ .../patches/04-dont-use-native-dialogs.patch | 12 +++++++ packages/virtual/emulators/package.mk | 2 +- 7 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 packages/emulators/standalone/suyu/config/SD865/qt-config.ini create mode 100644 packages/emulators/standalone/suyu/package.mk create mode 100644 packages/emulators/standalone/suyu/patches/01-no-cross-compile-tzdb.patch create mode 100644 packages/emulators/standalone/suyu/patches/02-force-type-cast.patch create mode 100644 packages/emulators/standalone/suyu/patches/03-set-rom-path.patch create mode 100644 packages/emulators/standalone/suyu/patches/04-dont-use-native-dialogs.patch diff --git a/packages/emulators/standalone/suyu/config/SD865/qt-config.ini b/packages/emulators/standalone/suyu/config/SD865/qt-config.ini new file mode 100644 index 0000000000..cff3e9586f --- /dev/null +++ b/packages/emulators/standalone/suyu/config/SD865/qt-config.ini @@ -0,0 +1,33 @@ +[Controls] +keyboard_enabled=false +player_0_button_a\default=false +player_0_button_a="pad:0,button:1,port:0,guid:03000000202000000130000001000000,engine:sdl" +player_0_button_b="pad:0,button:0,port:0,guid:03000000202000000130000001000000,engine:sdl" +player_0_button_x="pad:0,button:2,port:0,guid:03000000202000000130000001000000,engine:sdl" +player_0_button_y="pad:0,button:3,port:0,guid:03000000202000000130000001000000,engine:sdl" +player_0_button_lstick="engine:sdl,port:0,guid:03000000202000000130000001000000,button:9" +player_0_button_rstick="engine:sdl,port:0,guid:03000000202000000130000001000000,button:10" +player_0_button_l="engine:sdl,port:0,guid:03000000202000000130000001000000,button:4" +player_0_button_r="engine:sdl,port:0,guid:03000000202000000130000001000000,button:5" +player_0_button_zl="engine:sdl,invert:+,port:0,guid:03000000202000000130000001000000,axis:6,threshold:0.500000" +player_0_button_zr="engine:sdl,invert:+,port:0,guid:03000000202000000130000001000000,axis:7,threshold:0.500000" +player_0_button_plus="engine:sdl,port:0,guid:03000000202000000130000001000000,button:7" +player_0_button_minus="engine:sdl,port:0,guid:03000000202000000130000001000000,button:6" +player_0_button_dleft="engine:sdl,port:0,guid:03000000202000000130000001000000,button:13" +player_0_button_dup="engine:sdl,port:0,guid:03000000202000000130000001000000,button:11" +player_0_button_dright="engine:sdl,port:0,guid:03000000202000000130000001000000,button:14" +player_0_button_ddown="engine:sdl,port:0,guid:03000000202000000130000001000000,button:12" +player_0_button_slleft="engine:sdl,port:0,guid:03000000202000000130000001000000,button:4" +player_0_button_srleft="engine:sdl,port:0,guid:03000000202000000130000001000000,button:5" +player_0_button_home="engine:sdl,port:0,guid:03000000202000000130000001000000,button:8" +player_0_button_screenshot="engine:sdl,port:0,guid:03000000202000000130000001000000,button:15" +player_0_button_slright="engine:sdl,port:0,guid:03000000202000000130000001000000,button:4" +player_0_button_srright="engine:sdl,port:0,guid:03000000202000000130000001000000,button:5" +player_0_lstick="engine:sdl,port:0,guid:03000000202000000130000001000000,axis_x:0,offset_x:-0.000000,axis_y:1,offset_y:0.000000,invert_x:+,invert_y:+,deadzone:0.150000" +player_0_rstick="engine:sdl,port:0,guid:03000000202000000130000001000000,axis_x:3,offset_x:-0.000000,axis_y:4,offset_y:0.000000,invert_x:+,invert_y:+,deadzone:0.150000" + +[UI] +Paths\gamedirs\size=1 +Paths\gamedirs\1\path=/storage/games-internal/roms/switch/ +Paths\gamedirs\3\deep_scan=true +Paths\gamedirs\3\expanded=true diff --git a/packages/emulators/standalone/suyu/package.mk b/packages/emulators/standalone/suyu/package.mk new file mode 100644 index 0000000000..7432963ead --- /dev/null +++ b/packages/emulators/standalone/suyu/package.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX) + +PKG_NAME="suyu" +PKG_LICENSE="GPLv2" +PKG_DEPENDS_TARGET="toolchain SDL2 boost libevdev libdrm ffmpeg zlib libpng lzo libusb zstd ecm openal-soft pulseaudio alsa-lib llvm qt6 libfmt vulkan-headers" +PKG_LONGDESC="SuYu is a Switch emulator, allowing you to play games for this platforms on PC with improvements. " +PKG_TOOLCHAIN="cmake" +PKG_SITE="https://git.suyu.dev/suyu/suyu" +PKG_URL="${PKG_SITE}.git" +PKG_VERSION="ee365bad9501c73ff49936e72ec91cd9c3ce5c24" +PKG_CMAKE_OPTS_TARGET+=" -DSUYU_USE_BUNDLED_QT=OFF \ + -DENABLE_SDL=ON -DENABLE_QT6=ON \ + -DSUYU_USE_EXTERNAL_SDL2=ON \ + -DSUYU_USE_BUNDLED_FFMPEG=OFF \ + -DSUYU_TESTS=OFF " + +makeinstall_target() { + mkdir -p ${INSTALL}/usr/bin + cp ${PKG_BUILD}/.${TARGET_NAME}/bin/suyu ${INSTALL}/usr/bin/ + cp ${PKG_BUILD}/.${TARGET_NAME}/bin/suyu-cmd ${INSTALL}/usr/bin/ + cp ${PKG_BUILD}/.${TARGET_NAME}/bin/suyu-room ${INSTALL}/usr/bin/ + + mkdir -p ${INSTALL}/usr/config/suyu + cp -rf ${PKG_DIR}/config/${DEVICE}/* ${INSTALL}/usr/config/suyu +} diff --git a/packages/emulators/standalone/suyu/patches/01-no-cross-compile-tzdb.patch b/packages/emulators/standalone/suyu/patches/01-no-cross-compile-tzdb.patch new file mode 100644 index 0000000000..a933252db9 --- /dev/null +++ b/packages/emulators/standalone/suyu/patches/01-no-cross-compile-tzdb.patch @@ -0,0 +1,16 @@ +diff --git a/externals/nx_tzdb/tzdb_to_nx/src/CMakeLists.txt b/externals/nx_tzdb/tzdb_to_nx/src/CMakeLists.txt +--- a/externals/nx_tzdb/tzdb_to_nx/src/CMakeLists.txt ++++ b/externals/nx_tzdb/tzdb_to_nx/src/CMakeLists.txt +@@ -7,5 +7,11 @@ add_compile_options( + + include_directories(.) + +-add_subdirectory(tzdb2nx) ++include(ExternalProject) ++ExternalProject_Add(tzdb2nx ++ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/tzdb2nx/ ++ CMAKE_ARGS -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS= ++ INSTALL_COMMAND cmake -E echo "No install step" ++ BUILD_IN_SOURCE ON) ++set(TZDB2NX_PATH "${CMAKE_CURRENT_LIST_DIR}/tzdb2nx/tzdb2nx" CACHE PATH "Path to tzdb2nx path") + add_subdirectory(tzdb) diff --git a/packages/emulators/standalone/suyu/patches/02-force-type-cast.patch b/packages/emulators/standalone/suyu/patches/02-force-type-cast.patch new file mode 100644 index 0000000000..db976a7947 --- /dev/null +++ b/packages/emulators/standalone/suyu/patches/02-force-type-cast.patch @@ -0,0 +1,13 @@ +diff --git a/src/input_common/helpers/udp_protocol.h b/src/input_common/helpers/udp_protocol.h +index db08fc62c..8111b9ca2 100644 +--- a/src/input_common/helpers/udp_protocol.h ++++ b/src/input_common/helpers/udp_protocol.h +@@ -69,7 +69,7 @@ Message CreateMessage(const u32 magic, const T data, const u32 sender_id) { + }; + Message message{header, data}; + crc.process_bytes(&message, sizeof(Message)); +- message.header.crc = crc.checksum(); ++ message.header.crc = static_cast>(crc.checksum()); + return message; + } + diff --git a/packages/emulators/standalone/suyu/patches/03-set-rom-path.patch b/packages/emulators/standalone/suyu/patches/03-set-rom-path.patch new file mode 100644 index 0000000000..9b08e02bc0 --- /dev/null +++ b/packages/emulators/standalone/suyu/patches/03-set-rom-path.patch @@ -0,0 +1,14 @@ +diff --git a/src/common/fs/path_util.cpp b/src/common/fs/path_util.cpp +index 9362e18c3..99ce7656c 100644 +--- a/src/common/fs/path_util.cpp ++++ b/src/common/fs/path_util.cpp +@@ -122,7 +122,7 @@ public: + GenerateSuyuPath(SuyuPath::CrashDumpsDir, suyu_path / CRASH_DUMPS_DIR); + GenerateSuyuPath(SuyuPath::DumpDir, suyu_path / DUMP_DIR); + GenerateSuyuPath(SuyuPath::IconsDir, suyu_path / ICONS_DIR); +- GenerateSuyuPath(SuyuPath::KeysDir, suyu_path / KEYS_DIR); ++ GenerateSuyuPath(SuyuPath::KeysDir, fs::path("/storage/games-internal/roms/bios/")); + GenerateSuyuPath(SuyuPath::LoadDir, suyu_path / LOAD_DIR); + GenerateSuyuPath(SuyuPath::LogDir, suyu_path / LOG_DIR); + GenerateSuyuPath(SuyuPath::NANDDir, suyu_path / NAND_DIR); + diff --git a/packages/emulators/standalone/suyu/patches/04-dont-use-native-dialogs.patch b/packages/emulators/standalone/suyu/patches/04-dont-use-native-dialogs.patch new file mode 100644 index 0000000000..bd1d07365d --- /dev/null +++ b/packages/emulators/standalone/suyu/patches/04-dont-use-native-dialogs.patch @@ -0,0 +1,12 @@ +diff --git a/src/suyu/main.cpp b/src/suyu/main.cpp +index 991ff6776..12c4d1418 100644 +--- a/src/suyu/main.cpp ++++ b/src/suyu/main.cpp +@@ -5641,6 +5641,7 @@ int main(int argc, char* argv[]) { + // Disables the "?" button on all dialogs. Disabled by default on Qt6. + QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); + #endif ++ QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs); + + // Enables the core to make the qt created contexts current on std::threads + QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); diff --git a/packages/virtual/emulators/package.mk b/packages/virtual/emulators/package.mk index ec94511196..f85d19933f 100644 --- a/packages/virtual/emulators/package.mk +++ b/packages/virtual/emulators/package.mk @@ -75,7 +75,7 @@ case "${DEVICE}" in SD865) [ "${ENABLE_32BIT}" == "true" ] && EMUS_32BIT="box86 desmume-lr gpsp-lr pcsx_rearmed-lr wine" PKG_EMUS+=" aethersx2-sa box64 dolphin-sa drastic-sa lime3ds-sa melonds-sa portmaster rpcs3-sa scummvmsa supermodel-sa \ - yabasanshiro-sa xemu-sa" + yabasanshiro-sa suyu xemu-sa" LIBRETRO_CORES+=" beetle-psx-lr beetle-saturn-lr bsnes-lr bsnes-hd-lr dolphin-lr flycast-lr geolith-lr panda3ds-lr pcsx_rearmed-lr uae4arm kronos-lr" PKG_RETROARCH+=" retropie-shaders" ;;