Open-source Xbox-inspired desktop launcher for Xodus on Linux
TypeScript
chore(runtime): remove unreferenced patch assets
domsvoboda6b6cbf8d26b1
diff --git a/assets/wine-memfd-filename.patch b/assets/wine-memfd-filename.patchdeleted file mode 100644index 5954ab4..0000000--- a/assets/wine-memfd-filename.patch+++ /dev/null@@ -1,141 +0,0 @@-diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c-index 277dbd7389..fb0d6d239f 100644---- a/dlls/ntdll/unix/file.c-+++ b/dlls/ntdll/unix/file.c-@@ -4922,6 +4922,12 @@ NTSTATUS open_unix_file( HANDLE *handle, const char *unix_name, ACCESS_MASK acce- struct object_attributes *objattr;- unsigned int status;- data_size_t len;-+ int unix_fd;-+-+ unix_fd = get_mapped_exe_file( unix_name, strlen( unix_name ) );-+ if (unix_fd != -1) {-+ return wine_server_fd_to_handle_named( dup( unix_fd ), access, attributes, handle, attr->ObjectName );-+ }-- if ((status = alloc_object_attributes( attr, &objattr, &len ))) return status;--diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c-index 2498c2aae4..eedbcdec8f 100644---- a/dlls/ntdll/unix/loader.c-+++ b/dlls/ntdll/unix/loader.c-@@ -1603,7 +1603,7 @@ static NTSTATUS open_mapped_dll_file( const UNICODE_STRING *nt_name, HANDLE *map- len = end - sep - 1;- if (len != allocLen || strncmp( sep + 1, utf8_name, len )) continue;--- if ((status = wine_server_fd_to_handle( fd, GENERIC_READ | SYNCHRONIZE, 0, &handle ))) return status;-+ if ((status = wine_server_fd_to_handle_named( fd, GENERIC_READ | SYNCHRONIZE, 0, &handle, nt_name ))) return status;-- size.QuadPart = 0;- status = NtCreateSection( mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY |-diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c-index 112157b0dd..3e67166cd1 100644---- a/dlls/ntdll/unix/server.c-+++ b/dlls/ntdll/unix/server.c-@@ -1224,6 +1224,12 @@ done:- * wine_server_fd_to_handle- */- NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle )-+{-+ return wine_server_fd_to_handle_named( fd, access, attributes, handle, NULL );-+}-+-+NTSTATUS wine_server_fd_to_handle_named( int fd, unsigned int access, unsigned int attributes,-+ HANDLE *handle, const UNICODE_STRING *name )- {- unsigned int ret;--@@ -1235,6 +1241,7 @@ NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned i- req->access = access;- req->attributes = attributes;- req->fd = fd;-+ if (name) wine_server_add_data( req, name->Buffer, name->Length );- if (!(ret = wine_server_call( req ))) *handle = wine_server_ptr_handle( reply->handle );- }- SERVER_END_REQ;-diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h-index 2f649ca399..c1c5d05b7b 100644---- a/dlls/ntdll/unix/unix_private.h-+++ b/dlls/ntdll/unix/unix_private.h-@@ -401,6 +401,8 @@ extern struct cpu_topology_override *get_cpu_topology_override(void);- extern NTSTATUS unixcall_wine_dbg_write( void *args );- extern NTSTATUS unixcall_wine_server_call( void *args );- extern NTSTATUS unixcall_wine_server_fd_to_handle( void *args );-+extern NTSTATUS wine_server_fd_to_handle_named( int fd, unsigned int access, unsigned int attributes,-+ HANDLE *handle, const UNICODE_STRING *name );- extern NTSTATUS unixcall_wine_server_handle_to_fd( void *args );- extern NTSTATUS unixcall_wine_spawnvp( void *args );- #ifdef _WIN64-diff --git a/server/fd.c b/server/fd.c-index 69a22e4e27..c9b581313b 100644---- a/server/fd.c-+++ b/server/fd.c-@@ -1927,6 +1927,19 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )- name->len = fd->nt_namelen;- }--+/* Preserve the logical name when the contents live in an anonymous memfd. */-+int set_fd_nt_name( struct fd *fd, const struct unicode_str *name )-+{-+ WCHAR *copy;-+-+ if (!name->len) return 1;-+ if (!(copy = memdup( name->str, name->len ))) return 0;-+ free( fd->nt_name );-+ fd->nt_name = copy;-+ fd->nt_namelen = name->len;-+ return 1;-+}-+- /***********************************************************************- * get_mapped_exe_file- */-diff --git a/server/file.c b/server/file.c-index 55f304e006..37cbc2cfb6 100644---- a/server/file.c-+++ b/server/file.c-@@ -872,6 +872,7 @@ DECL_HANDLER(create_file)- DECL_HANDLER(alloc_file_handle)- {- struct file *file;-+ struct unicode_str name;- int fd;-- reply->handle = 0;-@@ -882,7 +883,11 @@ DECL_HANDLER(alloc_file_handle)- }- if ((file = create_file_for_fd( fd, req->access, FILE_SHARE_READ | FILE_SHARE_WRITE )))- {-- reply->handle = alloc_handle( current->process, file, req->access, req->attributes );-+ name.str = get_req_data();-+ name.len = get_req_data_size();-+ if (name.len > 65534 || name.len % sizeof(WCHAR)) set_error( STATUS_INVALID_PARAMETER );-+ else if (set_fd_nt_name( file->fd, &name ))-+ reply->handle = alloc_handle( current->process, file, req->access, req->attributes );- release_object( file );- }- }-diff --git a/server/file.h b/server/file.h-index d516681556..bfbfdbc61b 100644---- a/server/file.h-+++ b/server/file.h-@@ -107,6 +107,7 @@ extern void allow_fd_caching( struct fd *fd );- extern void set_fd_signaled( struct fd *fd, int signaled );- extern char *dup_fd_name( struct fd *root, const char *name ) __WINE_DEALLOC(free) __WINE_MALLOC;- extern void get_nt_name( struct fd *fd, struct unicode_str *name );-+extern int set_fd_nt_name( struct fd *fd, const struct unicode_str *name );-- extern struct object *default_fd_get_sync( struct object *obj );- extern WCHAR *default_fd_get_full_name( struct object *obj, data_size_t max, data_size_t *ret_len );-diff --git a/server/protocol.def b/server/protocol.def-index ac38076b22..998434b659 100644---- a/server/protocol.def-+++ b/server/protocol.def-@@ -1632,6 +1632,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };- unsigned int access; /* wanted access rights */- unsigned int attributes; /* object attributes */- int fd; /* file descriptor on the client side */-+ VARARG(filename,unicode_str); /* optional NT name for memory-backed images */- @REPLY- obj_handle_t handle; /* handle to the file */- @ENDdiff --git a/assets/xgameruntime-offline-taskqueue.patch b/assets/xgameruntime-offline-taskqueue.patchdeleted file mode 100644index 765dc23..0000000--- a/assets/xgameruntime-offline-taskqueue.patch+++ /dev/null@@ -1,694 +0,0 @@-diff --git a/private.h b/private.h-index c9a3d69..2e23c2b 100644---- a/private.h-+++ b/private.h-@@ -89,4 +89,7 @@ extern IXThreadingImpl *x_threading_impl;- extern IXUserImpl *x_user_impl;- extern IXUserDeviceImpl *x_user_device_impl;--+/* Offline-compatible XAsync completion helper implemented by xthreading.c. */-+void complete_async( XAsyncBlock *async );-+- HRESULT WINAPI QueryApiImpl( const GUID *classId, REFIID interfaceId, void **out );-diff --git a/xgameinvite.c b/xgameinvite.c-index db9bc21..6f93b99 100644---- a/xgameinvite.c-+++ b/xgameinvite.c-@@ -71,8 +71,9 @@ static ULONG WINAPI x_game_invite_Release( IXGameInviteImpl2 *iface )-- static HRESULT WINAPI x_game_invite_XGameInviteRegisterForEvent( IXGameInviteImpl2 *iface, XTaskQueueHandle queue, void *context, XGameInviteEventCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, context %p, callback %p, token %p stub!\n", iface, queue, context, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, context %p, callback %p, token %p; online invites disabled.\n", iface, queue, context, callback, token );-+ if (token) token->token = 1;-+ return S_OK;- }-- static BOOLEAN WINAPI x_game_invite_XGameInviteUnregisterForEvent( IXGameInviteImpl2 *iface, XTaskQueueRegistrationToken token, BOOLEAN wait )-diff --git a/xgameprotocol.c b/xgameprotocol.c-index 2db84e4..6054135 100644---- a/xgameprotocol.c-+++ b/xgameprotocol.c-@@ -70,13 +70,14 @@ static ULONG WINAPI x_game_protocol_Release( IXGameProtocolImpl *iface )-- static HRESULT WINAPI x_game_protocol_XGameProtocolRegisterForActivation( IXGameProtocolImpl *iface, XTaskQueueHandle queue, void *context, XGameProtocolActivationCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, context %p, callback %p, token %p stub!\n", iface, queue, context, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, context %p, callback %p, token %p; no offline activation pending.\n", iface, queue, context, callback, token );-+ if (token) token->token = 1;-+ return S_OK;- }-- static BOOLEAN WINAPI x_game_protocol_XGameProtocolUnregisterForActivation( IXGameProtocolImpl *iface, XTaskQueueRegistrationToken token, BOOLEAN wait )- {-- FIXME( "iface %p, token %p, wait %d stub!\n", iface, &token, wait );-+ TRACE( "iface %p, token %p, wait %d.\n", iface, &token, wait );- return TRUE;- }--diff --git a/xthreading.c b/xthreading.c-index 6d62fe1..5828b80 100644---- a/xthreading.c-+++ b/xthreading.c-@@ -68,16 +68,147 @@ static ULONG WINAPI x_threading_Release( IXThreadingImpl *iface )- return ref;- }--+struct task_callback_entry-+{-+ void *context;-+ XTaskQueueCallback *callback;-+ struct task_callback_entry *next;-+};-+-+struct task_queue-+{-+ XTaskQueueDispatchMode work_mode;-+ XTaskQueueDispatchMode completion_mode;-+ LONG ref;-+ volatile LONG init_state;-+ BOOL terminated;-+ CRITICAL_SECTION cs;-+ HANDLE work_event;-+ HANDLE completion_event;-+ struct task_callback_entry *work_head;-+ struct task_callback_entry *work_tail;-+ struct task_callback_entry *completion_head;-+ struct task_callback_entry *completion_tail;-+};-+-+struct threadpool_task-+{-+ void *context;-+ XTaskQueueCallback *callback;-+ UINT32 delay_ms;-+};-+-+struct termination_task-+{-+ void *context;-+ XTaskQueueTerminatedCallback *callback;-+};-+-+static struct task_queue default_process_queue =-+{-+ XTaskQueueDispatchMode_ThreadPool,-+ XTaskQueueDispatchMode_ThreadPool,-+ 1,-+};-+static XTaskQueueHandle current_process_queue = (XTaskQueueHandle)&default_process_queue;-+-+static void init_task_queue( struct task_queue *queue )-+{-+ LONG state;-+-+ if (InterlockedCompareExchange( &queue->init_state, 1, 0 ) == 0)-+ {-+ InitializeCriticalSection( &queue->cs );-+ queue->work_event = CreateEventW( NULL, FALSE, FALSE, NULL );-+ queue->completion_event = CreateEventW( NULL, FALSE, FALSE, NULL );-+ InterlockedExchange( &queue->init_state, 2 );-+ return;-+ }-+-+ while ((state = InterlockedCompareExchange( &queue->init_state, 2, 2 )) != 2) Sleep( 0 );-+}-+-+static DWORD WINAPI threadpool_task_proc( void *parameter )-+{-+ struct threadpool_task *task = parameter;-+-+ if (task->delay_ms) Sleep( task->delay_ms );-+ if (task->callback) task->callback( task->context, FALSE );-+ free( task );-+ return 0;-+}-+-+static void WINAPI async_completion_thunk( void *context, BOOLEAN canceled )-+{-+ XAsyncBlock *async = context;-+-+ if (!canceled && async && async->callback) async->callback( async );-+}-+-+static void WINAPI termination_thunk( void *context, BOOLEAN canceled )-+{-+ struct termination_task *task = context;-+-+ if (!canceled && task->callback) task->callback( task->context );-+ free( task );-+}-+-+static HRESULT submit_callback( struct task_queue *queue, XTaskQueuePort port,-+ void *context, XTaskQueueCallback *callback, BOOL allow_terminated )-+{-+ struct task_callback_entry *entry;-+ struct task_callback_entry **head, **tail;-+ HANDLE event;-+-+ if (!callback) return S_OK;-+ init_task_queue( queue );-+-+ entry = malloc( sizeof(*entry) );-+ if (!entry) return E_OUTOFMEMORY;-+ entry->context = context;-+ entry->callback = callback;-+ entry->next = NULL;-+-+ EnterCriticalSection( &queue->cs );-+ if (queue->terminated && !allow_terminated)-+ {-+ LeaveCriticalSection( &queue->cs );-+ free( entry );-+ return E_ABORT;-+ }-+-+ if (port == XTaskQueuePort_Work)-+ {-+ head = &queue->work_head;-+ tail = &queue->work_tail;-+ event = queue->work_event;-+ }-+ else-+ {-+ head = &queue->completion_head;-+ tail = &queue->completion_tail;-+ event = queue->completion_event;-+ }-+ if (*tail) (*tail)->next = entry;-+ else *head = entry;-+ *tail = entry;-+ LeaveCriticalSection( &queue->cs );-+ SetEvent( event );-+ return S_OK;-+}-+- static HRESULT WINAPI x_threading_XAsyncGetStatus( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, BOOLEAN wait )- {-- FIXME( "iface %p, asyncBlock %p, wait %d stub!\n", iface, asyncBlock, wait );-- return E_NOTIMPL;-+ TRACE( "iface %p, asyncBlock %p, wait %d.\n", iface, asyncBlock, wait );-+ return asyncBlock ? S_OK : E_POINTER;- }-- static HRESULT WINAPI x_threading_XAsyncGetResultSize( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, SIZE_T *bufferSize )- {-- FIXME( "iface %p, asyncBlock %p, bufferSize %p stub!\n", iface, asyncBlock, bufferSize );-- return E_NOTIMPL;-+ TRACE( "iface %p, asyncBlock %p, bufferSize %p.\n", iface, asyncBlock, bufferSize );-+ if (!asyncBlock || !bufferSize) return E_POINTER;-+ *bufferSize = 0;-+ return S_OK;- }-- static void WINAPI x_threading_XAsyncCancel( IXThreadingImpl *iface, XAsyncBlock *asyncBlock )-@@ -87,8 +218,13 @@ static void WINAPI x_threading_XAsyncCancel( IXThreadingImpl *iface, XAsyncBlock-- static HRESULT WINAPI x_threading_XAsyncRun( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, XAsyncWork *work )- {-- FIXME( "iface %p, asyncBlock %p, work %p stub!\n", iface, asyncBlock, work );-- return E_NOTIMPL;-+ HRESULT hr;-+-+ TRACE( "iface %p, asyncBlock %p, work %p.\n", iface, asyncBlock, work );-+ if (!asyncBlock || !work) return E_POINTER;-+ hr = work( asyncBlock );-+ if (SUCCEEDED( hr )) complete_async( asyncBlock );-+ return hr;- }-- static HRESULT WINAPI x_threading_XAsyncBegin( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, void *context, const void *identity, const char *identityName, XAsyncProvider *provider )-@@ -105,105 +241,277 @@ static HRESULT WINAPI __PADDING__( IXThreadingImpl *iface )-- static HRESULT WINAPI x_threading_XAsyncSchedule( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, UINT32 delayInMs )- {-- FIXME( "iface %p, asyncBlock %p, delayInMs %d stub!\n", iface, asyncBlock, delayInMs );-- return E_NOTIMPL;-+ TRACE( "iface %p, asyncBlock %p, delayInMs %d.\n", iface, asyncBlock, delayInMs );-+ if (!asyncBlock) return E_POINTER;-+ if (delayInMs) Sleep( delayInMs );-+ complete_async( asyncBlock );-+ return S_OK;- }-- static void WINAPI x_threading_XAsyncComplete( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, HRESULT result, SIZE_T requiredBufferSize )- {-- FIXME( "iface %p, asyncBlock %p, result %#lx, requiredBufferSize %Iu stub!\n", iface, asyncBlock, result, requiredBufferSize );-+ TRACE( "iface %p, asyncBlock %p, result %#lx, requiredBufferSize %Iu.\n", iface, asyncBlock, result, requiredBufferSize );-+ complete_async( asyncBlock );- }-- static HRESULT WINAPI x_threading_XAsyncGetResult( IXThreadingImpl *iface, XAsyncBlock *asyncBlock, const void *identity, SIZE_T bufferSize, void *buffer, SIZE_T *bufferUsed )- {-- FIXME( "iface %p asyncBlock %p, identity %p, bufferSize %Iu, buffer %p, bufferUsed %p stub!\n", iface, asyncBlock, identity, bufferSize, buffer, bufferUsed );-- return E_NOTIMPL;-+ TRACE( "iface %p asyncBlock %p, identity %p, bufferSize %Iu, buffer %p, bufferUsed %p.\n", iface, asyncBlock, identity, bufferSize, buffer, bufferUsed );-+ if (!asyncBlock) return E_POINTER;-+ if (buffer && bufferSize) memset( buffer, 0, bufferSize );-+ if (bufferUsed) *bufferUsed = bufferSize;-+ return S_OK;- }-- static HRESULT WINAPI x_threading_XTaskQueueCreate( IXThreadingImpl *iface, XTaskQueueDispatchMode workDispatchMode, XTaskQueueDispatchMode completionDispatchMode, XTaskQueueHandle *queue )- {-- FIXME( "iface %p, workDispatchMode %d, completionDispatchMode %d, queue %p stub!\n", iface, workDispatchMode, completionDispatchMode, queue );-- return E_NOTIMPL;-+ struct task_queue *task_queue;-+-+ TRACE( "iface %p, workDispatchMode %d, completionDispatchMode %d, queue %p.\n", iface, workDispatchMode, completionDispatchMode, queue );-+ if (!queue) return E_POINTER;-+ task_queue = calloc( 1, sizeof(*task_queue) );-+ if (!task_queue) return E_OUTOFMEMORY;-+ task_queue->work_mode = workDispatchMode;-+ task_queue->completion_mode = completionDispatchMode;-+ task_queue->ref = 1;-+ init_task_queue( task_queue );-+ *queue = (XTaskQueueHandle)task_queue;-+ return S_OK;- }-- static HRESULT WINAPI x_threading_XTaskQueueCreateComposite( IXThreadingImpl *iface, XTaskQueuePortHandle workPort, XTaskQueuePortHandle completionPort, XTaskQueueHandle *queue )- {-- FIXME( "iface %p, workPort %p, completionPort %p, queue %p stub!\n", iface, workPort, completionPort, queue );-- return E_NOTIMPL;-+ struct task_queue *work = (struct task_queue *)workPort;-+ struct task_queue *completion = (struct task_queue *)completionPort;-+-+ TRACE( "iface %p, workPort %p, completionPort %p, queue %p.\n", iface, workPort, completionPort, queue );-+ return x_threading_XTaskQueueCreate( iface,-+ work ? work->work_mode : XTaskQueueDispatchMode_Manual,-+ completion ? completion->completion_mode : XTaskQueueDispatchMode_Manual, queue );- }-- static HRESULT WINAPI x_threading_XTaskQueueGetPort( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueuePort port, XTaskQueuePortHandle *portHandle )- {-- FIXME( "iface %p, queue %p, port %d, portHandle %p stub!\n", iface, queue, port, portHandle );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, port %d, portHandle %p.\n", iface, queue, port, portHandle );-+ if (!portHandle) return E_POINTER;-+ *portHandle = (XTaskQueuePortHandle)(queue ? queue : current_process_queue);-+ return S_OK;- }-- static HRESULT WINAPI x_threading_XTaskQueueDuplicateHandle( IXThreadingImpl *iface, XTaskQueueHandle queueHandle, XTaskQueueHandle *duplicatedHandle )- {-- FIXME( "iface %p, queueHandle %p, duplicatedHandle %p stub!\n", iface, queueHandle, duplicatedHandle );-- return E_NOTIMPL;-+ struct task_queue *task_queue = (struct task_queue *)queueHandle;-+-+ TRACE( "iface %p, queueHandle %p, duplicatedHandle %p.\n", iface, queueHandle, duplicatedHandle );-+ if (!duplicatedHandle) return E_POINTER;-+ if (!task_queue) task_queue = (struct task_queue *)current_process_queue;-+ if (task_queue != &default_process_queue) InterlockedIncrement( &task_queue->ref );-+ *duplicatedHandle = (XTaskQueueHandle)task_queue;-+ return S_OK;- }-- static BOOLEAN WINAPI x_threading_XTaskQueueDispatch( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueuePort port, UINT32 timeoutInMs )- {-- FIXME( "iface %p, queue %p, port %d, timeoutInMs %d stub!\n", iface, queue, port, timeoutInMs );-- return FALSE;-+ struct task_queue *task_queue = queue ? (struct task_queue *)queue : (struct task_queue *)current_process_queue;-+ struct task_callback_entry *entry;-+ struct task_callback_entry **head, **tail;-+ HANDLE event;-+ DWORD wait_result;-+-+ TRACE( "iface %p, queue %p, port %d, timeoutInMs %u.\n", iface, queue, port, timeoutInMs );-+ init_task_queue( task_queue );-+ if (port == XTaskQueuePort_Work)-+ {-+ head = &task_queue->work_head;-+ tail = &task_queue->work_tail;-+ event = task_queue->work_event;-+ }-+ else-+ {-+ head = &task_queue->completion_head;-+ tail = &task_queue->completion_tail;-+ event = task_queue->completion_event;-+ }-+-+ for (;;)-+ {-+ EnterCriticalSection( &task_queue->cs );-+ entry = *head;-+ if (entry)-+ {-+ *head = entry->next;-+ if (!*head) *tail = NULL;-+ }-+ else if (task_queue->terminated)-+ {-+ LeaveCriticalSection( &task_queue->cs );-+ return FALSE;-+ }-+ LeaveCriticalSection( &task_queue->cs );-+-+ if (entry)-+ {-+ entry->callback( entry->context, FALSE );-+ free( entry );-+ return TRUE;-+ }-+ if (!timeoutInMs) return FALSE;-+ wait_result = WaitForSingleObject( event, timeoutInMs );-+ if (wait_result != WAIT_OBJECT_0) return FALSE;-+ }- }-- static void WINAPI x_threading_XTaskQueueCloseHandle( IXThreadingImpl *iface, XTaskQueueHandle queue )- {-- FIXME( "iface %p, queue %p stub!\n", iface, queue );-+ struct task_queue *task_queue = (struct task_queue *)queue;-+ struct task_callback_entry *entry, *next;-+-+ TRACE( "iface %p, queue %p.\n", iface, queue );-+ if (!task_queue || task_queue == &default_process_queue) return;-+ if (InterlockedDecrement( &task_queue->ref )) return;-+ init_task_queue( task_queue );-+ for (entry = task_queue->work_head; entry; entry = next)-+ {-+ next = entry->next;-+ free( entry );-+ }-+ for (entry = task_queue->completion_head; entry; entry = next)-+ {-+ next = entry->next;-+ free( entry );-+ }-+ CloseHandle( task_queue->work_event );-+ CloseHandle( task_queue->completion_event );-+ DeleteCriticalSection( &task_queue->cs );-+ free( task_queue );- }-- static HRESULT WINAPI x_threading_XTaskQueueSubmitCallback( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueuePort port, void *callbackContext, XTaskQueueCallback *callback )- {-- FIXME( "iface %p, queue %p, port %d, callbackContext %p, callback %p stub!\n", iface, queue, port, callbackContext, callback );-- return E_NOTIMPL;-+ struct task_queue *task_queue = queue ? (struct task_queue *)queue : (struct task_queue *)current_process_queue;-+ XTaskQueueDispatchMode mode = port == XTaskQueuePort_Work ? task_queue->work_mode : task_queue->completion_mode;-+ struct threadpool_task *task;-+-+ TRACE( "iface %p, queue %p, port %d, callbackContext %p, callback %p.\n", iface, queue, port, callbackContext, callback );-+ if (!callback) return E_POINTER;-+ if (mode == XTaskQueueDispatchMode_Immediate)-+ {-+ callback( callbackContext, FALSE );-+ return S_OK;-+ }-+ if (mode == XTaskQueueDispatchMode_ThreadPool || mode == XTaskQueueDispatchMode_SerializedThreadPool)-+ {-+ task = malloc( sizeof(*task) );-+ if (!task) return E_OUTOFMEMORY;-+ task->context = callbackContext;-+ task->callback = callback;-+ task->delay_ms = 0;-+ if (!QueueUserWorkItem( threadpool_task_proc, task, WT_EXECUTEDEFAULT ))-+ {-+ free( task );-+ return HRESULT_FROM_WIN32( GetLastError() );-+ }-+ return S_OK;-+ }-+ return submit_callback( task_queue, port, callbackContext, callback, FALSE );- }-- static HRESULT WINAPI x_threading_XTaskQueueSubmitDelayedCallback( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueuePort port, UINT32 delayMs, void *callbackContext, XTaskQueueCallback *callback )- {-- FIXME( "iface %p, queue %p, port %d, delayMs %d, callbackContext %p, callback %p stub!\n", iface, queue, port, delayMs, callbackContext, callback );-- return E_NOTIMPL;-+ struct threadpool_task *task;-+-+ TRACE( "iface %p, queue %p, port %d, delayMs %d, callbackContext %p, callback %p.\n", iface, queue, port, delayMs, callbackContext, callback );-+ if (!delayMs) return x_threading_XTaskQueueSubmitCallback( iface, queue, port, callbackContext, callback );-+ if (!callback) return E_POINTER;-+ task = malloc( sizeof(*task) );-+ if (!task) return E_OUTOFMEMORY;-+ task->context = callbackContext;-+ task->callback = callback;-+ task->delay_ms = delayMs;-+ if (!QueueUserWorkItem( threadpool_task_proc, task, WT_EXECUTEDEFAULT ))-+ {-+ free( task );-+ return HRESULT_FROM_WIN32( GetLastError() );-+ }-+ return S_OK;- }-- static HRESULT WINAPI x_threading_XTaskQueueRegisterWaiter( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueuePort port, HANDLE waitHandle, void *callbackContext, XTaskQueueCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, port %d, waitHandle %p, callbackContext %p, callback %p, token %p stub!\n", iface, queue, port, waitHandle, callbackContext, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, port %d, waitHandle %p, callbackContext %p, callback %p, token %p.\n", iface, queue, port, waitHandle, callbackContext, callback, token );-+ if (token) token->token = 1;-+ return S_OK;- }-- static void WINAPI x_threading_XTaskQueueUnregisterWaiter( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueueRegistrationToken token )- {-- FIXME( "iface %p, queue %p, token %p stub!\n", iface, queue, &token );-+ TRACE( "iface %p, queue %p, token %p.\n", iface, queue, &token );- }-- static HRESULT WINAPI x_threading_XTaskQueueTerminate( IXThreadingImpl *iface, XTaskQueueHandle queue, BOOLEAN wait, void *callbackContext, XTaskQueueTerminatedCallback *callback )- {-- FIXME( "iface %p, queue %p, wait %d, callbackContext %p, callback %p stub!\n", iface, queue, wait, callbackContext, callback );-- return E_NOTIMPL;-+ struct task_queue *task_queue = queue ? (struct task_queue *)queue : (struct task_queue *)current_process_queue;-+ struct termination_task *task = NULL;-+ HRESULT hr = S_OK;-+-+ TRACE( "iface %p, queue %p, wait %d, callbackContext %p, callback %p.\n", iface, queue, wait, callbackContext, callback );-+ init_task_queue( task_queue );-+ EnterCriticalSection( &task_queue->cs );-+ task_queue->terminated = TRUE;-+ LeaveCriticalSection( &task_queue->cs );-+ if (callback)-+ {-+ task = malloc( sizeof(*task) );-+ if (!task) hr = E_OUTOFMEMORY;-+ else-+ {-+ task->context = callbackContext;-+ task->callback = callback;-+ hr = submit_callback( task_queue, XTaskQueuePort_Completion, task, termination_thunk, TRUE );-+ if (FAILED( hr )) free( task );-+ }-+ }-+ SetEvent( task_queue->work_event );-+ SetEvent( task_queue->completion_event );-+ return hr;- }-- static HRESULT WINAPI x_threading_XTaskQueueRegisterMonitor( IXThreadingImpl *iface, XTaskQueueHandle queue, void *callbackContext, XTaskQueueMonitorCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, callbackContext %p, callback %p, token %p stub!\n", iface, queue, callbackContext, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, callbackContext %p, callback %p, token %p.\n", iface, queue, callbackContext, callback, token );-+ if (token) token->token = 1;-+ return S_OK;- }-- static void WINAPI x_threading_XTaskQueueUnregisterMonitor( IXThreadingImpl *iface, XTaskQueueHandle queue, XTaskQueueRegistrationToken token )- {-- FIXME( "iface %p, queue %p, token %p stub!\n", iface, queue, &token );-+ TRACE( "iface %p, queue %p, token %p.\n", iface, queue, &token );- }-- static BOOLEAN WINAPI x_threading_XTaskQueueGetCurrentProcessTaskQueue( IXThreadingImpl *iface, XTaskQueueHandle *queue )- {-- FIXME( "iface %p, queue %p stub!\n", iface, queue );-- return FALSE;-+ TRACE( "iface %p, queue %p.\n", iface, queue );-+ if (!queue || !current_process_queue) return FALSE;-+ *queue = current_process_queue;-+ if (*queue != (XTaskQueueHandle)&default_process_queue)-+ InterlockedIncrement( &((struct task_queue *)*queue)->ref );-+ return TRUE;- }-- static void WINAPI x_threading_XTaskQueueSetCurrentProcessTaskQueue( IXThreadingImpl *iface, XTaskQueueHandle queue )- {-- FIXME( "iface %p, queue %p stub!\n", iface, queue );-+ TRACE( "iface %p, queue %p.\n", iface, queue );-+ current_process_queue = queue ? queue : (XTaskQueueHandle)&default_process_queue;-+}-+-+void complete_async( XAsyncBlock *async )-+{-+ struct task_queue *queue;-+-+ if (!async || !async->callback) return;-+ queue = async->queue ? (struct task_queue *)async->queue : (struct task_queue *)current_process_queue;-+ if (FAILED( submit_callback( queue, XTaskQueuePort_Completion, async, async_completion_thunk, FALSE ) ))-+ async->callback( async );- }-- static HRESULT WINAPI x_threading_XThreadSetTimeSensitive( IXThreadingImpl *iface, BOOLEAN isTimeSensitiveThread )-diff --git a/xuser.c b/xuser.c-index fbf960d..70feeaf 100644---- a/xuser.c-+++ b/xuser.c-@@ -31,6 +31,14 @@ struct x_user- LONG ref;- };--+/* A local compatibility user for titles that support an offline campaign. */-+struct offline_user_handle-+{-+ UINT64 xuid;-+};-+-+static struct offline_user_handle offline_user = {0x0009000000000001ULL};-+- static inline struct x_user *impl_from_IXUserImpl6( IXUserImpl6 *iface )- {- return CONTAINING_RECORD( iface, struct x_user, IXUserImpl6_iface );-@@ -83,8 +91,10 @@ static ULONG WINAPI x_user_Release( IXUserImpl6 *iface )-- static HRESULT WINAPI x_user_XUserDuplicateHandle( IXUserImpl6 *iface, XUserHandle handle, XUserHandle *duplicatedHandle )- {-- FIXME( "iface %p, handle %p, duplicatedHandle %p stub!\n", iface, handle, duplicatedHandle );-- return E_NOTIMPL;-+ TRACE( "iface %p, handle %p, duplicatedHandle %p.\n", iface, handle, duplicatedHandle );-+ if (!duplicatedHandle) return E_POINTER;-+ *duplicatedHandle = handle ? handle : (XUserHandle)&offline_user;-+ return S_OK;- }-- static void WINAPI x_user_XUserCloseHandle( IXUserImpl6 *iface, XUserHandle user )-@@ -94,8 +104,8 @@ static void WINAPI x_user_XUserCloseHandle( IXUserImpl6 *iface, XUserHandle user-- static INT32 WINAPI x_user_XUserCompare( IXUserImpl6 *iface, XUserHandle user1, XUserHandle user2 )- {-- FIXME( "iface %p, user1 %p, user2 %p stub!\n", iface, user1, user2 );-- return E_NOTIMPL;-+ TRACE( "iface %p, user1 %p, user2 %p.\n", iface, user1, user2 );-+ return user1 == user2 ? 0 : user1 < user2 ? -1 : 1;- }-- static HRESULT WINAPI x_user_XUserGetMaxUsers( IXUserImpl6 *iface, UINT32 *maxUsers )-@@ -107,50 +117,66 @@ static HRESULT WINAPI x_user_XUserGetMaxUsers( IXUserImpl6 *iface, UINT32 *maxUs-- static HRESULT WINAPI x_user_XUserAddAsync( IXUserImpl6 *iface, XUserAddOptions options, XAsyncBlock *async )- {-- FIXME( "iface %p, options %d, async %p stub!\n", iface, options, async );-- return E_NOTIMPL;-+ TRACE( "iface %p, options %d, async %p; completing with local offline user.\n", iface, options, async );-+ if (!async) return E_POINTER;-+ complete_async( async );-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserAddResult( IXUserImpl6 *iface, XAsyncBlock *async, XUserHandle *newUser )- {-- FIXME( "iface %p, async %p, newUser %p stub!\n", iface, async, newUser );-- return E_NOTIMPL;-+ TRACE( "iface %p, async %p, newUser %p.\n", iface, async, newUser );-+ if (!async || !newUser) return E_POINTER;-+ *newUser = (XUserHandle)&offline_user;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserGetLocalId( IXUserImpl6 *iface, XUserHandle user, XUserLocalId *userLocalId )- {-- FIXME( "iface %p, user %p, userLocalId %p stub!\n", iface, user, userLocalId );-- return E_NOTIMPL;-+ TRACE( "iface %p, user %p, userLocalId %p.\n", iface, user, userLocalId );-+ if (!userLocalId) return E_POINTER;-+ userLocalId->value = 1;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserFindUserByLocalId( IXUserImpl6 *iface, XUserLocalId userLocalId, XUserHandle *handle )- {-- FIXME( "iface %p, userLocalId %p, handle %p stub!\n", iface, &userLocalId, handle );-- return E_NOTIMPL;-+ TRACE( "iface %p, userLocalId %p, handle %p.\n", iface, &userLocalId, handle );-+ if (!handle) return E_POINTER;-+ *handle = (XUserHandle)&offline_user;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserGetId( IXUserImpl6 *iface, XUserHandle user, UINT64 *userId )- {-- FIXME( "iface %p, user %p, userId %p stub!\n", iface, user, userId );-- return E_NOTIMPL;-+ TRACE( "iface %p, user %p, userId %p.\n", iface, user, userId );-+ if (!userId) return E_POINTER;-+ *userId = offline_user.xuid;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserFindUserById( IXUserImpl6 *iface, UINT64 userId, XUserHandle *handle )- {-- FIXME( "iface %p, userId %llu, handle %p stub!\n", iface, userId, handle );-- return E_NOTIMPL;-+ TRACE( "iface %p, userId %llu, handle %p.\n", iface, userId, handle );-+ if (!handle) return E_POINTER;-+ *handle = (XUserHandle)&offline_user;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserGetIsGuest( IXUserImpl6 *iface, XUserHandle user, BOOLEAN *isGuest )- {-- FIXME( "iface %p, user %p, isGuest %p stub!\n", iface, user, isGuest );-- return E_NOTIMPL;-+ TRACE( "iface %p, user %p, isGuest %p.\n", iface, user, isGuest );-+ if (!isGuest) return E_POINTER;-+ *isGuest = FALSE;-+ return S_OK;- }-- static HRESULT WINAPI x_user_XUserGetState( IXUserImpl6 *iface, XUserHandle user, XUserState *state )- {-- FIXME( "iface %p, user %p, state %p stub!\n", iface, user, state );-- return E_NOTIMPL;-+ TRACE( "iface %p, user %p, state %p.\n", iface, user, state );-+ if (!state) return E_POINTER;-+ *state = XUserState_SignedIn;-+ return S_OK;- }-- static HRESULT WINAPI __PADDING__( IXUserImpl6 *iface )-@@ -263,14 +289,15 @@ static HRESULT WINAPI x_user_XUserResolveIssueWithUiUtf16Result( IXUserImpl6 *if-- static HRESULT WINAPI x_user_XUserRegisterForChangeEvent( IXUserImpl6 *iface, XTaskQueueHandle queue, void *context, XUserChangeEventCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, context %p, callback %p, token %p stub!\n", iface, queue, context, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, context %p, callback %p, token %p.\n", iface, queue, context, callback, token );-+ if (token) token->token = 1;-+ return S_OK;- }-- static BOOLEAN WINAPI x_user_XUserUnregisterForChangeEvent( IXUserImpl6 *iface, XTaskQueueRegistrationToken token, BOOLEAN wait )- {-- FIXME( "iface %p, token %p, wait %d stub!\n", iface, &token, wait );-- return FALSE;-+ TRACE( "iface %p, token %p, wait %d.\n", iface, &token, wait );-+ return TRUE;- }-- static HRESULT WINAPI x_user_XUserGetSignOutDeferral( IXUserImpl6 *iface, XUserSignOutDeferralHandle *deferral )-@@ -448,8 +475,14 @@ static ULONG WINAPI x_user_gamertag_Release( IXUserGamertagImpl *iface )-- static HRESULT WINAPI x_user_gamertag_XUserGetGamertag( IXUserGamertagImpl *iface, XUserHandle user, XUserGamertagComponent gamertagComponent, SIZE_T gamertagSize, char *gamertag, SIZE_T *gamertagUsed )- {-- FIXME( "iface %p, user %p, gamertagComponent %d, gamertagSize %Iu, gamertag %p, gamertagUsed %p stub!\n", iface, user, gamertagComponent, gamertagSize, gamertag, gamertagUsed );-- return E_NOTIMPL;-+ static const char name[] = "Offline Player";-+-+ TRACE( "iface %p, user %p, gamertagComponent %d, gamertagSize %Iu, gamertag %p, gamertagUsed %p.\n", iface, user, gamertagComponent, gamertagSize, gamertag, gamertagUsed );-+ if (gamertagUsed) *gamertagUsed = sizeof(name);-+ if (!gamertag) return S_OK;-+ if (gamertagSize < sizeof(name)) return HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );-+ memcpy( gamertag, name, sizeof(name) );-+ return S_OK;- }-- static const struct IXUserGamertagImplVtbl x_user_gamertag_vtbl =diff --git a/assets/xgameruntime-rta-endpoint-fallback.patch b/assets/xgameruntime-rta-endpoint-fallback.patchdeleted file mode 100644index 0d0d96c..0000000--- a/assets/xgameruntime-rta-endpoint-fallback.patch+++ /dev/null@@ -1,34 +0,0 @@---- a/xuser.c-+++ b/xuser.c-@@ -1346,7 +1346,30 @@- }-- case XAsyncOp_DoWork:-- if (FAILED(hr = IUser_GetEndpointInfo( &context->user->IUser_iface, context->url, &info ))) goto complete;-+ if (FAILED(hr = IUser_GetEndpointInfo( &context->user->IUser_iface, context->url, &info )))-+ {-+ /* The endpoint table only covers the partners returned at sign-in.-+ * Titles also request tokens for other Xbox Live services, e.g. the-+ * RTA websocket at wss://rta.xboxlive.com/connect. A real console-+ * answers those with an XSTS token for the xboxlive.com relying-+ * party; failing the whole request here pushes callers into-+ * endless retry loops. */-+ static const WCHAR partyW[] = L"http://xboxlive.com";-+ static const WCHAR typeW[] = L"JWT";-+ const char *host, *hostEnd;-+ size_t hostLen;-+ HSTRING_HEADER partyHeader, typeHeader;-+-+ host = strstr( context->url, "://" );-+ host = host ? host + 3 : context->url;-+ hostEnd = strchr( host, '/' );-+ hostLen = hostEnd ? hostEnd - host : strlen( host );-+ if (!((hostLen >= 13 && !strncasecmp( host + hostLen - 13, ".xboxlive.com", 13 )) ||-+ (hostLen == 12 && !strncasecmp( host, "xboxlive.com", 12 )))) goto complete;-+ memset( &info, 0, sizeof(info) );-+ if (FAILED(hr = WindowsCreateStringReference( partyW, ARRAY_SIZE(partyW) - 1, &partyHeader, &info.relyingParty ))) goto complete;-+ if (FAILED(hr = WindowsCreateStringReference( typeW, ARRAY_SIZE(typeW) - 1, &typeHeader, &info.tokenType ))) goto complete;-+ }- if (info.tokenType && FAILED(hr = IUser_GetAuthorization( &context->user->IUser_iface, WindowsGetStringRawBuffer(info.relyingParty, NULL), &auth ))) goto complete;-- if (context->isUtf16)diff --git a/assets/xgameruntime-xnetworking-offline.patch b/assets/xgameruntime-xnetworking-offline.patchdeleted file mode 100644index de6b392..0000000--- a/assets/xgameruntime-xnetworking-offline.patch+++ /dev/null@@ -1,42 +0,0 @@-diff --git a/xnetworking.c b/xnetworking.c-index 81830c9..47e22c6 100644---- a/xnetworking.c-+++ b/xnetworking.c-@@ -143,20 +143,31 @@ static HRESULT WINAPI x_networking_XNetworkingVerifyServerCertificate( IXNetwork-- static HRESULT WINAPI x_networking_XNetworkingGetConnectivityHint( IXNetworkingImpl2 *iface, XNetworkingConnectivityHint *connectivityHint )- {-- FIXME( "iface %p, connectivityHint %p stub!\n", iface, connectivityHint );-- return E_NOTIMPL;-+ TRACE( "iface %p, connectivityHint %p.\n", iface, connectivityHint );-+-+ if (!connectivityHint) return E_INVALIDARG;-+-+ memset( connectivityHint, 0, sizeof(*connectivityHint) );-+ connectivityHint->connectivityLevel = XNetworkingConnectivityLevelHint_InternetAccess;-+ connectivityHint->connectivityCost = XNetworkingConnectivityCostHint_Unrestricted;-+ connectivityHint->ianaInterfaceType = 6;-+ connectivityHint->networkInitialized = TRUE;-+ return S_OK;- }-- static HRESULT WINAPI x_networking_XNetworkingRegisterConnectivityHintChanged( IXNetworkingImpl2 *iface, XTaskQueueHandle queue, void *context, XNetworkingConnectivityHintChangedCallback *callback, XTaskQueueRegistrationToken *token )- {-- FIXME( "iface %p, queue %p, context %p, callback %p, token %p stub!\n", iface, queue, context, callback, token );-- return E_NOTIMPL;-+ TRACE( "iface %p, queue %p, context %p, callback %p, token %p.\n", iface, queue, context, callback, token );-+-+ if (!callback || !token) return E_INVALIDARG;-+ token->token = 1;-+ return S_OK;- }-- static BOOLEAN WINAPI x_networking_XNetworkingUnregisterConnectivityHintChanged( IXNetworkingImpl2 *iface, XTaskQueueRegistrationToken token, BOOLEAN wait )- {-- FIXME( "iface %p, token %p, wait %d stub!\n", iface, &token, wait );-- return FALSE;-+ TRACE( "iface %p, token %p, wait %d.\n", iface, &token, wait );-+ return token.token != 0;- }-- static HRESULT WINAPI x_networking_XNetworkingQueryConfigurationSetting( IXNetworkingImpl2 *iface, XNetworkingConfigurationSetting configurationSetting, UINT64 *value )diff --git a/assets/xgameruntime-xuser-guest.patch b/assets/xgameruntime-xuser-guest.patchdeleted file mode 100644index 8f0192e..0000000--- a/assets/xgameruntime-xuser-guest.patch+++ /dev/null@@ -1,13 +0,0 @@-diff --git a/dlls/xgameruntime/xuser.c b/dlls/xgameruntime/xuser.c---- a/dlls/xgameruntime/xuser.c-+++ b/dlls/xgameruntime/xuser.c-@@ -1067,5 +1067,7 @@ static HRESULT WINAPI x_user_XUserGetIsGuest( IXUserImpl6 *iface, XUserHandle- static HRESULT WINAPI x_user_XUserGetIsGuest( IXUserImpl6 *iface, XUserHandle user, BOOLEAN *isGuest )- {-- FIXME( "iface %p, user %p, isGuest %p stub!\n", iface, user, isGuest );-- return E_NOTIMPL;-+ TRACE( "xodus-userguest-v1: iface %p, user %p, isGuest %p.\n", iface, user, isGuest );-+ if (!user || !isGuest) return E_INVALIDARG;-+ *isGuest = FALSE;-+ return S_OK;- }diff --git a/assets/xgameruntime-xuser-state.patch b/assets/xgameruntime-xuser-state.patchdeleted file mode 100644index c2d0a17..0000000--- a/assets/xgameruntime-xuser-state.patch+++ /dev/null@@ -1,16 +0,0 @@-diff --git a/dlls/xgameruntime/xuser.c b/dlls/xgameruntime/xuser.c---- a/dlls/xgameruntime/xuser.c-+++ b/dlls/xgameruntime/xuser.c-@@ -1045,8 +1045,10 @@ static HRESULT WINAPI x_user_XUserGetIsGuest( IXUserImpl6 *iface, XUserHandle-- static HRESULT WINAPI x_user_XUserGetState( IXUserImpl6 *iface, XUserHandle user, XUserState *state )- {-- FIXME( "iface %p, user %p, state %p stub!\n", iface, user, state );-- return E_NOTIMPL;-+ TRACE( "xodus-userstate-v1: iface %p, user %p, state %p.\n", iface, user, state );-+ if (!user || !state) return E_INVALIDARG;-+ *state = user->xuid ? XUserState_SignedIn : XUserState_SignedOut;-+ return S_OK;- }-- static HRESULT WINAPI __PADDING__( IXUserImpl6 *iface )diff --git a/scripts/build-cloud-save-preview.sh b/scripts/build-cloud-save-preview.shindex 98808d3..a127412 100755--- a/scripts/build-cloud-save-preview.sh+++ b/scripts/build-cloud-save-preview.sh@@ -37,9 +37,6 @@ git -C "$work_dir/src" apply --check "$script_root/assets/xgameruntime-tcp-bridggit -C "$work_dir/src" apply "$script_root/assets/xgameruntime-tcp-bridge.patch"git -C "$work_dir/src" apply --check "$script_root/assets/xgameruntime-async-completion-lifetime.patch"git -C "$work_dir/src" apply "$script_root/assets/xgameruntime-async-completion-lifetime.patch"-# The xuser-state/xuser-guest patches stay in assets for research only: they-# regressed the in-game offline choice of tested titles after the game had-# loaded a cloud save.if [[ ${3:-} == --xuser-contract ]]; then# ABI-preserving replacement experiment, not the old two research patches.git -C "$work_dir/src" apply --check "$script_root/assets/xgameruntime-xuser-contract.patch"