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

# IGameInputDevice::GetRawDeviceFeature

> デバイスから生の機能レポートを読み取ります。

デバイスから生の機能レポートを読み取ります。

## 構文

```cpp theme={null}
HRESULT GetRawDeviceFeature(
    uint32_t reportId,
    IGameInputRawDeviceReport** report
);
```

### パラメーター

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

読み取る機能レポートの ID。[GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md) から返されるいずれかのレポートの `id` メンバーと一致する必要があります。

*report*   \_COM\_Outptr\_\
型: [IGameInputRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\*\*

デバイスから読み取られた機能レポート データを格納する新しい `IGameInputRawDeviceReport` オブジェクトを受け取ります。失敗した場合は `nullptr` に設定されます。

### 戻り値

型: HRESULT

成功した場合は `S_OK` を返します。指定された ID の機能レポートがデバイスで定義されていない場合は `E_NOTFOUND` を返し、デバイスが集約デバイスの場合は `GAMEINPUT_E_AGGREGATE_OPERATION_NOT_SUPPORTED` を返します。デバイスからレポートを読み取れない場合は、その他のエラー コードを返します。

## 解説

`GetRawDeviceFeature` メソッドは、機能レポートの現在の内容をデバイスに要求し、新しい [IGameInputRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md) オブジェクトで返します。レポートの [GameInputRawDeviceReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) の `kind` メンバーは `GameInputRawFeatureReport` で、そのデータ サイズは [GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md) から返される対応する要素の `size` メンバーと一致します。データを読み取るには、[GetRawDataSize](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/methods/igameinputrawdevicereport_getrawdatasize.md) と [IGameInputRawDeviceReport::GetRawData](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/methods/igameinputrawdevicereport_getrawdata.md) を呼び出します。

デバイスが定義する機能レポートを調べるには、[GetFeatureReportCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) と [GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md) を使用します。現在、機能レポートは HID デバイスに対して公開されています。HID デバイスの場合、レポート データの最初のバイトはレポート ID です。

他の生のレポート メソッドとは異なり、`GetRawDeviceFeature` はデバイスが応答するまで待機してから戻るため、レンダー スレッドや入力ポーリング スレッドなど、時間的制約のあるスレッドでは呼び出さないでください。

```cpp theme={null}
Microsoft::WRL::ComPtr<IGameInputRawDeviceReport> report;
if (SUCCEEDED(device->GetRawDeviceFeature(reportId, &report)))
{
    std::vector<uint8_t> data(report->GetRawDataSize());
    data.resize(report->GetRawData(data.size(), data.data()));
    // Parse the device-specific feature report data...
}
```

GameInput API の中級および高度なユース ケースについては、「[GameInput の高度なトピック](https://docs.xbox.com/ja-jp/build/core-features/common/input/advanced/input-advanced-topics.md)」を参照してください。

## 要件

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

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

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

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[SetRawDeviceFeature](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)\
[GetFeatureReportCount](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)\
[GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[CreateRawDeviceReport](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)\
[IGameInputDevice](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 再導入されました。 |
| **v1** | 削除されました。 |
| **v0** | 導入されました (未実装)。 |

## 付録: 以前のバージョン

### v0

GameInput v0 では、このメソッドは同じシグネチャで宣言されていましたが、実装されていませんでした。詳細については、[IGameInputDevice::GetRawDeviceFeature (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md) を参照してください。


## Related topics

- [IGameInputDevice::GetRawDeviceFeature (非推奨)](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
- [GameInputRawDeviceReportKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)
- [GameInput API メンバー](https://docs.xbox.com/ja-jp/reference/input/gameinput/gameinput_members.md)
- [IGameInputDevice::SetRawDeviceFeature](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)
- [IGameInputDevice::GetFeatureReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md)
