> ## 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::GetInputReportInfo

> 检索设备定义的原始输入报告的说明。

检索设备定义的原始输入报告的说明。

## 语法

```cpp theme={null}
uint32_t GetInputReportInfo(
    uint32_t infoArrayCount,
    GameInputRawDeviceReportInfo* infoArray
);
```

### 参数

*infoArrayCount*   \_In\_\
类型：uint32\_t

*infoArray* 中的元素数量。若要检索所有输入报告，请传递 [GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md) 返回的值。

*infoArray*   \_Out\_writes\_to\_opt\_(infoArrayCount, return)\
类型：[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\*

指向数组的指针，该数组为每个输入报告接收一个结构。可以为 `nullptr`，在这种情况下不会写入任何内容，并且方法返回 0。

### 返回值

类型：uint32\_t

写入 *infoArray* 的元素数量。该值为 *infoArrayCount* 与设备上输入报告数量中的较小者；如果 *infoArray* 为 `nullptr` 或设备没有输入报告，则为 0。

## 备注

每个元素都是一个 [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) 结构，其 `kind` 成员为 `GameInputRawInputReport`，`id` 成员为设备定义的报告 ID，`size` 成员为报告数据的大小（以字节为单位）。

调用 [GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md) 获取输入报告的数量，分配该大小的数组，然后调用 `GetInputReportInfo` 填充该数组。如果 *infoArrayCount* 小于输入报告的数量，则只写入前 *infoArrayCount* 个元素。在设备保持连接期间，设备的输入报告不会更改，因此你可以只查询一次并缓存结果。

对于 [IGameInputReading::GetRawReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getrawreport.md) 从此设备的读数中返回的原始报告，每个元素的 `id` 成员与 [IGameInputRawDeviceReport::GetReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputrawdevicereport/methods/igameinputrawdevicereport_getreportinfo.md) 返回的报告 ID 相匹配。

以下示例演示如何检索设备的输入报告。

```cpp theme={null}
uint32_t reportCount = device->GetInputReportCount();
std::vector<GameInputRawDeviceReportInfo> reports(reportCount);
reports.resize(device->GetInputReportInfo(reportCount, reports.data()));

for (const GameInputRawDeviceReportInfo& report : reports)
{
    // report.id identifies an input report that can arrive in readings;
    // report.size is the size of its data in bytes.
}
```

在 GameInput v3 及更早版本中，此信息可从 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 返回的 [GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 结构的 `inputReportInfo` 成员中获取。

## 要求

**头文件：** GameInput.h

**库：** gameinput.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md)\
[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\
[GameInputRawDeviceReportKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[IGameInputReading::GetRawReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getrawreport.md)\
[GameInput 高级主题](https://docs.xbox.com/zh-CN/build/core-features/common/input/advanced/input-advanced-topics.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v4** | 引入。 |


## Related topics

- [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)
- [IGameInputDevice::GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md)
- [IGameInputDevice（接口内容）](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)
- [IGameInputDevice::GetFeatureReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md)
- [IGameInputDevice::GetOutputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportinfo.md)
