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

# XGameStreamingGetTouchBundleVersion

> XGameStreamingGetTouchBundleVersion

# XGameStreamingGetTouchBundleVersion

指定されたデバイスで現在使用されているタッチ アダプテーション バンドルのバージョンを取得します。

## Syntax

```cpp theme={null}
HRESULT XGameStreamingGetTouchBundleVersion(  
        XGameStreamingClientId client,
        XVersion* version,
        size_t versionNameSize,
        char* versionName
)  
```

### Parameters

*client*   \_In\_\
型: XGameStreamingClientId

照会するストリーミング クライアント。

*version*   \_Out\_opt\_\
型: XVersion\*

指定されたクライアントで現在使用されているバンドルのバージョン番号。バンドルにバージョン番号が指定されていない場合、0.0.0.0 が返されます。

*versionNameSize*   \_In\_\
型: size\_t

返される `versionName` の最大サイズ (バイト単位)。指定するサイズは、[XGameStreamingGetTouchBundleVersionNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize) を呼び出すことで取得できます。

*versionName*   \_Out\_writes\_opt\_z\_\
型: char\*

指定されたクライアントで現在使用されているバンドルのバージョン名。バンドルにバージョン名が指定されていない場合、`null` が返されます。

### Return value

型: HRESULT

成功した場合は **S\_OK** を返します。それ以外の場合はエラー コードを返します。

#### 想定されるエラー

| エラー コード                                  | エラー値       | エラーの理由                                                                                                                                                     |
| ---------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED       | 0x89245400 | XGameStreaming ランタイムが初期化されていません。他の API を呼び出す前に [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) を呼び出してください。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 指定されたクライアントが接続されていません。                                                                                                                                     |

エラー コードの一覧については、[Error Codes](/reference/errorcodes) を参照してください。

## Remarks

ゲーム ストリーミング中にプレイヤーに提示されるタッチ レイアウトは、タッチ アダプテーション バンドルの一部として Microsoft にアップロードされた事前定義済みのレイアウトを使用します。`XGameStreamingGetTouchBundleVersion` を使用すると、特定のクライアントで使用されているタッチ コントロールのセットに基づいて、ゲームが実行時に判断を行えます。これが利用されるいくつかの例:

* プレイヤーがタッチを使用しており、要素がタッチ オーバーレイ コントロールを介して利用可能な場合、その要素を HUD から取り除く。
* 表示されるタッチ レイアウトに基づいて、ゲーム内に表示するグラフィカルなヒントを決定する。

`version` は、サービスにアップロードされるバージョンごとに一意です。すべての更新には新しいバージョン番号が必要です。

`versionName` は、特定のバージョン番号に固定するのではなく、セマンティック バージョン (たとえば、これは DLC2 をサポートする一連のレイアウトです) を提供するために使用できます。たとえば、バージョン番号がビルド システムによって自動的に割り当てられる場合、実行時に表示されるタッチ アダプテーション バンドルの正確なバージョン番号をゲーム コード側で把握することが難しい場合があります。バンドルの正確なバージョンを知らなくてもコードでその存在を検出できるようにするため、バージョン番号による比較ではなくバージョン名を使用することを選択できます。

## Example

```C++ theme={null}
void GameStreamingClientManager::GetClientTouchBundleVersion(XGameStreamingClientId client)
{
    // Get the touch bundle version and initialize the touch HUD based on the 
    // semantic version name that was returned
    
    size_t versionNameSize = XGameStreamingGetTouchBundleVersionNameSize(clientId);

    XVersion version{};
    std::vector<char> versionName(versionNameSize, 0);
    XGameStreamingGetTouchBundleVersion(clientId, &version, versionNameSize, &versionName[0]);

    InitializeTouchHUD(versionName);

    if (strcmp("DLC2", versionName.data()) == 0)
    {
        // we have our DLC2 controls, switch to the HUD layout that works best with those overlay controls.
        InitializeHUDForDLC2TouchControls();
    }
}
```

## Requirements

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

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

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

## See also

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#ClientProperties)\
[XGameStreamingGetTouchBundleVersionNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize)


## Related topics

- [XGameStreamingGetTouchBundleVersionNameSize](/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize.md)
- [XGameStreamingClientProperty](/ja-jp/reference/system/xgamestreaming/enums/xgamestreamingclientproperty.md)
- [XGameStreaming](/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md)
- [Pack コマンド](/ja-jp/build/core-features/common/game-streaming/tak-command-line-tool/game-streaming-tak-command-line-pack-command.md)
- [GDK 向け Unity C# API ラッパー](/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
