diff options
author | Sergio <42090377+SSUPII@users.noreply.github.com> | 2022-10-18 15:39:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 15:39:29 +0200 |
commit | f3b29d67f42725c51c3b4e920786bd7be9b09000 (patch) | |
tree | 29e71a1977fc57d3769769040087df7bb10e5904 /launcher/RuntimeContext.h | |
parent | 2ee5c6b2a18d12ef21417df2bd5fb83feff2ca10 (diff) | |
parent | 3405fd91c6e116bc0af69a8be48c95e447306b52 (diff) | |
download | PrismLauncher-f3b29d67f42725c51c3b4e920786bd7be9b09000.tar.gz PrismLauncher-f3b29d67f42725c51c3b4e920786bd7be9b09000.tar.bz2 PrismLauncher-f3b29d67f42725c51c3b4e920786bd7be9b09000.zip |
Merge branch 'PrismLauncher:develop' into develop
Diffstat (limited to 'launcher/RuntimeContext.h')
-rw-r--r-- | launcher/RuntimeContext.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/launcher/RuntimeContext.h b/launcher/RuntimeContext.h index c1b71318..70e7d0d1 100644 --- a/launcher/RuntimeContext.h +++ b/launcher/RuntimeContext.h @@ -28,31 +28,38 @@ struct RuntimeContext { QString javaPath; QString system; - QString mappedJavaRealArchitecture() const { - if (javaRealArchitecture == "aarch64") { + QString mappedJavaRealArchitecture() const + { + if (javaRealArchitecture == "amd64") + return "x86_64"; + if (javaRealArchitecture == "i386" || javaRealArchitecture == "i686") + return "x86"; + if (javaRealArchitecture == "aarch64") return "arm64"; - } + if (javaRealArchitecture == "arm" || javaRealArchitecture == "armhf") + return "arm32"; return javaRealArchitecture; } - void updateFromInstanceSettings(SettingsObjectPtr instanceSettings) { + void updateFromInstanceSettings(SettingsObjectPtr instanceSettings) + { javaArchitecture = instanceSettings->get("JavaArchitecture").toString(); javaRealArchitecture = instanceSettings->get("JavaRealArchitecture").toString(); javaPath = instanceSettings->get("JavaPath").toString(); system = currentSystem(); } - QString getClassifier() const { - return system + "-" + mappedJavaRealArchitecture(); - } + QString getClassifier() const { return system + "-" + mappedJavaRealArchitecture(); } // "Legacy" refers to the fact that Mojang assumed that these are the only two architectures - bool isLegacyArch() const { - QSet<QString> legacyArchitectures{"amd64", "x86_64", "i386", "i686", "x86"}; - return legacyArchitectures.contains(mappedJavaRealArchitecture()); + bool isLegacyArch() const + { + const QString mapped = mappedJavaRealArchitecture(); + return mapped == "x86_64" || mapped == "x86"; } - bool classifierMatches(QString target) const { + bool classifierMatches(QString target) const + { // try to match precise classifier "[os]-[arch]" bool x = target == getClassifier(); // try to match imprecise classifier on legacy architectures "[os]" @@ -62,7 +69,8 @@ struct RuntimeContext { return x; } - static QString currentSystem() { + static QString currentSystem() + { #if defined(Q_OS_LINUX) return "linux"; #elif defined(Q_OS_MACOS) |