Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11748 from lioncash/enet
Common/ENetUtil: Move interface into Common namespace
  • Loading branch information
AdmiralCurtiss committed Apr 11, 2023
2 parents af52b5a + 09e11b8 commit d6ae7ad
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Common/CMakeLists.txt
Expand Up @@ -41,8 +41,8 @@ add_library(common
DebugInterface.h
DynamicLibrary.cpp
DynamicLibrary.h
ENetUtil.cpp
ENetUtil.h
ENet.cpp
ENet.h
EnumFormatter.h
EnumMap.h
Event.h
Expand Down
@@ -1,12 +1,12 @@
// Copyright 2015 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "Common/ENetUtil.h"
#include "Common/ENet.h"

#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"

namespace ENetUtil
namespace Common::ENet
{
void WakeupThread(ENetHost* host)
{
Expand Down Expand Up @@ -62,4 +62,4 @@ bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id)

return true;
}
} // namespace ENetUtil
} // namespace Common::ENet
4 changes: 2 additions & 2 deletions Source/Core/Common/ENetUtil.h → Source/Core/Common/ENet.h
Expand Up @@ -9,9 +9,9 @@

#include "Common/CommonTypes.h"

namespace ENetUtil
namespace Common::ENet
{
void WakeupThread(ENetHost* host);
int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id);
} // namespace ENetUtil
} // namespace Common::ENet
8 changes: 4 additions & 4 deletions Source/Core/Core/NetPlayClient.cpp
Expand Up @@ -23,7 +23,7 @@
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/Crypto/SHA1.h"
#include "Common/ENetUtil.h"
#include "Common/ENet.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
Expand Down Expand Up @@ -168,7 +168,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
{
if (Connect())
{
m_client->intercept = ENetUtil::InterceptCallback;
m_client->intercept = Common::ENet::InterceptCallback;
m_thread = std::thread(&NetPlayClient::ThreadFunc, this);
}
}
Expand Down Expand Up @@ -1522,7 +1522,7 @@ void NetPlayClient::OnGameDigestAbort()

void NetPlayClient::Send(const sf::Packet& packet, const u8 channel_id)
{
ENetUtil::SendPacket(m_server, packet, channel_id);
Common::ENet::SendPacket(m_server, packet, channel_id);
}

void NetPlayClient::DisplayPlayersPing()
Expand Down Expand Up @@ -1577,7 +1577,7 @@ void NetPlayClient::SendAsync(sf::Packet&& packet, const u8 channel_id)
std::lock_guard lkq(m_crit.async_queue_write);
m_async_queue.Push(AsyncQueueEntry{std::move(packet), channel_id});
}
ENetUtil::WakeupThread(m_client);
Common::ENet::WakeupThread(m_client);
}

// called from ---NETPLAY--- thread
Expand Down
10 changes: 5 additions & 5 deletions Source/Core/Core/NetPlayServer.cpp
Expand Up @@ -20,7 +20,7 @@
#include <fmt/format.h>

#include "Common/CommonPaths.h"
#include "Common/ENetUtil.h"
#include "Common/ENet.h"
#include "Common/FileUtil.h"
#include "Common/HttpRequest.h"
#include "Common/Logging/Log.h"
Expand Down Expand Up @@ -153,7 +153,7 @@ NetPlayServer::NetPlayServer(const u16 port, const bool forward_port, NetPlayUI*
if (m_server != nullptr)
{
m_server->mtu = std::min(m_server->mtu, NetPlay::MAX_ENET_MTU);
m_server->intercept = ENetUtil::InterceptCallback;
m_server->intercept = Common::ENet::InterceptCallback;
}

SetupIndex();
Expand Down Expand Up @@ -701,7 +701,7 @@ void NetPlayServer::SendAsync(sf::Packet&& packet, const PlayerId pid, const u8
std::lock_guard lkq(m_crit.async_queue_write);
m_async_queue.Push(AsyncQueueEntry{std::move(packet), pid, TargetMode::Only, channel_id});
}
ENetUtil::WakeupThread(m_server);
Common::ENet::WakeupThread(m_server);
}

void NetPlayServer::SendAsyncToClients(sf::Packet&& packet, const PlayerId skip_pid,
Expand All @@ -712,7 +712,7 @@ void NetPlayServer::SendAsyncToClients(sf::Packet&& packet, const PlayerId skip_
m_async_queue.Push(
AsyncQueueEntry{std::move(packet), skip_pid, TargetMode::AllExcept, channel_id});
}
ENetUtil::WakeupThread(m_server);
Common::ENet::WakeupThread(m_server);
}

void NetPlayServer::SendChunked(sf::Packet&& packet, const PlayerId pid, const std::string& title)
Expand Down Expand Up @@ -2183,7 +2183,7 @@ void NetPlayServer::SendToClients(const sf::Packet& packet, const PlayerId skip_

void NetPlayServer::Send(ENetPeer* socket, const sf::Packet& packet, const u8 channel_id)
{
ENetUtil::SendPacket(socket, packet, channel_id);
Common::ENet::SendPacket(socket, packet, channel_id);
}

void NetPlayServer::KickPlayer(PlayerId player)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinLib.props
Expand Up @@ -42,7 +42,7 @@
<ClInclude Include="Common\Debug\Watches.h" />
<ClInclude Include="Common\DebugInterface.h" />
<ClInclude Include="Common\DynamicLibrary.h" />
<ClInclude Include="Common\ENetUtil.h" />
<ClInclude Include="Common\ENet.h" />
<ClInclude Include="Common\EnumFormatter.h" />
<ClInclude Include="Common\EnumMap.h" />
<ClInclude Include="Common\Event.h" />
Expand Down Expand Up @@ -753,7 +753,7 @@
<ClCompile Include="Common\Debug\MemoryPatches.cpp" />
<ClCompile Include="Common\Debug\Watches.cpp" />
<ClCompile Include="Common\DynamicLibrary.cpp" />
<ClCompile Include="Common\ENetUtil.cpp" />
<ClCompile Include="Common\ENet.cpp" />
<ClCompile Include="Common\FatFsUtil.cpp" />
<ClCompile Include="Common\FileSearch.cpp" />
<ClCompile Include="Common\FileUtil.cpp" />
Expand Down

0 comments on commit d6ae7ad

Please sign in to comment.