> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameSaveSubmitUpdate

> XGameSaveSubmitUpdate

# XGameSaveSubmitUpdate

Envía una actualización al servicio XGameSave. Actualiza los blobs de un contenedor.

## Sintaxis

```cpp theme={null}
HRESULT XGameSaveSubmitUpdate(  
         XGameSaveUpdateHandle updateContext  
)  
```

### Parámetros

*updateContext*   \_In\_\
Tipo: XGameSaveUpdateHandle

Identificador del XGameSaveUpdate que se va a actualizar.

### Valor devuelto

Tipo: HRESULT

Resultado de la función.

Errores comunes

* E\_GS\_INVALID\_CONTAINER\_NAME
* E\_GS\_OUT\_OF\_LOCAL\_STORAGE
* E\_GS\_UPDATE\_TOO\_BIG
* E\_GS\_QUOTA\_EXCEEDED
* E\_GS\_CONTAINER\_NOT\_IN\_SYNC
* E\_GS\_CONTAINER\_SYNC\_FAILED
* E\_GS\_HANDLE\_EXPIRED

## Comentarios

<Note>No es seguro llamar a esta función en un subproceso sensible al tiempo. Para obtener más información, consulte [Subprocesos sensibles al tiempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Debe llamar correctamente a [XGameSaveCreateUpdate](/reference/system/xgamesave/functions/xgamesavecreateupdate) antes de realizar esta llamada.

La parte de almacenamiento de esta API está diseñada para transferir fácilmente datos del juego al almacenamiento persistente de forma segura, fiable y transaccional. Queremos asegurarnos de que los datos de respaldo de un contenedor sean siempre coherentes y, por ello, queremos que toda la operación se realice correctamente o falle de forma atómica. No queremos tener una actualización parcial en la que algunos datos de blob sean incoherentes con otros datos del contenedor. Para ello, proporcionamos un contexto de actualización al que se envían las escrituras y eliminaciones de blobs y, cuando está listo, se envía todo el contexto. En la práctica, esto tiene el siguiente aspecto:

Un XGameSaveUpdate se rellenará con acciones de escritura (Write) y eliminación (Delete) que se llevarán a cabo en los blobs del contenedor mediante [XGameSaveSubmitBlobWrite](/reference/system/xgamesave/functions/xgamesavesubmitblobwrite) y [XGameSaveSubmitBlobDelete](/reference/system/xgamesave/functions/xgamesavesubmitblobdelete). Una actualización se completa llamando a [XGameSaveSubmitUpdate](/reference/system/xgamesave/functions/xgamesavesubmitupdate).

Cuando termine con un **XGameSaveUpdate**, ciérrelo mediante el método [XGameSaveCloseUpdate](/reference/system/xgamesave/functions/xgamesavecloseupdate).

En el siguiente ejemplo de C++ se muestra una actualización sincrónica de XGameSave.

```cpp theme={null}
// SYNC Write - should not be called on a time sensitive thread 
//              as this will block until the operation is complete 
void Sample::_SaveDataSync(const char* containerName, const char* containerDisplayName) 
{ 
    HRESULT hr; 
    XGameSaveContainerHandle containerContext; 
    XGameSaveUpdateHandle updateContext; 
  
    hr = XGameSaveCreateContainer(_provider, containerName, &containerContext); 
    if (SUCCEEDED(hr)) 
    { 
        hr = XGameSaveCreateUpdate(containerContext, containerDisplayName, &updateContext); 
    } 
    if (SUCCEEDED(hr)) 
    { 
        hr = XGameSaveSubmitBlobWrite(updateContext, "WorldState", _worldState.data(), _worldState.size()); 
    } 
    if (SUCCEEDED(hr)) 
    { 
        hr = XGameSaveSubmitBlobWrite(updateContext, "PlayerState", _playerState.data(), _playerState.size()); 
    } 
    if (SUCCEEDED(hr)) 
    { 
        hr = XGameSaveSubmitBlobWrite(updateContext, "PlayerInventory", _playerInventory.data(), _playerInventory.size()); 
    } 
    if (SUCCEEDED(hr)) 
    { 
        if (_clearLevelProgress) 
        { 
            hr = XGameSaveSubmitBlobDelete(updateContext, "LevelProgress"); 
        } 
    } 
  
    if (SUCCEEDED(hr)) 
    { 
        hr = XGameSaveSubmitUpdate(updateContext); 
    } 
  
    if (updateContext) 
    { 
        XGameSaveCloseUpdate(updateContext); 
    } 
    if (containerContext) 
    { 
        XGameSaveCloseContainer(containerContext); 
    } 
  
    _HandleContainerUpdateErrors(hr); 
} 
  
  
void Sample::_HandleContainerUpdateErrors(HRESULT hr) 
{ 
    switch (hr) 
    { 
    case E_GS_INVALID_CONTAINER_NAME: 
        // tried to access a container with an invalid name 
        break; 
    case E_GS_OUT_OF_LOCAL_STORAGE: 
        // storage location is full, let the user know that saves won't work till this is fixed 
        break; 
    case E_GS_UPDATE_TOO_BIG: 
        // the blob that we provided was too big, can't be larger than GS_MAX_BLOB_SIZE 
        break; 
    case E_GS_QUOTA_EXCEEDED: 
        // the update we did was larger than our overall quota, need to track that! (see XGameSaveQueryRemainingQuota & XGameSaveQueryRemainingQuotaAsync) 
        break; 
    case E_GS_CONTAINER_NOT_IN_SYNC: 
    case E_GS_CONTAINER_SYNC_FAILED: 
        // need to sync and we are offline ? 
        break; 
    case E_GS_HANDLE_EXPIRED: 
        // need to re-initialize since another device has taken 
        // ownership while we were suspended and/or busy 
        break; 
    } 
} 
```

## Requisitos

**Encabezado:** XGameSave.h

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Documentación conceptual

* [Depuración de partidas guardadas](/build/core-features/common/game-save/game-saves-debugging)
* [Subprocesos sensibles al tiempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Consulte también

[XGameSave](/reference/system/xgamesave/xgamesave_members)\
[XGameSaveCreateUpdate](/reference/system/xgamesave/functions/xgamesavecreateupdate)\
[XGameSaveSubmitBlobWrite](/reference/system/xgamesave/functions/xgamesavesubmitblobwrite)\
[XGameSaveSubmitBlobDelete](/reference/system/xgamesave/functions/xgamesavesubmitblobdelete)\
[XGameSaveCloseUpdate](/reference/system/xgamesave/functions/xgamesavecloseupdate)
[Depuración de partidas guardadas](/build/core-features/common/game-save/game-saves-debugging)


## Related topics

- [XGameSaveCreateUpdate](/es/reference/system/xgamesave/functions/xgamesavecreateupdate.md)
- [XGameSaveSubmitBlobDelete](/es/reference/system/xgamesave/functions/xgamesavesubmitblobdelete.md)
- [XGameSaveSubmitBlobWrite](/es/reference/system/xgamesave/functions/xgamesavesubmitblobwrite.md)
- [XGameSaveGetRemainingQuota](/es/reference/system/xgamesave/functions/xgamesavegetremainingquota.md)
- [Depuración de Game Saves](/es/build/core-features/common/game-save/game-saves-debugging.md)
