Compartir a través de


How to use a durable without a package

Durables can be configured with or without a package that is downloaded to the client. A durable without package is easier to configure and use. These types of durables are typically used to gate access to content that is already part of the base game. Many games opt to include the content for add-ons in the base game package because they use the assets for multiplayer or preview purposes even when unlicensed.

Note

Durables without a package are not supported on discs.

Even without a downloadable package, these product types still provide a license according to the Product sharing model for games.

It is not enough to simply check for ownership using XStoreQueryEntitledProductsAsync as this will result in only the purchaser being granted access. Instead, properly check for access to durables using XStoreAcquireLicenseForDurablesAsync:

void AcquireLicenseForDurable(const char* storeId)
{
    auto async = new XAsyncBlock{};
    async->queue = m_asyncQueue;
    async->callback = [](XAsyncBlock* async)
    {
        XStoreLicenseHandle result = {};

        HRESULT hr = XStoreAcquireLicenseForDurablesResult(
            async,
            &result);

        if (SUCCEEDED(hr))
        {
            bool isValid = XStoreIsLicenseValid(result);
            printf("Is valid license: %s\n", isValid? "yes" : "no");
        }
        else
        {
            printf("Error calling XStoreAcquireLicenseForDurablesResult: 0x%x\n", hr);
        }

        delete async;
    };

    HRESULT hr = XStoreAcquireLicenseForDurablesAsync(
        m_xStoreContext,
        storeId,
        async);

    if (FAILED(hr))
    {
        delete async;
        return;
    }
}

See also

Commerce Overview

Manage and license downloadable content (DLC)

XStore API reference