Point users to ARM64 version of Moonlight if running the x86 or x64 versions

This commit is contained in:
Cameron Gutman 2020-12-28 12:27:22 -06:00
parent 2ecfb7af64
commit 565bba6e55
3 changed files with 40 additions and 2 deletions

View File

@ -6,19 +6,55 @@
#include "streaming/session.h"
#include "streaming/streamutils.h"
#ifdef Q_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
SystemProperties::SystemProperties()
{
versionString = QString(VERSION_STR);
hasWindowManager = WMUtils::isRunningWindowManager();
isRunningWayland = WMUtils::isRunningWayland();
isRunningXWayland = isRunningWayland && QGuiApplication::platformName() == "xcb";
QString nativeArch = QSysInfo::currentCpuArchitecture();
#ifdef Q_OS_WIN32
isWow64 = QSysInfo::currentCpuArchitecture() != QSysInfo::buildCpuArchitecture();
{
USHORT processArch, machineArch;
// Use IsWow64Process2 on TH2 and later, because it supports ARM64
auto isWow64Process2 = (decltype(IsWow64Process2)*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process2");
if (isWow64Process2 != nullptr && IsWow64Process2(GetCurrentProcess(), &processArch, &machineArch)) {
switch (machineArch) {
case IMAGE_FILE_MACHINE_I386:
nativeArch = "i386";
break;
case IMAGE_FILE_MACHINE_AMD64:
nativeArch = "x86_64";
break;
case IMAGE_FILE_MACHINE_ARM64:
nativeArch = "arm64";
break;
}
}
isWow64 = nativeArch != QSysInfo::buildCpuArchitecture();
}
#else
isWow64 = false;
#endif
if (nativeArch == "i386") {
friendlyNativeArchName = "x86";
}
else if (nativeArch == "x86_64") {
friendlyNativeArchName = "x64";
}
else {
friendlyNativeArchName = nativeArch.toUpper();
}
#ifndef STEAM_LINK
// Assume we can probably launch a browser if we're in a GUI environment
hasBrowser = hasWindowManager;

View File

@ -15,6 +15,7 @@ public:
Q_PROPERTY(bool isRunningWayland MEMBER isRunningWayland CONSTANT)
Q_PROPERTY(bool isRunningXWayland MEMBER isRunningXWayland CONSTANT)
Q_PROPERTY(bool isWow64 MEMBER isWow64 CONSTANT)
Q_PROPERTY(QString friendlyNativeArchName MEMBER friendlyNativeArchName CONSTANT)
Q_PROPERTY(bool hasWindowManager MEMBER hasWindowManager CONSTANT)
Q_PROPERTY(bool hasBrowser MEMBER hasBrowser CONSTANT)
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
@ -38,6 +39,7 @@ private:
bool isRunningWayland;
bool isRunningXWayland;
bool isWow64;
QString friendlyNativeArchName;
bool hasWindowManager;
bool hasBrowser;
bool hasDiscordIntegration;

View File

@ -405,7 +405,7 @@ ApplicationWindow {
NavigableMessageDialog {
id: wow64Dialog
standardButtons: Dialog.Ok | Dialog.Cancel
text: qsTr("This PC is running a 64-bit version of Windows. Please download the x64 version of Moonlight for the best streaming performance.")
text: qsTr("This PC is running the %1 version of Windows. Please download the %1 version of Moonlight for the best streaming performance.").arg(SystemProperties.friendlyNativeArchName)
onAccepted: {
Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-qt/releases");
}