chore: use system architecture to detect vulkan layers

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-04-01 12:56:09 -04:00
parent 3e3b92d4c1
commit 4055e34320
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86

View File

@ -19,6 +19,7 @@
#include <QStringList> #include <QStringList>
#include <QDir> #include <QDir>
#include <QString> #include <QString>
#include <QSysInfo>
#include <QtGlobal> #include <QtGlobal>
#include "MangoHud.h" #include "MangoHud.h"
@ -76,7 +77,13 @@ QString getLibraryString()
for (QString vkLayer : vkLayerList) { for (QString vkLayer : vkLayerList) {
// prefer to use architecture specific vulkan layers // prefer to use architecture specific vulkan layers
QStringList manifestNames = { "MangoHud.x86_64.json", "MangoHud.aarch64.json", "MangoHud.json" }; QString currentArch = QSysInfo::currentCpuArchitecture();
if (currentArch == "arm64") {
currentArch = "aarch64";
}
QStringList manifestNames = { QString("MangoHud.%1.json").arg(currentArch), "MangoHud.json" };
QString filePath = ""; QString filePath = "";
for (QString manifestName : manifestNames) { for (QString manifestName : manifestNames) {
@ -87,8 +94,9 @@ QString getLibraryString()
} }
} }
if (filePath.isEmpty()) if (filePath.isEmpty()) {
continue; continue;
}
auto conf = Json::requireDocument(filePath, vkLayer); auto conf = Json::requireDocument(filePath, vkLayer);
auto confObject = Json::requireObject(conf, vkLayer); auto confObject = Json::requireObject(conf, vkLayer);