Skip to content

Commit 4f66bf8

Browse files
committed
✨ Specifically warn about OpenXR Toolkit
Singling out OpenXR Toolkit for now as it's the only layer I'm aware of that is explicitly unsupported and known to cause problems. This may become more generic in the future if additional layers become unsupported.
1 parent bd2edc6 commit 4f66bf8

File tree

3 files changed

+66
-23
lines changed

3 files changed

+66
-23
lines changed

.clang-format

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
BasedOnStyle: Google
22
AlignAfterOpenBracket: AlwaysBreak
3-
AlignConsecutiveDeclarations: 'false'
4-
AlignEscapedNewlinesLeft: DontAlign
5-
AlignOperands: 'false'
6-
AlignTrailingComments: 'false'
7-
AllowAllParametersOfDeclarationOnNextLine: 'false'
8-
AllowShortBlocksOnASingleLine: 'false'
9-
AllowShortFunctionsOnASingleLine: false
3+
AlignConsecutiveDeclarations: 'None'
4+
AlignOperands: false
5+
AlignTrailingComments: false
6+
AllowAllParametersOfDeclarationOnNextLine: false
7+
AllowShortBlocksOnASingleLine: 'Never'
8+
AllowShortFunctionsOnASingleLine: 'None'
109
AllowShortIfStatementsOnASingleLine: 'false'
11-
AllowShortLoopsOnASingleLine: 'false'
12-
BinPackArguments: 'false'
13-
BinPackParameters: 'false'
14-
BreakBeforeBinaryOperators: 'true'
15-
ColumnLimit: '80'
16-
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
17-
ConstructorInitializerIndentWidth: '2'
18-
ContinuationIndentWidth: '2'
10+
AllowShortLoopsOnASingleLine: false
11+
BinPackArguments: false
12+
BinPackParameters: false
13+
BreakBeforeBinaryOperators: true
14+
ColumnLimit: 80
15+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
16+
ConstructorInitializerIndentWidth: 2
17+
ContinuationIndentWidth: 2
1918
DeriveLineEnding: false
2019
DerivePointerAlignment: false
2120
IncludeBlocks: Regroup
@@ -46,16 +45,15 @@ IncludeCategories:
4645
CaseSensitive: true
4746
- Regex: '^<[a-z0-9_]+\.h>$'
4847
Priority: 43
49-
IndentRequires: true
50-
IndentWidth: '2'
48+
IndentWidth: 2
5149
LineEnding: 'LF'
52-
MaxEmptyLinesToKeep: '1'
50+
MaxEmptyLinesToKeep: 1
5351
PointerAlignment: Left
5452
ReflowComments: true
55-
SpaceBeforeCpp11BracedList: 'true'
56-
SpaceBeforeAssignmentOperators: 'true'
57-
SpaceBeforeRangeBasedForLoopColon: 'false'
58-
SpacesBeforeTrailingComments: '0'
53+
SpaceBeforeCpp11BracedList: true
54+
SpaceBeforeAssignmentOperators: true
55+
SpaceBeforeRangeBasedForLoopColon: false
56+
SpacesBeforeTrailingComments: 0
5957
Standard: c++20
60-
TabWidth: '2'
58+
TabWidth: 2
6159
UseTab: Never

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ if(WIN32)
111111
linters
112112
PRIVATE
113113
linters/windows/NotADWORDLinter.cpp
114+
linters/windows/OpenXRToolkitLinter.cpp
114115
linters/windows/OutdatedOpenKneeboardLinter.cpp
115116
linters/windows/ProgramFilesLinter.cpp
116117
linters/windows/UnsignedDllLinter.cpp
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 OpenXRToolkitLinter 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_MBUCCHIA_toolkit") {
30+
continue;
31+
}
32+
errors.push_back(std::make_shared<LintError>(
33+
"OpenXR Toolkit is unsupported, and is known to cause crashes and "
34+
"other issues in modern games; you should disable it if you encounter "
35+
"problems.",
36+
PathSet { layer.mJSONPath }));
37+
}
38+
return errors;
39+
}
40+
};
41+
42+
static OpenXRToolkitLinter gInstance;
43+
44+
}// namespace FredEmmott::OpenXRLayers

0 commit comments

Comments
 (0)