> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameStreamingGetLastFrameDisplayed

> XGameStreamingGetLastFrameDisplayed

# XGameStreamingGetLastFrameDisplayed

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

ストリーミング クライアントの画面で最後に表示されたフレームのフレーム パイプライン トークンを取得します。

## Syntax

```cpp theme={null}
HRESULT XGameStreamingGetLastFrameDisplayed(  
         XGameStreamingClientId client,  
         D3D12XBOX_FRAME_PIPELINE_TOKEN* framePipelineToken  
)  
```

### Parameters

*client*   \_In\_\
型: XGameStreamingClientId

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

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

クライアント デバイスに最後に表示されたフレーム パイプライン トークン。

### Return value

型: HRESULT

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

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

| エラー コード | エラー値 | エラーの理由 |
| - | - | - |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming ランタイムが初期化されていません。他の API を呼び出す前に [XGameStreamingInitialize](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminginitialize.md) を呼び出してください。 |
| E\_GAMESTREAMING\_CLIENT\_NOT\_CONNECTED | 0x89245401 | 指定されたクライアントが接続されていません。 |
| E\_GAMESTREAMING\_NO\_DATA | 0x89245402 | 要求されたデータは利用できません。データは後で利用可能になる場合があります。 |

## Remarks

プレイヤーがゲームをストリーミング中に、特定のフレームがユーザーの画面に表示されたことの確認に基づいてゲームの動作を変更する必要がある場合、`XGameStreamingGetLastFrameDisplayed` を利用できます。

ゲームがこれを利用する例として、以下のようなケースがあります。

* 視覚的なタイマーの期限が切れ、プレイヤーが期限までにアクションを行わなかった。
* 適切なウィンドウ内でアクションが行われなかった。
* プレイヤーが動作を続けて範囲外に移動し、リカバリーのためのアクションを行わなかった。

`XGameStreamingGetLastFrameDisplayed` は、アクションが行われるべきだったのに行われなかった状況を判定する際に使用します。プレイヤーによって入力が **行われた** ときに何が表示されていたかをゲームが判定する必要がある場合は、[XGameStreamingGetAssociatedFrame](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe.md) を利用してください。

## Example

```C++ theme={null}
// In this example, when processing input, the game would like to pass along the last frame 
// that was being displayed to the player 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)
{
    ...

    D3D12XBOX_FRAME_PIPELINE_TOKEN framePipelineToken = D3D12XBOX_FRAME_PIPELINE_TOKEN_NULL;
    if SUCCEEDED(XGameStreamingGetLastFrameDisplayed(clientId, &framePipelineToken)
    {
        SimulateBasedOnLastFrameDisplayed(framePipelineToken);
    }
    else 
    {
        // don't have last token, potentially simulate based on current frame

        SimulateBasedOnCurrentFrame();
    }

    
      
    ...
}

```

## Requirements

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

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

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

## Conceptual documentation

* [Game streaming latency compensation deep dive](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive.md)

## See also

[XGameStreamingGetAssociatedFrame](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe.md)\
[XGameStreaming](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md#Latency)\
[Game Streaming Latency Compensation Overview](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-latency-compensation-overview.md)


## Related topics

- [XGameStreamingGetAssociatedFrame](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/functions/xgamestreaminggetassociatedframe.md)
- [ゲーム ストリーミング レイテンシー補正の詳細](https://docs.xbox.com/ja-jp/build/core-features/common/game-streaming/game-streaming-latency-compensation-deep-dive.md)
- [XGameStreaming (API の内容)](https://docs.xbox.com/ja-jp/reference/system/xgamestreaming/xgamestreaming_members.md)
- [Unity プロジェクトでの GDK API 用 C# ラッパーの使用](https://docs.xbox.com/ja-jp/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [GetLastXmaFrameBitPosition](https://docs.xbox.com/ja-jp/reference/audio/xma2defs/functions/getlastxmaframebitposition.md)
