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