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

# XGameStreamingGetAssociatedFrame

> XGameStreamingGetAssociatedFrame

# XGameStreamingGetAssociatedFrame

<Info>**非推奨。** この API は 2604 GDK リリース以降非推奨となっており、今後の GDK リリースで削除されます。代替 API はありません。タイトルはレイテンシを考慮したゲームプレイ調整のために代わりに [XGameStreamingGetStreamAddedLatency](/reference/system/xgamestreaming/functions/xgamestreaminggetstreamaddedlatency) を使用してください。</Info>

特定の入力読み取りからフレーム パイプライン トークンを取得します。

## Syntax

```cpp theme={null}
HRESULT XGameStreamingGetAssociatedFrame(  
         IGameInputReading* gamepadReading,  
         D3D12XBOX_FRAME_PIPELINE_TOKEN* framePipelineToken  
)  
```

### Parameters

*gamepadReading*   \_In\_\
型: IGameInputReading\*

照会するゲームパッドの読み取り。

*framePipelineToken*   \_Out\_\
型: D3D12XBOX\_FRAME\_PIPELINE\_TOKEN\*

プレイヤーが入力を行った時点でクライアントのデバイスに表示されていたフレームに関連付けられているフレーム パイプライン トークン。このパイプライン トークンは、ゲームが present してクライアント デバイスに送信した際の PresentX 呼び出しに対応します。

### Return value

型: HRESULT

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

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

| エラー コード                                      | エラー値       | エラーの理由                                                                                                                                                     |
| -------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED           | 0x89245400 | XGameStreaming ランタイムが初期化されていません。他の API を呼び出す前に [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) を呼び出してください。 |
| E\_GAMESTREAMING\_NO\_DATA                   | 0x89245402 | 要求されたデータは利用できません。データは後で利用可能になる場合があります。                                                                                                                     |
| E\_GAMESTREAMING\_NOT\_STREAMING\_CONTROLLER | 0x89245404 | 現在の読み取りはストリーミング コントローラーからのものではありません。                                                                                                                       |

## Remarks

プレイヤーがゲームをストリーミング中に、入力が行われた時点でプレイヤーのデバイスに表示されていた特定のフレームに基づいてゲームの動作を変更する必要がある場合、`XGameStreamingGetAssociatedFrame` を利用できます。

これにより、ゲームは現在のフレームではなく、入力時にプレイヤーが見ていたフレームに基づいてシミュレーションを決定できます。

`XGameStreamingGetAssociatedFrame` は、新しい入力読み取りが作成されたときに表示されていたフレームに関する情報のみをゲームに提供できます。プレイヤーによる入力がなかった時点で何が表示されていたかを判定する必要がある場合、ゲームは [XGameStreamingGetLastFrameDisplayed](/reference/system/xgamestreaming/functions/xgamestreaminggetlastframedisplayed) を利用する必要があります。

## Example

```C++ theme={null}
// In this example, when processing input, the game would like to pass along the frame 
// that was being displayed to the player at the time of input so that their simulation
// engine can take that into account.

// The framePipelineToken was initially captured at the callback of WaitFrameEventX

void Game::Update(DX::StepTimer const& timer)
{
    IGameInputReading* reading;
    if (SUCCEEDED(g_gameInput->GetCurrentReading(GameInputKindGamepad, g_gamepad, &reading)))
    {
        D3D12XBOX_FRAME_PIPELINE_TOKEN framePipelineToken = D3D12XBOX_FRAME_PIPELINE_TOKEN_NULL;        

        if SUCCEEDED(XGameStreamingGetAssociatedFrame(&reading, &framePipelineToken)) 
        {
            SimulateBasedOnInputAndFrameDisplayed(reading, framePipelineToken);
        }
        else 
        {
            // simulate based on current frame
            SimulateBasedOnInput(reading);
        }

        reading->Release();
    }
}

```

## Requirements

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

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

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

## Conceptual documentation

* [Game streaming latency compensation deep dive](/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive)

## See also

[XGameStreamingGetLastFrameDisplayed](/reference/system/xgamestreaming/functions/xgamestreaminggetlastframedisplayed)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members#Latency)\
[Game Streaming Latency Compensation Overview](/build/core-features/common/game-streaming/game-streaming-latency-compensation-overview)


## Related topics

- [XGameStreamingGetLastFrameDisplayed](/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetlastframedisplayed.md)
- [ゲーム ストリーミング レイテンシー補正の詳細](/ja-jp/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive.md)
- [XGameStreaming](/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md)
- [XGameStreamingGetStreamAddedLatency](/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetstreamaddedlatency.md)
- [XGameStreamingGetClients](/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetclients.md)
