> ## 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.

# XPackageInstallChunksAsync

> XPackageInstallChunksAsync

# XPackageInstallChunksAsync

チャンクのインストールを開始します。

## Syntax

```cpp theme={null}
HRESULT XPackageInstallChunksAsync(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors,  
         uint32_t minimumUpdateIntervalMs,  
         bool suppressUserConfirmation,  
         XAsyncBlock* asyncBlock  
)  
```

### Parameters

*packageIdentifier*   \_In\_z\_\
型: char\*

ディスク上のインストール済みパッケージを一意に識別する文字列。パッケージ識別子の詳細については、[ダウンロード可能なコンテンツ (DLC) の管理およびライセンス](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages) を参照してください。

*selectorCount*   \_In\_\
型: uint32\_t

*selectors* パラメーター内のセレクターの数。

*selectors*   \_In\_reads\_(selectorCount)\
型: [XPackageChunkSelector\*](/reference/system/xpackage/structs/xpackagechunkselector)

インストールするチャンクを指定するセレクターの配列。

*minimumUpdateIntervalMs*   \_In\_\
型: uint32\_t

更新の間隔 (ミリ秒単位)。

*suppressUserConfirmation*   \_In\_\
型: bool

インストールするチャンクが事前設定されたサイズを超える場合、確認プロンプトが表示されます。*suppressUserConfirmation* が true の場合、プロンプトは表示されず、ユーザーが承諾したかのようにインストールが進行します。これにより、ゲームは独自の UI を表示できます。ゲームがこれを使用する場合、[XPackageEstimateDownloadSize](/reference/system/xpackage/functions/xpackageestimatedownloadsize) を呼び出して、ユーザーに表示されるサイズも取得する必要があります。[XPackageEstimateDownloadSize](/reference/system/xpackage/functions/xpackageestimatedownloadsize) はまた、サイズがプロンプトを表示するのに十分な大きさかどうかを示すブール値を返します。ダウンロード確認が必要な場合、ゲームは独自の UI を使用して表示するか、**XPackageInstallChunks** に表示させる必要があります。

*asyncBlock*   \_Inout\_\
型: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

非同期呼び出しの状態を監視するための **XAsyncBlock**。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。

## Remarks

[XPackageInstallChunks](/reference/system/xpackage/functions/xpackageinstallchunks) には非同期バリアントがあります。チャンクのインストールでは、ダウンロード サイズを承諾するようユーザーに促す場合があります。

この例では、非同期 API を使用して BigMaps をインストールする方法を示します:

```cpp theme={null}
void CALLBACK BigMapsInstallProgress(
    void* /* context */,
    XPackageInstallationMonitorHandle monitor)
{
    XPackageInstallationProgress progress;
    XPackageGetInstallationProgress(monitor, &progress);
    if (progress.completed)
    {
        printf("BigMaps Installed\n");
        XPackageCloseInstallationMonitorHandle(monitor);
    }
}

void CALLBACK BigMapsAsyncInstallComplete(XAsyncBlock* asyncBlock)
{
    XPackageInstallationMonitorHandle monitor;
    HRESULT hr = XPackageInstallChunksResult(asyncBlock, &monitor);
    delete asyncBlock;

    if (SUCCEEDED(hr))
    {
        XTaskQueueRegistrationToken token;
        if (FAILED(XPackageRegisterInstallationProgressChanged(
            monitor,
            nullptr,
            BigMapsInstallProgress, &token)))
        {
            XPackageCloseInstallationMonitorHandle(monitor);
        }
    }
}

HRESULT InstallBigMapsAsync(XTaskQueueHandle queue)
{
    char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];
    HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
    if (FAILED(hr)) return hr;

    XPackageChunkSelector selector;
    selector.type = XPackageChunkSelectorType::Tag;
    selector.tag = "BigMaps";

    XAsyncBlock* asyncBlock = new (std::nothrow) XAsyncBlock{};
    asyncBlock->callback = BigMapsAsyncInstallComplete;
    asyncBlock->queue = queue;

    hr = XPackageInstallChunksAsync(
        id, 1, &selector, 1000,
        false, asyncBlock);

    if (FAILED(hr))
    {
        delete asyncBlock;
    }

    return hr;
}
```

## Requirements

**ヘッダー:** XPackage.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [非同期プログラミングの設計目標と改善](/build/core-features/common/async/async-whitepaper)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[ストリーミング インストールとインテリジェント デリバリー](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)\
[XPackageInstallChunks](/reference/system/xpackage/functions/xpackageinstallchunks)


## Related topics

- [XPackageInstallChunksResult](/ja-jp/reference/system/xpackage/functions/xpackageinstallchunksresult.md)
- [XPackage](/ja-jp/reference/system/xpackage/xpackage_members.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageInstallChunks](/ja-jp/reference/system/xpackage/functions/xpackageinstallchunks.md)
- [XPackageChangeChunkInstallOrder](/ja-jp/reference/system/xpackage/functions/xpackagechangechunkinstallorder.md)
