From 9fc03d4b91e69ab4590d6e257b41810dcf36abf9 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 30 Jul 2022 05:55:29 +0200 Subject: dedicated_room: Initial implementation --- src/dedicated_room/CMakeLists.txt | 24 +++ src/dedicated_room/yuzu-room.cpp | 376 ++++++++++++++++++++++++++++++++++++++ src/dedicated_room/yuzu-room.rc | 17 ++ 3 files changed, 417 insertions(+) create mode 100644 src/dedicated_room/CMakeLists.txt create mode 100644 src/dedicated_room/yuzu-room.cpp create mode 100644 src/dedicated_room/yuzu-room.rc (limited to 'src/dedicated_room') diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt new file mode 100644 index 000000000..7a29bd015 --- /dev/null +++ b/src/dedicated_room/CMakeLists.txt @@ -0,0 +1,24 @@ +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) + +add_executable(yuzu-room + yuzu-room.cpp + yuzu-room.rc +) + +create_target_directory_groups(yuzu-room) + +target_link_libraries(yuzu-room PRIVATE common core network) +if (ENABLE_WEB_SERVICE) + target_compile_definitions(yuzu-room PRIVATE -DENABLE_WEB_SERVICE) + target_link_libraries(yuzu-room PRIVATE web_service) +endif() + +target_link_libraries(yuzu-room PRIVATE mbedtls) +if (MSVC) + target_link_libraries(yuzu-room PRIVATE getopt) +endif() +target_link_libraries(yuzu-room PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) + +if(UNIX AND NOT APPLE) + install(TARGETS yuzu-room RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") +endif() diff --git a/src/dedicated_room/yuzu-room.cpp b/src/dedicated_room/yuzu-room.cpp new file mode 100644 index 000000000..9c1bfaab9 --- /dev/null +++ b/src/dedicated_room/yuzu-room.cpp @@ -0,0 +1,376 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +// windows.h needs to be included before shellapi.h +#include + +#include +#endif + +#include +#include "common/common_types.h" +#include "common/detached_tasks.h" +#include "common/fs/file.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" +#include "common/logging/backend.h" +#include "common/logging/log.h" +#include "common/scm_rev.h" +#include "common/settings.h" +#include "common/string_util.h" +#include "core/announce_multiplayer_session.h" +#include "core/core.h" +#include "network/network.h" +#include "network/room.h" +#include "network/verify_user.h" + +#ifdef ENABLE_WEB_SERVICE +#include "web_service/verify_user_jwt.h" +#endif + +#undef _UNICODE +#include +#ifndef _MSC_VER +#include +#endif + +static void PrintHelp(const char* argv0) { + std::cout << "Usage: " << argv0 + << " [options] \n" + "--room-name The name of the room\n" + "--room-description The room description\n" + "--port The port used for the room\n" + "--max_members The maximum number of players for this room\n" + "--password The password for the room\n" + "--preferred-game The preferred game for this room\n" + "--preferred-game-id The preferred game-id for this room\n" + "--username The username used for announce\n" + "--token The token used for announce\n" + "--web-api-url yuzu Web API url\n" + "--ban-list-file The file for storing the room ban list\n" + "--log-file The file for storing the room log\n" + "--enable-yuzu-mods Allow yuzu Community Moderators to moderate on your room\n" + "-h, --help Display this help and exit\n" + "-v, --version Output version information and exit\n"; +} + +static void PrintVersion() { + std::cout << "yuzu dedicated room " << Common::g_scm_branch << " " << Common::g_scm_desc + << " Libnetwork: " << Network::network_version << std::endl; +} + +/// The magic text at the beginning of a yuzu-room ban list file. +static constexpr char BanListMagic[] = "YuzuRoom-BanList-1"; + +static constexpr char token_delimiter{':'}; + +static std::string UsernameFromDisplayToken(const std::string& display_token) { + std::size_t outlen; + + std::array output; + mbedtls_base64_decode(output.data(), output.size(), &outlen, + reinterpret_cast(display_token.c_str()), + display_token.length()); + std::string decoded_display_token(reinterpret_cast(&output), outlen); + return decoded_display_token.substr(0, decoded_display_token.find(token_delimiter)); +} + +static std::string TokenFromDisplayToken(const std::string& display_token) { + std::size_t outlen; + + std::array output; + mbedtls_base64_decode(output.data(), output.size(), &outlen, + reinterpret_cast(display_token.c_str()), + display_token.length()); + std::string decoded_display_token(reinterpret_cast(&output), outlen); + return decoded_display_token.substr(decoded_display_token.find(token_delimiter) + 1); +} + +static Network::Room::BanList LoadBanList(const std::string& path) { + std::ifstream file; + Common::FS::OpenFileStream(file, path, std::ios_base::in); + if (!file || file.eof()) { + std::cout << "Could not open ban list!\n\n"; + return {}; + } + std::string magic; + std::getline(file, magic); + if (magic != BanListMagic) { + std::cout << "Ban list is not valid!\n\n"; + return {}; + } + + // false = username ban list, true = ip ban list + bool ban_list_type = false; + Network::Room::UsernameBanList username_ban_list; + Network::Room::IPBanList ip_ban_list; + while (!file.eof()) { + std::string line; + std::getline(file, line); + line.erase(std::remove(line.begin(), line.end(), '\0'), line.end()); + line = Common::StripSpaces(line); + if (line.empty()) { + // An empty line marks start of the IP ban list + ban_list_type = true; + continue; + } + if (ban_list_type) { + ip_ban_list.emplace_back(line); + } else { + username_ban_list.emplace_back(line); + } + } + + return {username_ban_list, ip_ban_list}; +} + +static void SaveBanList(const Network::Room::BanList& ban_list, const std::string& path) { + std::ofstream file; + Common::FS::OpenFileStream(file, path, std::ios_base::out); + if (!file) { + std::cout << "Could not save ban list!\n\n"; + return; + } + + file << BanListMagic << "\n"; + + // Username ban list + for (const auto& username : ban_list.first) { + file << username << "\n"; + } + file << "\n"; + + // IP ban list + for (const auto& ip : ban_list.second) { + file << ip << "\n"; + } + + file.flush(); +} + +static void InitializeLogging(const std::string& log_file) { + Common::Log::Initialize(); + Common::Log::SetColorConsoleBackendEnabled(true); + Common::Log::Start(); +} + +/// Application entry point +int main(int argc, char** argv) { + Common::DetachedTasks detached_tasks; + int option_index = 0; + char* endarg; + + std::string room_name; + std::string room_description; + std::string password; + std::string preferred_game; + std::string username; + std::string token; + std::string web_api_url; + std::string ban_list_file; + std::string log_file = "yuzu-room.log"; + u64 preferred_game_id = 0; + u32 port = Network::DefaultRoomPort; + u32 max_members = 16; + bool enable_yuzu_mods = false; + + static struct option long_options[] = { + {"room-name", required_argument, 0, 'n'}, + {"room-description", required_argument, 0, 'd'}, + {"port", required_argument, 0, 'p'}, + {"max_members", required_argument, 0, 'm'}, + {"password", required_argument, 0, 'w'}, + {"preferred-game", required_argument, 0, 'g'}, + {"preferred-game-id", required_argument, 0, 'i'}, + {"username", optional_argument, 0, 'u'}, + {"token", required_argument, 0, 't'}, + {"web-api-url", required_argument, 0, 'a'}, + {"ban-list-file", required_argument, 0, 'b'}, + {"log-file", required_argument, 0, 'l'}, + {"enable-yuzu-mods", no_argument, 0, 'e'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0}, + }; + + while (optind < argc) { + int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); + if (arg != -1) { + switch (static_cast(arg)) { + case 'n': + room_name.assign(optarg); + break; + case 'd': + room_description.assign(optarg); + break; + case 'p': + port = strtoul(optarg, &endarg, 0); + break; + case 'm': + max_members = strtoul(optarg, &endarg, 0); + break; + case 'w': + password.assign(optarg); + break; + case 'g': + preferred_game.assign(optarg); + break; + case 'i': + preferred_game_id = strtoull(optarg, &endarg, 16); + break; + case 'u': + username.assign(optarg); + break; + case 't': + token.assign(optarg); + break; + case 'a': + web_api_url.assign(optarg); + break; + case 'b': + ban_list_file.assign(optarg); + break; + case 'l': + log_file.assign(optarg); + break; + case 'e': + enable_yuzu_mods = true; + break; + case 'h': + PrintHelp(argv[0]); + return 0; + case 'v': + PrintVersion(); + return 0; + } + } + } + + if (room_name.empty()) { + std::cout << "room name is empty!\n\n"; + PrintHelp(argv[0]); + return -1; + } + if (preferred_game.empty()) { + std::cout << "preferred game is empty!\n\n"; + PrintHelp(argv[0]); + return -1; + } + if (preferred_game_id == 0) { + std::cout << "preferred-game-id not set!\nThis should get set to allow users to find your " + "room.\nSet with --preferred-game-id id\n\n"; + } + if (max_members > Network::MaxConcurrentConnections || max_members < 2) { + std::cout << "max_members needs to be in the range 2 - " + << Network::MaxConcurrentConnections << "!\n\n"; + PrintHelp(argv[0]); + return -1; + } + if (port > 65535) { + std::cout << "port needs to be in the range 0 - 65535!\n\n"; + PrintHelp(argv[0]); + return -1; + } + if (ban_list_file.empty()) { + std::cout << "Ban list file not set!\nThis should get set to load and save room ban " + "list.\nSet with --ban-list-file \n\n"; + } + bool announce = true; + if (token.empty() && announce) { + announce = false; + std::cout << "token is empty: Hosting a private room\n\n"; + } + if (web_api_url.empty() && announce) { + announce = false; + std::cout << "endpoint url is empty: Hosting a private room\n\n"; + } + if (announce) { + if (username.empty()) { + std::cout << "Hosting a public room\n\n"; + Settings::values.web_api_url = web_api_url; + Settings::values.yuzu_username = UsernameFromDisplayToken(token); + username = Settings::values.yuzu_username.GetValue(); + Settings::values.yuzu_token = TokenFromDisplayToken(token); + } else { + std::cout << "Hosting a public room\n\n"; + Settings::values.web_api_url = web_api_url; + Settings::values.yuzu_username = username; + Settings::values.yuzu_token = token; + } + } + if (!announce && enable_yuzu_mods) { + enable_yuzu_mods = false; + std::cout << "Can not enable yuzu Moderators for private rooms\n\n"; + } + + InitializeLogging(log_file); + + // Load the ban list + Network::Room::BanList ban_list; + if (!ban_list_file.empty()) { + ban_list = LoadBanList(ban_list_file); + } + + std::unique_ptr verify_backend; + if (announce) { +#ifdef ENABLE_WEB_SERVICE + verify_backend = + std::make_unique(Settings::values.web_api_url.GetValue()); +#else + std::cout + << "yuzu Web Services is not available with this build: validation is disabled.\n\n"; + verify_backend = std::make_unique(); +#endif + } else { + verify_backend = std::make_unique(); + } + + Core::System system{}; + auto& network = system.GetRoomNetwork(); + network.Init(); + if (std::shared_ptr room = network.GetRoom().lock()) { + AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, + .id = preferred_game_id}; + if (!room->Create(room_name, room_description, "", port, password, max_members, username, + preferred_game_info, std::move(verify_backend), ban_list, + enable_yuzu_mods)) { + std::cout << "Failed to create room: \n\n"; + return -1; + } + std::cout << "Room is open. Close with Q+Enter...\n\n"; + auto announce_session = std::make_unique(network); + if (announce) { + announce_session->Start(); + } + while (room->GetState() == Network::Room::State::Open) { + std::string in; + std::cin >> in; + if (in.size() > 0) { + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + if (announce) { + announce_session->Stop(); + } + announce_session.reset(); + // Save the ban list + if (!ban_list_file.empty()) { + SaveBanList(room->GetBanList(), ban_list_file); + } + room->Destroy(); + } + network.Shutdown(); + detached_tasks.WaitForAllTasks(); + return 0; +} diff --git a/src/dedicated_room/yuzu-room.rc b/src/dedicated_room/yuzu-room.rc new file mode 100644 index 000000000..b616a5764 --- /dev/null +++ b/src/dedicated_room/yuzu-room.rc @@ -0,0 +1,17 @@ +#include "winresrc.h" +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +YUZU_ICON ICON "../../dist/yuzu.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +0 RT_MANIFEST "../../dist/yuzu.manifest" -- cgit v1.2.3 From bb84f5353927e473f39fc5fac741a623b48a1ef1 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 30 Jul 2022 20:16:47 +0200 Subject: Make copyright headers SPDX-compliant --- src/dedicated_room/CMakeLists.txt | 3 +++ src/dedicated_room/yuzu-room.cpp | 5 ++--- src/dedicated_room/yuzu-room.rc | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/dedicated_room') diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 7a29bd015..7b9dc9c04 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2017 Citra Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) add_executable(yuzu-room diff --git a/src/dedicated_room/yuzu-room.cpp b/src/dedicated_room/yuzu-room.cpp index 9c1bfaab9..88645dba7 100644 --- a/src/dedicated_room/yuzu-room.cpp +++ b/src/dedicated_room/yuzu-room.cpp @@ -1,6 +1,5 @@ -// Copyright 2017 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. +// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later #include #include diff --git a/src/dedicated_room/yuzu-room.rc b/src/dedicated_room/yuzu-room.rc index b616a5764..a08957684 100644 --- a/src/dedicated_room/yuzu-room.rc +++ b/src/dedicated_room/yuzu-room.rc @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2017 Citra Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + #include "winresrc.h" ///////////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From 6d41088153b4b932b4f2524d4252993a5642f998 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Mon, 1 Aug 2022 22:47:39 +0200 Subject: core, yuzu: Address first part of review comments --- src/dedicated_room/yuzu-room.cpp | 100 +++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/dedicated_room') diff --git a/src/dedicated_room/yuzu-room.cpp b/src/dedicated_room/yuzu-room.cpp index 88645dba7..482e772fb 100644 --- a/src/dedicated_room/yuzu-room.cpp +++ b/src/dedicated_room/yuzu-room.cpp @@ -44,28 +44,30 @@ #endif static void PrintHelp(const char* argv0) { - std::cout << "Usage: " << argv0 - << " [options] \n" - "--room-name The name of the room\n" - "--room-description The room description\n" - "--port The port used for the room\n" - "--max_members The maximum number of players for this room\n" - "--password The password for the room\n" - "--preferred-game The preferred game for this room\n" - "--preferred-game-id The preferred game-id for this room\n" - "--username The username used for announce\n" - "--token The token used for announce\n" - "--web-api-url yuzu Web API url\n" - "--ban-list-file The file for storing the room ban list\n" - "--log-file The file for storing the room log\n" - "--enable-yuzu-mods Allow yuzu Community Moderators to moderate on your room\n" - "-h, --help Display this help and exit\n" - "-v, --version Output version information and exit\n"; + LOG_INFO(Network, + "Usage: {}" + " [options] \n" + "--room-name The name of the room\n" + "--room-description The room description\n" + "--port The port used for the room\n" + "--max_members The maximum number of players for this room\n" + "--password The password for the room\n" + "--preferred-game The preferred game for this room\n" + "--preferred-game-id The preferred game-id for this room\n" + "--username The username used for announce\n" + "--token The token used for announce\n" + "--web-api-url yuzu Web API url\n" + "--ban-list-file The file for storing the room ban list\n" + "--log-file The file for storing the room log\n" + "--enable-yuzu-mods Allow yuzu Community Moderators to moderate on your room\n" + "-h, --help Display this help and exit\n" + "-v, --version Output version information and exit\n", + argv0); } static void PrintVersion() { - std::cout << "yuzu dedicated room " << Common::g_scm_branch << " " << Common::g_scm_desc - << " Libnetwork: " << Network::network_version << std::endl; + LOG_INFO(Network, "yuzu dedicated room {} {} Libnetwork: {}", Common::g_scm_branch, + Common::g_scm_desc, Network::network_version); } /// The magic text at the beginning of a yuzu-room ban list file. @@ -76,7 +78,7 @@ static constexpr char token_delimiter{':'}; static std::string UsernameFromDisplayToken(const std::string& display_token) { std::size_t outlen; - std::array output; + std::array output{}; mbedtls_base64_decode(output.data(), output.size(), &outlen, reinterpret_cast(display_token.c_str()), display_token.length()); @@ -87,7 +89,7 @@ static std::string UsernameFromDisplayToken(const std::string& display_token) { static std::string TokenFromDisplayToken(const std::string& display_token) { std::size_t outlen; - std::array output; + std::array output{}; mbedtls_base64_decode(output.data(), output.size(), &outlen, reinterpret_cast(display_token.c_str()), display_token.length()); @@ -99,13 +101,13 @@ static Network::Room::BanList LoadBanList(const std::string& path) { std::ifstream file; Common::FS::OpenFileStream(file, path, std::ios_base::in); if (!file || file.eof()) { - std::cout << "Could not open ban list!\n\n"; + LOG_ERROR(Network, "Could not open ban list!"); return {}; } std::string magic; std::getline(file, magic); if (magic != BanListMagic) { - std::cout << "Ban list is not valid!\n\n"; + LOG_ERROR(Network, "Ban list is not valid!"); return {}; } @@ -137,7 +139,7 @@ static void SaveBanList(const Network::Room::BanList& ban_list, const std::strin std::ofstream file; Common::FS::OpenFileStream(file, path, std::ios_base::out); if (!file) { - std::cout << "Could not save ban list!\n\n"; + LOG_ERROR(Network, "Could not save ban list!"); return; } @@ -153,8 +155,6 @@ static void SaveBanList(const Network::Room::BanList& ban_list, const std::strin for (const auto& ip : ban_list.second) { file << ip << "\n"; } - - file.flush(); } static void InitializeLogging(const std::string& log_file) { @@ -202,6 +202,8 @@ int main(int argc, char** argv) { {0, 0, 0, 0}, }; + InitializeLogging(log_file); + while (optind < argc) { int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); if (arg != -1) { @@ -256,52 +258,53 @@ int main(int argc, char** argv) { } if (room_name.empty()) { - std::cout << "room name is empty!\n\n"; + LOG_ERROR(Network, "Room name is empty!"); PrintHelp(argv[0]); return -1; } if (preferred_game.empty()) { - std::cout << "preferred game is empty!\n\n"; + LOG_ERROR(Network, "Preferred game is empty!"); PrintHelp(argv[0]); return -1; } if (preferred_game_id == 0) { - std::cout << "preferred-game-id not set!\nThis should get set to allow users to find your " - "room.\nSet with --preferred-game-id id\n\n"; + LOG_ERROR(Network, + "preferred-game-id not set!\nThis should get set to allow users to find your " + "room.\nSet with --preferred-game-id id"); } if (max_members > Network::MaxConcurrentConnections || max_members < 2) { - std::cout << "max_members needs to be in the range 2 - " - << Network::MaxConcurrentConnections << "!\n\n"; + LOG_ERROR(Network, "max_members needs to be in the range 2 - {}!", + Network::MaxConcurrentConnections); PrintHelp(argv[0]); return -1; } - if (port > 65535) { - std::cout << "port needs to be in the range 0 - 65535!\n\n"; + if (port > UINT16_MAX) { + LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!"); PrintHelp(argv[0]); return -1; } if (ban_list_file.empty()) { - std::cout << "Ban list file not set!\nThis should get set to load and save room ban " - "list.\nSet with --ban-list-file \n\n"; + LOG_ERROR(Network, "Ban list file not set!\nThis should get set to load and save room ban " + "list.\nSet with --ban-list-file "); } bool announce = true; if (token.empty() && announce) { announce = false; - std::cout << "token is empty: Hosting a private room\n\n"; + LOG_INFO(Network, "Token is empty: Hosting a private room"); } if (web_api_url.empty() && announce) { announce = false; - std::cout << "endpoint url is empty: Hosting a private room\n\n"; + LOG_INFO(Network, "Endpoint url is empty: Hosting a private room"); } if (announce) { if (username.empty()) { - std::cout << "Hosting a public room\n\n"; + LOG_INFO(Network, "Hosting a public room"); Settings::values.web_api_url = web_api_url; Settings::values.yuzu_username = UsernameFromDisplayToken(token); username = Settings::values.yuzu_username.GetValue(); Settings::values.yuzu_token = TokenFromDisplayToken(token); } else { - std::cout << "Hosting a public room\n\n"; + LOG_INFO(Network, "Hosting a public room"); Settings::values.web_api_url = web_api_url; Settings::values.yuzu_username = username; Settings::values.yuzu_token = token; @@ -309,11 +312,9 @@ int main(int argc, char** argv) { } if (!announce && enable_yuzu_mods) { enable_yuzu_mods = false; - std::cout << "Can not enable yuzu Moderators for private rooms\n\n"; + LOG_INFO(Network, "Can not enable yuzu Moderators for private rooms"); } - InitializeLogging(log_file); - // Load the ban list Network::Room::BanList ban_list; if (!ban_list_file.empty()) { @@ -326,27 +327,26 @@ int main(int argc, char** argv) { verify_backend = std::make_unique(Settings::values.web_api_url.GetValue()); #else - std::cout - << "yuzu Web Services is not available with this build: validation is disabled.\n\n"; + LOG_INFO(Network, + "yuzu Web Services is not available with this build: validation is disabled."); verify_backend = std::make_unique(); #endif } else { verify_backend = std::make_unique(); } - Core::System system{}; - auto& network = system.GetRoomNetwork(); + Network::RoomNetwork network{}; network.Init(); - if (std::shared_ptr room = network.GetRoom().lock()) { + if (auto room = network.GetRoom().lock()) { AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, .id = preferred_game_id}; if (!room->Create(room_name, room_description, "", port, password, max_members, username, preferred_game_info, std::move(verify_backend), ban_list, enable_yuzu_mods)) { - std::cout << "Failed to create room: \n\n"; + LOG_INFO(Network, "Failed to create room: "); return -1; } - std::cout << "Room is open. Close with Q+Enter...\n\n"; + LOG_INFO(Network, "Room is open. Close with Q+Enter..."); auto announce_session = std::make_unique(network); if (announce) { announce_session->Start(); -- cgit v1.2.3 From 72b90a5bbf7a9308f7172f38be88e29bab58a21b Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 13 Aug 2022 13:11:01 -0500 Subject: core: network: Address review comments --- src/dedicated_room/CMakeLists.txt | 4 +- src/dedicated_room/yuzu-room.cpp | 375 -------------------------------------- src/dedicated_room/yuzu-room.rc | 20 -- src/dedicated_room/yuzu_room.cpp | 375 ++++++++++++++++++++++++++++++++++++++ src/dedicated_room/yuzu_room.rc | 20 ++ 5 files changed, 397 insertions(+), 397 deletions(-) delete mode 100644 src/dedicated_room/yuzu-room.cpp delete mode 100644 src/dedicated_room/yuzu-room.rc create mode 100644 src/dedicated_room/yuzu_room.cpp create mode 100644 src/dedicated_room/yuzu_room.rc (limited to 'src/dedicated_room') diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 7b9dc9c04..b674b915b 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -4,8 +4,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) add_executable(yuzu-room - yuzu-room.cpp - yuzu-room.rc + yuzu_room.cpp + yuzu_room.rc ) create_target_directory_groups(yuzu-room) diff --git a/src/dedicated_room/yuzu-room.cpp b/src/dedicated_room/yuzu-room.cpp deleted file mode 100644 index 482e772fb..000000000 --- a/src/dedicated_room/yuzu-room.cpp +++ /dev/null @@ -1,375 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -// windows.h needs to be included before shellapi.h -#include - -#include -#endif - -#include -#include "common/common_types.h" -#include "common/detached_tasks.h" -#include "common/fs/file.h" -#include "common/fs/fs.h" -#include "common/fs/path_util.h" -#include "common/logging/backend.h" -#include "common/logging/log.h" -#include "common/scm_rev.h" -#include "common/settings.h" -#include "common/string_util.h" -#include "core/announce_multiplayer_session.h" -#include "core/core.h" -#include "network/network.h" -#include "network/room.h" -#include "network/verify_user.h" - -#ifdef ENABLE_WEB_SERVICE -#include "web_service/verify_user_jwt.h" -#endif - -#undef _UNICODE -#include -#ifndef _MSC_VER -#include -#endif - -static void PrintHelp(const char* argv0) { - LOG_INFO(Network, - "Usage: {}" - " [options] \n" - "--room-name The name of the room\n" - "--room-description The room description\n" - "--port The port used for the room\n" - "--max_members The maximum number of players for this room\n" - "--password The password for the room\n" - "--preferred-game The preferred game for this room\n" - "--preferred-game-id The preferred game-id for this room\n" - "--username The username used for announce\n" - "--token The token used for announce\n" - "--web-api-url yuzu Web API url\n" - "--ban-list-file The file for storing the room ban list\n" - "--log-file The file for storing the room log\n" - "--enable-yuzu-mods Allow yuzu Community Moderators to moderate on your room\n" - "-h, --help Display this help and exit\n" - "-v, --version Output version information and exit\n", - argv0); -} - -static void PrintVersion() { - LOG_INFO(Network, "yuzu dedicated room {} {} Libnetwork: {}", Common::g_scm_branch, - Common::g_scm_desc, Network::network_version); -} - -/// The magic text at the beginning of a yuzu-room ban list file. -static constexpr char BanListMagic[] = "YuzuRoom-BanList-1"; - -static constexpr char token_delimiter{':'}; - -static std::string UsernameFromDisplayToken(const std::string& display_token) { - std::size_t outlen; - - std::array output{}; - mbedtls_base64_decode(output.data(), output.size(), &outlen, - reinterpret_cast(display_token.c_str()), - display_token.length()); - std::string decoded_display_token(reinterpret_cast(&output), outlen); - return decoded_display_token.substr(0, decoded_display_token.find(token_delimiter)); -} - -static std::string TokenFromDisplayToken(const std::string& display_token) { - std::size_t outlen; - - std::array output{}; - mbedtls_base64_decode(output.data(), output.size(), &outlen, - reinterpret_cast(display_token.c_str()), - display_token.length()); - std::string decoded_display_token(reinterpret_cast(&output), outlen); - return decoded_display_token.substr(decoded_display_token.find(token_delimiter) + 1); -} - -static Network::Room::BanList LoadBanList(const std::string& path) { - std::ifstream file; - Common::FS::OpenFileStream(file, path, std::ios_base::in); - if (!file || file.eof()) { - LOG_ERROR(Network, "Could not open ban list!"); - return {}; - } - std::string magic; - std::getline(file, magic); - if (magic != BanListMagic) { - LOG_ERROR(Network, "Ban list is not valid!"); - return {}; - } - - // false = username ban list, true = ip ban list - bool ban_list_type = false; - Network::Room::UsernameBanList username_ban_list; - Network::Room::IPBanList ip_ban_list; - while (!file.eof()) { - std::string line; - std::getline(file, line); - line.erase(std::remove(line.begin(), line.end(), '\0'), line.end()); - line = Common::StripSpaces(line); - if (line.empty()) { - // An empty line marks start of the IP ban list - ban_list_type = true; - continue; - } - if (ban_list_type) { - ip_ban_list.emplace_back(line); - } else { - username_ban_list.emplace_back(line); - } - } - - return {username_ban_list, ip_ban_list}; -} - -static void SaveBanList(const Network::Room::BanList& ban_list, const std::string& path) { - std::ofstream file; - Common::FS::OpenFileStream(file, path, std::ios_base::out); - if (!file) { - LOG_ERROR(Network, "Could not save ban list!"); - return; - } - - file << BanListMagic << "\n"; - - // Username ban list - for (const auto& username : ban_list.first) { - file << username << "\n"; - } - file << "\n"; - - // IP ban list - for (const auto& ip : ban_list.second) { - file << ip << "\n"; - } -} - -static void InitializeLogging(const std::string& log_file) { - Common::Log::Initialize(); - Common::Log::SetColorConsoleBackendEnabled(true); - Common::Log::Start(); -} - -/// Application entry point -int main(int argc, char** argv) { - Common::DetachedTasks detached_tasks; - int option_index = 0; - char* endarg; - - std::string room_name; - std::string room_description; - std::string password; - std::string preferred_game; - std::string username; - std::string token; - std::string web_api_url; - std::string ban_list_file; - std::string log_file = "yuzu-room.log"; - u64 preferred_game_id = 0; - u32 port = Network::DefaultRoomPort; - u32 max_members = 16; - bool enable_yuzu_mods = false; - - static struct option long_options[] = { - {"room-name", required_argument, 0, 'n'}, - {"room-description", required_argument, 0, 'd'}, - {"port", required_argument, 0, 'p'}, - {"max_members", required_argument, 0, 'm'}, - {"password", required_argument, 0, 'w'}, - {"preferred-game", required_argument, 0, 'g'}, - {"preferred-game-id", required_argument, 0, 'i'}, - {"username", optional_argument, 0, 'u'}, - {"token", required_argument, 0, 't'}, - {"web-api-url", required_argument, 0, 'a'}, - {"ban-list-file", required_argument, 0, 'b'}, - {"log-file", required_argument, 0, 'l'}, - {"enable-yuzu-mods", no_argument, 0, 'e'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {0, 0, 0, 0}, - }; - - InitializeLogging(log_file); - - while (optind < argc) { - int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); - if (arg != -1) { - switch (static_cast(arg)) { - case 'n': - room_name.assign(optarg); - break; - case 'd': - room_description.assign(optarg); - break; - case 'p': - port = strtoul(optarg, &endarg, 0); - break; - case 'm': - max_members = strtoul(optarg, &endarg, 0); - break; - case 'w': - password.assign(optarg); - break; - case 'g': - preferred_game.assign(optarg); - break; - case 'i': - preferred_game_id = strtoull(optarg, &endarg, 16); - break; - case 'u': - username.assign(optarg); - break; - case 't': - token.assign(optarg); - break; - case 'a': - web_api_url.assign(optarg); - break; - case 'b': - ban_list_file.assign(optarg); - break; - case 'l': - log_file.assign(optarg); - break; - case 'e': - enable_yuzu_mods = true; - break; - case 'h': - PrintHelp(argv[0]); - return 0; - case 'v': - PrintVersion(); - return 0; - } - } - } - - if (room_name.empty()) { - LOG_ERROR(Network, "Room name is empty!"); - PrintHelp(argv[0]); - return -1; - } - if (preferred_game.empty()) { - LOG_ERROR(Network, "Preferred game is empty!"); - PrintHelp(argv[0]); - return -1; - } - if (preferred_game_id == 0) { - LOG_ERROR(Network, - "preferred-game-id not set!\nThis should get set to allow users to find your " - "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 - {}!", - Network::MaxConcurrentConnections); - PrintHelp(argv[0]); - return -1; - } - if (port > UINT16_MAX) { - LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!"); - PrintHelp(argv[0]); - return -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 "); - } - bool announce = true; - if (token.empty() && announce) { - announce = false; - LOG_INFO(Network, "Token is empty: Hosting a private room"); - } - if (web_api_url.empty() && announce) { - announce = false; - LOG_INFO(Network, "Endpoint url is empty: Hosting a private room"); - } - if (announce) { - if (username.empty()) { - LOG_INFO(Network, "Hosting a public room"); - Settings::values.web_api_url = web_api_url; - Settings::values.yuzu_username = UsernameFromDisplayToken(token); - username = Settings::values.yuzu_username.GetValue(); - Settings::values.yuzu_token = TokenFromDisplayToken(token); - } else { - LOG_INFO(Network, "Hosting a public room"); - Settings::values.web_api_url = web_api_url; - Settings::values.yuzu_username = username; - Settings::values.yuzu_token = token; - } - } - if (!announce && enable_yuzu_mods) { - enable_yuzu_mods = false; - LOG_INFO(Network, "Can not enable yuzu Moderators for private rooms"); - } - - // Load the ban list - Network::Room::BanList ban_list; - if (!ban_list_file.empty()) { - ban_list = LoadBanList(ban_list_file); - } - - std::unique_ptr verify_backend; - if (announce) { -#ifdef ENABLE_WEB_SERVICE - verify_backend = - std::make_unique(Settings::values.web_api_url.GetValue()); -#else - LOG_INFO(Network, - "yuzu Web Services is not available with this build: validation is disabled."); - verify_backend = std::make_unique(); -#endif - } else { - verify_backend = std::make_unique(); - } - - Network::RoomNetwork network{}; - network.Init(); - if (auto room = network.GetRoom().lock()) { - AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, - .id = preferred_game_id}; - if (!room->Create(room_name, room_description, "", port, password, max_members, username, - preferred_game_info, std::move(verify_backend), ban_list, - enable_yuzu_mods)) { - LOG_INFO(Network, "Failed to create room: "); - return -1; - } - LOG_INFO(Network, "Room is open. Close with Q+Enter..."); - auto announce_session = std::make_unique(network); - if (announce) { - announce_session->Start(); - } - while (room->GetState() == Network::Room::State::Open) { - std::string in; - std::cin >> in; - if (in.size() > 0) { - break; - } - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - if (announce) { - announce_session->Stop(); - } - announce_session.reset(); - // Save the ban list - if (!ban_list_file.empty()) { - SaveBanList(room->GetBanList(), ban_list_file); - } - room->Destroy(); - } - network.Shutdown(); - detached_tasks.WaitForAllTasks(); - return 0; -} diff --git a/src/dedicated_room/yuzu-room.rc b/src/dedicated_room/yuzu-room.rc deleted file mode 100644 index a08957684..000000000 --- a/src/dedicated_room/yuzu-room.rc +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: 2017 Citra Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "winresrc.h" -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -YUZU_ICON ICON "../../dist/yuzu.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// RT_MANIFEST -// - -0 RT_MANIFEST "../../dist/yuzu.manifest" diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp new file mode 100644 index 000000000..482e772fb --- /dev/null +++ b/src/dedicated_room/yuzu_room.cpp @@ -0,0 +1,375 @@ +// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +// windows.h needs to be included before shellapi.h +#include + +#include +#endif + +#include +#include "common/common_types.h" +#include "common/detached_tasks.h" +#include "common/fs/file.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" +#include "common/logging/backend.h" +#include "common/logging/log.h" +#include "common/scm_rev.h" +#include "common/settings.h" +#include "common/string_util.h" +#include "core/announce_multiplayer_session.h" +#include "core/core.h" +#include "network/network.h" +#include "network/room.h" +#include "network/verify_user.h" + +#ifdef ENABLE_WEB_SERVICE +#include "web_service/verify_user_jwt.h" +#endif + +#undef _UNICODE +#include +#ifndef _MSC_VER +#include +#endif + +static void PrintHelp(const char* argv0) { + LOG_INFO(Network, + "Usage: {}" + " [options] \n" + "--room-name The name of the room\n" + "--room-description The room description\n" + "--port The port used for the room\n" + "--max_members The maximum number of players for this room\n" + "--password The password for the room\n" + "--preferred-game The preferred game for this room\n" + "--preferred-game-id The preferred game-id for this room\n" + "--username The username used for announce\n" + "--token The token used for announce\n" + "--web-api-url yuzu Web API url\n" + "--ban-list-file The file for storing the room ban list\n" + "--log-file The file for storing the room log\n" + "--enable-yuzu-mods Allow yuzu Community Moderators to moderate on your room\n" + "-h, --help Display this help and exit\n" + "-v, --version Output version information and exit\n", + argv0); +} + +static void PrintVersion() { + LOG_INFO(Network, "yuzu dedicated room {} {} Libnetwork: {}", Common::g_scm_branch, + Common::g_scm_desc, Network::network_version); +} + +/// The magic text at the beginning of a yuzu-room ban list file. +static constexpr char BanListMagic[] = "YuzuRoom-BanList-1"; + +static constexpr char token_delimiter{':'}; + +static std::string UsernameFromDisplayToken(const std::string& display_token) { + std::size_t outlen; + + std::array output{}; + mbedtls_base64_decode(output.data(), output.size(), &outlen, + reinterpret_cast(display_token.c_str()), + display_token.length()); + std::string decoded_display_token(reinterpret_cast(&output), outlen); + return decoded_display_token.substr(0, decoded_display_token.find(token_delimiter)); +} + +static std::string TokenFromDisplayToken(const std::string& display_token) { + std::size_t outlen; + + std::array output{}; + mbedtls_base64_decode(output.data(), output.size(), &outlen, + reinterpret_cast(display_token.c_str()), + display_token.length()); + std::string decoded_display_token(reinterpret_cast(&output), outlen); + return decoded_display_token.substr(decoded_display_token.find(token_delimiter) + 1); +} + +static Network::Room::BanList LoadBanList(const std::string& path) { + std::ifstream file; + Common::FS::OpenFileStream(file, path, std::ios_base::in); + if (!file || file.eof()) { + LOG_ERROR(Network, "Could not open ban list!"); + return {}; + } + std::string magic; + std::getline(file, magic); + if (magic != BanListMagic) { + LOG_ERROR(Network, "Ban list is not valid!"); + return {}; + } + + // false = username ban list, true = ip ban list + bool ban_list_type = false; + Network::Room::UsernameBanList username_ban_list; + Network::Room::IPBanList ip_ban_list; + while (!file.eof()) { + std::string line; + std::getline(file, line); + line.erase(std::remove(line.begin(), line.end(), '\0'), line.end()); + line = Common::StripSpaces(line); + if (line.empty()) { + // An empty line marks start of the IP ban list + ban_list_type = true; + continue; + } + if (ban_list_type) { + ip_ban_list.emplace_back(line); + } else { + username_ban_list.emplace_back(line); + } + } + + return {username_ban_list, ip_ban_list}; +} + +static void SaveBanList(const Network::Room::BanList& ban_list, const std::string& path) { + std::ofstream file; + Common::FS::OpenFileStream(file, path, std::ios_base::out); + if (!file) { + LOG_ERROR(Network, "Could not save ban list!"); + return; + } + + file << BanListMagic << "\n"; + + // Username ban list + for (const auto& username : ban_list.first) { + file << username << "\n"; + } + file << "\n"; + + // IP ban list + for (const auto& ip : ban_list.second) { + file << ip << "\n"; + } +} + +static void InitializeLogging(const std::string& log_file) { + Common::Log::Initialize(); + Common::Log::SetColorConsoleBackendEnabled(true); + Common::Log::Start(); +} + +/// Application entry point +int main(int argc, char** argv) { + Common::DetachedTasks detached_tasks; + int option_index = 0; + char* endarg; + + std::string room_name; + std::string room_description; + std::string password; + std::string preferred_game; + std::string username; + std::string token; + std::string web_api_url; + std::string ban_list_file; + std::string log_file = "yuzu-room.log"; + u64 preferred_game_id = 0; + u32 port = Network::DefaultRoomPort; + u32 max_members = 16; + bool enable_yuzu_mods = false; + + static struct option long_options[] = { + {"room-name", required_argument, 0, 'n'}, + {"room-description", required_argument, 0, 'd'}, + {"port", required_argument, 0, 'p'}, + {"max_members", required_argument, 0, 'm'}, + {"password", required_argument, 0, 'w'}, + {"preferred-game", required_argument, 0, 'g'}, + {"preferred-game-id", required_argument, 0, 'i'}, + {"username", optional_argument, 0, 'u'}, + {"token", required_argument, 0, 't'}, + {"web-api-url", required_argument, 0, 'a'}, + {"ban-list-file", required_argument, 0, 'b'}, + {"log-file", required_argument, 0, 'l'}, + {"enable-yuzu-mods", no_argument, 0, 'e'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0}, + }; + + InitializeLogging(log_file); + + while (optind < argc) { + int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); + if (arg != -1) { + switch (static_cast(arg)) { + case 'n': + room_name.assign(optarg); + break; + case 'd': + room_description.assign(optarg); + break; + case 'p': + port = strtoul(optarg, &endarg, 0); + break; + case 'm': + max_members = strtoul(optarg, &endarg, 0); + break; + case 'w': + password.assign(optarg); + break; + case 'g': + preferred_game.assign(optarg); + break; + case 'i': + preferred_game_id = strtoull(optarg, &endarg, 16); + break; + case 'u': + username.assign(optarg); + break; + case 't': + token.assign(optarg); + break; + case 'a': + web_api_url.assign(optarg); + break; + case 'b': + ban_list_file.assign(optarg); + break; + case 'l': + log_file.assign(optarg); + break; + case 'e': + enable_yuzu_mods = true; + break; + case 'h': + PrintHelp(argv[0]); + return 0; + case 'v': + PrintVersion(); + return 0; + } + } + } + + if (room_name.empty()) { + LOG_ERROR(Network, "Room name is empty!"); + PrintHelp(argv[0]); + return -1; + } + if (preferred_game.empty()) { + LOG_ERROR(Network, "Preferred game is empty!"); + PrintHelp(argv[0]); + return -1; + } + if (preferred_game_id == 0) { + LOG_ERROR(Network, + "preferred-game-id not set!\nThis should get set to allow users to find your " + "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 - {}!", + Network::MaxConcurrentConnections); + PrintHelp(argv[0]); + return -1; + } + if (port > UINT16_MAX) { + LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!"); + PrintHelp(argv[0]); + return -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 "); + } + bool announce = true; + if (token.empty() && announce) { + announce = false; + LOG_INFO(Network, "Token is empty: Hosting a private room"); + } + if (web_api_url.empty() && announce) { + announce = false; + LOG_INFO(Network, "Endpoint url is empty: Hosting a private room"); + } + if (announce) { + if (username.empty()) { + LOG_INFO(Network, "Hosting a public room"); + Settings::values.web_api_url = web_api_url; + Settings::values.yuzu_username = UsernameFromDisplayToken(token); + username = Settings::values.yuzu_username.GetValue(); + Settings::values.yuzu_token = TokenFromDisplayToken(token); + } else { + LOG_INFO(Network, "Hosting a public room"); + Settings::values.web_api_url = web_api_url; + Settings::values.yuzu_username = username; + Settings::values.yuzu_token = token; + } + } + if (!announce && enable_yuzu_mods) { + enable_yuzu_mods = false; + LOG_INFO(Network, "Can not enable yuzu Moderators for private rooms"); + } + + // Load the ban list + Network::Room::BanList ban_list; + if (!ban_list_file.empty()) { + ban_list = LoadBanList(ban_list_file); + } + + std::unique_ptr verify_backend; + if (announce) { +#ifdef ENABLE_WEB_SERVICE + verify_backend = + std::make_unique(Settings::values.web_api_url.GetValue()); +#else + LOG_INFO(Network, + "yuzu Web Services is not available with this build: validation is disabled."); + verify_backend = std::make_unique(); +#endif + } else { + verify_backend = std::make_unique(); + } + + Network::RoomNetwork network{}; + network.Init(); + if (auto room = network.GetRoom().lock()) { + AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, + .id = preferred_game_id}; + if (!room->Create(room_name, room_description, "", port, password, max_members, username, + preferred_game_info, std::move(verify_backend), ban_list, + enable_yuzu_mods)) { + LOG_INFO(Network, "Failed to create room: "); + return -1; + } + LOG_INFO(Network, "Room is open. Close with Q+Enter..."); + auto announce_session = std::make_unique(network); + if (announce) { + announce_session->Start(); + } + while (room->GetState() == Network::Room::State::Open) { + std::string in; + std::cin >> in; + if (in.size() > 0) { + break; + } + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + if (announce) { + announce_session->Stop(); + } + announce_session.reset(); + // Save the ban list + if (!ban_list_file.empty()) { + SaveBanList(room->GetBanList(), ban_list_file); + } + room->Destroy(); + } + network.Shutdown(); + detached_tasks.WaitForAllTasks(); + return 0; +} diff --git a/src/dedicated_room/yuzu_room.rc b/src/dedicated_room/yuzu_room.rc new file mode 100644 index 000000000..a08957684 --- /dev/null +++ b/src/dedicated_room/yuzu_room.rc @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2017 Citra Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "winresrc.h" +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +YUZU_ICON ICON "../../dist/yuzu.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +0 RT_MANIFEST "../../dist/yuzu.manifest" -- cgit v1.2.3