mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
NetPlay: add a Common/ENetUtil namespace
Move WakeupThread in it
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
set(SRCS BreakPoints.cpp
|
||||
CDUtils.cpp
|
||||
ColorUtil.cpp
|
||||
ENetUtil.cpp
|
||||
FileSearch.cpp
|
||||
FileUtil.cpp
|
||||
GekkoDisassembler.cpp
|
||||
|
@ -51,6 +51,7 @@
|
||||
<ClInclude Include="CommonTypes.h" />
|
||||
<ClInclude Include="CPUDetect.h" />
|
||||
<ClInclude Include="DebugInterface.h" />
|
||||
<ClInclude Include="ENetUtil.h" />
|
||||
<ClInclude Include="Event.h" />
|
||||
<ClInclude Include="FifoQueue.h" />
|
||||
<ClInclude Include="FileSearch.h" />
|
||||
@ -94,6 +95,7 @@
|
||||
<ClCompile Include="BreakPoints.cpp" />
|
||||
<ClCompile Include="CDUtils.cpp" />
|
||||
<ClCompile Include="ColorUtil.cpp" />
|
||||
<ClCompile Include="ENetUtil.cpp" />
|
||||
<ClCompile Include="FileSearch.cpp" />
|
||||
<ClCompile Include="FileUtil.cpp" />
|
||||
<ClCompile Include="GekkoDisassembler.cpp" />
|
||||
@ -146,4 +148,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -25,6 +25,7 @@
|
||||
<ClInclude Include="CommonTypes.h" />
|
||||
<ClInclude Include="CPUDetect.h" />
|
||||
<ClInclude Include="DebugInterface.h" />
|
||||
<ClInclude Include="ENetUtil.h" />
|
||||
<ClInclude Include="FifoQueue.h" />
|
||||
<ClInclude Include="FileSearch.h" />
|
||||
<ClInclude Include="FileUtil.h" />
|
||||
@ -78,6 +79,7 @@
|
||||
<ClCompile Include="BreakPoints.cpp" />
|
||||
<ClCompile Include="CDUtils.cpp" />
|
||||
<ClCompile Include="ColorUtil.cpp" />
|
||||
<ClCompile Include="ENetUtil.cpp" />
|
||||
<ClCompile Include="FileSearch.cpp" />
|
||||
<ClCompile Include="FileUtil.cpp" />
|
||||
<ClCompile Include="Hash.cpp" />
|
||||
|
28
Source/Core/Common/ENetUtil.cpp
Normal file
28
Source/Core/Common/ENetUtil.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2015 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "ENetUtil.h"
|
||||
|
||||
namespace ENetUtil
|
||||
{
|
||||
|
||||
void WakeupThread(ENetHost* host)
|
||||
{
|
||||
// Send ourselves a spurious message. This is hackier than it should be.
|
||||
// comex reported this as https://github.com/lsalzman/enet/issues/23, so
|
||||
// hopefully there will be a better way to do it in the future.
|
||||
ENetAddress address;
|
||||
if (host->address.port != 0)
|
||||
address.port = host->address.port;
|
||||
else
|
||||
enet_socket_get_address(host->socket, &address);
|
||||
address.host = 0x0100007f; // localhost
|
||||
u8 byte = 0;
|
||||
ENetBuffer buf;
|
||||
buf.data = &byte;
|
||||
buf.dataLength = 1;
|
||||
enet_socket_send(host->socket, &address, &buf, 1);
|
||||
}
|
||||
|
||||
}
|
15
Source/Core/Common/ENetUtil.h
Normal file
15
Source/Core/Common/ENetUtil.h
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2015 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include <enet/enet.h>
|
||||
#include "Common.h"
|
||||
|
||||
namespace ENetUtil
|
||||
{
|
||||
|
||||
void WakeupThread(ENetHost* host);
|
||||
|
||||
}
|
Reference in New Issue
Block a user