├── .gitattributes
├── .github
└── FUNDING.yml
├── .gitignore
├── BuildTargets.targets
├── LICENSE
├── PerformanceMeter.csproj
├── PerformanceMeter.sln
├── PerformanceMeterController.cs
├── Plugin.cs
├── PluginConfig.cs
├── Properties
└── AssemblyInfo.cs
├── README.md
├── Settings.bsml
├── Settings.cs
├── WindowGraph.cs
├── manifest.json
└── screenshot.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: MCJack123
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore References folder
2 | References/
3 | bin/
4 | obj/
5 | Refs/
6 | .vs/
7 | *.csproj.user
8 |
--------------------------------------------------------------------------------
/BuildTargets.targets:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | 1.4
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | $(BeatSaberDir)\IPA\Pending\Plugins
39 |
40 |
41 | $(BeatSaberDir)\Plugins
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | 0 && endColumn > 0)
157 | AssemblyVersion = firstLineStr.Substring(startColumn, endColumn - startColumn);
158 | else
159 | badParse = true;
160 | }
161 | else
162 | badParse = true;
163 | if (badParse)
164 | {
165 | Log.LogError("Build", "BSMOD03", "", assemblyFile, 0, 0, 0, 0, "Unable to parse the AssemblyVersion from {0}", assemblyFile);
166 | if(ErrorOnMismatch)
167 | return false;
168 | badParse = false;
169 | }
170 |
171 | if (PluginVersion != "E.R.R" && AssemblyVersion != PluginVersion)
172 | {
173 | Log.LogError("Build", "BSMOD01", "", assemblyFile, startLine, startColumn + 1, startLine, endColumn + 1, "PluginVersion {0} in manifest.json does not match AssemblyVersion {1} in AssemblyInfo.cs", PluginVersion, AssemblyVersion, assemblyFile);
174 | Log.LogMessage(MessageImportance.High, "PluginVersion {0} does not match AssemblyVersion {1}", PluginVersion, AssemblyVersion);
175 | if(ErrorOnMismatch)
176 | return false;
177 | }
178 | if (!string.IsNullOrEmpty(endLineStr))
179 | {
180 | startColumn = endLineStr.IndexOf('"') + 1;
181 | endColumn = endLineStr.LastIndexOf('"');
182 | if (startColumn > 0 && endColumn > 0)
183 | {
184 | assemblyFileVersion = endLineStr.Substring(startColumn, endColumn - startColumn);
185 | if (AssemblyVersion != assemblyFileVersion)
186 | {
187 | Log.LogWarning("Build", "BSMOD02", "", assemblyFile, endLine, startColumn + 1, endLine, endColumn + 1, "AssemblyVersion {0} does not match AssemblyFileVersion {1} in AssemblyInfo.cs", AssemblyVersion, assemblyFileVersion);
188 | if(ErrorOnMismatch)
189 | return false;
190 | }
191 |
192 | }
193 | else
194 | {
195 | Log.LogWarning("Build", "BSMOD06", "", assemblyFile, 0, 0, 0, 0, "Unable to parse the AssemblyFileVersion from {0}", assemblyFile);
196 | if(ErrorOnMismatch)
197 | return false;
198 | }
199 | }
200 | return true;
201 | }
202 | catch (Exception ex)
203 | {
204 | Log.LogErrorFromException(ex);
205 | return false;
206 | }
207 | ]]>
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 | = 7)
280 | {
281 | CommitShortHash = outText.Substring(0, 7);
282 | return true;
283 | }
284 | }
285 | catch (Win32Exception ex)
286 | {
287 | noGitFound = true;
288 |
289 | }
290 | catch (Exception ex)
291 | {
292 | Log.LogErrorFromException(ex);
293 | return true;
294 | }
295 | try
296 | {
297 | string gitPath = Path.GetFullPath(Path.Combine(ProjectDir, ".git"));
298 | string headPath = Path.Combine(gitPath, "HEAD");
299 | string headContents = null;
300 | if (File.Exists(headPath))
301 | headContents = File.ReadAllText(headPath);
302 | else
303 | {
304 | gitPath = Path.GetFullPath(Path.Combine(ProjectDir, "..", ".git"));
305 | headPath = Path.Combine(gitPath, "HEAD");
306 | if (File.Exists(headPath))
307 | headContents = File.ReadAllText(headPath);
308 | }
309 | headPath = null;
310 | if (!string.IsNullOrEmpty(headContents) && headContents.StartsWith("ref:"))
311 | headPath = Path.Combine(gitPath, headContents.Replace("ref:", "").Trim());
312 | if (File.Exists(headPath))
313 | {
314 | headContents = File.ReadAllText(headPath);
315 | if (headContents.Length >= 7)
316 | CommitShortHash = headContents.Substring(0, 7);
317 | }
318 | }
319 | catch { }
320 | if (CommitShortHash == "local")
321 | {
322 | if(noGitFound)
323 | Log.LogMessage(MessageImportance.High, " 'git' command not found, unable to retrieve current commit hash.");
324 | else
325 | Log.LogMessage(MessageImportance.High, " Unable to retrieve current commit hash.");
326 | }
327 | return true;
328 | ]]>
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
354 |
355 |
356 |
357 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021-2022 JackMacWindows
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/PerformanceMeter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {68EA3912-8A4C-49C1-9CB7-E385986C469D}
9 | Library
10 | Properties
11 | PerformanceMeter
12 | PerformanceMeter
13 | v4.7.2
14 | 9.0
15 | 512
16 | portable
17 | $(ProjectDir)Refs
18 | $(BeatSaberDir)
19 | $(SolutionDir)Refs
20 | $(MSBuildProjectDirectory)\
21 | $(AppOutputBase)=X:\$(AssemblyName)\
22 |
23 |
24 |
25 | true
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | true
34 | bin\Release\
35 |
36 |
37 | prompt
38 | 4
39 | true
40 |
41 |
42 | True
43 |
44 |
45 | True
46 | True
47 |
48 |
49 |
50 |
51 |
52 |
53 | False
54 | $(BeatSaberDir)\Beat Saber_Data\Managed\BeatmapCore.dll
55 | False
56 |
57 |
58 | False
59 | $(BeatSaberDir)\Plugins\BSML.dll
60 | False
61 |
62 |
63 | False
64 | $(BeatSaberDir)\Plugins\BS_Utils.dll
65 | False
66 |
67 |
68 | False
69 | $(BeatSaberDir)\Beat Saber_Data\Managed\GameplayCore.dll
70 | False
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | $(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll
80 | False
81 |
82 |
83 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMLib.dll
84 | False
85 |
86 |
87 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll
88 | False
89 |
90 |
91 | $(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll
92 | False
93 |
94 |
95 | $(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll
96 | False
97 |
98 |
99 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.dll
100 | False
101 |
102 |
103 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.AssetBundleModule.dll
104 |
105 |
106 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
107 | False
108 |
109 |
110 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.TextRenderingModule.dll
111 |
112 |
113 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll
114 | False
115 |
116 |
117 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIElementsModule.dll
118 | False
119 |
120 |
121 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIModule.dll
122 | False
123 |
124 |
125 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.VRModule.dll
126 | False
127 |
128 |
129 | $(BeatSaberDir)\Beat Saber_Data\Managed\Zenject.dll
130 | False
131 | False
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | Settings.cs
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/PerformanceMeter.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30011.22
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerformanceMeter", "PerformanceMeter.csproj", "{68EA3912-8A4C-49C1-9CB7-E385986C469D}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {68EA3912-8A4C-49C1-9CB7-E385986C469D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {68EA3912-8A4C-49C1-9CB7-E385986C469D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {68EA3912-8A4C-49C1-9CB7-E385986C469D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {68EA3912-8A4C-49C1-9CB7-E385986C469D}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {6D8E14F9-0C44-4EFB-84D5-C0F56873299D}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/PerformanceMeterController.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * PerformanceMeterController.cs
3 | * PerformanceMeter
4 | *
5 | * This file defines the main functionality of PerformanceMeter.
6 | *
7 | * This code is licensed under the MIT license.
8 | * Copyright (c) 2021-2022 JackMacWindows.
9 | */
10 |
11 | using System.Reflection;
12 | using System.Collections;
13 | using System.Collections.Generic;
14 | using System.Linq;
15 | using System;
16 | using UnityEngine;
17 | using UnityEngine.UI;
18 | using UnityEngine.XR;
19 | using TMPro;
20 |
21 | namespace PerformanceMeter {
22 | public struct Pair {
23 | public T first;
24 | public U second;
25 | public Pair(T a, U b) {first = a; second = b;}
26 | }
27 |
28 | public class PerformanceMeterController : MonoBehaviour {
29 | public static PerformanceMeterController instance { get; private set; }
30 |
31 | List> energyList = new List>();
32 | List> secondaryEnergyList = new List>();
33 | List misses = new List();
34 | float averageHitValue = 0.0f;
35 | int averageHitValueSize = 0;
36 | float secondaryAverageHitValue = 0.0f;
37 | int secondaryAverageHitValueSize = 0;
38 | ScoreController scoreController;
39 | BeatmapObjectManager objectManager;
40 | IComboController comboController;
41 | GameEnergyCounter energyCounter;
42 | RelativeScoreAndImmediateRankCounter rankCounter;
43 | AudioTimeSyncController audioController;
44 | PauseController pauseController;
45 | GameObject panel;
46 | ILevelEndActions endActions;
47 | bool levelOk = false;
48 | bool levelNotOk = false;
49 | static readonly FieldInfo _beatmapObjectManager = typeof(ScoreController).GetField("_beatmapObjectManager", BindingFlags.NonPublic | BindingFlags.Instance);
50 | static readonly FieldInfo _comboController = typeof(ComboUIController).GetField("_comboController", BindingFlags.NonPublic | BindingFlags.Instance);
51 | static readonly FieldInfo StandardLevelGameplayManager_pauseController = typeof(StandardLevelGameplayManager).GetField("_pauseController", BindingFlags.NonPublic | BindingFlags.Instance);
52 | static readonly FieldInfo MissionLevelGameplayManager_pauseController = typeof(MissionLevelGameplayManager).GetField("_pauseController", BindingFlags.NonPublic | BindingFlags.Instance);
53 |
54 | public void ShowResults() {
55 | if (!levelOk || levelNotOk)
56 | return;
57 | levelOk = false;
58 | levelNotOk = false;
59 | Logger.log.Debug("Found " + energyList.Count() + " primary notes, " + secondaryEnergyList.Count() + " secondary notes");
60 |
61 | panel = new GameObject("PerformanceMeter");
62 | panel.transform.Rotate(22.5f, 0, 0, Space.World);
63 | Canvas canvas = panel.AddComponent