diff options
| author | 2022-07-25 18:31:45 -0400 | |
|---|---|---|
| committer | 2022-07-25 18:31:45 -0400 | |
| commit | 1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2 (patch) | |
| tree | 999411f1ca76390654d1034c6d0bd2c47c3f101c /src/core/core.cpp | |
| parent | Merge pull request #8564 from lat9nq/dinner-fork (diff) | |
| parent | network: Address review comments (diff) | |
| download | yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.gz yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.tar.xz yuzu-1e67d2b59f6dfd561768db3fb9a8e0c6a16ec9f2.zip | |
Merge pull request #8541 from FearlessTobi/multiplayer-part1
yuzu, network: Add room service and UI configuration
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
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 | } |