Merge pull request #965 from getchoo/update-manoghud-detection

This commit is contained in:
Sefa Eyeoglu 2023-04-02 17:55:19 +02:00 committed by GitHub
commit 0a9081cb87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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