mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-25 22:25:46 +03:00
lsteamclient: Terminate callback thread on Steam interface shutdown.
CW-Bug-Id: #22649
This commit is contained in:
parent
e8df09e258
commit
516f76e446
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient006.h"
|
||||
HSteamPipe cppISteamClient_SteamClient006_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient006_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient007.h"
|
||||
HSteamPipe cppISteamClient_SteamClient007_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient007_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient008.h"
|
||||
HSteamPipe cppISteamClient_SteamClient008_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient008_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient009.h"
|
||||
HSteamPipe cppISteamClient_SteamClient009_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient009_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient010.h"
|
||||
HSteamPipe cppISteamClient_SteamClient010_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient010_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient010_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient010_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient010_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient011.h"
|
||||
HSteamPipe cppISteamClient_SteamClient011_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient011_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -129,7 +129,7 @@ void cppISteamClient_SteamClient011_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient011_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient011_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient012.h"
|
||||
HSteamPipe cppISteamClient_SteamClient012_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient012_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient012_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient012_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient012_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient013.h"
|
||||
HSteamPipe cppISteamClient_SteamClient013_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient013_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient013_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient013_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient013_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient014.h"
|
||||
HSteamPipe cppISteamClient_SteamClient014_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient014_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient014_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient014_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient014_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient015.h"
|
||||
HSteamPipe cppISteamClient_SteamClient015_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient015_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient015_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient015_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient015_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient016.h"
|
||||
HSteamPipe cppISteamClient_SteamClient016_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient016_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient016_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient016_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient016_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient017.h"
|
||||
HSteamPipe cppISteamClient_SteamClient017_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient017_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -124,7 +124,7 @@ void cppISteamClient_SteamClient017_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient017_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient017_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient018.h"
|
||||
HSteamPipe cppISteamClient_SteamClient018_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient018_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -130,7 +130,7 @@ void cppISteamClient_SteamClient018_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient018_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient018_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient019.h"
|
||||
HSteamPipe cppISteamClient_SteamClient019_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient019_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -130,7 +130,7 @@ void cppISteamClient_SteamClient019_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient019_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient019_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
#include "cppISteamClient_SteamClient020.h"
|
||||
HSteamPipe cppISteamClient_SteamClient020_CreateSteamPipe(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->CreateSteamPipe();
|
||||
return after_steam_pipe_create(((ISteamClient*)linux_side)->CreateSteamPipe());
|
||||
}
|
||||
|
||||
bool cppISteamClient_SteamClient020_BReleaseSteamPipe(void *linux_side, HSteamPipe hSteamPipe)
|
||||
@ -130,7 +130,7 @@ void cppISteamClient_SteamClient020_SetWarningMessageHook(void *linux_side, Stea
|
||||
|
||||
bool cppISteamClient_SteamClient020_BShutdownIfAllPipesClosed(void *linux_side)
|
||||
{
|
||||
return ((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed();
|
||||
return after_shutdown(((ISteamClient*)linux_side)->BShutdownIfAllPipesClosed());
|
||||
}
|
||||
|
||||
void *cppISteamClient_SteamClient020_GetISteamHTTP(void *linux_side, HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char * pchVersion)
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
CLANG_PATH='/usr/lib/clang/13.0.1'
|
||||
CLANG_PATH='/usr/lib/clang/16'
|
||||
|
||||
from clang.cindex import CursorKind, Index, Type, TypeKind
|
||||
from collections import namedtuple
|
||||
@ -232,6 +232,16 @@ manually_handled_methods = {
|
||||
#TODO: Do we need the the value -> pointer conversion for other versions of the interface?
|
||||
Method("InitiateGameConnection", lambda version: version == 8),
|
||||
],
|
||||
#"cppISteamClient_SteamClient": [
|
||||
# Method("BShutdownIfAllPipesClosed"),
|
||||
#],
|
||||
}
|
||||
|
||||
|
||||
|
||||
post_execution_functions = {
|
||||
"ISteamClient_BShutdownIfAllPipesClosed" : "after_shutdown",
|
||||
"ISteamClient_CreateSteamPipe" : "after_steam_pipe_create",
|
||||
}
|
||||
|
||||
INTERFACE_NAME_VERSION = re.compile(r'^(?P<name>.+?)(?P<version>\d*)$')
|
||||
@ -246,6 +256,9 @@ def method_needs_manual_handling(interface_with_version, method_name):
|
||||
|
||||
return method and method.version_func(version)
|
||||
|
||||
def post_execution_function(classname, method_name):
|
||||
return post_execution_functions.get(classname + "_" + method_name)
|
||||
|
||||
# manual converters for simple types (function pointers)
|
||||
manual_type_converters = [
|
||||
"FSteamNetworkingSocketsDebugOutput",
|
||||
@ -816,6 +829,10 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
else:
|
||||
cpp.write(" return ")
|
||||
|
||||
post_exec = post_execution_function(classname, method.spelling)
|
||||
if post_exec != None:
|
||||
cpp.write(post_exec + '(');
|
||||
|
||||
should_do_cb_wrap = "GetAPICallResult" in used_name
|
||||
should_gen_wrapper = cpp != dummy_writer and \
|
||||
(method.result_type.spelling.startswith("ISteam") or \
|
||||
@ -861,7 +878,10 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
cpp.write(f"({param.type.spelling}){param.spelling}")
|
||||
if should_gen_wrapper:
|
||||
cfile.write(")")
|
||||
|
||||
cfile.write(");\n")
|
||||
if post_exec != None:
|
||||
cpp.write(")")
|
||||
cpp.write(");\n")
|
||||
if returns_record:
|
||||
cfile.write(" return _r;\n")
|
||||
|
@ -755,6 +755,21 @@ static void callback_complete(UINT64 cookie)
|
||||
pthread_mutex_unlock(&callback_queue_mutex);
|
||||
}
|
||||
|
||||
static void finish_callback_thread(void)
|
||||
{
|
||||
if (!callback_thread_handle)
|
||||
return;
|
||||
pthread_mutex_lock(&callback_queue_mutex);
|
||||
callback_queue_done = TRUE;
|
||||
pthread_cond_broadcast(&callback_queue_callback_event);
|
||||
pthread_cond_broadcast(&callback_queue_complete_event);
|
||||
pthread_mutex_unlock(&callback_queue_mutex);
|
||||
|
||||
WaitForSingleObject(callback_thread_handle, INFINITE);
|
||||
CloseHandle(callback_thread_handle);
|
||||
callback_thread_handle = NULL;
|
||||
}
|
||||
|
||||
typedef void (WINAPI *win_FSteamNetworkingSocketsDebugOutput)(ESteamNetworkingSocketsDebugOutputType nType,
|
||||
const char *pszMsg);
|
||||
typedef void (CDECL *win_SteamAPIWarningMessageHook_t)(int, const char *pszMsg);
|
||||
@ -795,6 +810,7 @@ static DWORD WINAPI callback_thread(void *dummy)
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE("exiting.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1065,3 +1081,32 @@ void CDECL Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId(int a, int b
|
||||
{
|
||||
TRACE("\n");
|
||||
}
|
||||
|
||||
bool after_shutdown(bool ret)
|
||||
{
|
||||
TRACE("ret %d.\n", ret);
|
||||
|
||||
if (!ret)
|
||||
return 0;
|
||||
finish_callback_thread();
|
||||
return ret;
|
||||
}
|
||||
|
||||
HSteamPipe after_steam_pipe_create(HSteamPipe pipe)
|
||||
{
|
||||
DWORD callback_thread_id;
|
||||
|
||||
TRACE("pipe %#x.\n", pipe);
|
||||
|
||||
if (!pipe)
|
||||
return 0;
|
||||
|
||||
if (callback_thread_handle)
|
||||
return pipe;
|
||||
|
||||
callback_queue_done = FALSE;
|
||||
callback_thread_handle = CreateThread(NULL, 0, callback_thread, NULL, 0, &callback_thread_id);
|
||||
TRACE("Created callback thread 0x%04x.\n", callback_thread_id);
|
||||
|
||||
return pipe;
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ struct callback_data
|
||||
|
||||
void execute_callback(struct callback_data *cb_data);
|
||||
BOOL is_native_thread(void);
|
||||
bool after_shutdown(bool);
|
||||
HSteamPipe after_steam_pipe_create(HSteamPipe pipe);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user