本文介绍了检测是否在Xbox One X上播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们从以下论坛将此问题移至MSDN论坛:
https://github.com/Microsoft/xbox-live-unity-plugin/issues/168
We moved this issue to the MSDN forum from the following forum:https://github.com/Microsoft/xbox-live-unity-plugin/issues/168
我为问一个与Xbox Live Unity插件没有直接关系的问题而道歉,但是任何人都知道可靠(或官方)的方式来检测是否有人在Xbox One X上玩?我想为One X用户增加
的帧速率和/或其他更改,而不是手动切换选项。
推荐答案
诀窍是这个API是16299的新手,所以如果你要发送桌面或移动设备系列的包(而不是只需要Xbox)你需要使用延迟加载:
The trick is that this API is new to 16299, so if you are shipping a package for the Desktop or Mobile device family (instead of just Xbox) you need to use delay loading:
#include <libloaderapi2.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
// Requires the linker settings to include /DELAYLOAD:api-ms-win-gaming-deviceinformation-l1-1-0.dll
if (QueryOptionalDelayLoadedAPI(reinterpret_cast<HMODULE>(&__ImageBase),
"api-ms-win-gaming-deviceinformation-l1-1-0.dll",
"GetGamingDeviceModelInformation",
0))
{
GAMING_DEVICE_MODEL_INFORMATION info = {};
GetGamingDeviceModelInformation(&info);
if (info.vendorId == GAMING_DEVICE_VENDOR_ID_MICROSOFT)
{
switch (info.deviceId)
{
case GAMING_DEVICE_DEVICE_ID_XBOX_ONE:
case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_S:
// This is an Xbox One/Xbox One S (or a Xbox One X DevKit in emulation mode)
break;
case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X:
case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X_DEVKIT:
// This is an Xbox One X (or a Xbox One X DevKit in Scorpio mode)
break;
default:
// This is some unknown device ID
// Should probably assume it's at least as good as an Xbox One X
break;
}
}
}
BTW,您还可以查看。
BTW, you can also look at the SystemInfoUWP sample.
这篇关于检测是否在Xbox One X上播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!