Compare commits
5 Commits
02307a36ed
...
7c6d09fa1d
Author | SHA1 | Date |
---|---|---|
Randy Li | 7c6d09fa1d | |
Mr_Goldberg | 802d8bcc8f | |
Mr_Goldberg | 7e1824290a | |
Mr_Goldberg | 647e894d62 | |
ayaka | 242abbbfea |
|
@ -6,7 +6,7 @@ Then use my emu like you normally would. (Don't forget to put a steam_appid.txt)
|
|||
|
||||
|
||||
For the LAN only connections feature:
|
||||
If for some reason you want to disable this feature create a file named: disable_lan_only.txt beside the steam_api dll.
|
||||
If for some reason you want to disable this feature create a file named: disable_lan_only.txt beside the steam_api dll or inside the steam_settings folder beside the steam api dll.
|
||||
|
||||
I noticed a lot of games seem to connect to analytics services and other crap that I hate.
|
||||
|
||||
|
|
|
@ -824,7 +824,7 @@ static bool network_functions_attached = false;
|
|||
BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
|
||||
switch ( dwReason ) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (!file_exists(get_full_program_path() + "disable_lan_only.txt")) {
|
||||
if (!file_exists(get_full_program_path() + "disable_lan_only.txt") && !file_exists(get_full_program_path() + "\\steam_settings\\disable_lan_only.txt")) {
|
||||
PRINT_DEBUG("Hooking lan only functions\n");
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread( GetCurrentThread() );
|
||||
|
|
|
@ -112,7 +112,6 @@ inline void reset_LastError()
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
@ -205,4 +204,4 @@ inline std::string ascii_to_lowercase(std::string data) {
|
|||
|
||||
#define LOBBY_CONNECT_APPID ((uint32)-2)
|
||||
|
||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
||||
#endif//__INCLUDED_COMMON_INCLUDES__
|
||||
|
|
|
@ -809,17 +809,20 @@ bool SetLobbyData( CSteamID steamIDLobby, const char *pchKey, const char *pchVal
|
|||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
|
||||
Lobby *lobby = get_lobby(steamIDLobby);
|
||||
if (!lobby || lobby->owner() != settings->get_local_steam_id().ConvertToUint64() || lobby->deleted()) {
|
||||
if (!lobby || lobby->deleted()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto result = caseinsensitive_find(lobby->values(), pchKey);
|
||||
bool changed = true;
|
||||
if (result == lobby->values().end()) {
|
||||
(*lobby->mutable_values())[pchKey] = pchValue;
|
||||
} else {
|
||||
if (result->second == std::string(pchValue)) changed = false;
|
||||
(*lobby->mutable_values())[result->first] = pchValue;
|
||||
//callback is always triggered when setlobbydata is called from non owner however no data is actually changed.
|
||||
if (lobby->owner() == settings->get_local_steam_id().ConvertToUint64()) {
|
||||
auto result = caseinsensitive_find(lobby->values(), pchKey);
|
||||
if (result == lobby->values().end()) {
|
||||
(*lobby->mutable_values())[pchKey] = pchValue;
|
||||
} else {
|
||||
if (result->second == std::string(pchValue)) changed = false;
|
||||
(*lobby->mutable_values())[result->first] = pchValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
|
|
|
@ -881,7 +881,7 @@ SteamNetworkingMessage_t *get_steam_message_connection(HSteamNetConnection hConn
|
|||
pMsg->m_pfnRelease = &delete_steam_message;
|
||||
pMsg->m_nChannel = 0;
|
||||
connect_socket->second.data.pop();
|
||||
PRINT_DEBUG("get_steam_message_connection %u %u\n", hConn, size);
|
||||
PRINT_DEBUG("get_steam_message_connection %u %u, %u\n", hConn, size, pMsg->m_nMessageNumber);
|
||||
return pMsg;
|
||||
}
|
||||
|
||||
|
@ -913,6 +913,7 @@ int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessa
|
|||
++messages;
|
||||
}
|
||||
|
||||
PRINT_DEBUG("messages %u\n", messages);
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
@ -2085,13 +2086,13 @@ void Callback(Common_Message *msg)
|
|||
auto connect_socket = s->connect_sockets.find(msg->networking_sockets().connection_id());
|
||||
if (connect_socket != s->connect_sockets.end()) {
|
||||
if (connect_socket->second.remote_identity.GetSteamID64() == msg->source_id() && (connect_socket->second.status == CONNECT_SOCKET_CONNECTED)) {
|
||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %u on connection %u\n", msg->networking_sockets().data().size(), connect_socket->first);
|
||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %u, num %u on connection %u\n", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
||||
connect_socket->second.data.push(msg->networking_sockets());
|
||||
}
|
||||
} else {
|
||||
connect_socket = std::find_if(s->connect_sockets.begin(), s->connect_sockets.end(), [msg](const auto &in) {return in.second.remote_identity.GetSteamID64() == msg->source_id() && (in.second.status == CONNECT_SOCKET_NOT_ACCEPTED || in.second.status == CONNECT_SOCKET_CONNECTED) && in.second.remote_id == msg->networking_sockets().connection_id_from();});
|
||||
if (connect_socket != s->connect_sockets.end()) {
|
||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %u on not accepted connection %u\n", msg->networking_sockets().data().size(), connect_socket->first);
|
||||
PRINT_DEBUG("Steam_Networking_Sockets: got data len %u, num %u on not accepted connection %u\n", msg->networking_sockets().data().size(), msg->networking_sockets().message_number(), connect_socket->first);
|
||||
connect_socket->second.data.push(msg->networking_sockets());
|
||||
}
|
||||
}
|
||||
|
|
67
dll/wrap.cpp
67
dll/wrap.cpp
|
@ -25,6 +25,7 @@
|
|||
// Nothing to be done here
|
||||
#else
|
||||
#define STEAM_API_FUNCTIONS_IMPL
|
||||
|
||||
#include "base.h"
|
||||
#include "dll.h"
|
||||
|
||||
|
@ -34,6 +35,26 @@
|
|||
const char *STEAM_PATH;
|
||||
size_t STEAM_PATH_SIZE;
|
||||
|
||||
#ifndef __x86_64__
|
||||
# define _STAT_VER_LINUX_OLD 1
|
||||
# define _STAT_VER_KERNEL 1
|
||||
# define _STAT_VER_SVR4 2
|
||||
# define _STAT_VER_LINUX 3
|
||||
# define _MKNOD_VER_LINUX 1
|
||||
# define _MKNOD_VER_SVR4 2
|
||||
#else
|
||||
# define _STAT_VER_KERNEL 0
|
||||
# define _STAT_VER_LINUX 1
|
||||
# define _MKNOD_VER_LINUX 0
|
||||
#endif
|
||||
#define _STAT_VER _STAT_VER_LINUX
|
||||
#define _MKNOD_VER _MKNOD_VER_LINUX
|
||||
|
||||
/* From kernel_stat.h It help me save some condition */
|
||||
#define XSTAT_IS_XSTAT64 1
|
||||
#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64
|
||||
#define STAT_IS_KERNEL_STAT 1
|
||||
|
||||
// Returns a '/' terminated absolute path to the steam folder in user's home,
|
||||
// root is returned if env home is not set
|
||||
const char *get_steam_path()
|
||||
|
@ -290,7 +311,16 @@ STEAMAPI_API int __wrap_access(const char *path, int mode)
|
|||
STEAMAPI_API int __wrap___xstat(int ver, const char * path, struct stat * stat_buf)
|
||||
{
|
||||
const char *path_lowercased = lowercase_path(path, false, false);
|
||||
int result = __xstat(ver, path_lowercased, stat_buf);
|
||||
int result;
|
||||
|
||||
switch (ver) {
|
||||
case _STAT_VER_KERNEL:
|
||||
result = stat(path_lowercased, stat_buf);
|
||||
break;
|
||||
default:
|
||||
result = EINVAL;
|
||||
}
|
||||
|
||||
if (path_lowercased != path) {
|
||||
free((void *)path_lowercased);
|
||||
}
|
||||
|
@ -305,7 +335,16 @@ STEAMAPI_API int __wrap_stat(const char * path, struct stat * stat_buf)
|
|||
STEAMAPI_API int __wrap___lxstat(int ver, const char * path, struct stat * stat_buf)
|
||||
{
|
||||
const char *path_lowercased = lowercase_path(path, false, false);
|
||||
int result = __lxstat(ver, path_lowercased, stat_buf);
|
||||
int result;
|
||||
|
||||
switch (ver) {
|
||||
case _STAT_VER_KERNEL:
|
||||
result = lstat(path_lowercased, stat_buf);
|
||||
break;
|
||||
default:
|
||||
result = EINVAL;
|
||||
}
|
||||
|
||||
if (path_lowercased != path) {
|
||||
free((void *)path_lowercased);
|
||||
}
|
||||
|
@ -350,7 +389,16 @@ STEAMAPI_API DIR *__wrap_opendir(const char *path)
|
|||
STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat_buf)
|
||||
{
|
||||
const char *path_lowercased = lowercase_path(path, false, false);
|
||||
int result = __xstat64(ver, path_lowercased, stat_buf);
|
||||
int result;
|
||||
|
||||
switch (ver) {
|
||||
case _STAT_VER_KERNEL:
|
||||
result = stat64(path_lowercased, stat_buf);
|
||||
break;
|
||||
default:
|
||||
result = EINVAL;
|
||||
}
|
||||
|
||||
if (path_lowercased != path) {
|
||||
free((void *)path_lowercased);
|
||||
}
|
||||
|
@ -360,7 +408,16 @@ STEAMAPI_API int __wrap___xstat64(int ver, const char *path, struct stat64 *stat
|
|||
STEAMAPI_API int __wrap___lxstat64(int ver, const char *path, struct stat64 *stat_buf)
|
||||
{
|
||||
const char *path_lowercased = lowercase_path(path, false, false);
|
||||
int result = __lxstat64(ver, path_lowercased, stat_buf);
|
||||
int result;
|
||||
|
||||
switch (ver) {
|
||||
case _STAT_VER_KERNEL:
|
||||
result = lstat64(path_lowercased, stat_buf);
|
||||
break;
|
||||
default:
|
||||
result = EINVAL;
|
||||
}
|
||||
|
||||
if (path_lowercased != path) {
|
||||
free((void *)path_lowercased);
|
||||
}
|
||||
|
@ -448,7 +505,7 @@ STEAMAPI_API int __wrap_link(const char *path1, const char *path2)
|
|||
STEAMAPI_API int __wrap_mknod(const char *path, mode_t mode, dev_t dev)
|
||||
{
|
||||
const char *path_lowercased = lowercase_path(path, true, true);
|
||||
int result = __xmknod(1, path_lowercased, mode, &dev);
|
||||
int result = mknod(path_lowercased, mode, dev);
|
||||
if (path_lowercased != path) {
|
||||
free((void *)path_lowercased);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue