diff --git a/.ci/ps4/build.sh b/.ci/ps4/build.sh new file mode 100755 index 0000000000..8a5a64c5ec --- /dev/null +++ b/.ci/ps4/build.sh @@ -0,0 +1,67 @@ +#!/usr/local/bin/bash -ex + +# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +[ -z ${OO_PS4_TOOLCHAIN+x} ] && exit + +[ -f "ps4-toolchain.cmake" ] || cat << EOF >"ps4-toolchain.cmake" +set(CMAKE_SYSROOT "$OO_PS4_TOOLCHAIN") +set(CMAKE_STAGING_PREFIX "$OO_PS4_TOOLCHAIN") +set(CMAKE_SYSTEM_NAME "OpenOrbis") + +set(CMAKE_C_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables") +set(CMAKE_CXX_FLAGS " -D__OPENORBIS__ -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 --target=x86_64-pc-freebsd12-elf -mtune=btver2 -march=btver2 -fPIC -funwind-tables") + +set(CMAKE_EXE_LINKER_FLAGS "-m elf_x86_64 -pie -T $OO_PS4_TOOLCHAIN/link.x --eh-frame-hdr -L$OO_PS4_TOOLCHAIN/lib") +set(CMAKE_C_LINK_FLAGS "-m elf_x86_64 -pie -T $OO_PS4_TOOLCHAIN/link.x --eh-frame-hdr -L$OO_PS4_TOOLCHAIN/lib") +set(CMAKE_CXX_LINK_FLAGS "-m elf_x86_64 -pie -T $OO_PS4_TOOLCHAIN/link.x --eh-frame-hdr -L$OO_PS4_TOOLCHAIN/lib") + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_LINKER ld.lld) +set(CMAKE_C_LINK_EXECUTABLE " -o -lc -lkernel -lSceUserService -lSceSysmodule -lSceNet -lSceLibcInternal $OO_PS4_TOOLCHAIN/lib/crt1.o ") +set(CMAKE_CXX_LINK_EXECUTABLE " -o -lc -lkernel -lc++ -lSceUserService -lSceSysmodule -lSceNet -lSceLibcInternal $OO_PS4_TOOLCHAIN/lib/crt1.o ") + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# TODO: Why does cmake not set this? +set(CMAKE_SIZEOF_VOID_P 8) +EOF + +NPROC=$(nproc || 1) + +# Normally a platform has a package manager +# PS4 does not, atleast not in the normal sense +export EXTRA_CMAKE_FLAGS=("${EXTRA_CMAKE_FLAGS[@]}" $@) +cmake -S . -B build -G "Unix Makefiles" \ + -DCMAKE_TOOLCHAIN_FILE="ps4-toolchain.cmake" \ + -DENABLE_QT_TRANSLATION=OFF \ + -DENABLE_CUBEB=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS="$ARCH_FLAGS" \ + -DCMAKE_C_FLAGS="$ARCH_FLAGS" \ + -DENABLE_SDL2=ON \ + -DENABLE_LIBUSB=OFF \ + -DENABLE_UPDATE_CHECKER=OFF \ + -DENABLE_QT=OFF \ + -DENABLE_OPENSSL=OFF \ + -DENABLE_WEB_SERVICE=OFF \ + -DUSE_DISCORD_PRESENCE=OFF \ + -DCPMUTIL_FORCE_BUNDLED=ON \ + -DOPENSSL_ROOT_DIR="$OO_PS4_TOOLCHAIN" \ + -DOPENSSL_SSL_LIBRARY="$OO_PS4_TOOLCHAIN/lib/libssl.a" \ + -DOPENSSL_CRYPTO_LIBRARY="$OO_PS4_TOOLCHAIN/lib/libcrypto.a" \ + -DOPENSSL_INCLUDE_DIR="$OO_PS4_TOOLCHAIN/include/openssl" \ + -DYUZU_USE_EXTERNAL_FFMPEG=ON \ + -DYUZU_USE_CPM=ON \ + -DDYNARMIC_ENABLE_NO_EXECUTE_SUPPORT=OFF \ + -DDYNARMIC_TESTS=ON \ + -DYUZU_USE_EXTERNAL_SDL2=ON \ + "${EXTRA_CMAKE_FLAGS[@]}" || exit +cmake --build build -t yuzu-cmd_pkg -- -j$NPROC +#cmake --build build -t dynarmic_tests_pkg -- -j$NPROC +#cmake --build build -t testps4_pkg -- -j$NPROC diff --git a/.ci/ps4/make-toolchain.sh b/.ci/ps4/make-toolchain.sh new file mode 100755 index 0000000000..2b4f994b79 --- /dev/null +++ b/.ci/ps4/make-toolchain.sh @@ -0,0 +1,176 @@ +#!/usr/local/bin/bash -ex + +# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# Define global vars +# These flags are used everywhere, so let's reuse them. +export OO_PS4_TOOLCHAIN="$PWD/prefix" +export PREFIX="$OO_PS4_TOOLCHAIN" +export CC="clang" +export CXX="clang++" +export AR="llvm-ar" +export CFLAGS="-fPIC -DPS4 -D_LIBUNWIND_IS_BAREMETAL=1" +export CXXFLAGS="$CFLAGS -D__STDC_VERSION__=0" +export TARGET="x86_64-scei-ps4" +export LLVM_ROOT="$PWD/llvm-project" +export LLVM_PATH="$PWD/llvm-project/llvm" +export WORK_PATH="$PWD" + +prepare_prefix() { + [ -d OpenOrbis-PS4-Toolchain ] || git clone --depth=1 https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain + [ -d musl ] || git clone --depth=1 https://github.com/OpenOrbis/musl + [ -d llvm-project ] || git clone --depth=1 --branch openorbis/20.x https://github.com/seuros/llvm-project + [ -d create-fself ] || git clone --depth=1 https://github.com/OpenOrbis/create-fself + [ -d create-gp4 ] || git clone --depth=1 https://github.com/OpenOrbis/create-gp4 + [ -d readoelf ] || git clone --depth=1 https://github.com/OpenOrbis/readoelf + [ -d LibOrbisPkg ] || git clone --depth=1 https://github.com/maxton/LibOrbisPkg + + mkdir -p $PREFIX "$PREFIX/bin" "$PREFIX/include" + [ -f "$PREFIX/include/orbis/libkernel.h" ] || cp -r OpenOrbis-PS4-Toolchain/include/* "$PREFIX/include/" + mkdir -p $PREFIX/usr + [ -L "$PREFIX/usr/include" ] || ln -s $PREFIX/include $PREFIX/usr/include || echo 1 + [ -L "$PREFIX/usr/share" ] || ln -s $PREFIX/share $PREFIX/usr/share || echo 1 + [ -L "$PREFIX/usr/lib" ] || ln -s $PREFIX/lib $PREFIX/usr/lib || echo 1 + [ -L "$PREFIX/usr/bin" ] || ln -s $PREFIX/bin $PREFIX/usr/bin || echo 1 +} + +build_musl() { + mkdir -p musl-build + cd musl-build + ../musl/configure --target=$TARGET --disable-shared CC="$CC" CFLAGS="$CFLAGS" --prefix=$PREFIX + gmake -j8 && gmake install + cd .. +} + +build_llvm() { + # Build compiler-rt + cmake "$LLVM_ROOT/compiler-rt" -B "$WORK_PATH/llvm-build/compiler-rt" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_ASM_COMPILER="$CC" -DCMAKE_ASM_FLAGS="$CFLAGS -x assembler-with-cpp" \ + -DLLVM_PATH="$LLVM_PATH" -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE="$TARGET" \ + -DCOMPILER_RT_BAREMETAL_BUILD=YES -DCOMPILER_RT_BUILD_BUILTINS=ON \ + -DCOMPILER_RT_BUILD_CRT=OFF -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ + -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ + -DCOMPILER_RT_BUILD_PROFILE=OFF -DCOMPILER_RT_STANDALONE_BUILD=ON + # Build libunwind + cmake "$LLVM_ROOT/libunwind" -B "$WORK_PATH/llvm-build/libunwind" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_FLAGS="$CFLAGS -fcxx-exceptions" -DCMAKE_CXX_FLAGS="$CXXFLAGS -fcxx-exceptions" \ + -DCMAKE_ASM_COMPILER="$CC" -DCMAKE_ASM_FLAGS="$CFLAGS -x assembler-with-cpp" \ + -DLLVM_PATH="$LLVM_PATH" -DLIBUNWIND_USE_COMPILER_RT=YES \ + -DLIBUNWIND_BUILD_32_BITS=NO -DLIBUNWIND_ENABLE_STATIC=ON \ + -DLIBUNWIND_ENABLE_SHARED=OFF -DLIBUNWIND_IS_BAREMETAL=ON + # Build libcxxabi + cmake "$LLVM_ROOT/libcxxabi" -B "$WORK_PATH/llvm-build/libcxxabi" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_FLAGS="$CFLAGS -D_GNU_SOURCE=1 -isysroot $PREFIX -isystem $LLVM_ROOT/libcxx/include -isystem $PREFIX/include -isystem $WORK_PATH/llvm-build/libcxx/include/c++/v1" \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS -D_GNU_SOURCE=1 -isysroot $PREFIX -isystem $LLVM_ROOT/libcxx/include -isystem $PREFIX/include -isystem $WORK_PATH/llvm-build/libcxx/include/c++/v1" \ + -DCMAKE_ASM_COMPILER="$CC" -DCMAKE_ASM_FLAGS="$CFLAGS -x assembler-with-cpp" \ + -DLLVM_PATH="$LLVM_PATH" -DLIBCXXABI_ENABLE_SHARED=NO \ + -DLLVM_ENABLE_RUNTIMES="rt;libunwind" \ + -DLIBCXXABI_ENABLE_STATIC=YES -DLIBCXXABI_ENABLE_EXCEPTIONS=YES \ + -DLIBCXXABI_USE_COMPILER_RT=YES -DLIBCXXABI_USE_LLVM_UNWINDER=YES \ + -DLIBCXXABI_LIBUNWIND_PATH="$LLVM_ROOT/libunwind" \ + -DLIBCXXABI_LIBCXX_INCLUDES="$LLVM_ROOT/libcxx/include" \ + -DLIBCXXABI_ENABLE_PIC=YES + # Build libcxx + cmake "$LLVM_ROOT/libcxx" -B "$WORK_PATH/llvm-build/libcxx" \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \ + -DCMAKE_C_FLAGS="$CFLAGS -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 -isysroot $PREFIX -isystem $PREFIX/include/c++/v1 -isystem $PREFIX/include" \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS -D_LIBCPP_HAS_MUSL_LIBC=1 -D_GNU_SOURCE=1 -isysroot $PREFIX -isystem $PREFIX/include/c++/v1 -isystem $PREFIX/include" \ + -DCMAKE_ASM_COMPILER="$CC" -DCMAKE_ASM_FLAGS="$CFLAGS -x assembler-with-cpp" \ + -DLLVM_PATH="$LLVM_PATH" -DLIBCXX_ENABLE_RTTI=YES \ + -DLIBCXX_HAS_MUSL_LIBC=YES -DLIBCXX_ENABLE_SHARED=NO \ + -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LLVM_ROOT/libcxxabi/include" \ + -DLIBCXX_CXX_ABI_LIBRARY_PATH="$LLVM_ROOT/libcxxabi/build/lib" + + cmake --build "$WORK_PATH/llvm-build/compiler-rt" --parallel + cmake --install "$WORK_PATH/llvm-build/compiler-rt" + + cmake --build "$WORK_PATH/llvm-build/libunwind" --parallel + cmake --install "$WORK_PATH/llvm-build/libunwind" + + cmake --build "$WORK_PATH/llvm-build/libcxxabi" --parallel + cmake --install "$WORK_PATH/llvm-build/libcxxabi" + + touch "$WORK_PATH/llvm-build/libcxx/include/c++/v1/libcxx.imp" + cmake --build "$WORK_PATH/llvm-build/libcxx" --parallel + cmake --install "$WORK_PATH/llvm-build/libcxx" +} + +build_tools() { + + # Build create-fself + cd create-fself/cmd/create-fself + cp go-linux.mod go.mod + go build -ldflags "-linkmode external -extldflags -static" -o create-fself + mv ./create-fself $PREFIX/bin/create-fself + cd ../../../ + + # Build create-gp4 + cd create-gp4/cmd/create-gp4 + go build -ldflags "-linkmode external -extldflags -static" -o create-gp4 + mv ./create-gp4 $PREFIX/bin/create-gp4 + cd ../../../ + + # Build readoelf + cd readoelf/cmd/readoelf + go build -ldflags "-linkmode external -extldflags -static" -o readoelf + mv ./readoelf $PREFIX/bin/readoelf + cd ../../../ + + # # Pull maxton's publishing tools (<3) + # # Sadly maxton has passed on, we have forked the repository and will continue to update it in the future. RIP <3 + # cd $PREFIX/bin + # [ -f PkgTool.Core-linux-x64-0.2.231.zip ] || wget https://github.com/maxton/LibOrbisPkg/releases/download/v0.2/PkgTool.Core-linux-x64-0.2.231.zip + # [ -f PkgTool.Core ] || unzip PkgTool.Core-linux-x64-0.2.231.zip + # chmod +x PkgTool.Core +} + +finish_prefix() { + as $WORK_PATH/OpenOrbis-PS4-Toolchain/src/crt/crtlib.S -o $PREFIX/lib/crtlib.o + cp -a $WORK_PATH/OpenOrbis-PS4-Toolchain/link.x $PREFIX/ + + cp -a ~/OpenOrbis/PS4Toolchain/lib/libkernel* $PREFIX/lib/ + cp -a ~/OpenOrbis/PS4Toolchain/lib/libSce* $PREFIX/lib/ + + cp -a ~/OpenOrbis/PS4Toolchain/lib/libSDL* $PREFIX/lib/ + cp -r ~/OpenOrbis/PS4Toolchain/include/SDL2 $PREFIX/include/SDL2 + + cp $WORK_PATH/llvm-build/compiler-rt/lib/freebsd/libclang_rt.builtins-x86_64.a $PREFIX/lib/ + + # Combine libc++, libc++abi and libunwind into a single archive + cat << EOF >"mri.txt" +CREATE $PREFIX/lib/libc++M.a +ADDLIB $PREFIX/lib/libunwind.a +ADDLIB $PREFIX/lib/libc++abi.a +ADDLIB $PREFIX/lib/libc++.a +SAVE +END +EOF + $AR -M < mri.txt + cp $PREFIX/lib/libc++M.a $PREFIX/lib/libc++.a + # Merge compiler-rt into libc + cat << EOF >"mri.txt" +CREATE $PREFIX/lib/libcM.a +ADDLIB $PREFIX/lib/libc.a +ADDLIB $PREFIX/lib/libclang_rt.builtins-x86_64.a +SAVE +END +EOF + $AR -M < mri.txt + cp $PREFIX/lib/libcM.a $PREFIX/lib/libc.a + rm mri.txt +} + +prepare_prefix +build_musl +build_llvm +build_tools +finish_prefix diff --git a/.gitignore b/.gitignore index 67bdd8adf4..b304411646 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ artifacts /install* vulkansdk*.exe *.tar.zst + +# PS4 toolchain stuff +ps4-toolchain.cmake diff --git a/.patch/boost/0004-openorbis.patch b/.patch/boost/0004-openorbis.patch new file mode 100644 index 0000000000..09071b599c --- /dev/null +++ b/.patch/boost/0004-openorbis.patch @@ -0,0 +1,17 @@ +diff --git a/libs/asio/include/boost/asio/detail/impl/socket_ops.ipp b/libs/asio/include/boost/asio/detail/impl/socket_ops.ipp +index 0129511c..10fc9b04 100644 +--- a/libs/asio/include/boost/asio/detail/impl/socket_ops.ipp ++++ b/libs/asio/include/boost/asio/detail/impl/socket_ops.ipp +@@ -15,6 +15,12 @@ + # pragma once + #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + ++// hacky fix for ps4 ++#if defined(__OPENORBIS__) ++# define FIONBIO 0 ++# define FIONREAD 1 ++#endif ++ + #include + + #include diff --git a/.patch/enet/0001-openorbis.patch b/.patch/enet/0001-openorbis.patch new file mode 100644 index 0000000000..744e2f879d --- /dev/null +++ b/.patch/enet/0001-openorbis.patch @@ -0,0 +1,13 @@ +diff --git a/unix.c b/unix.c +index 6669216..86a2faa 100644 +--- a/unix.c ++++ b/unix.c +@@ -53,7 +53,7 @@ + #include + #endif + +-#if !defined(HAS_SOCKLEN_T) && !defined(__socklen_t_defined) ++#if !defined(__OPENORBIS__) && !defined(HAS_SOCKLEN_T) && !defined(__socklen_t_defined) + typedef int socklen_t; + #endif + diff --git a/.patch/httplib/0002-fix-zstd.patch b/.patch/httplib/0002-fix-zstd.patch new file mode 100644 index 0000000000..f54485ea53 --- /dev/null +++ b/.patch/httplib/0002-fix-zstd.patch @@ -0,0 +1,89 @@ +From 509be32bbfa6eb95014860f7c9ea6d45c8ddaa56 Mon Sep 17 00:00:00 2001 +From: crueter +Date: Sun, 8 Mar 2026 15:11:12 -0400 +Subject: [PATCH] [cmake] Simplify zstd find logic, and support pre-existing + zstd target + +Some deduplication work on the zstd required/if-available logic. Also +adds support for pre-existing `zstd::libzstd` which is useful for +projects that bundle their own zstd in a way that doesn't get caught by +`CONFIG` + +Signed-off-by: crueter +--- + CMakeLists.txt | 46 ++++++++++++++++++++++++++-------------------- + 1 file changed, 26 insertions(+), 20 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1874e36be0..8d31198006 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -241,28 +241,34 @@ endif() + # NOTE: + # zstd < 1.5.6 does not provide the CMake imported target `zstd::libzstd`. + # Older versions must be consumed via their pkg-config file. +-if(HTTPLIB_REQUIRE_ZSTD) +- find_package(zstd 1.5.6 CONFIG) +- if(NOT zstd_FOUND) +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(zstd REQUIRED IMPORTED_TARGET libzstd) +- add_library(zstd::libzstd ALIAS PkgConfig::zstd) +- endif() +- set(HTTPLIB_IS_USING_ZSTD TRUE) +-elseif(HTTPLIB_USE_ZSTD_IF_AVAILABLE) +- find_package(zstd 1.5.6 CONFIG QUIET) +- if(NOT zstd_FOUND) +- find_package(PkgConfig QUIET) +- if(PKG_CONFIG_FOUND) +- pkg_check_modules(zstd QUIET IMPORTED_TARGET libzstd) +- +- if(TARGET PkgConfig::zstd) ++if (HTTPLIB_REQUIRE_ZSTD) ++ set(HTTPLIB_ZSTD_REQUESTED ON) ++ set(HTTPLIB_ZSTD_REQUIRED REQUIRED) ++elseif (HTTPLIB_USE_ZSTD_IF_AVAILABLE) ++ set(HTTPLIB_ZSTD_REQUESTED ON) ++ set(HTTPLIB_ZSTD_REQUIRED QUIET) ++endif() ++ ++if (HTTPLIB_ZSTD_REQUESTED) ++ if (TARGET zstd::libzstd) ++ set(HTTPLIB_IS_USING_ZSTD TRUE) ++ else() ++ find_package(zstd 1.5.6 CONFIG QUIET) ++ ++ if (NOT zstd_FOUND) ++ find_package(PkgConfig ${HTTPLIB_ZSTD_REQUIRED}) ++ pkg_check_modules(zstd ${HTTPLIB_ZSTD_REQUIRED} IMPORTED_TARGET libzstd) ++ ++ if (TARGET PkgConfig::zstd) + add_library(zstd::libzstd ALIAS PkgConfig::zstd) + endif() + endif() ++ ++ # This will always be true if zstd is required. ++ # If zstd *isn't* found when zstd is set to required, ++ # CMake will error out earlier in this block. ++ set(HTTPLIB_IS_USING_ZSTD ${zstd_FOUND}) + endif() +- # Both find_package and PkgConf set a XXX_FOUND var +- set(HTTPLIB_IS_USING_ZSTD ${zstd_FOUND}) + endif() + + # Used for default, common dirs that the end-user can change (if needed) +@@ -317,13 +323,13 @@ if(HTTPLIB_COMPILE) + $ + $ + ) +- ++ + # Add C++20 module support if requested + # Include from separate file to prevent parse errors on older CMake versions + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.28") + include(cmake/modules.cmake) + endif() +- ++ + set_target_properties(${PROJECT_NAME} + PROPERTIES + VERSION ${${PROJECT_NAME}_VERSION} diff --git a/.patch/mbedtls/0003-openorbis.patch b/.patch/mbedtls/0003-openorbis.patch new file mode 100644 index 0000000000..46cfbd408f --- /dev/null +++ b/.patch/mbedtls/0003-openorbis.patch @@ -0,0 +1,13 @@ +diff --git a/library/entropy_poll.c b/library/entropy_poll.c +index 611768c..8950ee4 100644 +--- a/library/entropy_poll.c ++++ b/library/entropy_poll.c +@@ -118,7 +118,7 @@ static int getrandom_wrapper(void *buf, size_t buflen, unsigned int flags) + * + * Documentation: https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7 + */ +-#if (defined(__FreeBSD__) || defined(__NetBSD__)) && !defined(HAVE_GETRANDOM) ++#if (defined(__FreeBSD__) || defined(__NetBSD__)) && !defined(HAVE_GETRANDOM) && !defined(__OPENORBIS__) + #include + #include + #if defined(KERN_ARND) diff --git a/.patch/sdl2_ps4/0001-ps4.patch b/.patch/sdl2_ps4/0001-ps4.patch new file mode 100644 index 0000000000..cb5ed901cb --- /dev/null +++ b/.patch/sdl2_ps4/0001-ps4.patch @@ -0,0 +1,359 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7c230473ac..b1275edb61 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -331,6 +331,13 @@ if(CYGWIN) + list(APPEND SDL_CFLAGS "-I/usr/include/mingw") + endif() + ++######### *FIXME* ++if(PS4 OR ORBIS) ++ set(USE_GENERATED_CONFIG Off) ++else() ++ set(USE_GENERATED_CONFIG On) ++endif() ++ + # General includes + target_compile_definitions(sdl-build-options INTERFACE "-DUSING_GENERATED_CONFIG_H") + target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL2_BINARY_DIR}/include" "${SDL2_BINARY_DIR}/include-config-$>") +@@ -359,6 +366,15 @@ if(EMSCRIPTEN) + set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) + endif() + ++if(PS4 OR ORBIS) ++ set(SDL_ATOMIC_ENABLED_BY_DEFAULT ON) ++ set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) ++ set(SDL_THREADS_ENABLED_BY_DEFAULT ON) ++ set(SDL_PTHREADS_ENABLED_BY_DEFAULT ON) ++ set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) ++ set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF) ++endif() ++ + if(VITA OR PSP OR PS2 OR N3DS) + set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) + set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) +@@ -1478,7 +1494,42 @@ elseif(EMSCRIPTEN) + + CheckPTHREAD() + CheckLibUnwind() ++elseif(PS4 OR ORBIS) ++ CheckPTHREAD() ++ if(SDL_AUDIO) ++ set(SDL_AUDIO_DRIVER_PS4 1) ++ file(GLOB PS4_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/ps4/*.c) ++ set(SOURCE_FILES ${SOURCE_FILES} ${PS4_AUDIO_SOURCES}) ++ set(HAVE_SDL_AUDIO TRUE) ++ endif() ++# if(SDL_FILESYSTEM) ++# set(SDL_FILESYSTEM_PS4 1) ++# file(GLOB PS4_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/ps4/*.c) ++# set(SOURCE_FILES ${SOURCE_FILES} ${PS4_FILESYSTEM_SOURCES}) ++# set(HAVE_SDL_FILESYSTEM TRUE) ++# endif() ++ if(SDL_JOYSTICK) ++ set(SDL_JOYSTICK_PS4 1) ++ file(GLOB PS4_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/ps4/*.c) ++ set(SOURCE_FILES ${SOURCE_FILES} ${PS4_JOYSTICK_SOURCES}) ++ set(HAVE_SDL_JOYSTICK TRUE) ++ endif() ++ if(SDL_TIMERS) ++ set(SDL_TIMER_UNIX 1) ++ file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) ++ set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) ++ set(HAVE_SDL_TIMERS TRUE) + ++ if(CLOCK_GETTIME) ++ set(HAVE_CLOCK_GETTIME 1) ++ endif() ++ endif() ++ if(SDL_VIDEO) ++ set(SDL_VIDEO_DRIVER_PS4 1) ++ file(GLOB PS4_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/ps4/*.c) ++ set(SOURCE_FILES ${SOURCE_FILES} ${PS4_VIDEO_SOURCES}) ++ set(HAVE_SDL_VIDEO TRUE) ++ endif() + elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) + if(SDL_AUDIO) + if(SYSV5 OR SOLARIS OR HPUX) +@@ -3039,7 +3090,7 @@ endif() + # We always need to have threads and timers around + if(NOT HAVE_SDL_THREADS) + # The emscripten platform has been carefully vetted to work without threads +- if (EMSCRIPTEN) ++ if (EMSCRIPTEN OR PS4 OR ORBIS) + set(SDL_THREADS_DISABLED 1) + file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) + list(APPEND SOURCE_FILES ${THREADS_SOURCES}) +diff --git a/README.md b/README.md +index fa7f7ba0b5..8d5a375694 100644 +--- a/README.md ++++ b/README.md +@@ -1,5 +1,5 @@ + +-# Simple DirectMedia Layer (SDL) Version 2.0 ++# Simple DirectMedia Layer (SDL) Version 2.0 (For OpenOrbis PS4 SDK) + + https://www.libsdl.org/ + +diff --git a/include/SDL_config.h b/include/SDL_config.h +index a628d86252..a101532d16 100644 +--- a/include/SDL_config.h ++++ b/include/SDL_config.h +@@ -41,6 +41,10 @@ + #include "SDL_config_iphoneos.h" + #elif defined(__ANDROID__) + #include "SDL_config_android.h" ++#elif defined(__PSP__) ++#include "SDL_config_psp.h" ++#elif defined(__OPENORBIS__) ++#include "SDL_config_ps4.h" + #elif defined(__OS2__) + #include "SDL_config_os2.h" + #elif defined(__EMSCRIPTEN__) +diff --git a/include/SDL_platform.h b/include/SDL_platform.h +index 36df782a4e..0cc20dc4e2 100644 +--- a/include/SDL_platform.h ++++ b/include/SDL_platform.h +@@ -214,6 +214,10 @@ + #if defined(PS2) + #define __PS2__ 1 + #endif ++#if defined(__OPENORBIS__) ++#undef __PS4__ ++#define __PS4__ 1 ++#endif + + /* The NACL compiler defines __native_client__ and __pnacl__ + * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi +diff --git a/src/SDL.c b/src/SDL.c +index cfeea077e7..33fce965c0 100644 +--- a/src/SDL.c ++++ b/src/SDL.c +@@ -642,6 +642,8 @@ const char *SDL_GetPlatform(void) + return "Nokia N-Gage"; + #elif defined(__3DS__) + return "Nintendo 3DS"; ++#elif defined(__PS4__) ++ return "PlayStation4"; + #else + return "Unknown (see SDL_platform.h)"; + #endif +diff --git a/src/SDL_error.c b/src/SDL_error.c +index 993f5bac55..083ebf3027 100644 +--- a/src/SDL_error.c ++++ b/src/SDL_error.c +@@ -50,11 +50,14 @@ int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) + va_end(ap); + } + } +- ++#ifndef __OPENORBIS__ // Yeah this is stupid but whatever + if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { ++#endif + /* If we are in debug mode, print out the error message */ + SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", error->str); ++#ifndef __OPENORBIS__ // Yeah this is stupid but whatever + } ++#endif + } + + return -1; +diff --git a/src/SDL_log.c b/src/SDL_log.c +index 7a5f1dbc03..a7f3d85782 100644 +--- a/src/SDL_log.c ++++ b/src/SDL_log.c +@@ -390,10 +390,12 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va + int len; + va_list aq; + ++#ifndef __OPENORBIS__ + /* Nothing to do if we don't have an output function */ + if (!SDL_log_function) { + return; + } ++#endif + + /* Make sure we don't exceed array bounds */ + if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) { +@@ -442,7 +444,11 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va + } + + SDL_LockMutex(log_function_mutex); ++#ifdef __OPENORBIS__ ++ printf("%s\n", message); // just fucking do it ++#else + SDL_log_function(SDL_log_userdata, category, priority, message); ++#endif + SDL_UnlockMutex(log_function_mutex); + + /* Free only if dynamically allocated */ +diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c +index 421adbc76a..82d087a2f8 100644 +--- a/src/audio/SDL_audio.c ++++ b/src/audio/SDL_audio.c +@@ -114,7 +114,10 @@ static const AudioBootStrap *const bootstrap[] = { + #ifdef SDL_AUDIO_DRIVER_N3DS + &N3DSAUDIO_bootstrap, + #endif +-#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN ++#if SDL_AUDIO_DRIVER_PS4 ++ &PS4AUDIO_bootstrap, ++#endif ++#if SDL_AUDIO_DRIVER_EMSCRIPTEN + &EMSCRIPTENAUDIO_bootstrap, + #endif + #ifdef SDL_AUDIO_DRIVER_JACK +diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h +index 87387692ce..b1c00ba9dc 100644 +--- a/src/audio/SDL_sysaudio.h ++++ b/src/audio/SDL_sysaudio.h +@@ -207,6 +207,7 @@ extern AudioBootStrap PS2AUDIO_bootstrap; + extern AudioBootStrap PSPAUDIO_bootstrap; + extern AudioBootStrap VITAAUD_bootstrap; + extern AudioBootStrap N3DSAUDIO_bootstrap; ++extern AudioBootStrap PS4AUDIO_bootstrap; + extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; + extern AudioBootStrap OS2AUDIO_bootstrap; + +diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h +index 178218c053..a6e298a9fe 100644 +--- a/src/dynapi/SDL_dynapi.h ++++ b/src/dynapi/SDL_dynapi.h +@@ -69,6 +69,8 @@ + #define SDL_DYNAMIC_API 0 /* devkitARM doesn't support dynamic linking */ + #elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN) + #define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */ ++#elif defined(__OPENORBIS__) // Apparently __PS4__ getting defined is missed somewhere, I get broken static builds so force the issue ++#define SDL_DYNAMIC_API 0 + #endif + + /* everyone else. This is where we turn on the API if nothing forced it off. */ +diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c +index 60b0daf790..34433166e8 100644 +--- a/src/joystick/SDL_joystick.c ++++ b/src/joystick/SDL_joystick.c +@@ -106,6 +106,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { + #ifdef SDL_JOYSTICK_N3DS + &SDL_N3DS_JoystickDriver + #endif ++#ifdef SDL_JOYSTICK_PS4 ++ &SDL_PS4_JoystickDriver, ++#endif + #if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED) + &SDL_DUMMY_JoystickDriver + #endif +diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h +index d36f784143..6671aff2fd 100644 +--- a/src/joystick/SDL_sysjoystick.h ++++ b/src/joystick/SDL_sysjoystick.h +@@ -243,6 +243,7 @@ extern SDL_JoystickDriver SDL_HAIKU_JoystickDriver; + extern SDL_JoystickDriver SDL_HIDAPI_JoystickDriver; + extern SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver; + extern SDL_JoystickDriver SDL_IOS_JoystickDriver; ++extern SDL_JoystickDriver SDL_PS4_JoystickDriver; + extern SDL_JoystickDriver SDL_LINUX_JoystickDriver; + extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; + extern SDL_JoystickDriver SDL_WGI_JoystickDriver; +diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c +index 35f80664ab..cd8f9d3615 100644 +--- a/src/render/SDL_render.c ++++ b/src/render/SDL_render.c +@@ -137,6 +137,10 @@ static const SDL_RenderDriver *render_drivers[] = { + #if SDL_VIDEO_RENDER_VITA_GXM + &VITA_GXM_RenderDriver, + #endif ++#if SDL_VIDEO_RENDER_PS4 && 0 // *FIXME* PS4_RenderDriver Disabled, it's software anyhow lets not reinvent... ++#error Use SoftRender for PS4 currently! ++ &PS4_RenderDriver, ++#endif + #if SDL_VIDEO_RENDER_SW + &SW_RenderDriver + #endif +diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h +index ac5426b676..d9b5bfbc39 100644 +--- a/src/render/SDL_sysrender.h ++++ b/src/render/SDL_sysrender.h +@@ -307,6 +307,7 @@ extern SDL_RenderDriver DirectFB_RenderDriver; + extern SDL_RenderDriver METAL_RenderDriver; + extern SDL_RenderDriver PS2_RenderDriver; + extern SDL_RenderDriver PSP_RenderDriver; ++extern SDL_RenderDriver PS4_RenderDriver; + extern SDL_RenderDriver SW_RenderDriver; + extern SDL_RenderDriver VITA_GXM_RenderDriver; + +diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c +index 212fe9c000..a920afba0b 100644 +--- a/src/thread/pthread/SDL_systhread.c ++++ b/src/thread/pthread/SDL_systhread.c +@@ -29,8 +29,10 @@ + #include + #endif + ++#ifdef HAVE_SIGNAL_H + #include + #include ++#endif + + #ifdef __LINUX__ + #include +@@ -60,7 +62,7 @@ + #endif + + +-#ifndef __NACL__ ++#if !defined(__NACL__) && !defined(__OPENORBIS__) + /* List of signals to mask in the subthreads */ + static const int sig_list[] = { + SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCHLD, SIGWINCH, +@@ -162,7 +164,7 @@ void SDL_SYS_SetupThread(const char *name) + } + + /* NativeClient does not yet support signals.*/ +-#if !defined(__NACL__) ++#if !defined(__NACL__) && !defined(__OPENORBIS__) + /* Mask asynchronous signals for this thread */ + sigemptyset(&mask); + for (i = 0; sig_list[i]; ++i) { +diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h +index badb1a3edc..e17beb9f5c 100644 +--- a/src/video/SDL_sysvideo.h ++++ b/src/video/SDL_sysvideo.h +@@ -471,6 +471,7 @@ extern VideoBootStrap PSP_bootstrap; + extern VideoBootStrap VITA_bootstrap; + extern VideoBootStrap RISCOS_bootstrap; + extern VideoBootStrap N3DS_bootstrap; ++extern VideoBootStrap PS4_bootstrap; + extern VideoBootStrap RPI_bootstrap; + extern VideoBootStrap KMSDRM_bootstrap; + extern VideoBootStrap KMSDRM_LEGACY_bootstrap; +diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c +index 134cc05e13..f40d6104e2 100644 +--- a/src/video/SDL_video.c ++++ b/src/video/SDL_video.c +@@ -121,6 +121,9 @@ static VideoBootStrap *bootstrap[] = { + #ifdef SDL_VIDEO_DRIVER_N3DS + &N3DS_bootstrap, + #endif ++#ifdef SDL_VIDEO_DRIVER_PS4 ++ &PS4_bootstrap, ++#endif + #ifdef SDL_VIDEO_DRIVER_KMSDRM + &KMSDRM_bootstrap, + #endif +@@ -241,6 +244,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U + SDL_GetWindowSizeInPixels(window, &w, &h); + + if (!data) { ++ + SDL_Renderer *renderer = NULL; + const char *render_driver = NULL; + const char *hint; +@@ -297,7 +301,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U + SDL_assert(renderer != NULL); /* should have explicitly checked this above. */ + + /* Create the data after we successfully create the renderer (bug #1116) */ +- data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); ++ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(SDL_WindowTextureData)); + if (!data) { + SDL_DestroyRenderer(renderer); + return SDL_OutOfMemory(); diff --git a/.patch/spirv-tools/0003-openorbis.patch b/.patch/spirv-tools/0003-openorbis.patch new file mode 100644 index 0000000000..f2c19d893f --- /dev/null +++ b/.patch/spirv-tools/0003-openorbis.patch @@ -0,0 +1,25 @@ +diff --git a/source/opt/loop_dependence.cpp b/source/opt/loop_dependence.cpp +index e41c044..a51b53b 100644 +--- a/source/opt/loop_dependence.cpp ++++ b/source/opt/loop_dependence.cpp +@@ -12,6 +12,12 @@ + // See the License for the specific language governing permissions and + // limitations under the License. + ++// PS4: issue? ++#ifdef __PS4__ ++#pragma clang diagnostic ignored "-Wabsolute-value" ++#pragma clang diagnostic ignored "-Wshorten-64-to-32" ++#endif ++ + #include "source/opt/loop_dependence.h" + + #include +@@ -19,6 +25,7 @@ + #include + #include + #include ++#include + + #include "source/opt/instruction.h" + #include "source/opt/scalar_analysis_nodes.h" diff --git a/.patch/xbyak/0001-macro-stl.patch b/.patch/xbyak/0001-macro-stl.patch new file mode 100644 index 0000000000..5cfb9eeec6 --- /dev/null +++ b/.patch/xbyak/0001-macro-stl.patch @@ -0,0 +1,21 @@ +diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h +index ed7706a..51b520d 100644 +--- a/xbyak/xbyak.h ++++ b/xbyak/xbyak.h +@@ -37,6 +37,7 @@ + #define XBYAK_GNUC_PREREQ(major, minor) 0 + #endif + ++#if !defined(XBYAK_STD_UNORDERED_SET) + // This covers -std=(gnu|c)++(0x|11|1y), -stdlib=libc++, and modern Microsoft. + #if ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_LIBCPP_VERSION) ||\ + ((__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__))) +@@ -71,6 +72,8 @@ + #define XBYAK_STD_UNORDERED_MAP std::map + #define XBYAK_STD_UNORDERED_MULTIMAP std::multimap + #endif ++#endif ++ + #ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN diff --git a/.patch/xbyak_sun/0001-macro-stl.patch b/.patch/xbyak_sun/0001-macro-stl.patch new file mode 100644 index 0000000000..5cfb9eeec6 --- /dev/null +++ b/.patch/xbyak_sun/0001-macro-stl.patch @@ -0,0 +1,21 @@ +diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h +index ed7706a..51b520d 100644 +--- a/xbyak/xbyak.h ++++ b/xbyak/xbyak.h +@@ -37,6 +37,7 @@ + #define XBYAK_GNUC_PREREQ(major, minor) 0 + #endif + ++#if !defined(XBYAK_STD_UNORDERED_SET) + // This covers -std=(gnu|c)++(0x|11|1y), -stdlib=libc++, and modern Microsoft. + #if ((defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(_LIBCPP_VERSION) ||\ + ((__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__))) +@@ -71,6 +72,8 @@ + #define XBYAK_STD_UNORDERED_MAP std::map + #define XBYAK_STD_UNORDERED_MULTIMAP std::multimap + #endif ++#endif ++ + #ifdef _WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN diff --git a/CMakeLists.txt b/CMakeLists.txt index 4490df21cb..fa5a85c724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ include(UseCcache) include(CMakeDependentOption) include(CTest) include(CPMUtil) +include(OpenOrbis) if (NOT DEFINED ARCHITECTURE) message(FATAL_ERROR "Architecture didn't make it out of scope, did you delete DetectArchitecture.cmake?") diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index 5b0adad8dd..0c8c9cedec 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -18,10 +18,13 @@ if (DEFINED GIT_RELEASE) set(BUILD_VERSION "${GIT_TAG}") set(GIT_REFSPEC "${GIT_RELEASE}") set(IS_DEV_BUILD false) -else() +elseif(DEFINED GIT_COMMIT) string(SUBSTRING ${GIT_COMMIT} 0 10 BUILD_VERSION) set(BUILD_VERSION "${BUILD_VERSION}-${GIT_REFSPEC}") set(IS_DEV_BUILD true) +else() + set(BUILD_VERSION "NoGitInfo") + set(IS_DEV_BUILD true) endif() if (NIGHTLY_BUILD) diff --git a/CMakeModules/OpenOrbis.cmake b/CMakeModules/OpenOrbis.cmake new file mode 100644 index 0000000000..6babccdd6d --- /dev/null +++ b/CMakeModules/OpenOrbis.cmake @@ -0,0 +1,46 @@ +# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +function(create_ps4_eboot project target content_id) + set(sce_sys_dir sce_sys) + set(sce_sys_param ${sce_sys_dir}/param.sfo) + add_custom_command( + OUTPUT "${target}.pkg" + COMMAND ${CMAKE_SYSROOT}/bin/create-fself -in=bin/${target} -out=${target}.oelf --eboot ${target}_eboot.bin + VERBATIM + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${project} + ) + add_custom_target(${project}_pkg ALL DEPENDS "${target}.pkg") +endfunction() + +function(create_ps4_pkg project target content_id) + set(sce_sys_dir sce_sys) + set(sce_sys_param ${sce_sys_dir}/param.sfo) + add_custom_command( + OUTPUT "${target}.pkg" + COMMAND ${CMAKE_SYSROOT}/bin/create-fself -in=bin/${target} -out=${target}.oelf --eboot ${target}_eboot.bin + COMMAND mkdir -p ${sce_sys_dir} + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_new ${sce_sys_param} + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} APP_TYPE --type Integer --maxsize 4 --value 1 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} APP_VER --type Utf8 --maxsize 8 --value 1.03 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} ATTRIBUTE --type Integer --maxsize 4 --value 0 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} CATEGORY --type Utf8 --maxsize 4 --value gd + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} CONTENT_ID --type Utf8 --maxsize 48 --value ${content_id} + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} DOWNLOAD_DATA_SIZE --type Integer --maxsize 4 --value 0 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} SYSTEM_VER --type Integer --maxsize 4 --value 0 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} TITLE --type Utf8 --maxsize 128 --value ${target} + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} TITLE_ID --type Utf8 --maxsize 12 --value BREW00090 + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core sfo_setentry ${sce_sys_param} VERSION --type Utf8 --maxsize 8 --value 1.03 + COMMAND ${CMAKE_SYSROOT}/bin/create-gp4 -out ${target}.gp4 --content-id=${content_id} --files "${target}_eboot.bin ${sce_sys_param} sce_module/libc.prx sce_module/libSceFios2.prx" + COMMAND ${CMAKE_SYSROOT}/bin/PkgTool.Core pkg_build ${target}.gp4 . + VERBATIM + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${project} + ) + add_custom_target(${project}_pkg ALL DEPENDS "${target}.pkg") +endfunction() + +if (NOT DEFINED ENV{OO_PS4_TOOLCHAIN}) + set(ENV{OO_PS4_TOOLCHAIN} ${CMAKE_SYSROOT}) +endif () diff --git a/README.md b/README.md index 3ae31151f7..44a2b4c28b 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,10 @@ See the [sign-up instructions](docs/SIGNUP.md) for information on registration. Alternatively, if you wish to add translations, go to the [Eden project on Transifex](https://app.transifex.com/edenemu/eden-emulator) and review [the translations README](./dist/languages). +## Documentation + +We have a user manual! See our [User Handbook](./docs/user/README.md). + ## Building See the [General Build Guide](docs/Build.md) @@ -69,7 +73,9 @@ For information on provided development tooling, see the [Tools directory](./too ## Download -You can download the latest releases from [here](https://github.com/eden-emulator/Releases/releases). +You can download the latest releases from [here](https://git.eden-emu.dev/eden-emu/eden/releases). + +Save us some bandwidth! We have [mirrors available](./docs/user/ThirdParty.md#mirrors) as well. ## Support diff --git a/cpmfile.json b/cpmfile.json index 774f160360..e9884910a5 100644 --- a/cpmfile.json +++ b/cpmfile.json @@ -17,7 +17,8 @@ "version": "1.57", "find_args": "CONFIG OPTIONAL_COMPONENTS headers context system fiber filesystem", "patches": [ - "0001-clang-cl.patch" + "0001-clang-cl.patch", + "0004-openorbis.patch" ] }, "fmt": { @@ -46,9 +47,9 @@ "package": "ZLIB", "repo": "madler/zlib", "tag": "v%VERSION%", - "hash": "06eaa3a1eaaeb31f461a2283b03a91ed8eb2406e62cd97ea1c69836324909edeecd93edd03ff0bf593d9dde223e3376149134c5b1fe2e8688c258cadf8cd60ff", + "hash": "16fea4df307a68cf0035858abe2fd550250618a97590e202037acd18a666f57afc10f8836cbbd472d54a0e76539d0e558cb26f059d53de52ff90634bbf4f47d4", "version": "1.2", - "git_version": "1.3.1.2", + "git_version": "1.3.2", "options": [ "ZLIB_BUILD_SHARED OFF", "ZLIB_INSTALL OFF" @@ -98,9 +99,9 @@ "package": "VVL", "repo": "KhronosGroup/Vulkan-ValidationLayers", "tag": "vulkan-sdk-%VERSION%", - "git_version": "1.4.335.0", + "git_version": "1.4.341.0", "artifact": "android-binaries-%VERSION%.zip", - "hash": "48167c4a17736301bd08f9290f41830443e1f18cce8ad867fc6f289b49e18b40e93c9850b377951af82f51b5b6d7313aa6a884fc5df79f5ce3df82696c1c1244" + "hash": "8812ae84cbe49e6a3418ade9c458d3be6d74a3dffd319d4502007b564d580998056e8190414368ec11b27bc83993c7a0dad713c31bcc3d9553b51243efee3753" }, "quazip": { "package": "QuaZip-Qt6", diff --git a/dist/icon_variations/ps4.svg b/dist/icon_variations/ps4.svg new file mode 100644 index 0000000000..0ee32c660c --- /dev/null +++ b/dist/icon_variations/ps4.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Caveats.md b/docs/Caveats.md index 39b5ab15e6..a5203775e7 100644 --- a/docs/Caveats.md +++ b/docs/Caveats.md @@ -11,6 +11,7 @@ - [NetBSD](#netbsd) - [MSYS2](#msys2) - [RedoxOS](#redoxos) +- [PlayStation 4](#playstation-4) - [Windows](#windows) - [Windows 7, Windows 8 and Windows 8.1](#windows-7-windows-8-and-windows-81) - [Windows Vista and below](#windows-vista-and-below) @@ -91,7 +92,7 @@ After configuration, you may need to modify `externals/ffmpeg/CMakeFiles/ffmpeg- `-lc++-experimental` doesn't exist in OpenBSD but the LLVM driver still tries to link against it, to solve just symlink `ln -s /usr/lib/libc++.a /usr/lib/libc++experimental.a`. Builds are currently not working due to lack of `std::jthread` and such, either compile libc++ manually or wait for ports to catch up. -If clang has errors, try using `g++-11`. +If clang has errors, try using `g++11`. ## FreeBSD @@ -107,6 +108,8 @@ hw.usb.usbhid.enable="0" ## NetBSD +2026-02-07: `vulkan-headers` must not be installed, since the version found in `pkgsrc` is older than required. Either wait for binary packages to update or build newer versions from source. + Install `pkgin` if not already `pkg_add pkgin`, see also the general [pkgsrc guide](https://www.netbsd.org/docs/pkgsrc/using.html). For NetBSD 10.1 provide `echo 'PKG_PATH="https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All/"' >/etc/pkg_install.conf`. If `pkgin` is taking too much time consider adding the following to `/etc/rc.conf`: ```sh @@ -116,7 +119,7 @@ ip6addrctl_policy=ipv4_prefer System provides a default `g++-10` which doesn't support the current C++ codebase; install `clang-19` with `pkgin install clang-19`. Or install `gcc14` (or `gcc15` with current pkgsrc). Provided that, the following CMake commands may work: -- `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Bbuild` +- `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -Bbuild` (Recommended) - `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/pkg/gcc14/bin/gcc -DCMAKE_CXX_COMPILER=/usr/pkg/gcc14/bin/g++ -Bbuild` - `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/pkg/gcc15/bin/gcc -DCMAKE_CXX_COMPILER=/usr/pkg/gcc15/bin/g++ -Bbuild` @@ -138,8 +141,12 @@ cmake --install build However, pkgsrc is highly recommended, see [getting pkgsrc](https://iso.us.netbsd.org/pub/pkgsrc/current/pkgsrc/doc/pkgsrc.html#getting). You must get `current` not the `2025Q2` version. +`QtCore` on NetBSD is included, but due to misconfigurations(!) we MUST include one of the standard headers that include `bits/c++config.h`, since source_location (required by `QtCore`) isn't properly configured to intake `bits/c++config.h` (none of the experimental library is). This is a bug with NetBSD packaging and not our fault, but alas. + ## DragonFlyBSD +2026-02-07: `vulkan-headers` and `vulkan-utility-libraries` must NOT be uninstalled, since they're too old: `1.3.289`. Either wait for binary packages to update or build newer versions from source. + If `libstdc++.so.6` is not found (`GLIBCXX_3.4.30`) then attempt: ```sh @@ -214,6 +221,17 @@ The package install may randomly hang at times, in which case it has to be resta When CMake invokes certain file syscalls - it may sometimes cause crashes or corruptions on the (kernel?) address space - so reboot the system if there is a "hang" in CMake. +## PlayStation 4 + +```sh +export OO_PS4_TOOLCHAIN="$HOME/OpenOrbis/PS4Toolchain/prefix" +export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 +``` + +```sh +cp $OO_PS4_TOOLCHAIN/include/endian.h $OO_PS4_TOOLCHAIN/include/sys/endian.h +``` + ## Windows ### Windows 7, Windows 8 and Windows 8.1 diff --git a/docs/README.md b/docs/README.md index 01727ae4dc..4ea532be8e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,7 @@ # Eden Build Documentation +Are you just a casual user? Take a look at our [User Handbook](./user) then! + This contains documentation created by developers. This contains build instructions, guidelines, instructions/layouts for [cool stuff we made](./CPMUtil), and more. - **[General Build Instructions](Build.md)** @@ -11,7 +13,6 @@ This contains documentation created by developers. This contains build instructi - **[CPM - CMake Package Manager](./CPMUtil)** - **[Platform-Specific Caveats](Caveats.md)** - **[The NVIDIA SM86 (Maxwell) GPU](./NvidiaGpu.md)** -- **[User Handbook](./user)** - **[Dynarmic](./dynarmic)** - **[Cross compilation](./CrossCompile.md)** - **[Driver Bugs](./DriverBugs.md)** diff --git a/docs/user/AddGamesToSRM.md b/docs/user/AddGamesToSRM.md deleted file mode 100644 index 433999c9b6..0000000000 --- a/docs/user/AddGamesToSRM.md +++ /dev/null @@ -1,100 +0,0 @@ -# Importing Games into Steam with Steam Rom Manager - -Use this when you want to import your games inside Eden into Steam to launch with artwork from Steam Game Mode without needing to launch Eden first. - -**Click [Here](https://evilperson1337.notion.site/Importing-Games-into-Steam-with-Steam-Rom-Manager-2b757c2edaf680d7a491c92b138f1fcc) for a version of this guide with images & visual elements.** - ---- - -### Pre-Requisites - -- Steam Deck Set up and Configured -- Eden set up and Configured -- Internet Access - ---- - -## Steps - -1. Press the **STEAM** button and then go to *Power → Switch to Desktop* to enter the Desktop mode. - -1. Install ***Steam ROM Manager***, there are 2 ways you can accomplish this, either manually or through [*EmuDeck*](https://www.emudeck.com/#downloads). - - --- - - ### Manual Installation - - 1. Open the *Discover Store* and search for *Steam ROM Manager.* - 2. Select the **Install** button to install the program. - - --- - - ### Installing Through *EmuDeck* - - - - 1. Open **EmuDeck**, then navigate to *Manage Emulators.* - 2. Scroll down to the bottom of the page to the *Manage your Tools & Frontends* section. Click **Steam ROM Manager**. - - 3. Click the **Install** button on the right hand side to install it. - - --- - -2. Open the Start Menu and Launch ***Steam ROM Manager*** - -1. The program will now launch and show you a window with parsers. - - - -2. Switch off all Parsers by hitting the *Toggle Parsers* switch. -3. Scroll down the list on the left-hand side and look for a parser called *Nintendo Switch - Eden* and switch it on. This parser may not exist depending on how you installed *Steam ROM Manager* (EmuDeck creates it for you). Follow these steps to create it if it is missing. - - --- - ### Creating the Eden Parser - - 1. Select Create Parser and in the *Community Presets* option look for **Nintendo Switch - Yuzu**. - 2. Change the **Parser title** from *Nintendo Switch - Yuzu* to *Nintendo Switch - Eden.* - 3. Hit the **Browse** option under the *ROMs directory* section. Select the directory containing your Switch ROMs. - 4. Under *Steam collections*, you can add a Steam category name. This just organizes the games under a common category in your Steam Library, this is optional but recommended. - 5. Scroll down slightly to the **Executable Configuration → Executable**, select **Browse** and select the Eden AppImage. - 6. Leave everything else the same and hit **Save** to save the parser. - --- - -4. Click the Eden parser to view the options on the right, select **Test** at the bottom of the screen to ensure that *Steam ROM Manager* detects your games correctly. -1. *Steam ROM Manager* will start to scan the specified ROMs directory and match them to games. Look over the results to ensure they are accurate. If you do not see any entries - check your parsers ROMs directory field. -1. When you are happy with the results, click the **Add Games** → **Parse** to start the actual Parsing. -1. The program will now identify the games and pull artwork from [*SteamGridDB*](https://www.steamgriddb.com/). -2. Review the game matches and ensure everything is there. - - --- - - ### Correcting a Mismatch - - If the game is not identified correctly, you may need to tell *Steam ROM Manager* what the game is manually. - - 1. Hover over the game card and click the magnifying glass icon. - 2. Search for the game on the *Search SteamGridDB* section and scroll through the results, selecting the one you want. - 3. Ensure the *Name* and *Game ID* update in the **Per-App Exceptions** and press **Save and close**. The game should now update. - - --- - - ### Excluding Matches - - You may want to tell Steam ROM Manager to ignore some files (updates/DLC/etc.) that it finds in the directory. This is how you do so. - - 1. Hit the **Exclude Games** button in the bottom right. - 2. Deselect the game you want to exclude, the poster artwork should go dim and the **Number Excluded** number should increment up. Repeat with any other exclusions you want to add. - 3. Hit **Save Excludes** when you are happy with your selections. - --- -3. When you are happy with the results, select **Save to Steam** to save the results. -1. The program will now start writing the entries into the Steam Library. You should get pop up notifications of the progress, but you can monitor the progress by selecting the **Log** on the left-hand side if needed. -2. Restart Steam to have the changes take effect. Check your library to ensure that your games are there, in a category if you defined one in the parser. -3. Try to launch a game and ensure everything is working. You are now good to go. \ No newline at end of file diff --git a/docs/user/Basics.md b/docs/user/Basics.md index 5101f4d9c3..b8719a9310 100644 --- a/docs/user/Basics.md +++ b/docs/user/Basics.md @@ -26,6 +26,7 @@ Eden will store configuration files in the following directories: - **Android**: Data is stored internally. - **Linux, macOS, FreeBSD, Solaris, OpenBSD**: `$XDG_DATA_HOME`, `$XDG_CACHE_HOME`, `$XDG_CONFIG_HOME`. - **HaikuOS**: `/boot/home/config/settings/eden` +- **PlayStation 4**: `/data/eden` If a `user` directory is present in the current working directory, that will override all global configuration directories and the emulator will use that instead. diff --git a/docs/user/CFW.md b/docs/user/CFW.md new file mode 100644 index 0000000000..ea224d3d36 --- /dev/null +++ b/docs/user/CFW.md @@ -0,0 +1,11 @@ +# User Handbook - Custom Firmware (CFW) + +At the moment of writing, we do not support CFW such as Atmosphere, due to: + +- Lacking the required LLE emulation capabilities to properly emulate the full firmware. +- Lack of implementation on some of the key internals. +- Nobody has bothered to do it (PRs always welcome!) + +We do however, maintain HLE compatibility with the former mentioned CFW, applications that require Atmosphere to run will run fine in the emulator without any adjustments. + +If they don't run - then that's a bug! diff --git a/docs/user/Graphics.md b/docs/user/Graphics.md index e1e13a777d..ad359b9049 100644 --- a/docs/user/Graphics.md +++ b/docs/user/Graphics.md @@ -1,5 +1,7 @@ # User Handbook - Graphics +Graphical enhancements and visual quality improvments. This doesn't cover texture mods. + ## Visual Enhancements ### Anti-aliasing @@ -89,7 +91,7 @@ The OpenGL backend would invoke behaviour that would result in swarst/LLVMpipe w ### HaikuOS compatibility -HaikuOS bundles a Mesa library that doesn't support full core OpenGL 4.6 (required by the emulator). This leads to HaikuOS being one of the few computer platforms where Vulkan is the only available option for users. If OpenGL is desired, Mesa has to be built manually from source. For debugging purpouses `lavapipe` is recommended over the GPU driver; there is in-kernel support for NVIDIA cards through. +HaikuOS bundles a Mesa library that doesn't support full core OpenGL 4.6 (required by the emulator). This leads to HaikuOS being one of the few computer platforms where Vulkan is the only available option for users. If OpenGL is desired, Mesa has to be built manually from source. For debugging purposes `lavapipe` is recommended over the GPU driver; there is in-kernel support for NVIDIA cards through. ### Fixes for Windows 10 and above having "Device loss" diff --git a/docs/user/Mods.md b/docs/user/Mods.md new file mode 100644 index 0000000000..11361d628c --- /dev/null +++ b/docs/user/Mods.md @@ -0,0 +1,206 @@ +# User Handbook - Installing Mods + +## General Notes + +**Note:** When installing a mod, always read the mod's installation instructions. + +This is especially important if a mod uses a framework such as **ARCropolis**, **Skyline**, or **Atmosphere plugins**. In those cases, follow the framework's instructions instead of using Eden's normal mod folder. + +For example, **Super Smash Bros. Ultimate** uses such a framework. See the related section below for details. + +--- + +# Installing Mods for Most Games + +1. Right click a game in the game list. +2. Click **"Open Mod Data Location"**. +3. Extract the mod into that folder. + +Each mod should be placed inside **its own subfolder**. + +--- + +# Enabling or Disabling Mods + +1. Right click the game in the game list. +2. Click **Configure Game**. +3. In the **Add-Ons** tab, enable or disable mods, updates, and DLC by ticking or unticking their boxes. + +--- + +# Important Note About SD Card Paths + +Some mods are designed for real Nintendo Switch consoles and refer to the **SD card root**. + +The emulated SD card is located at: + +``` +%AppData%\eden\sdmc +``` + +Example: + +``` +Switch instruction: sd:/ultimate/mods +Eden equivalent: sdmc/ultimate/mods +``` + +--- + +# Framework-Based Mods (Super Smash Bros. Ultimate) + +Some games require external mod frameworks instead of the built-in mod loader. + +The most common example is **Super Smash Bros. Ultimate**. + +These mods are installed directly to the **emulated SD card**, not the normal Eden mod folder. + +--- + +# Installing the ARCropolis Modding Framework + +**Note:** Some mod packs bundle ARCropolis with their installer (for example, Smash Ult-S). + +--- + +## 1. Download ARCropolis + +Download the latest release: + +https://github.com/Raytwo/ARCropolis/releases/ + +--- + +## 2. Install ARCropolis + +Extract the **`atmosphere`** folder into: + +``` +%AppData%\eden\sdmc +``` + +This is the **emulated SD card directory**. + +Verify installation by checking that the following file exists: + +``` +sdmc\atmosphere\contents\01006A800016E000\romfs\skyline\plugins\libarcropolis.nro +``` + +--- + +## 3. Download Skyline + +Download the latest Skyline release: + +https://github.com/skyline-dev/skyline/releases + +Skyline used to be bundled with ARCropolis but is now distributed separately to avoid compatibility issues caused by outdated bundled versions. + +--- + +## 4. Install Skyline + +Extract the **`exefs`** folder into: + +``` +sdmc\atmosphere\contents\01006A800016E000 +``` + +The `exefs` folder should be **next to the `romfs` folder**. + +Verify installation by checking that the following file exists: + +``` +%AppData%\eden\sdmc\atmosphere\contents\01006A800016E000\exefs\subsdk9 +``` + +--- + +## 5. Launch the Game Once + +Start the game and make sure you see the **ARCropolis version text on the title screen**. + +This will also create the folders required for installing mods. + +--- + +## 6. Install Smash Ultimate Mods + +Install mods inside: + +``` +sdmc\ultimate\mods +``` + +Each mod must be placed inside **its own subfolder**. + +Example: + +``` +sdmc\ultimate\mods\ExampleMod +``` + +--- + +# Troubleshooting + +## ARCropolis text does not appear on startup + +Check the following: + +- `libarcropolis.nro` exists in: + +``` +sdmc\atmosphere\contents\01006A800016E000\romfs\skyline\plugins +``` + +- `subsdk9` exists in: + +``` +sdmc\atmosphere\contents\01006A800016E000\exefs +``` + +- Files were extracted to: + +``` +%AppData%\eden\sdmc +``` + +--- + +## Mods are not loading + +Make sure mods are installed inside: + +``` +sdmc\ultimate\mods +``` + +Each mod must have its **own subfolder**. + +Correct example: + +``` +sdmc\ultimate\mods\ExampleMod +``` + +Incorrect example: + +``` +sdmc\ultimate\mods\ExampleMod\ExampleMod +``` + +--- + +## Installing mods in the wrong folder + +ARCropolis mods **do not go in Eden's normal mod folder**. + +Do **not** install Smash mods here: + +``` +user\load\01006A800016E000 +``` + +That folder is only used for traditional **RomFS mods**, not ARCropolis. diff --git a/docs/user/README.md b/docs/user/README.md index 5fd3a17e51..9804f4d62f 100644 --- a/docs/user/README.md +++ b/docs/user/README.md @@ -4,10 +4,14 @@ The "FAQ". This handbook is primarily aimed at the end-user - baking useful knowledge for enhancing their emulation experience. +A copy of this handbook is [available online](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/README.md). + ## Basics - **[The Basics](Basics.md)** - **[Quickstart](./QuickStart.md)** +- **[Settings](./Settings.md)** +- **[Installing Mods](./Mods.md)** - **[Run On macOS](./RunOnMacOS.md)** - **[Audio](Audio.md)** - **[Graphics](Graphics.md)** @@ -17,22 +21,29 @@ This handbook is primarily aimed at the end-user - baking useful knowledge for e - **[Using Amiibo](./UsingAmiibo.md)** - **[Using Cheats](./UsingCheats.md)** - **[Importing Saves](./ImportingSaves.md)** -- **[Add Eden to Steam ROM Manager](./AddEdenToSRM.md)** -- **[Add Games to Steam ROM Manager](./AddGamesToSRM.md)** - **[Installing Atmosphere Mods](./InstallingAtmosphereMods.md)** - **[Installing Updates & DLCs](./InstallingUpdatesDLC.md)** - **[Controller Profiles](./ControllerProfiles.md)** - **[Alter Date & Time](./AlterDateTime.md)** +## 3rd-party Integration + +- **[Configuring Steam ROM Manager](./SteamROM.md)** +- **[Server hosting](ServerHosting.md)** +- **[Syncthing Guide](./SyncthingGuide.md)** +- **[Third Party](./ThirdParty.md)** + - **[Obtainium](./ThirdParty.md#configuring-obtainium)** + - **[ES-DE](./ThirdParty.md#configuring-es-de)** + - **[Mirrors](./ThirdParty.md#mirrors)** + ## Advanced +- **[Custom Firmware](./CFW.md)** - **[How To Access Logs](./HowToAccessLogs.md)** - **[Gyro Controls](./GyroControls.md)** - **[Platforms and Architectures](Architectures.md)** -- **[Server hosting](ServerHosting.md)** - **[Command Line](CommandLine.md)** - **[Native Application Development](Native.md)** - **[Adding Boolean Settings Toggles](AddingBooleanToggles.md)** - **[Adding Debug Knobs](./AddingDebugKnobs.md)** -- **[Syncthing Guide](./SyncthingGuide.md)** - **[Testing](Testing.md)** diff --git a/docs/user/Settings.md b/docs/user/Settings.md new file mode 100644 index 0000000000..35fcd0c9ef --- /dev/null +++ b/docs/user/Settings.md @@ -0,0 +1,54 @@ +# User Handbook - Settings + +As the emulator continues to grow, so does the number of settings that come and go. + +Most of the development adds new settings that enhance performance/compatibility, only to be removed later in newer versions due to newfound discoveries or because they were "a hacky workaround". + +As such, this guide will NOT mention those kind of settings, we'd rather mention settings which have a long shelf time (i.e won't get removed in future releases) and are likely to be unchanged. + +Some of the options are self explainatory, and they do exactly what they say they do (i.e "Pause when not in focus"); such options will be also skipped due to triviality. + +## Foreword + +Before touching the settings, please see the game boots with stock options. We try our best to ensure users can boot any game using the default settings. If they don't work, then you may try fiddling with options - but please, first use stock options. + +## General + +- `General/Force X11 as Graphics Backend`: Wayland on *NIX has prominent issues that are unlikely to be resolved; the kind that are "not our fault, it's Wayland issue", this "temporary" hack forces X11 as the backend, regardless of the desktop manager's default. +- `General/Enable Gamemode`: This only does anything when you have Feral Interactive's Gamemode library installed somewhere, if you do, this will help boost FPS by telling the OS to explicitly prioritize *this* application for "gaming" - only for *NIX systems. +- `Hotkeys`: Deceptively to remove a hotkey you must right click and a menu will appear to remove that specific hotkey. +- `UI/Language`: Changes language *of the interface* NOT the emulated program! +- `Debug/Enable Auto Stub`: May help to "fix" some games by just lying and saying that everything they do returns "success" instead of outright crashing for any function/service that is NOT implemented. +- `Debug/Show log in console`: Does as said, note that the program may need to be reopened (Windows) for changes to take effect. +- `Debug/Flush log output`: Classically, every write to the log is "buffered", that is, changes aren't written to the disk UNTIL the program has decided it is time to write, until then it keeps data in a buffer which resides on RAM. If the program crashes, the OS will automatically discard said buffer (any RAM associated with a dead process is automatically discarded/reused for some other purpose); this means critical data may not be logged to the disk on time, which may lead to missing log lines. Use this if you're wanting to remove that factor when debugging, sometimes a hard crash may "eat" some of the log lines IF this option isn't enabled. +- `Debug/Disable Macro HLE:` The emulator has HLE emulation of macro programs for Maxwell, this means that some details are purpousefully skipped; this option forces all macro programs to be ran without skipping anything. + +## System + +- `System/RNG Seed`: Set to 0 (and uncheck) to disable ASLR systemwide (this makes mods like CTGP to stop working); by default it enables ASLR to replicate console behaviour. +- `Network/Enable Airplane Mode`: Enable this if a game is crashing before loading AND the logs mention anything related to "web" or "internet" services. + +## CPU + +- `CPU/Virtual table bouncing`: Some games have the tendency to crash on loading due to an indirect bad jump (Pokemon ZA being the worst offender); this option lies to the game and tells it to just pretend it never executed a given function. This is fine for most casual users, but developers of switch applications **must** disable this. This temporary "hack" should hopefully be gone in 6-7 months from now on. +- `Fastmem`, aka. `CPU/Enable Host MMU`: Enables "fastmem"; a detailed description of fastmem can be found [here](../dynarmic/Design.md#fast-memory-fastmem). +- `CPU/Unsafe FMA`: Enables deliberate innacurate FMA behaviour which may affect how FMA returns any given operation - this may introduce tiny floating point errors which can cascade in sensitive code (i.e FFmpeg). +- `CPU/Faster FRSQRTE and FRECPE`: Introduces accuracy errors on square root and reciprocals in exchange for less checks - this introduces inaccuracies with some cases but it's mostly safe. +- `CPU/Faster ASIMD Instructions`: Skips rounding mode checks for ARM ASIMD instructions - this means some code dpeending on these rounding modes may misbehave. +- `CPU/Disable address space checks`: Before each memory access, the emulator checks the address is in range, if not it faults; this option makes it so the emulator skips the check entirely (which may be expensive for a myriad of reasons). However at the same time this allows the guest program to "break out" of the emulation context by writing to arbitrary addresses. +- `CPU/Ignore global monitor`: This relies on a quirk present on x86 to avoid the ARM global monitor emulation, this may increase performance in mutex-heavy contexts (i.e games waiting for next frames or such); but also can cause deadlocks and fun to debug issues. + +It is important to note the majority of precision-reducing instructions do not benefit cases where they are not used, which means the performance gains will vary per game. + +# Graphics + +See also [an extended breakdown of some options](./Graphics.md). + +- `Extras/Extended Dynamic State` and `Extras/Vertex Input Dynamic State`: These Vulkan extensions essentially allow you to reuse the same pipeline but just change the state between calls (so called "dynamic state"); the "extended" levels signifies how much state can be placed on this "dynamic" range, for example the amount of depth culling to use can be placed on the dynamic state, avoiding costly reloads and flushes. While this by itself is a fine option, SOME vendors (notably PowerVR and Mali) have problems with anything related to EDS3. EDS3 contains EDS2, and EDS2 contains EDS1. Essentially this means more extended data the driver has to keep track of, at the benefit of avoiding costly flushes. +- `Advanced/Use persistent cache`: This saves compiled shaders onto the disk, independent of any driver's own disk saved shaders (yes, some drivers, notably NVIDIA, save a secondary shader cache onto disk) - disable this only if you're debugging or working on the GPU backend. This option is meant to massively help to reduce shader stutters (after playing for one session that compiles them). +- `Advanced/Use Vulkan pipeline cache`: This is NOT the same as `Use persistent cache`; it's a separate flag that tells the Vulkan backend to create pipeline caches, which are a detail that can be used to massively improve performance and remove pipeline creation overhead. This is a Vulkan feature. + +## Controls + +Most of the controls should work out of the box. If not, please use a joystick calibrator to ensure it's not an issue with your own controller, for example: +- https://github.com/dkosmari/calibrate-joystick diff --git a/docs/user/AddEdenToSRM.md b/docs/user/SteamROM.md similarity index 50% rename from docs/user/AddEdenToSRM.md rename to docs/user/SteamROM.md index 4658bcf7e0..a782b51969 100644 --- a/docs/user/AddEdenToSRM.md +++ b/docs/user/SteamROM.md @@ -1,4 +1,6 @@ -# Importing Eden into Steam with Steam Rom Manager +# User Handbook - Configuring Steam ROM Manager + +## Importing Eden into Steam with Steam Rom Manager Use this when you want to import the Eden AppImage into your Steam Library along with artwork using *Steam ROM Manager.* @@ -6,7 +8,7 @@ Use this when you want to import the Eden AppImage into your Steam Library along --- -### Pre-Requisites +#### Pre-Requisites - Eden set up and configured - Internet Connection @@ -14,9 +16,9 @@ Use this when you want to import the Eden AppImage into your Steam Library along --- -## Steps +### Steps -### Initial Setup +#### Initial Setup 1. Press the **STEAM** button and then go to *Power → Switch to Desktop* to enter the Desktop mode. @@ -24,14 +26,14 @@ Use this when you want to import the Eden AppImage into your Steam Library along --- - ### Manual Installation + #### Manual Installation 1. Open the *Discover Store* and search for *Steam ROM Manager.* 2. Select the **Install** button to install the program. --- - ### Installing Through *EmuDeck* + #### Installing Through *EmuDeck*