mirror of
https://git.citron-emu.org/Citron/Emulator.git
synced 2025-12-30 04:37:05 +00:00
- In commit b3facaa6bb, the copyright header was
updated to include "Citron Homebrew Project" across multiple files, regardless
of whether any contributions were made.
- This commit removes the incorrect attribution and reverts the copyright header
to its previous state.
- Copyright attribution should only be added when meaningful contributions have
been made to the file.
- This commit ensures proper compliance with copyright standards and maintains
correct attribution to the respective contributors.
- Special thanks to Tachi for pointing out the need for these corrections and
ensuring that proper attribution practices are followed.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
// SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "common/assert.h"
|
|
#include "common/logging/log.h"
|
|
#include "enet/enet.h"
|
|
#include "network/network.h"
|
|
|
|
namespace Network {
|
|
|
|
RoomNetwork::RoomNetwork() {
|
|
m_room = std::make_shared<Room>();
|
|
m_room_member = std::make_shared<RoomMember>();
|
|
}
|
|
|
|
bool RoomNetwork::Init() {
|
|
if (enet_initialize() != 0) {
|
|
LOG_ERROR(Network, "Error initializing ENet");
|
|
return false;
|
|
}
|
|
m_room = std::make_shared<Room>();
|
|
m_room_member = std::make_shared<RoomMember>();
|
|
LOG_DEBUG(Network, "initialized OK");
|
|
return true;
|
|
}
|
|
|
|
std::weak_ptr<Room> RoomNetwork::GetRoom() {
|
|
return m_room;
|
|
}
|
|
|
|
std::weak_ptr<RoomMember> RoomNetwork::GetRoomMember() {
|
|
return m_room_member;
|
|
}
|
|
|
|
void RoomNetwork::Shutdown() {
|
|
if (m_room_member) {
|
|
if (m_room_member->IsConnected())
|
|
m_room_member->Leave();
|
|
m_room_member.reset();
|
|
}
|
|
if (m_room) {
|
|
if (m_room->GetState() == Room::State::Open)
|
|
m_room->Destroy();
|
|
m_room.reset();
|
|
}
|
|
enet_deinitialize();
|
|
LOG_DEBUG(Network, "shutdown OK");
|
|
}
|
|
|
|
} // namespace Network
|