mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-30 15:38:23 +03:00
lsteamclient: Remove now unused steamclient_manual_common.cpp.
CW-Bug-Id: #22729
This commit is contained in:
parent
d570a2cba7
commit
7f5533a34d
@ -215,7 +215,6 @@ SOURCES = \
|
||||
cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION012.cpp \
|
||||
cppISteamVideo_STEAMVIDEO_INTERFACE_V001.cpp \
|
||||
cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp \
|
||||
steamclient_manual_common.cpp \
|
||||
struct_converters_111x.cpp \
|
||||
struct_converters_112.cpp \
|
||||
struct_converters_112x.cpp \
|
||||
|
@ -123,13 +123,9 @@ static DWORD WINAPI callback_thread( void *dummy )
|
||||
cb_data.steam_api_warning_hook.msg );
|
||||
callback_complete( cookie );
|
||||
break;
|
||||
case STEAM_API_CALLBACK_ONE_PARAM:
|
||||
TRACE( "STEAM_API_CALLBACK_ONE_PARAM func %p, param %p.\n", cb_data.func,
|
||||
cb_data.steam_api_callback_one_param.param );
|
||||
((void (WINAPI *)( void * ))cb_data.func)( cb_data.steam_api_callback_one_param.param );
|
||||
callback_complete( cookie );
|
||||
default:
|
||||
ERR( "Unexpected callback type %u.\n", cb_data.type );
|
||||
break;
|
||||
default: ERR( "Unexpected callback type %u.\n", cb_data.type ); break;
|
||||
}
|
||||
}
|
||||
TRACE( "exiting.\n" );
|
||||
|
@ -27,38 +27,6 @@ char g_tmppath[PATH_MAX];
|
||||
static CRITICAL_SECTION steamclient_cs = { NULL, -1, 0, 0, 0, 0 };
|
||||
static HANDLE steam_overlay_event;
|
||||
|
||||
static void * (WINAPI *p_NtCurrentTeb)(void);
|
||||
|
||||
static void init_ntdll_so_funcs(void)
|
||||
{
|
||||
static const WCHAR ntdllW[] = {'n','t','d','l','l','.','d','l','l',0};
|
||||
Dl_info info;
|
||||
uint64_t unix_funcs;
|
||||
unsigned int status;
|
||||
void *ntdll;
|
||||
|
||||
status = NtQueryVirtualMemory(GetCurrentProcess(), GetModuleHandleW(ntdllW), (MEMORY_INFORMATION_CLASS)1000 /*MemoryWineUnixFuncs*/,
|
||||
&unix_funcs, sizeof(unix_funcs), NULL);
|
||||
if (status)
|
||||
{
|
||||
fprintf(stderr, "err:lsteamclient:init_ntdll_so_funcs NtQueryVirtualMemory status %#x.\n", status);
|
||||
return;
|
||||
}
|
||||
if (!dladdr((void *)(ULONG_PTR)unix_funcs, &info))
|
||||
{
|
||||
fprintf(stderr, "err:lsteamclient:init_ntdll_so_funcs dladdr failed.\n");
|
||||
return;
|
||||
}
|
||||
ntdll = dlopen(info.dli_fname, RTLD_NOW);
|
||||
if (!ntdll)
|
||||
{
|
||||
fprintf(stderr, "err:lsteamclient:init_ntdll_so_funcs could not find ntdll.so.\n");
|
||||
return;
|
||||
}
|
||||
p_NtCurrentTeb = dlsym(ntdll, "NtCurrentTeb");
|
||||
dlclose(ntdll);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
{
|
||||
TRACE("(%p, %u, %p)\n", instance, reason, reserved);
|
||||
@ -68,7 +36,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(instance);
|
||||
steam_overlay_event = CreateEventA(NULL, TRUE, FALSE, "__wine_steamclient_GameOverlayActivated");
|
||||
init_ntdll_so_funcs();
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
stop_callback_thread();
|
||||
@ -79,13 +46,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool is_native_thread(void)
|
||||
{
|
||||
if (!p_NtCurrentTeb)
|
||||
return TRUE;
|
||||
return !p_NtCurrentTeb();
|
||||
}
|
||||
|
||||
void sync_environment(void)
|
||||
{
|
||||
static const char *steamapi_envs[] =
|
||||
|
@ -1,197 +0,0 @@
|
||||
#include "unix_private.h"
|
||||
|
||||
extern "C" {
|
||||
#define SDK_VERSION 1531
|
||||
#include "steamclient_manual_common.h"
|
||||
} /* extern "C" { */
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
||||
|
||||
struct msg_wrapper {
|
||||
w_SteamNetworkingMessage_t_153a win_msg;
|
||||
u_SteamNetworkingMessage_t_153a *lin_msg;
|
||||
|
||||
struct list mapping_entry;
|
||||
void (*orig_FreeData)( u_SteamNetworkingMessage_t_153a * );
|
||||
void (*orig_Release)( u_SteamNetworkingMessage_t_153a * );
|
||||
};
|
||||
|
||||
/***** manual struct converter for SteamNetworkingMessage_t_153a *****/
|
||||
|
||||
static struct list msg_lin_to_win_mapping = LIST_INIT(msg_lin_to_win_mapping);
|
||||
static pthread_mutex_t msg_lin_to_win_mapping_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static struct msg_wrapper *msg_wrapper_from_lin( u_SteamNetworkingMessage_t_153a *lin_msg )
|
||||
{
|
||||
struct msg_wrapper *msg = NULL, *m;
|
||||
|
||||
pthread_mutex_lock(&msg_lin_to_win_mapping_mutex);
|
||||
LIST_FOR_EACH_ENTRY(m, &msg_lin_to_win_mapping, struct msg_wrapper, mapping_entry)
|
||||
{
|
||||
if (m->lin_msg == lin_msg)
|
||||
{
|
||||
msg = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&msg_lin_to_win_mapping_mutex);
|
||||
if (!msg)
|
||||
fprintf(stderr, "err:lsteamclient:msg_wrapper_from_lin Mapping for %p not found.\n", lin_msg);
|
||||
return msg;
|
||||
}
|
||||
|
||||
static void W_STDCALL win_FreeData( w_SteamNetworkingMessage_t_153a *win_msg )
|
||||
{
|
||||
struct msg_wrapper *msg = CONTAINING_RECORD(win_msg, struct msg_wrapper, win_msg);
|
||||
TRACE("%p\n", msg);
|
||||
if(msg->orig_FreeData)
|
||||
{
|
||||
msg->lin_msg->m_pData = msg->win_msg.m_pData;
|
||||
msg->orig_FreeData(msg->lin_msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void W_STDCALL win_Release( w_SteamNetworkingMessage_t_153a *win_msg )
|
||||
{
|
||||
struct msg_wrapper *msg = CONTAINING_RECORD(win_msg, struct msg_wrapper, win_msg);
|
||||
|
||||
TRACE("%p\n", msg);
|
||||
if (msg->orig_Release)
|
||||
msg->orig_Release(msg->lin_msg);
|
||||
pthread_mutex_lock(&msg_lin_to_win_mapping_mutex);
|
||||
list_remove(&msg->mapping_entry);
|
||||
pthread_mutex_unlock(&msg_lin_to_win_mapping_mutex);
|
||||
SecureZeroMemory(msg, sizeof(*msg));
|
||||
HeapFree(GetProcessHeap(), 0, msg);
|
||||
}
|
||||
|
||||
static void lin_FreeData( u_SteamNetworkingMessage_t_153a *lin_msg )
|
||||
{
|
||||
struct msg_wrapper *msg = msg_wrapper_from_lin(lin_msg);
|
||||
struct callback_data cb_data;
|
||||
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
if (!msg->win_msg.m_pfnFreeData)
|
||||
return;
|
||||
|
||||
if (!is_native_thread())
|
||||
{
|
||||
TRACE("msg %p, callback %p.\n", msg, msg->win_msg.m_pfnFreeData);
|
||||
msg->win_msg.m_pfnFreeData( &msg->win_msg );
|
||||
return;
|
||||
}
|
||||
|
||||
cb_data.type = STEAM_API_CALLBACK_ONE_PARAM;
|
||||
cb_data.func = (void *)msg->win_msg.m_pfnFreeData;
|
||||
cb_data.steam_api_callback_one_param.param = (void *)&msg->win_msg;
|
||||
execute_callback(&cb_data);
|
||||
}
|
||||
|
||||
static void lin_Release( u_SteamNetworkingMessage_t_153a *lin_msg )
|
||||
{
|
||||
struct msg_wrapper *msg = msg_wrapper_from_lin(lin_msg);
|
||||
struct callback_data cb_data;
|
||||
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
if (!msg->win_msg.m_pfnRelease)
|
||||
return;
|
||||
|
||||
if (!is_native_thread())
|
||||
{
|
||||
TRACE("msg %p, callback %p.\n", msg, msg->win_msg.m_pfnFreeData);
|
||||
msg->win_msg.m_pfnRelease( &msg->win_msg );
|
||||
return;
|
||||
}
|
||||
|
||||
cb_data.type = STEAM_API_CALLBACK_ONE_PARAM;
|
||||
cb_data.func = (void *)msg->win_msg.m_pfnRelease;
|
||||
cb_data.steam_api_callback_one_param.param = (void *)&msg->win_msg;
|
||||
execute_callback(&cb_data);
|
||||
}
|
||||
|
||||
void *network_message_lin_to_win_(void *msg_, unsigned int version)
|
||||
{
|
||||
u_SteamNetworkingMessage_t_153a *lin_msg = (u_SteamNetworkingMessage_t_153a *)msg_;
|
||||
struct msg_wrapper *msg;
|
||||
|
||||
msg = (struct msg_wrapper *)HeapAlloc(GetProcessHeap(), 0, sizeof(*msg));
|
||||
|
||||
TRACE("lin_msg %p, msg %p, m_cbSize %d.\n", lin_msg, msg, lin_msg->m_cbSize);
|
||||
|
||||
msg->lin_msg = lin_msg;
|
||||
|
||||
msg->win_msg.m_pData = msg->lin_msg->m_pData;
|
||||
msg->win_msg.m_cbSize = msg->lin_msg->m_cbSize;
|
||||
msg->win_msg.m_conn = msg->lin_msg->m_conn;
|
||||
msg->win_msg.m_identityPeer = msg->lin_msg->m_identityPeer;
|
||||
msg->win_msg.m_nConnUserData = msg->lin_msg->m_nConnUserData;
|
||||
msg->win_msg.m_usecTimeReceived= msg->lin_msg->m_usecTimeReceived;
|
||||
msg->win_msg.m_nMessageNumber = msg->lin_msg->m_nMessageNumber;
|
||||
msg->win_msg.m_pfnFreeData = win_FreeData;
|
||||
msg->win_msg.m_pfnRelease = win_Release;
|
||||
msg->win_msg.m_nChannel = msg->lin_msg->m_nChannel;
|
||||
if (version >= 1470)
|
||||
{
|
||||
msg->win_msg.m_nFlags = msg->lin_msg->m_nFlags;
|
||||
msg->win_msg.m_nUserData = msg->lin_msg->m_nUserData;
|
||||
}
|
||||
if (version >= 1530)
|
||||
msg->win_msg.m_idxLane = msg->lin_msg->m_idxLane;
|
||||
|
||||
msg->orig_FreeData = msg->lin_msg->m_pfnFreeData;
|
||||
msg->lin_msg->m_pfnFreeData = lin_FreeData;
|
||||
msg->orig_Release = msg->lin_msg->m_pfnRelease;
|
||||
msg->lin_msg->m_pfnRelease = lin_Release;
|
||||
|
||||
pthread_mutex_lock(&msg_lin_to_win_mapping_mutex);
|
||||
list_add_head(&msg_lin_to_win_mapping, &msg->mapping_entry);
|
||||
pthread_mutex_unlock(&msg_lin_to_win_mapping_mutex);
|
||||
|
||||
return &msg->win_msg;
|
||||
}
|
||||
|
||||
void lin_to_win_struct_SteamNetworkingMessage_t_(int n_messages, void **l, void **w, int max_messages, int version)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(n_messages > 0)
|
||||
TRACE("%u %p %p\n", n_messages, l, w);
|
||||
|
||||
for(i = 0; i < n_messages; ++i)
|
||||
w[i] = network_message_lin_to_win_(l[i], version);
|
||||
|
||||
for(; i < max_messages; ++i)
|
||||
w[i] = NULL;
|
||||
}
|
||||
|
||||
void *network_message_win_to_lin_(void *win_msg, unsigned int version)
|
||||
{
|
||||
struct msg_wrapper *msg = CONTAINING_RECORD(win_msg, struct msg_wrapper, win_msg);
|
||||
u_SteamNetworkingMessage_t_153a *lin_msg = msg->lin_msg;
|
||||
|
||||
TRACE("msg %p, lin_msg %p.\n", msg, lin_msg);
|
||||
|
||||
lin_msg->m_pData = msg->win_msg.m_pData;
|
||||
lin_msg->m_cbSize = msg->win_msg.m_cbSize;
|
||||
lin_msg->m_conn = msg->win_msg.m_conn;
|
||||
lin_msg->m_identityPeer = msg->win_msg.m_identityPeer;
|
||||
lin_msg->m_nConnUserData = msg->win_msg.m_nConnUserData;
|
||||
lin_msg->m_usecTimeReceived= msg->win_msg.m_usecTimeReceived;
|
||||
lin_msg->m_nMessageNumber = msg->win_msg.m_nMessageNumber;
|
||||
lin_msg->m_nChannel = msg->win_msg.m_nChannel;
|
||||
if (version >= 1470)
|
||||
{
|
||||
lin_msg->m_nFlags = msg->win_msg.m_nFlags;
|
||||
lin_msg->m_nUserData = msg->win_msg.m_nUserData;
|
||||
}
|
||||
if (version >= 1530)
|
||||
lin_msg->m_idxLane = msg->win_msg.m_idxLane;
|
||||
|
||||
return lin_msg;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
|
||||
#ifndef SDK_VERSION
|
||||
#error "SDK_VERSION is not defined"
|
||||
#endif
|
||||
|
||||
/* Once new steamclient_manual_...cpp is added structures in steamclient_manual_common.cpp
|
||||
* (currently SteamNetworkingMessage_t) must be checked for the compatibility with the new version. */
|
||||
C_ASSERT(SDK_VERSION <= 1531);
|
||||
|
||||
/* Returns Windows version of SteamNetworkingMessage_t */
|
||||
#define network_message_lin_to_win(m) network_message_lin_to_win_(m, SDK_VERSION)
|
||||
void *network_message_lin_to_win_(void *lin_msg, unsigned int version);
|
||||
|
||||
/* Returns Linux version of SteamNetworkingMessage_t */
|
||||
#define network_message_win_to_lin(m) network_message_win_to_lin_(m, SDK_VERSION)
|
||||
void *network_message_win_to_lin_(void *win_msg, unsigned int version);
|
||||
|
||||
#define lin_to_win_struct_SteamNetworkingMessage_t(a, b, c, d) lin_to_win_struct_SteamNetworkingMessage_t_(a, (void **)(b), (void **)(c), d, SDK_VERSION)
|
||||
void lin_to_win_struct_SteamNetworkingMessage_t_(int n_messages, void **l, void **w, int max_messages, int version);
|
@ -33,7 +33,6 @@ enum callback_type
|
||||
{
|
||||
SOCKET_DEBUG_OUTPUT = 1,
|
||||
STEAM_API_WARNING_HOOK,
|
||||
STEAM_API_CALLBACK_ONE_PARAM,
|
||||
};
|
||||
|
||||
struct callback_data
|
||||
@ -55,16 +54,10 @@ struct callback_data
|
||||
const char *msg;
|
||||
}
|
||||
steam_api_warning_hook;
|
||||
struct
|
||||
{
|
||||
void *param;
|
||||
}
|
||||
steam_api_callback_one_param;
|
||||
};
|
||||
};
|
||||
|
||||
void execute_callback(struct callback_data *cb_data);
|
||||
bool is_native_thread(void);
|
||||
|
||||
#ifndef STEAM_API_H
|
||||
struct networking_message_pool;
|
||||
|
Loading…
x
Reference in New Issue
Block a user