network: Move global state into a seperate class
Co-Authored-By: Narr the Reg <5944268+german77@users.noreply.github.com>
This commit is contained in:
parent
899c8bb330
commit
7d82e57b91
21 changed files with 152 additions and 98 deletions
|
@ -131,7 +131,7 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
|
|||
|
||||
struct System::Impl {
|
||||
explicit Impl(System& system)
|
||||
: kernel{system}, fs_controller{system}, memory{system}, hid_core{},
|
||||
: kernel{system}, fs_controller{system}, memory{system}, hid_core{}, room_network{},
|
||||
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
|
||||
|
||||
SystemResultStatus Run() {
|
||||
|
@ -320,7 +320,7 @@ struct System::Impl {
|
|||
if (app_loader->ReadTitle(name) != Loader::ResultStatus::Success) {
|
||||
LOG_ERROR(Core, "Failed to read title for ROM (Error {})", load_result);
|
||||
}
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
||||
Network::GameInfo game_info;
|
||||
game_info.name = name;
|
||||
game_info.id = program_id;
|
||||
|
@ -374,7 +374,7 @@ struct System::Impl {
|
|||
memory.Reset();
|
||||
applet_manager.ClearAll();
|
||||
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
||||
Network::GameInfo game_info{};
|
||||
room_member->SendGameInfo(game_info);
|
||||
}
|
||||
|
@ -451,6 +451,8 @@ struct System::Impl {
|
|||
std::unique_ptr<AudioCore::AudioCore> audio_core;
|
||||
Core::Memory::Memory memory;
|
||||
Core::HID::HIDCore hid_core;
|
||||
Network::RoomNetwork room_network;
|
||||
|
||||
CpuManager cpu_manager;
|
||||
std::atomic_bool is_powered_on{};
|
||||
bool exit_lock = false;
|
||||
|
@ -896,6 +898,14 @@ const Core::Debugger& System::GetDebugger() const {
|
|||
return *impl->debugger;
|
||||
}
|
||||
|
||||
Network::RoomNetwork& System::GetRoomNetwork() {
|
||||
return impl->room_network;
|
||||
}
|
||||
|
||||
const Network::RoomNetwork& System::GetRoomNetwork() const {
|
||||
return impl->room_network;
|
||||
}
|
||||
|
||||
void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) {
|
||||
impl->execute_program_callback = std::move(callback);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue