From 545944cb0de33438b0584785a900045eb35ecd58 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 15 Oct 2022 12:41:16 +0200 Subject: [PATCH 1/2] refactor: support armhf Signed-off-by: Sefa Eyeoglu --- launcher/RuntimeContext.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/launcher/RuntimeContext.h b/launcher/RuntimeContext.h index c1b71318..bc2ed5c8 100644 --- a/launcher/RuntimeContext.h +++ b/launcher/RuntimeContext.h @@ -29,9 +29,14 @@ struct RuntimeContext { QString system; QString mappedJavaRealArchitecture() const { - if (javaRealArchitecture == "aarch64") { + 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; } @@ -48,8 +53,8 @@ struct RuntimeContext { // "Legacy" refers to the fact that Mojang assumed that these are the only two architectures bool isLegacyArch() const { - QSet legacyArchitectures{"amd64", "x86_64", "i386", "i686", "x86"}; - return legacyArchitectures.contains(mappedJavaRealArchitecture()); + const QString mapped = mappedJavaRealArchitecture(); + return mapped == "x86_64" || mapped == "x86"; } bool classifierMatches(QString target) const { From 3b92ec8e82ca9334e72e7c1a9eddbb0c492277d0 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 15 Oct 2022 12:43:15 +0200 Subject: [PATCH 2/2] chore: clang-format RuntimeContext Signed-off-by: Sefa Eyeoglu --- launcher/RuntimeContext.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/launcher/RuntimeContext.h b/launcher/RuntimeContext.h index bc2ed5c8..70e7d0d1 100644 --- a/launcher/RuntimeContext.h +++ b/launcher/RuntimeContext.h @@ -28,7 +28,8 @@ struct RuntimeContext { QString javaPath; QString system; - QString mappedJavaRealArchitecture() const { + QString mappedJavaRealArchitecture() const + { if (javaRealArchitecture == "amd64") return "x86_64"; if (javaRealArchitecture == "i386" || javaRealArchitecture == "i686") @@ -40,24 +41,25 @@ struct RuntimeContext { 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 { + 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]" @@ -67,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)