disable cpu model check on xbox as it doesn't work and can even crash the app for some users

This commit is contained in:
Tunip3 2021-09-02 18:21:16 +01:00
parent bb0fe6c2d1
commit 9228a6f8ab
2 changed files with 36 additions and 31 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap mp rescap">
<Identity Name="1e4cf179-f3c2-404f-b9f3-cb2070a5aad8" Publisher="CN=libretro" Version="1.9.0.0" />
<mp:PhoneIdentity PhoneProductId="1e4cf179-f3c2-404f-b9f3-cb2070a5aad8" PhonePublisherId="00000000-0000-0000-0000-000000000000" />

View File

@ -830,46 +830,51 @@ extern "C" {
return rarch_get_language_from_iso(lang_iso);
}
const char *uwp_get_cpu_model_name(void)
const char* uwp_get_cpu_model_name(void)
{
Platform::String^ cpu_id = nullptr;
Platform::String^ cpu_name = nullptr;
/* GUID_DEVICE_PROCESSOR: {97FADB10-4E33-40AE-359C-8BEF029DBDD0} */
Platform::String^ if_filter = L"System.Devices.InterfaceClassGuid:=\"{97FADB10-4E33-40AE-359C-8BEF029DBDD0}\"";
if (!is_running_on_xbox())
{
Platform::String^ cpu_id = nullptr;
Platform::String^ cpu_name = nullptr;
/* Enumerate all CPU DeviceInterfaces, and get DeviceInstanceID of the first one. */
cpu_id = RunAsyncAndCatchErrors<Platform::String^>([&]() {
return create_task(DeviceInformation::FindAllAsync(if_filter)).then(
[&](DeviceInformationCollection^ collection)
/* GUID_DEVICE_PROCESSOR: {97FADB10-4E33-40AE-359C-8BEF029DBDD0} */
Platform::String^ if_filter = L"System.Devices.InterfaceClassGuid:=\"{97FADB10-4E33-40AE-359C-8BEF029DBDD0}\"";
/* Enumerate all CPU DeviceInterfaces, and get DeviceInstanceID of the first one. */
cpu_id = RunAsyncAndCatchErrors<Platform::String^>([&]() {
return create_task(DeviceInformation::FindAllAsync(if_filter)).then(
[&](DeviceInformationCollection^ collection)
{
return dynamic_cast<Platform::String^>(
collection->GetAt(0)->Properties->Lookup(L"System.Devices.DeviceInstanceID"));
});
}, nullptr);
if (cpu_id)
{
Platform::String^ dev_filter = L"System.Devices.DeviceInstanceID:=\"" + cpu_id + L"\"";
if (cpu_id)
{
Platform::String^ dev_filter = L"System.Devices.DeviceInstanceID:=\"" + cpu_id + L"\"";
/* Get the Device with the same ID as the DeviceInterface
* Then get the name (description) of that Device
* We have to do this because the DeviceInterface we get doesn't have a proper description. */
cpu_name = RunAsyncAndCatchErrors<Platform::String^>([&]() {
return create_task(
DeviceInformation::FindAllAsync(dev_filter, {}, DeviceInformationKind::Device)).then(
[&](DeviceInformationCollection^ collection)
{
return cpu_name = collection->GetAt(0)->Name;
});
/* Get the Device with the same ID as the DeviceInterface
* Then get the name (description) of that Device
* We have to do this because the DeviceInterface we get doesn't have a proper description. */
cpu_name = RunAsyncAndCatchErrors<Platform::String^>([&]() {
return create_task(
DeviceInformation::FindAllAsync(dev_filter, {}, DeviceInformationKind::Device)).then(
[&](DeviceInformationCollection^ collection)
{
return cpu_name = collection->GetAt(0)->Name;
});
}, nullptr);
}
if (!cpu_name)
return "Unknown";
}
wcstombs(win32_cpu_model_name, cpu_name->Data(), sizeof(win32_cpu_model_name));
return win32_cpu_model_name;
if (!cpu_name)
return "Unknown";
wcstombs(win32_cpu_model_name, cpu_name->Data(), sizeof(win32_cpu_model_name));
return win32_cpu_model_name;
}
else
return "Unknown";
}
}