diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/core/announce_multiplayer_session.cpp | 164 | ||||
| -rw-r--r-- | src/core/announce_multiplayer_session.h | 98 | ||||
| -rw-r--r-- | src/core/core.cpp | 31 | ||||
| -rw-r--r-- | src/core/core.h | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/sockets/bsd.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/sockets/bsd.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/sockets/sockets_translate.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/sockets/sockets_translate.h | 2 | ||||
| -rw-r--r-- | src/core/internal_network/network.cpp (renamed from src/core/network/network.cpp) | 6 | ||||
| -rw-r--r-- | src/core/internal_network/network.h (renamed from src/core/network/network.h) | 0 | ||||
| -rw-r--r-- | src/core/internal_network/network_interface.cpp (renamed from src/core/network/network_interface.cpp) | 2 | ||||
| -rw-r--r-- | src/core/internal_network/network_interface.h (renamed from src/core/network/network_interface.h) | 0 | ||||
| -rw-r--r-- | src/core/internal_network/sockets.h (renamed from src/core/network/sockets.h) | 3 |
15 files changed, 322 insertions, 20 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 32cc2f392..c1cc62a45 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -1,4 +1,6 @@ | |||
| 1 | add_library(core STATIC | 1 | add_library(core STATIC |
| 2 | announce_multiplayer_session.cpp | ||
| 3 | announce_multiplayer_session.h | ||
| 2 | arm/arm_interface.h | 4 | arm/arm_interface.h |
| 3 | arm/arm_interface.cpp | 5 | arm/arm_interface.cpp |
| 4 | arm/cpu_interrupt_handler.cpp | 6 | arm/cpu_interrupt_handler.cpp |
| @@ -714,6 +716,11 @@ add_library(core STATIC | |||
| 714 | hle/service/vi/vi_u.h | 716 | hle/service/vi/vi_u.h |
| 715 | hle/service/wlan/wlan.cpp | 717 | hle/service/wlan/wlan.cpp |
| 716 | hle/service/wlan/wlan.h | 718 | hle/service/wlan/wlan.h |
| 719 | internal_network/network.cpp | ||
| 720 | internal_network/network.h | ||
| 721 | internal_network/network_interface.cpp | ||
| 722 | internal_network/network_interface.h | ||
| 723 | internal_network/sockets.h | ||
| 717 | loader/deconstructed_rom_directory.cpp | 724 | loader/deconstructed_rom_directory.cpp |
| 718 | loader/deconstructed_rom_directory.h | 725 | loader/deconstructed_rom_directory.h |
| 719 | loader/elf.cpp | 726 | loader/elf.cpp |
| @@ -741,11 +748,6 @@ add_library(core STATIC | |||
| 741 | memory/dmnt_cheat_vm.h | 748 | memory/dmnt_cheat_vm.h |
| 742 | memory.cpp | 749 | memory.cpp |
| 743 | memory.h | 750 | memory.h |
| 744 | network/network.cpp | ||
| 745 | network/network.h | ||
| 746 | network/network_interface.cpp | ||
| 747 | network/network_interface.h | ||
| 748 | network/sockets.h | ||
| 749 | perf_stats.cpp | 751 | perf_stats.cpp |
| 750 | perf_stats.h | 752 | perf_stats.h |
| 751 | reporter.cpp | 753 | reporter.cpp |
| @@ -780,7 +782,7 @@ endif() | |||
| 780 | 782 | ||
| 781 | create_target_directory_groups(core) | 783 | create_target_directory_groups(core) |
| 782 | 784 | ||
| 783 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 785 | target_link_libraries(core PUBLIC common PRIVATE audio_core network video_core) |
| 784 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus) | 786 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus) |
| 785 | if (MINGW) | 787 | if (MINGW) |
| 786 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) | 788 | target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY}) |
diff --git a/src/core/announce_multiplayer_session.cpp b/src/core/announce_multiplayer_session.cpp new file mode 100644 index 000000000..d73a488cf --- /dev/null +++ b/src/core/announce_multiplayer_session.cpp | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <chrono> | ||
| 5 | #include <future> | ||
| 6 | #include <vector> | ||
| 7 | #include "announce_multiplayer_session.h" | ||
| 8 | #include "common/announce_multiplayer_room.h" | ||
| 9 | #include "common/assert.h" | ||
| 10 | #include "common/settings.h" | ||
| 11 | #include "network/network.h" | ||
| 12 | |||
| 13 | #ifdef ENABLE_WEB_SERVICE | ||
| 14 | #include "web_service/announce_room_json.h" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | namespace Core { | ||
| 18 | |||
| 19 | // Time between room is announced to web_service | ||
| 20 | static constexpr std::chrono::seconds announce_time_interval(15); | ||
| 21 | |||
| 22 | AnnounceMultiplayerSession::AnnounceMultiplayerSession(Network::RoomNetwork& room_network_) | ||
| 23 | : room_network{room_network_} { | ||
| 24 | #ifdef ENABLE_WEB_SERVICE | ||
| 25 | backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(), | ||
| 26 | Settings::values.yuzu_username.GetValue(), | ||
| 27 | Settings::values.yuzu_token.GetValue()); | ||
| 28 | #else | ||
| 29 | backend = std::make_unique<AnnounceMultiplayerRoom::NullBackend>(); | ||
| 30 | #endif | ||
| 31 | } | ||
| 32 | |||
| 33 | WebService::WebResult AnnounceMultiplayerSession::Register() { | ||
| 34 | std::shared_ptr<Network::Room> room = room_network.GetRoom().lock(); | ||
| 35 | if (!room) { | ||
| 36 | return WebService::WebResult{WebService::WebResult::Code::LibError, | ||
| 37 | "Network is not initialized", ""}; | ||
| 38 | } | ||
| 39 | if (room->GetState() != Network::Room::State::Open) { | ||
| 40 | return WebService::WebResult{WebService::WebResult::Code::LibError, "Room is not open", ""}; | ||
| 41 | } | ||
| 42 | UpdateBackendData(room); | ||
| 43 | WebService::WebResult result = backend->Register(); | ||
| 44 | if (result.result_code != WebService::WebResult::Code::Success) { | ||
| 45 | return result; | ||
| 46 | } | ||
| 47 | LOG_INFO(WebService, "Room has been registered"); | ||
| 48 | room->SetVerifyUID(result.returned_data); | ||
| 49 | registered = true; | ||
| 50 | return WebService::WebResult{WebService::WebResult::Code::Success, "", ""}; | ||
| 51 | } | ||
| 52 | |||
| 53 | void AnnounceMultiplayerSession::Start() { | ||
| 54 | if (announce_multiplayer_thread) { | ||
| 55 | Stop(); | ||
| 56 | } | ||
| 57 | shutdown_event.Reset(); | ||
| 58 | announce_multiplayer_thread = | ||
| 59 | std::make_unique<std::thread>(&AnnounceMultiplayerSession::AnnounceMultiplayerLoop, this); | ||
| 60 | } | ||
| 61 | |||
| 62 | void AnnounceMultiplayerSession::Stop() { | ||
| 63 | if (announce_multiplayer_thread) { | ||
| 64 | shutdown_event.Set(); | ||
| 65 | announce_multiplayer_thread->join(); | ||
| 66 | announce_multiplayer_thread.reset(); | ||
| 67 | backend->Delete(); | ||
| 68 | registered = false; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | AnnounceMultiplayerSession::CallbackHandle AnnounceMultiplayerSession::BindErrorCallback( | ||
| 73 | std::function<void(const WebService::WebResult&)> function) { | ||
| 74 | std::lock_guard lock(callback_mutex); | ||
| 75 | auto handle = std::make_shared<std::function<void(const WebService::WebResult&)>>(function); | ||
| 76 | error_callbacks.insert(handle); | ||
| 77 | return handle; | ||
| 78 | } | ||
| 79 | |||
| 80 | void AnnounceMultiplayerSession::UnbindErrorCallback(CallbackHandle handle) { | ||
| 81 | std::lock_guard lock(callback_mutex); | ||
| 82 | error_callbacks.erase(handle); | ||
| 83 | } | ||
| 84 | |||
| 85 | AnnounceMultiplayerSession::~AnnounceMultiplayerSession() { | ||
| 86 | Stop(); | ||
| 87 | } | ||
| 88 | |||
| 89 | void AnnounceMultiplayerSession::UpdateBackendData(std::shared_ptr<Network::Room> room) { | ||
| 90 | Network::RoomInformation room_information = room->GetRoomInformation(); | ||
| 91 | std::vector<AnnounceMultiplayerRoom::Member> memberlist = room->GetRoomMemberList(); | ||
| 92 | backend->SetRoomInformation(room_information.name, room_information.description, | ||
| 93 | room_information.port, room_information.member_slots, | ||
| 94 | Network::network_version, room->HasPassword(), | ||
| 95 | room_information.preferred_game); | ||
| 96 | backend->ClearPlayers(); | ||
| 97 | for (const auto& member : memberlist) { | ||
| 98 | backend->AddPlayer(member); | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | void AnnounceMultiplayerSession::AnnounceMultiplayerLoop() { | ||
| 103 | // Invokes all current bound error callbacks. | ||
| 104 | const auto ErrorCallback = [this](WebService::WebResult result) { | ||
| 105 | std::lock_guard<std::mutex> lock(callback_mutex); | ||
| 106 | for (auto callback : error_callbacks) { | ||
| 107 | (*callback)(result); | ||
| 108 | } | ||
| 109 | }; | ||
| 110 | |||
| 111 | if (!registered) { | ||
| 112 | WebService::WebResult result = Register(); | ||
| 113 | if (result.result_code != WebService::WebResult::Code::Success) { | ||
| 114 | ErrorCallback(result); | ||
| 115 | return; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | auto update_time = std::chrono::steady_clock::now(); | ||
| 120 | std::future<WebService::WebResult> future; | ||
| 121 | while (!shutdown_event.WaitUntil(update_time)) { | ||
| 122 | update_time += announce_time_interval; | ||
| 123 | std::shared_ptr<Network::Room> room = room_network.GetRoom().lock(); | ||
| 124 | if (!room) { | ||
| 125 | break; | ||
| 126 | } | ||
| 127 | if (room->GetState() != Network::Room::State::Open) { | ||
| 128 | break; | ||
| 129 | } | ||
| 130 | UpdateBackendData(room); | ||
| 131 | WebService::WebResult result = backend->Update(); | ||
| 132 | if (result.result_code != WebService::WebResult::Code::Success) { | ||
| 133 | ErrorCallback(result); | ||
| 134 | } | ||
| 135 | if (result.result_string == "404") { | ||
| 136 | registered = false; | ||
| 137 | // Needs to register the room again | ||
| 138 | WebService::WebResult register_result = Register(); | ||
| 139 | if (register_result.result_code != WebService::WebResult::Code::Success) { | ||
| 140 | ErrorCallback(register_result); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | AnnounceMultiplayerRoom::RoomList AnnounceMultiplayerSession::GetRoomList() { | ||
| 147 | return backend->GetRoomList(); | ||
| 148 | } | ||
| 149 | |||
| 150 | bool AnnounceMultiplayerSession::IsRunning() const { | ||
| 151 | return announce_multiplayer_thread != nullptr; | ||
| 152 | } | ||
| 153 | |||
| 154 | void AnnounceMultiplayerSession::UpdateCredentials() { | ||
| 155 | ASSERT_MSG(!IsRunning(), "Credentials can only be updated when session is not running"); | ||
| 156 | |||
| 157 | #ifdef ENABLE_WEB_SERVICE | ||
| 158 | backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(), | ||
| 159 | Settings::values.yuzu_username.GetValue(), | ||
| 160 | Settings::values.yuzu_token.GetValue()); | ||
| 161 | #endif | ||
| 162 | } | ||
| 163 | |||
| 164 | } // namespace Core | ||
diff --git a/src/core/announce_multiplayer_session.h b/src/core/announce_multiplayer_session.h new file mode 100644 index 000000000..db790f7d2 --- /dev/null +++ b/src/core/announce_multiplayer_session.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <atomic> | ||
| 7 | #include <functional> | ||
| 8 | #include <memory> | ||
| 9 | #include <mutex> | ||
| 10 | #include <set> | ||
| 11 | #include <thread> | ||
| 12 | #include "common/announce_multiplayer_room.h" | ||
| 13 | #include "common/common_types.h" | ||
| 14 | #include "common/thread.h" | ||
| 15 | |||
| 16 | namespace Network { | ||
| 17 | class Room; | ||
| 18 | class RoomNetwork; | ||
| 19 | } // namespace Network | ||
| 20 | |||
| 21 | namespace Core { | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Instruments AnnounceMultiplayerRoom::Backend. | ||
| 25 | * Creates a thread that regularly updates the room information and submits them | ||
| 26 | * An async get of room information is also possible | ||
| 27 | */ | ||
| 28 | class AnnounceMultiplayerSession { | ||
| 29 | public: | ||
| 30 | using CallbackHandle = std::shared_ptr<std::function<void(const WebService::WebResult&)>>; | ||
| 31 | AnnounceMultiplayerSession(Network::RoomNetwork& room_network_); | ||
| 32 | ~AnnounceMultiplayerSession(); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Allows to bind a function that will get called if the announce encounters an error | ||
| 36 | * @param function The function that gets called | ||
| 37 | * @return A handle that can be used the unbind the function | ||
| 38 | */ | ||
| 39 | CallbackHandle BindErrorCallback(std::function<void(const WebService::WebResult&)> function); | ||
| 40 | |||
| 41 | /** | ||
| 42 | * Unbind a function from the error callbacks | ||
| 43 | * @param handle The handle for the function that should get unbind | ||
| 44 | */ | ||
| 45 | void UnbindErrorCallback(CallbackHandle handle); | ||
| 46 | |||
| 47 | /** | ||
| 48 | * Registers a room to web services | ||
| 49 | * @return The result of the registration attempt. | ||
| 50 | */ | ||
| 51 | WebService::WebResult Register(); | ||
| 52 | |||
| 53 | /** | ||
| 54 | * Starts the announce of a room to web services | ||
| 55 | */ | ||
| 56 | void Start(); | ||
| 57 | |||
| 58 | /** | ||
| 59 | * Stops the announce to web services | ||
| 60 | */ | ||
| 61 | void Stop(); | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Returns a list of all room information the backend got | ||
| 65 | * @param func A function that gets executed when the async get finished, e.g. a signal | ||
| 66 | * @return a list of rooms received from the web service | ||
| 67 | */ | ||
| 68 | AnnounceMultiplayerRoom::RoomList GetRoomList(); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Whether the announce session is still running | ||
| 72 | */ | ||
| 73 | bool IsRunning() const; | ||
| 74 | |||
| 75 | /** | ||
| 76 | * Recreates the backend, updating the credentials. | ||
| 77 | * This can only be used when the announce session is not running. | ||
| 78 | */ | ||
| 79 | void UpdateCredentials(); | ||
| 80 | |||
| 81 | private: | ||
| 82 | void UpdateBackendData(std::shared_ptr<Network::Room> room); | ||
| 83 | void AnnounceMultiplayerLoop(); | ||
| 84 | |||
| 85 | Common::Event shutdown_event; | ||
| 86 | std::mutex callback_mutex; | ||
| 87 | std::set<CallbackHandle> error_callbacks; | ||
| 88 | std::unique_ptr<std::thread> announce_multiplayer_thread; | ||
| 89 | |||
| 90 | /// Backend interface that logs fields | ||
| 91 | std::unique_ptr<AnnounceMultiplayerRoom::Backend> backend; | ||
| 92 | |||
| 93 | std::atomic_bool registered = false; ///< Whether the room has been registered | ||
| 94 | |||
| 95 | Network::RoomNetwork& room_network; | ||
| 96 | }; | ||
| 97 | |||
| 98 | } // namespace Core | ||
diff --git a/src/core/core.cpp b/src/core/core.cpp index 0ede0d85c..95791a07f 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -43,14 +43,15 @@ | |||
| 43 | #include "core/hle/service/service.h" | 43 | #include "core/hle/service/service.h" |
| 44 | #include "core/hle/service/sm/sm.h" | 44 | #include "core/hle/service/sm/sm.h" |
| 45 | #include "core/hle/service/time/time_manager.h" | 45 | #include "core/hle/service/time/time_manager.h" |
| 46 | #include "core/internal_network/network.h" | ||
| 46 | #include "core/loader/loader.h" | 47 | #include "core/loader/loader.h" |
| 47 | #include "core/memory.h" | 48 | #include "core/memory.h" |
| 48 | #include "core/memory/cheat_engine.h" | 49 | #include "core/memory/cheat_engine.h" |
| 49 | #include "core/network/network.h" | ||
| 50 | #include "core/perf_stats.h" | 50 | #include "core/perf_stats.h" |
| 51 | #include "core/reporter.h" | 51 | #include "core/reporter.h" |
| 52 | #include "core/telemetry_session.h" | 52 | #include "core/telemetry_session.h" |
| 53 | #include "core/tools/freezer.h" | 53 | #include "core/tools/freezer.h" |
| 54 | #include "network/network.h" | ||
| 54 | #include "video_core/renderer_base.h" | 55 | #include "video_core/renderer_base.h" |
| 55 | #include "video_core/video_core.h" | 56 | #include "video_core/video_core.h" |
| 56 | 57 | ||
| @@ -130,7 +131,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, | |||
| 130 | 131 | ||
| 131 | struct System::Impl { | 132 | struct System::Impl { |
| 132 | explicit Impl(System& system) | 133 | explicit Impl(System& system) |
| 133 | : kernel{system}, fs_controller{system}, memory{system}, hid_core{}, | 134 | : kernel{system}, fs_controller{system}, memory{system}, hid_core{}, room_network{}, |
| 134 | cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} | 135 | cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} |
| 135 | 136 | ||
| 136 | SystemResultStatus Run() { | 137 | SystemResultStatus Run() { |
| @@ -315,6 +316,17 @@ struct System::Impl { | |||
| 315 | GetAndResetPerfStats(); | 316 | GetAndResetPerfStats(); |
| 316 | perf_stats->BeginSystemFrame(); | 317 | perf_stats->BeginSystemFrame(); |
| 317 | 318 | ||
| 319 | std::string name = "Unknown Game"; | ||
| 320 | if (app_loader->ReadTitle(name) != Loader::ResultStatus::Success) { | ||
| 321 | LOG_ERROR(Core, "Failed to read title for ROM (Error {})", load_result); | ||
| 322 | } | ||
| 323 | if (auto room_member = room_network.GetRoomMember().lock()) { | ||
| 324 | Network::GameInfo game_info; | ||
| 325 | game_info.name = name; | ||
| 326 | game_info.id = program_id; | ||
| 327 | room_member->SendGameInfo(game_info); | ||
| 328 | } | ||
| 329 | |||
| 318 | status = SystemResultStatus::Success; | 330 | status = SystemResultStatus::Success; |
| 319 | return status; | 331 | return status; |
| 320 | } | 332 | } |
| @@ -362,6 +374,11 @@ struct System::Impl { | |||
| 362 | memory.Reset(); | 374 | memory.Reset(); |
| 363 | applet_manager.ClearAll(); | 375 | applet_manager.ClearAll(); |
| 364 | 376 | ||
| 377 | if (auto room_member = room_network.GetRoomMember().lock()) { | ||
| 378 | Network::GameInfo game_info{}; | ||
| 379 | room_member->SendGameInfo(game_info); | ||
| 380 | } | ||
| 381 | |||
| 365 | LOG_DEBUG(Core, "Shutdown OK"); | 382 | LOG_DEBUG(Core, "Shutdown OK"); |
| 366 | } | 383 | } |
| 367 | 384 | ||
| @@ -434,6 +451,8 @@ struct System::Impl { | |||
| 434 | std::unique_ptr<AudioCore::AudioCore> audio_core; | 451 | std::unique_ptr<AudioCore::AudioCore> audio_core; |
| 435 | Core::Memory::Memory memory; | 452 | Core::Memory::Memory memory; |
| 436 | Core::HID::HIDCore hid_core; | 453 | Core::HID::HIDCore hid_core; |
| 454 | Network::RoomNetwork room_network; | ||
| 455 | |||
| 437 | CpuManager cpu_manager; | 456 | CpuManager cpu_manager; |
| 438 | std::atomic_bool is_powered_on{}; | 457 | std::atomic_bool is_powered_on{}; |
| 439 | bool exit_lock = false; | 458 | bool exit_lock = false; |
| @@ -879,6 +898,14 @@ const Core::Debugger& System::GetDebugger() const { | |||
| 879 | return *impl->debugger; | 898 | return *impl->debugger; |
| 880 | } | 899 | } |
| 881 | 900 | ||
| 901 | Network::RoomNetwork& System::GetRoomNetwork() { | ||
| 902 | return impl->room_network; | ||
| 903 | } | ||
| 904 | |||
| 905 | const Network::RoomNetwork& System::GetRoomNetwork() const { | ||
| 906 | return impl->room_network; | ||
| 907 | } | ||
| 908 | |||
| 882 | void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) { | 909 | void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) { |
| 883 | impl->execute_program_callback = std::move(callback); | 910 | impl->execute_program_callback = std::move(callback); |
| 884 | } | 911 | } |
diff --git a/src/core/core.h b/src/core/core.h index a49d1214b..13122dd61 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -97,6 +97,10 @@ namespace Core::HID { | |||
| 97 | class HIDCore; | 97 | class HIDCore; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | namespace Network { | ||
| 101 | class RoomNetwork; | ||
| 102 | } | ||
| 103 | |||
| 100 | namespace Core { | 104 | namespace Core { |
| 101 | 105 | ||
| 102 | class ARM_Interface; | 106 | class ARM_Interface; |
| @@ -379,6 +383,12 @@ public: | |||
| 379 | [[nodiscard]] Core::Debugger& GetDebugger(); | 383 | [[nodiscard]] Core::Debugger& GetDebugger(); |
| 380 | [[nodiscard]] const Core::Debugger& GetDebugger() const; | 384 | [[nodiscard]] const Core::Debugger& GetDebugger() const; |
| 381 | 385 | ||
| 386 | /// Gets a mutable reference to the Room Network. | ||
| 387 | [[nodiscard]] Network::RoomNetwork& GetRoomNetwork(); | ||
| 388 | |||
| 389 | /// Gets an immutable reference to the Room Network. | ||
| 390 | [[nodiscard]] const Network::RoomNetwork& GetRoomNetwork() const; | ||
| 391 | |||
| 382 | void SetExitLock(bool locked); | 392 | void SetExitLock(bool locked); |
| 383 | [[nodiscard]] bool GetExitLock() const; | 393 | [[nodiscard]] bool GetExitLock() const; |
| 384 | 394 | ||
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 7055ea93e..2889973e4 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -18,8 +18,8 @@ namespace { | |||
| 18 | 18 | ||
| 19 | } // Anonymous namespace | 19 | } // Anonymous namespace |
| 20 | 20 | ||
| 21 | #include "core/network/network.h" | 21 | #include "core/internal_network/network.h" |
| 22 | #include "core/network/network_interface.h" | 22 | #include "core/internal_network/network_interface.h" |
| 23 | 23 | ||
| 24 | namespace Service::NIFM { | 24 | namespace Service::NIFM { |
| 25 | 25 | ||
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 3e9dc4a13..c7194731e 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -13,8 +13,8 @@ | |||
| 13 | #include "core/hle/kernel/k_thread.h" | 13 | #include "core/hle/kernel/k_thread.h" |
| 14 | #include "core/hle/service/sockets/bsd.h" | 14 | #include "core/hle/service/sockets/bsd.h" |
| 15 | #include "core/hle/service/sockets/sockets_translate.h" | 15 | #include "core/hle/service/sockets/sockets_translate.h" |
| 16 | #include "core/network/network.h" | 16 | #include "core/internal_network/network.h" |
| 17 | #include "core/network/sockets.h" | 17 | #include "core/internal_network/sockets.h" |
| 18 | 18 | ||
| 19 | namespace Service::Sockets { | 19 | namespace Service::Sockets { |
| 20 | 20 | ||
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index fed740d87..9ea36428d 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h | |||
| @@ -16,7 +16,7 @@ class System; | |||
| 16 | 16 | ||
| 17 | namespace Network { | 17 | namespace Network { |
| 18 | class Socket; | 18 | class Socket; |
| 19 | } | 19 | } // namespace Network |
| 20 | 20 | ||
| 21 | namespace Service::Sockets { | 21 | namespace Service::Sockets { |
| 22 | 22 | ||
diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 9c0936d97..2db10ec81 100644 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/hle/service/sockets/sockets.h" | 8 | #include "core/hle/service/sockets/sockets.h" |
| 9 | #include "core/hle/service/sockets/sockets_translate.h" | 9 | #include "core/hle/service/sockets/sockets_translate.h" |
| 10 | #include "core/network/network.h" | 10 | #include "core/internal_network/network.h" |
| 11 | 11 | ||
| 12 | namespace Service::Sockets { | 12 | namespace Service::Sockets { |
| 13 | 13 | ||
diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h index 5e9809add..c93291d3e 100644 --- a/src/core/hle/service/sockets/sockets_translate.h +++ b/src/core/hle/service/sockets/sockets_translate.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/service/sockets/sockets.h" | 9 | #include "core/hle/service/sockets/sockets.h" |
| 10 | #include "core/network/network.h" | 10 | #include "core/internal_network/network.h" |
| 11 | 11 | ||
| 12 | namespace Service::Sockets { | 12 | namespace Service::Sockets { |
| 13 | 13 | ||
diff --git a/src/core/network/network.cpp b/src/core/internal_network/network.cpp index fdafbea92..36c43cc8f 100644 --- a/src/core/network/network.cpp +++ b/src/core/internal_network/network.cpp | |||
| @@ -29,9 +29,9 @@ | |||
| 29 | #include "common/common_types.h" | 29 | #include "common/common_types.h" |
| 30 | #include "common/logging/log.h" | 30 | #include "common/logging/log.h" |
| 31 | #include "common/settings.h" | 31 | #include "common/settings.h" |
| 32 | #include "core/network/network.h" | 32 | #include "core/internal_network/network.h" |
| 33 | #include "core/network/network_interface.h" | 33 | #include "core/internal_network/network_interface.h" |
| 34 | #include "core/network/sockets.h" | 34 | #include "core/internal_network/sockets.h" |
| 35 | 35 | ||
| 36 | namespace Network { | 36 | namespace Network { |
| 37 | 37 | ||
diff --git a/src/core/network/network.h b/src/core/internal_network/network.h index 10e5ef10d..10e5ef10d 100644 --- a/src/core/network/network.h +++ b/src/core/internal_network/network.h | |||
diff --git a/src/core/network/network_interface.cpp b/src/core/internal_network/network_interface.cpp index 15ecc6abf..0f0a66160 100644 --- a/src/core/network/network_interface.cpp +++ b/src/core/internal_network/network_interface.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "common/settings.h" | 12 | #include "common/settings.h" |
| 13 | #include "common/string_util.h" | 13 | #include "common/string_util.h" |
| 14 | #include "core/network/network_interface.h" | 14 | #include "core/internal_network/network_interface.h" |
| 15 | 15 | ||
| 16 | #ifdef _WIN32 | 16 | #ifdef _WIN32 |
| 17 | #include <iphlpapi.h> | 17 | #include <iphlpapi.h> |
diff --git a/src/core/network/network_interface.h b/src/core/internal_network/network_interface.h index 9b98b6b42..9b98b6b42 100644 --- a/src/core/network/network_interface.h +++ b/src/core/internal_network/network_interface.h | |||
diff --git a/src/core/network/sockets.h b/src/core/internal_network/sockets.h index f889159f5..77e27e928 100644 --- a/src/core/network/sockets.h +++ b/src/core/internal_network/sockets.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <map> | ||
| 6 | #include <memory> | 7 | #include <memory> |
| 7 | #include <utility> | 8 | #include <utility> |
| 8 | 9 | ||
| @@ -12,7 +13,7 @@ | |||
| 12 | #endif | 13 | #endif |
| 13 | 14 | ||
| 14 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 15 | #include "core/network/network.h" | 16 | #include "core/internal_network/network.h" |
| 16 | 17 | ||
| 17 | // TODO: C++20 Replace std::vector usages with std::span | 18 | // TODO: C++20 Replace std::vector usages with std::span |
| 18 | 19 | ||