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

# XSystemDeviceType

> XSystemDeviceType

# XSystemDeviceType

指示通过调用 [XSystemGetDeviceType](https://docs.xbox.com/zh-CN/reference/system/xsystem/functions/xsystemgetdevicetype.md) 返回的系统设备类型。

## 语法

```cpp theme={null}
enum class XSystemDeviceType  : uint32_t
{
    Unknown              = 0x00,
    Pc                   = 0x01,
    XboxOne              = 0x02,
    XboxOneS             = 0x03,
    XboxOneX             = 0x04,
    XboxOneXDevkit       = 0x05,
    XboxScarlettLockhart = 0x06,
    XboxScarlettAnaconda = 0x07,
    XboxScarlettDevkit   = 0x08
}
```

## 常量

| 常量 | 说明 |
| - | - |
| Unknown | 设备类型未知。当无法确定设备类型时，`XSystemGetDeviceType` 返回此值。 |
| Pc | 设备是 PC。 |
| XboxOne | 设备是 XBOX One。 |
| XboxOneS | 设备是 XBOX One S。 |
| XboxOneX | 设备是 XBOX One X。 |
| XboxOneXDevkit | 设备是 XBOX One X Dev Kit。 |
| XboxScarlettLockhart | 设备是 XBOX Series S。 |
| XboxScarlettAnaconda | 设备是 XBOX Series X。 |
| XboxScarlettDevkit | 设备是 XBOX Series X Dev Kit。 |

## 备注

`XSystemGetDeviceType` 函数没有显式的错误状态。如果无法确定系统设备类型，则返回 `XSystemDeviceType::Unknown` 的值。

可以在游戏早期初始化期间、在调用 [XGameRuntimeInitialize](https://docs.xbox.com/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize.md) 之前调用 `XSystemGetDeviceType`。

以下代码示例获取当前正在使用的系统设备类型。如果在开发工具包上运行，则运行自定义代码以在游戏中启用开发人员功能。

```cpp theme={null}
const XSystemDeviceType deviceType = XSystemGetDeviceType();

const bool deviceIsDevkit = 
    deviceType == XSystemDeviceType::XboxOneXDevkit || 
    deviceType == XSystemDeviceType::XboxScarlettDevkit;

if (deviceIsDevkit)
{
    EnableGameSpecificDevkitFeatures();
}
```

## 要求

**头文件：** XSystem.h

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

## 另请参阅

[XSystem](https://docs.xbox.com/zh-CN/reference/system/xsystem/xsystem_members.md)\
[XSystemGetDeviceType](https://docs.xbox.com/zh-CN/reference/system/xsystem/functions/xsystemgetdevicetype.md)\
[XGameRuntimeInitialize](https://docs.xbox.com/zh-CN/reference/system/xgameruntimeinit/functions/xgameruntimeinitialize.md)


## Related topics

- [XSystemGetDeviceType](https://docs.xbox.com/zh-CN/reference/system/xsystem/functions/xsystemgetdevicetype.md)
- [XSystem（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xsystem/xsystem_members.md)
- [Intelligent Delivery：设备修饰符](https://docs.xbox.com/zh-CN/build/core-features/common/packaging/intelligentdelivery-device.md)
- [了解 PlayFab Party 聊天的工作原理](https://docs.xbox.com/zh-CN/services/playfab/community/voice-communications/concepts-chat.md)
- [Link Android Device ID](https://docs.xbox.com/api-reference/account-management/link-android-device-id.md)
