共用方式為


XGameSaveGetRemainingQuota

Returns the amount of data available to store using the XGameSave api.

Syntax

HRESULT XGameSaveGetRemainingQuota(  
         XGameSaveProviderHandle provider,  
         int64_t* remainingQuota  
)  

Parameters

provider   _In_
Type: XGameSaveProviderHandle

Handle to the XGameSaveProvider to query remaining data for.

remainingQuota   _Out_
Type: int64_t*

Amount of data available to be used as storage.

Return value

Type: HRESULT

Function result.

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

Each application has a quota on how much data they can save for a user, if this is exceeded any attempts to save more data may fail with E_GS_QUOTA_EXCEEDED. As this is not a fixed size we have exposed access to the remaining quota so the application can try to avoid E_GS_QUOTA_EXCEEDED failures. To give an accurate view we always make sure that any outstanding writes, updates or deletes are handled first before returning since any of these can change the remaining quota. It is recommended that you call this function to make sure there is a reasonable amount of data left to execute a call to XGameSaveSubmitUpdate.

void Sample::_GetQuotaSync(uint64_t* remainingQuota) 
{ 
    HRESULT hr = XGameSaveGetRemainingQuota(_provider, remainingQuota); 
    if (FAILED(hr)) 
    { 
        printf("Error retrieving Quota hr=0x%08x\n", hr); 
    } 
} 

Requirements

Header: XGameSave.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XGameSave
XGameSaveSubmitUpdate
Game save errors