VERY experimental Nintendo Switch 2 emulator
C++
remove solo executables (#106)
Aleksandr Popovich1f8b8e0fa16f
diff --git a/.ci/linux/build.sh b/.ci/linux/build.shindex c020cc7edd..70917aec6f 100755--- a/.ci/linux/build.sh+++ b/.ci/linux/build.sh@@ -25,14 +25,13 @@ if [ -z "$NPROC" ]; thenfiif [ "$TARGET" = "appimage" ]; then- # Compile the AppImage we distribute with Clang.- export EXTRA_CMAKE_FLAGS=(-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=/etc/bin/ld.lld)+ export EXTRA_CMAKE_FLAGS=(-DYUZU_CMD=OFF -DYUZU_ROOM_STANDALONE=OFF)# Bundle required QT wayland librariesexport EXTRA_QT_PLUGINS="waylandcompositor"export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so"else# For the linux-fresh verification target, verify compilation without PCH as well.- export EXTRA_CMAKE_FLAGS=(-DCITRA_USE_PRECOMPILED_HEADERS=OFF)+ export EXTRA_CMAKE_FLAGS=(-DYUZU_USE_PRECOMPILED_HEADERS=OFF)fiif [ "$GITHUB_REF_TYPE" == "tag" ]; thendiff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex d8d636c117..d90e424fe8 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -96,7 +96,7 @@ jobs:fetch-tags: true- name: Build- run: ./.ci/linux/build.sh v3 8+ run: TARGET=appimage ./.ci/linux/build.sh v3 8- name: Package AppImagerun: ./.ci/linux/package.sh v3 &> /dev/nulldiff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.ymlindex 5553884862..29d66c42d7 100644--- a/.github/workflows/trigger_release.yml+++ b/.github/workflows/trigger_release.yml@@ -93,7 +93,7 @@ jobs:fetch-tags: true- name: Build- run: ./.ci/linux/build.sh v3 8+ run: TARGET=appimage ./.ci/linux/build.sh v3 8- name: Package AppImagerun: ./.ci/linux/package.sh v3 &> /dev/nulldiff --git a/CMakeLists.txt b/CMakeLists.txtindex 40a9b9ee18..95fc803e30 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -61,7 +61,11 @@ option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)-CMAKE_DEPENDENT_OPTION(YUZU_ROOM "Compile LDN room server" ON "NOT ANDROID" OFF)+CMAKE_DEPENDENT_OPTION(YUZU_ROOM "Enable dedicated room functionality" ON "NOT ANDROID" OFF)++CMAKE_DEPENDENT_OPTION(YUZU_ROOM_STANDALONE "Enable standalone room executable" ON "YUZU_ROOM" OFF)++CMAKE_DEPENDENT_OPTION(YUZU_CMD "Compile the eden-cli executable" ON "NOT ANDROID" OFF)CMAKE_DEPENDENT_OPTION(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX" OFF)@@ -285,6 +289,10 @@ if (ARCHITECTURE_arm64 AND (ANDROID OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))add_definitions(-DHAS_NCE=1)endif()+if (YUZU_ROOM)+ add_definitions(-DYUZU_ROOM)+endif()+# Configure C++ standard# ===========================@@ -396,7 +404,6 @@ endif()add_subdirectory(externals)-if (ENABLE_QT)if (NOT USE_SYSTEM_QT)download_qt(6.8.3)diff --git a/src/CMakeLists.txt b/src/CMakeLists.txtindex 117a0e1265..4308534f12 100644--- a/src/CMakeLists.txt+++ b/src/CMakeLists.txt@@ -88,26 +88,26 @@ if (MSVC)/wd4702 # unreachable code (when used with LTO))- if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)+if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21- add_compile_options(/Z7)- # Avoid D9025 warning- string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")- string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")- else()- add_compile_options(/Zi)- endif()+ add_compile_options(/Z7)+ # Avoid D9025 warning+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")+ string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")+else()+ add_compile_options(/Zi)+endif()- if (ARCHITECTURE_x86_64)- add_compile_options(/QIntel-jcc-erratum)- endif()+if (ARCHITECTURE_x86_64)+ add_compile_options(/QIntel-jcc-erratum)+endif()- # /GS- - No stack buffer overflow checks- add_compile_options("$<$<CONFIG:Release>:/GS->")+# /GS- - No stack buffer overflow checks+add_compile_options("$<$<CONFIG:Release>:/GS->")- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)- set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)+set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)else()add_compile_options(-fwrapv@@ -124,63 +124,63 @@ else()-Wno-missing-field-initializers)- if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang- add_compile_options(- -Wno-braced-scalar-init- -Wno-unused-private-field- -Wno-nullability-completeness- -Werror=shadow-uncaptured-local- -Werror=implicit-fallthrough- -Werror=type-limits- )- endif()+if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang+ add_compile_options(+ -Wno-braced-scalar-init+ -Wno-unused-private-field+ -Wno-nullability-completeness+ -Werror=shadow-uncaptured-local+ -Werror=implicit-fallthrough+ -Werror=type-limits+ )+endif()- if (ARCHITECTURE_x86_64)- add_compile_options("-mcx16")- endif()+if (ARCHITECTURE_x86_64)+ add_compile_options("-mcx16")+endif()- if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)- add_compile_options("-stdlib=libc++")- endif()+if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)+ add_compile_options("-stdlib=libc++")+endif()- # GCC bugs- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")- # These diagnostics would be great if they worked, but are just completely broken- # and produce bogus errors on external libraries like fmt.- add_compile_options(- -Wno-array-bounds- -Wno-stringop-overread- -Wno-stringop-overflow- )- endif()+# GCC bugs+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")+ # These diagnostics would be great if they worked, but are just completely broken+ # and produce bogus errors on external libraries like fmt.+ add_compile_options(+ -Wno-array-bounds+ -Wno-stringop-overread+ -Wno-stringop-overflow+ )+endif()- # Set file offset size to 64 bits.- #- # On modern Unixes, this is typically already the case. The lone exception is- # glibc, which may default to 32 bits. glibc allows this to be configured- # by setting _FILE_OFFSET_BITS.- if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)- add_definitions(-D_FILE_OFFSET_BITS=64)- endif()+# Set file offset size to 64 bits.+#+# On modern Unixes, this is typically already the case. The lone exception is+# glibc, which may default to 32 bits. glibc allows this to be configured+# by setting _FILE_OFFSET_BITS.+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)+ add_definitions(-D_FILE_OFFSET_BITS=64)+endif()- if (MINGW)- add_definitions(-DMINGW_HAS_SECURE_API)- add_compile_options("-msse4.1")+if (MINGW)+ add_definitions(-DMINGW_HAS_SECURE_API)+ add_compile_options("-msse4.1")- if (MINGW_STATIC_BUILD)- add_definitions(-DQT_STATICPLUGIN)- add_compile_options("-static")- endif()+ if (MINGW_STATIC_BUILD)+ add_definitions(-DQT_STATICPLUGIN)+ add_compile_options("-static")endif()+endif()- if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)- # GNU ar: Create thin archive files.- # Requires binutils-2.19 or later.- set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")- set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")- set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")- set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")- endif()+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)+ # GNU ar: Create thin archive files.+ # Requires binutils-2.19 or later.+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")+ set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")+ set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")+endif()endif()add_subdirectory(common)@@ -194,18 +194,23 @@ add_subdirectory(frontend_common)add_subdirectory(shader_recompiler)if (YUZU_ROOM)- add_subdirectory(dedicated_room)+ add_subdirectory(dedicated_room)endif()if (YUZU_TESTS)add_subdirectory(tests)endif()-if (ENABLE_SDL2)+if (ENABLE_SDL2 AND YUZU_CMD)add_subdirectory(yuzu_cmd)set_target_properties(yuzu-cmd PROPERTIES OUTPUT_NAME "eden-cli")endif()+if (YUZU_ROOM_STANDALONE)+ add_subdirectory(yuzu_room_standalone)+ set_target_properties(yuzu-room PROPERTIES OUTPUT_NAME "eden-room")+endif()+if (ENABLE_QT)add_subdirectory(yuzu)endif()diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txtindex 56c7d9a54e..5ffe45be25 100644--- a/src/dedicated_room/CMakeLists.txt+++ b/src/dedicated_room/CMakeLists.txt@@ -1,9 +1,13 @@# SPDX-FileCopyrightText: 2017 Citra Emulator Project# SPDX-License-Identifier: GPL-2.0-or-later-add_executable(yuzu-room+# SPDX-FileCopyrightText: 2025 eden Emulator Project+# SPDX-License-Identifier: GPL-3.0-or-later++add_library(yuzu-room STATIC EXCLUDE_FROM_ALLprecompiled_headers.hyuzu_room.cpp+ yuzu_room.hyuzu_room.rc)@@ -27,6 +31,4 @@ if (YUZU_USE_PRECOMPILED_HEADERS)target_precompile_headers(yuzu-room PRIVATE precompiled_headers.h)endif()-set_target_properties(yuzu-room PROPERTIES OUTPUT_NAME "eden-room")-create_target_directory_groups(yuzu-room)diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cppindex 7604cf4276..f02407780f 100644--- a/src/dedicated_room/yuzu_room.cpp+++ b/src/dedicated_room/yuzu_room.cpp@@ -1,9 +1,11 @@// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later-// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project / Eden Emulator Project+// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project// SPDX-License-Identifier: GPL-3.0-or-later+// SPDX-FileCopyrightText: 2025 eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later#include <chrono>#include <fstream>@@ -47,6 +49,8 @@#include <unistd.h>#endif+#include "yuzu_room.h"+static void PrintHelp(const char* argv0) {LOG_INFO(Network,"Usage: {}"@@ -186,11 +190,17 @@ static void InitializeLogging(const std::string& log_file) {}/// Application entry point-int main(int argc, char** argv) {+void LaunchRoom(int argc, char** argv, bool called_by_option)+{Common::DetachedTasks detached_tasks;int option_index = 0;char* endarg;+ char* new_argv0 = argv[0];+ if (called_by_option) {+ strncat(new_argv0, " --room", 8);+ }+std::string room_name;std::string room_description;std::string password;@@ -205,6 +215,7 @@ int main(int argc, char** argv) {u32 port = Network::DefaultRoomPort;u32 max_members = 16;+ // TODO(alekpop): Implement this into main executable, for --room and a few others.static struct option long_options[] = {{"room-name", required_argument, 0, 'n'},{"room-description", required_argument, 0, 'd'},@@ -222,14 +233,15 @@ int main(int argc, char** argv) {{"enable-yuzu-mods", no_argument, 0, 'e'},{"help", no_argument, 0, 'h'},{"version", no_argument, 0, 'v'},+ // Entry option+ {"room", 0, 0, 0},{0, 0, 0, 0},};InitializeLogging(log_file);while (optind < argc) {- int arg =- getopt_long(argc, argv, "n:d:s:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index);+ int arg = getopt_long(argc, argv, "n:d:s:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index);if (arg != -1) {switch (static_cast<char>(arg)) {case 'n':@@ -273,10 +285,10 @@ int main(int argc, char** argv) {break;case 'h':PrintHelp(argv[0]);- return 0;+ std::exit(0);case 'v':PrintVersion();- return 0;+ std::exit(0);}}}@@ -284,12 +296,12 @@ int main(int argc, char** argv) {if (room_name.empty()) {LOG_ERROR(Network, "Room name is empty!");PrintHelp(argv[0]);- return -1;+ std::exit(-1);}if (preferred_game.empty()) {LOG_ERROR(Network, "Preferred game is empty!");PrintHelp(argv[0]);- return -1;+ std::exit(-1);}if (preferred_game_id == 0) {LOG_ERROR(Network,@@ -297,10 +309,11 @@ int main(int argc, char** argv) {"room.\nSet with --preferred-game-id id");}if (max_members > Network::MaxConcurrentConnections || max_members < 2) {- LOG_ERROR(Network, "max_members needs to be in the range 2 - {}!",+ LOG_ERROR(Network,+ "max_members needs to be in the range 2 - {}!",Network::MaxConcurrentConnections);PrintHelp(argv[0]);- return -1;+ std::exit(-1);}if (bind_address.empty()) {LOG_INFO(Network, "Bind address is empty: defaulting to 0.0.0.0");@@ -308,11 +321,12 @@ int main(int argc, char** argv) {if (port > UINT16_MAX) {LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!");PrintHelp(argv[0]);- return -1;+ std::exit(-1);}if (ban_list_file.empty()) {- LOG_ERROR(Network, "Ban list file not set!\nThis should get set to load and save room ban "- "list.\nSet with --ban-list-file <file>");+ LOG_ERROR(Network,+ "Ban list file not set!\nThis should get set to load and save room ban "+ "list.\nSet with --ban-list-file <file>");}bool announce = true;if (token.empty() && announce) {@@ -368,7 +382,7 @@ int main(int argc, char** argv) {password, max_members, username, preferred_game_info,std::move(verify_backend), ban_list)) {LOG_INFO(Network, "Failed to create room: ");- return -1;+ std::exit(-1);}LOG_INFO(Network, "Room is open. Close with Q+Enter...");auto announce_session = std::make_unique<Core::AnnounceMultiplayerSession>(network);@@ -395,5 +409,5 @@ int main(int argc, char** argv) {}network.Shutdown();detached_tasks.WaitForAllTasks();- return 0;+ std::exit(0);}diff --git a/src/dedicated_room/yuzu_room.h b/src/dedicated_room/yuzu_room.hnew file mode 100644index 0000000000..4dbd4808bf--- /dev/null+++ b/src/dedicated_room/yuzu_room.h@@ -0,0 +1,7 @@+// Copyright eden Emulator Project+// Licensed under GPLv3 or any later version+// Refer to the license.txt file included.++#pragma once++void LaunchRoom(int argc, char** argv, bool called_by_option);diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txtindex 83ca3307fc..d5ef48de96 100644--- a/src/yuzu/CMakeLists.txt+++ b/src/yuzu/CMakeLists.txt@@ -484,4 +484,8 @@ if (YUZU_USE_PRECOMPILED_HEADERS)target_precompile_headers(yuzu PRIVATE precompiled_headers.h)endif()+if (YUZU_ROOM)+ target_link_libraries(yuzu PRIVATE yuzu-room)+endif()+create_target_directory_groups(yuzu)diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cppindex 450d340580..928e42df59 100644--- a/src/yuzu/main.cpp+++ b/src/yuzu/main.cpp@@ -52,6 +52,10 @@#include "yuzu/multiplayer/state.h"#include "yuzu/util/controller_navigation.h"+#ifdef YUZU_ROOM+#include "dedicated_room/yuzu_room.h"+#endif+// These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows// defines.static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper(@@ -5457,6 +5461,20 @@ static void SetHighDPIAttributes() {}int main(int argc, char* argv[]) {+#if YUZU_ROOM+ bool launch_room = false;+ for (int i = 1; i < argc; i++) {+ if (strcmp(argv[i], "--room") == 0) {+ launch_room = true;+ }+ }++ if (launch_room) {+ LaunchRoom(argc, argv, true);+ return 0;+ }+#endif+bool has_broken_vulkan = false;bool is_child = false;if (CheckEnvVars(&is_child)) {@@ -5521,6 +5539,7 @@ int main(int argc, char* argv[]) {QApplication app(argc, argv);+#ifdef _WIN32OverrideWindowsFont();#endifdiff --git a/src/yuzu_room_standalone/CMakeLists.txt b/src/yuzu_room_standalone/CMakeLists.txtnew file mode 100644index 0000000000..a0e688d4a8--- /dev/null+++ b/src/yuzu_room_standalone/CMakeLists.txt@@ -0,0 +1,11 @@+add_executable(yuzu_room_standalone+ yuzu_room_standalone.cpp+)++set_target_properties(yuzu_room_standalone PROPERTIES OUTPUT_NAME "eden-room")++target_link_libraries(yuzu_room_standalone PRIVATE yuzu-room)++if(UNIX AND NOT APPLE)+ install(TARGETS yuzu_room_standalone RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")+endif()diff --git a/src/yuzu_room_standalone/main.cpp b/src/yuzu_room_standalone/main.cppnew file mode 100644index 0000000000..3129fb9dd9--- /dev/null+++ b/src/yuzu_room_standalone/main.cpp@@ -0,0 +1,9 @@+#include <iostream>++using namespace std;++int main()+{+ cout << "Hello World!" << endl;+ return 0;+}diff --git a/src/yuzu_room_standalone/yuzu_room_standalone.cpp b/src/yuzu_room_standalone/yuzu_room_standalone.cppnew file mode 100644index 0000000000..719e8dda3c--- /dev/null+++ b/src/yuzu_room_standalone/yuzu_room_standalone.cpp@@ -0,0 +1,10 @@+// Copyright eden Emulator Project+// Licensed under GPLv3 or any later version+// Refer to the license.txt file included.++#include "dedicated_room/yuzu_room.h"++int main(int argc, char* argv[])+{+ LaunchRoom(argc, argv, false);+}