Skip to content

Commit e4ea5a4

Browse files
committed
✨ Add warning for XRNeckSafer
Discussed with layer author; an update is planned, but with no ETA. Warning will be removed automatically when author changes implementation version in JSON metadata. https://gitlab.com/NobiWan/xrnecksafer/-/issues/25 is the biggest one
1 parent e622836 commit e4ea5a4

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ if(WIN32)
118118
linters/windows/OutdatedOpenKneeboardLinter.cpp
119119
linters/windows/ProgramFilesLinter.cpp
120120
linters/windows/UnsignedDllLinter.cpp
121+
linters/windows/XRNeckSaferLinter.cpp
121122
)
122123

123124
target_sources(
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright 2023 Fred Emmott <[email protected]>
2+
// SPDX-License-Identifier: ISC
3+
4+
#include <fmt/core.h>
5+
6+
#include <ShlObj.h>
7+
8+
#include "Linter.hpp"
9+
#include "windows/WindowsAPILayerStore.hpp"
10+
11+
namespace FredEmmott::OpenXRLayers {
12+
13+
class XRNeckSaferLinter final : public Linter {
14+
virtual std::vector<std::shared_ptr<LintError>> Lint(
15+
const APILayerStore* store,
16+
const std::vector<std::tuple<APILayer, APILayerDetails>>& layers) {
17+
auto winStore = dynamic_cast<const WindowsAPILayerStore*>(store);
18+
if (
19+
winStore->GetRegistryBitness()
20+
!= WindowsAPILayerStore::RegistryBitness::Wow64_64) {
21+
return {};
22+
}
23+
24+
std::vector<std::shared_ptr<LintError>> errors;
25+
for (const auto& [layer, details]: layers) {
26+
if (!layer.IsEnabled()) {
27+
continue;
28+
}
29+
if (details.mName != "XR_APILAYER_NOVENDOR_XRNeckSafer") {
30+
continue;
31+
}
32+
if (details.mImplementationVersion != "1") {
33+
continue;
34+
}
35+
errors.push_back(
36+
std::make_shared<LintError>(
37+
"XRNeckSafer has bugs that can cause issues include game crashes, and "
38+
"crashes in other API layers. Disable or uninstall it if you have any "
39+
"issues.",
40+
PathSet {layer.mJSONPath}));
41+
}
42+
return errors;
43+
}
44+
};
45+
46+
static XRNeckSaferLinter gInstance;
47+
48+
}// namespace FredEmmott::OpenXRLayers

0 commit comments

Comments
 (0)