Compare commits
5 Commits
7ea90b03c4
...
5f8a454e3f
Author | SHA1 | Date |
---|---|---|
Mr_Goldberg | 5f8a454e3f | |
Mr_Goldberg | 6dfe11503b | |
Mr_Goldberg | 5873398790 | |
Mr_Goldberg | 9a63cf868d | |
Mr_Goldberg | 37b329c9c5 |
|
@ -649,6 +649,13 @@ static void load_dlls()
|
||||||
std::vector<std::string> paths = Local_Storage::get_filenames_path(path);
|
std::vector<std::string> paths = Local_Storage::get_filenames_path(path);
|
||||||
for (auto & p: paths) {
|
for (auto & p: paths) {
|
||||||
std::string full_path = path + p;
|
std::string full_path = path + p;
|
||||||
|
size_t length = full_path.length();
|
||||||
|
if (length < 4) continue;
|
||||||
|
if (std::toupper(full_path[length - 1]) != 'L') continue;
|
||||||
|
if (std::toupper(full_path[length - 2]) != 'L') continue;
|
||||||
|
if (std::toupper(full_path[length - 3]) != 'D') continue;
|
||||||
|
if (full_path[length - 4] != '.') continue;
|
||||||
|
|
||||||
PRINT_DEBUG("Trying to load %s\n", full_path.c_str());
|
PRINT_DEBUG("Trying to load %s\n", full_path.c_str());
|
||||||
if (LoadLibraryA(full_path.c_str())) {
|
if (LoadLibraryA(full_path.c_str())) {
|
||||||
PRINT_DEBUG("LOADED %s\n", full_path.c_str());
|
PRINT_DEBUG("LOADED %s\n", full_path.c_str());
|
||||||
|
|
|
@ -107,11 +107,16 @@ Steam_Networking_Sockets(class Settings *settings, class Networking *network, cl
|
||||||
this->run_every_runcb->remove(&Steam_Networking_Sockets::steam_run_every_runcb, this);
|
this->run_every_runcb->remove(&Steam_Networking_Sockets::steam_run_every_runcb, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long get_socket_id()
|
||||||
|
{
|
||||||
|
static unsigned long socket_id;
|
||||||
|
socket_id++;
|
||||||
|
return socket_id;
|
||||||
|
}
|
||||||
|
|
||||||
HSteamListenSocket new_listen_socket(int nSteamConnectVirtualPort)
|
HSteamListenSocket new_listen_socket(int nSteamConnectVirtualPort)
|
||||||
{
|
{
|
||||||
static HSteamListenSocket socket_id;
|
HSteamListenSocket socket_id = get_socket_id();
|
||||||
++socket_id;
|
|
||||||
if (socket_id == k_HSteamListenSocket_Invalid) ++socket_id;
|
if (socket_id == k_HSteamListenSocket_Invalid) ++socket_id;
|
||||||
|
|
||||||
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&nSteamConnectVirtualPort](struct Listen_Socket const& conn) { return conn.virtual_port == nSteamConnectVirtualPort;});
|
auto conn = std::find_if(listen_sockets.begin(), listen_sockets.end(), [&nSteamConnectVirtualPort](struct Listen_Socket const& conn) { return conn.virtual_port == nSteamConnectVirtualPort;});
|
||||||
|
@ -165,8 +170,7 @@ HSteamNetConnection new_connect_socket(SteamNetworkingIdentity remote_identity,
|
||||||
socket.user_data = -1;
|
socket.user_data = -1;
|
||||||
socket.poll_group = k_HSteamNetPollGroup_Invalid;
|
socket.poll_group = k_HSteamNetPollGroup_Invalid;
|
||||||
|
|
||||||
static HSteamNetConnection socket_id;
|
HSteamNetConnection socket_id = get_socket_id();
|
||||||
++socket_id;
|
|
||||||
if (socket_id == k_HSteamNetConnection_Invalid) ++socket_id;
|
if (socket_id == k_HSteamNetConnection_Invalid) ++socket_id;
|
||||||
|
|
||||||
if (connect_sockets.insert(std::make_pair(socket_id, socket)).second == false) {
|
if (connect_sockets.insert(std::make_pair(socket_id, socket)).second == false) {
|
||||||
|
@ -833,7 +837,25 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe
|
||||||
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
|
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo\n");
|
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo\n");
|
||||||
|
if (!pInfo)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
auto connect_socket = connect_sockets.find(hConn);
|
||||||
|
if (connect_socket == connect_sockets.end()) return false;
|
||||||
|
|
||||||
|
memset(pInfo, 0, sizeof(SteamNetConnectionInfo_t));
|
||||||
|
pInfo->m_identityRemote = connect_socket->second.remote_identity;
|
||||||
|
pInfo->m_nUserData = connect_socket->second.user_data;
|
||||||
|
pInfo->m_hListenSocket = connect_socket->second.listen_socket_id;
|
||||||
|
//pInfo->m_addrRemote; //TODO
|
||||||
|
pInfo->m_idPOPRemote = 0;
|
||||||
|
pInfo->m_idPOPRelay = 0;
|
||||||
|
pInfo->m_eState = convert_status(connect_socket->second.status);
|
||||||
|
pInfo->m_eEndReason = 0; //TODO
|
||||||
|
pInfo->m_szEndDebug[0] = 0;
|
||||||
|
sprintf(pInfo->m_szConnectionDescription, "%u", hConn);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -878,7 +900,7 @@ int ReceiveMessagesOnListenSocket( HSteamListenSocket hSocket, SteamNetworkingMe
|
||||||
/// Returns information about the specified connection.
|
/// Returns information about the specified connection.
|
||||||
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
|
bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo\n");
|
PRINT_DEBUG("Steam_Networking_Sockets::GetConnectionInfo001\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +910,21 @@ bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *
|
||||||
bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats )
|
bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickConnectionStatus *pStats )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Networking_Sockets::GetQuickConnectionStatus\n");
|
PRINT_DEBUG("Steam_Networking_Sockets::GetQuickConnectionStatus\n");
|
||||||
|
if (!pStats)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
auto connect_socket = connect_sockets.find(hConn);
|
||||||
|
if (connect_socket == connect_sockets.end()) return false;
|
||||||
|
memset(pStats, 0, sizeof(SteamNetworkingQuickConnectionStatus));
|
||||||
|
|
||||||
|
pStats->m_eState = convert_status(connect_socket->second.status);
|
||||||
|
pStats->m_nPing = 10; //TODO: calculate real numbers?
|
||||||
|
pStats->m_flConnectionQualityLocal = 1.0;
|
||||||
|
pStats->m_flConnectionQualityRemote = 1.0;
|
||||||
|
//TODO: rest
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,15 @@ bool Windows_Hook::start_hook()
|
||||||
{
|
{
|
||||||
GetRawInputBuffer = ::GetRawInputBuffer;
|
GetRawInputBuffer = ::GetRawInputBuffer;
|
||||||
GetRawInputData = ::GetRawInputData;
|
GetRawInputData = ::GetRawInputData;
|
||||||
|
SetCursorPos = ::SetCursorPos;
|
||||||
|
|
||||||
PRINT_DEBUG("Hooked Windows\n");
|
PRINT_DEBUG("Hooked Windows\n");
|
||||||
|
|
||||||
BeginHook();
|
BeginHook();
|
||||||
HookFuncs(
|
HookFuncs(
|
||||||
std::make_pair<void**, void*>(&(PVOID&)GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer),
|
std::make_pair<void**, void*>(&(PVOID&)GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer),
|
||||||
std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData)
|
std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData),
|
||||||
|
std::make_pair<void**, void*>(&(PVOID&)SetCursorPos , &Windows_Hook::MySetCursorPos)
|
||||||
);
|
);
|
||||||
EndHook();
|
EndHook();
|
||||||
|
|
||||||
|
@ -169,6 +171,18 @@ UINT WINAPI Windows_Hook::MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI Windows_Hook::MySetCursorPos(int x, int y)
|
||||||
|
{
|
||||||
|
if (get_steam_client()->steam_overlay->ShowOverlay()) {
|
||||||
|
POINT p;
|
||||||
|
GetCursorPos(&p);
|
||||||
|
x = p.x;
|
||||||
|
y = p.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Windows_Hook::Inst()->SetCursorPos(x, y);
|
||||||
|
}
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Windows_Hook::Windows_Hook() :
|
Windows_Hook::Windows_Hook() :
|
||||||
|
|
|
@ -26,11 +26,13 @@ private:
|
||||||
// Hook to Windows window messages
|
// Hook to Windows window messages
|
||||||
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
||||||
decltype(GetRawInputData)* GetRawInputData;
|
decltype(GetRawInputData)* GetRawInputData;
|
||||||
|
decltype(SetCursorPos)* SetCursorPos;
|
||||||
|
|
||||||
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||||
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||||
|
|
||||||
|
static BOOL WINAPI MySetCursorPos(int x, int y);
|
||||||
public:
|
public:
|
||||||
virtual ~Windows_Hook();
|
virtual ~Windows_Hook();
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
/// setting the options "immediately" after creation.
|
/// setting the options "immediately" after creation.
|
||||||
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||||
|
|
||||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
|
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P
|
||||||
///
|
///
|
||||||
/// nVirtualPort specifies how clients can connect to this socket using
|
/// nVirtualPort specifies how clients can connect to this socket using
|
||||||
|
@ -81,7 +80,6 @@ public:
|
||||||
/// SteamNetworkingConfigValue_t for more about why this is preferable to
|
/// SteamNetworkingConfigValue_t for more about why this is preferable to
|
||||||
/// setting the options "immediately" after creation.
|
/// setting the options "immediately" after creation.
|
||||||
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Accept an incoming connection that has been received on a listen socket.
|
/// Accept an incoming connection that has been received on a listen socket.
|
||||||
///
|
///
|
||||||
|
@ -411,8 +409,6 @@ public:
|
||||||
/// other connections.)
|
/// other connections.)
|
||||||
virtual int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
virtual int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||||
|
|
||||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clients connecting to dedicated servers hosted in a data center,
|
// Clients connecting to dedicated servers hosted in a data center,
|
||||||
// using central-authority-granted tickets.
|
// using central-authority-granted tickets.
|
||||||
|
@ -608,7 +604,6 @@ public:
|
||||||
/// If you expect to be using relayed connections, then you probably want
|
/// If you expect to be using relayed connections, then you probably want
|
||||||
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
|
/// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes
|
||||||
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0;
|
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0;
|
||||||
#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Certificate provision by the application. On Steam, we normally handle all this automatically
|
// Certificate provision by the application. On Steam, we normally handle all this automatically
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
class ISteamNetworkingUtils001
|
class ISteamNetworkingUtils001
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -149,7 +148,6 @@ public:
|
||||||
/// Get list of all POP IDs. Returns the number of entries that were filled into
|
/// Get list of all POP IDs. Returns the number of entries that were filled into
|
||||||
/// your list.
|
/// your list.
|
||||||
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
|
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
|
||||||
#endif // #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc
|
// Misc
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
class ISteamNetworkingUtils002
|
class ISteamNetworkingUtils002
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialization and status check
|
// Initialization and status check
|
||||||
|
@ -152,7 +151,6 @@ public:
|
||||||
/// Get list of all POP IDs. Returns the number of entries that were filled into
|
/// Get list of all POP IDs. Returns the number of entries that were filled into
|
||||||
/// your list.
|
/// your list.
|
||||||
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
|
virtual int GetPOPList( SteamNetworkingPOPID *list, int nListSz ) = 0;
|
||||||
#endif // #ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Misc
|
// Misc
|
||||||
|
|
Loading…
Reference in New Issue