diff options
| author | Aleksandr Popovich <alekpopo@pm.me> | 2025-05-19 21:30:10 +0000 |
|---|---|---|
| committer | AlekPop <alekpop@noreply.localhost> | 2025-05-19 21:30:10 +0000 |
| commit | 1f8b8e0fa16fe9e254d31f06dde6984bbd75676f (patch) | |
| tree | 65effe55c2c06b1fc9c087470fa2bd87f60dc461 /src/dedicated_room | |
| parent | bc55ed496f48f8b9f5ecde3d6dfc35d03912ba2e (diff) | |
remove solo executables (#106)
also, fixes CI not targeting the right flag settings.
this pr needs to add the room exe removal from lime3ds.
Signed-off-by: Aleksandr Popovich <alekpopo@pm.me>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/106
Co-authored-by: Aleksandr Popovich <alekpopo@pm.me>
Co-committed-by: Aleksandr Popovich <alekpopo@pm.me>
Diffstat (limited to 'src/dedicated_room')
| -rw-r--r-- | src/dedicated_room/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/dedicated_room/yuzu_room.cpp | 44 | ||||
| -rw-r--r-- | src/dedicated_room/yuzu_room.h | 7 |
3 files changed, 41 insertions, 18 deletions
diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 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_ALL precompiled_headers.h yuzu_room.cpp + yuzu_room.h yuzu_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.cpp index 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.h new file mode 100644 index 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); |
