├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── master.yml │ └── pr.yml ├── .gitignore ├── FPS Counter.sln ├── FPS Counter ├── Converters │ └── FpsTargetPercentageColorValueConverter.cs ├── Counters │ ├── FpsCounter.cs │ └── FpsCounterCountersPlus.cs ├── Directory.Build.props ├── FPS Counter.csproj ├── Installers │ ├── AppInstaller.cs │ ├── GamePlayCoreInstaller.cs │ └── MenuInstaller.cs ├── Plugin.cs ├── Resources │ └── Icon.png ├── Settings │ ├── Configuration.cs │ └── UI │ │ ├── SettingsController.cs │ │ ├── SettingsControllerManager.cs │ │ └── Views │ │ ├── mainSettings.bsml │ │ └── mainSettingsCountersPlus.bsml ├── Utilities │ ├── FpsCounterUtils.cs │ └── PluginUtils.cs └── manifest.json ├── LICENSE └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = tab 7 | tab_width = 4 8 | end_of_line = lf 9 | trim_trailing_whitespace = true 10 | charset = utf-8 11 | max_line_length = 200 12 | insert_final_newline = false 13 | 14 | # ReSharper properties 15 | resharper_csharp_indent_style = tab 16 | resharper_csharp_max_line_length = 200 17 | resharper_html_indent_style = tab 18 | resharper_html_max_line_length = 200 19 | resharper_resx_indent_style = tab 20 | resharper_resx_max_line_length = 200 21 | resharper_use_indent_from_vs = false 22 | resharper_vb_indent_style = tab 23 | resharper_vb_max_line_length = 200 24 | resharper_xmldoc_indent_style = tab 25 | resharper_xmldoc_max_line_length = 200 26 | resharper_xml_indent_style = tab 27 | resharper_xml_max_line_length = 200 28 | 29 | # ReSharper inspection severities 30 | resharper_web_config_module_not_resolved_highlighting = warning 31 | resharper_web_config_type_not_resolved_highlighting = warning 32 | resharper_web_config_wrong_module_highlighting = warning 33 | 34 | # Organize usings 35 | dotnet_sort_system_directives_first = true 36 | dotnet_separate_import_directive_groups = false 37 | 38 | # this. preferences 39 | dotnet_style_qualification_for_field = false:warning 40 | dotnet_style_qualification_for_property = false:warning 41 | dotnet_style_qualification_for_method = false:warning 42 | dotnet_style_qualification_for_event = false:warning 43 | 44 | # Language keywords vs BCL types preferences 45 | dotnet_style_predefined_type_for_locals_parameters_members = true:warning 46 | dotnet_style_predefined_type_for_member_access = true:warning 47 | 48 | # Parentheses preferences 49 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent 50 | dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent 51 | dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:silent 52 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent 53 | 54 | # Modifier preferences 55 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning 56 | dotnet_style_readonly_field = true:suggestion 57 | 58 | # Expression-level preferences 59 | dotnet_style_object_initializer = true:suggestion 60 | dotnet_style_collection_initializer = true:suggestion 61 | dotnet_style_explicit_tuple_names = true:suggestion 62 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion 63 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 64 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 65 | dotnet_style_prefer_auto_properties = true:suggestion 66 | dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion 67 | dotnet_style_prefer_conditional_expression_over_return = true:suggestion 68 | dotnet_style_prefer_compound_assignment = true:suggestion 69 | 70 | # Null-checking preferences 71 | dotnet_style_coalesce_expression = true:suggestion 72 | dotnet_style_null_propagation = true:suggestion 73 | 74 | # Parameter preferences 75 | dotnet_code_quality_unused_parameters = non_public:suggestion 76 | 77 | ############################### 78 | # Naming Conventions # 79 | ############################### 80 | 81 | # Style Definitions 82 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case 83 | dotnet_naming_style.uppercase_style.capitalization = all_upper 84 | 85 | # Use upper case for constant fields 86 | dotnet_naming_rule.constant_fields_should_be_upper_case.severity = warning 87 | dotnet_naming_rule.constant_fields_should_be_upper_case.symbols = constant_fields 88 | dotnet_naming_rule.constant_fields_should_be_upper_case.style = uppercase_style 89 | dotnet_naming_symbols.constant_fields.applicable_kinds = field 90 | dotnet_naming_symbols.constant_fields.applicable_accessibilities = * 91 | dotnet_naming_symbols.constant_fields.required_modifiers = const 92 | 93 | # Use upper case for constant fields 94 | dotnet_naming_rule.static_readonly_fields_should_be_upper_case.severity = warning 95 | dotnet_naming_rule.static_readonly_fields_should_be_upper_case.symbols = static_readonly_fields 96 | dotnet_naming_rule.static_readonly_fields_should_be_upper_case.style = uppercase_style 97 | dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field 98 | dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = public 99 | dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly 100 | 101 | ############################### 102 | # C# Code Style Rules # 103 | ############################### 104 | 105 | # var preferences 106 | csharp_style_var_for_built_in_types = true:warning 107 | csharp_style_var_when_type_is_apparent = true:warning 108 | csharp_style_var_elsewhere = true:suggestion 109 | 110 | # Expression-bodied members 111 | csharp_style_expression_bodied_methods = false:suggestion 112 | csharp_style_expression_bodied_constructors = false:suggestion 113 | csharp_style_expression_bodied_operators = false:suggestion 114 | csharp_style_expression_bodied_properties = true:suggestion 115 | csharp_style_expression_bodied_indexers = true:suggestion 116 | csharp_style_expression_bodied_accessors = true:suggestion 117 | csharp_style_expression_bodied_lambdas = true:suggestion 118 | csharp_style_expression_bodied_local_functions = false:warning 119 | 120 | # Pattern-matching preferences 121 | csharp_style_pattern_matching_over_is_with_cast_check = true:warning 122 | csharp_style_pattern_matching_over_as_with_null_check = true:warning 123 | 124 | # Null-checking preferences 125 | csharp_style_throw_expression = true:suggestion 126 | csharp_style_conditional_delegate_call = true:suggestion 127 | 128 | # Modifier preferences 129 | csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion 130 | 131 | # Expression-level preferences 132 | csharp_prefer_braces = true:warning 133 | csharp_style_deconstructed_variable_declaration = true:suggestion 134 | csharp_prefer_simple_default_expression = true:warning 135 | csharp_style_pattern_local_over_anonymous_function = true:suggestion 136 | csharp_style_inlined_variable_declaration = true:warning 137 | 138 | ############################### 139 | # C# Formatting Rules # 140 | ############################### 141 | 142 | # New line preferences 143 | csharp_new_line_before_open_brace = all 144 | csharp_new_line_before_else = true 145 | csharp_new_line_before_catch = true 146 | csharp_new_line_before_finally = true 147 | csharp_new_line_before_members_in_object_initializers = true 148 | csharp_new_line_before_members_in_anonymous_types = true 149 | csharp_new_line_between_query_expression_clauses = true 150 | 151 | # Indentation preferences 152 | csharp_indent_case_contents = true 153 | csharp_indent_switch_labels = true 154 | csharp_indent_labels = flush_left 155 | 156 | # Space preferences 157 | csharp_space_after_cast = true 158 | csharp_space_after_keywords_in_control_flow_statements = true 159 | csharp_space_between_method_call_parameter_list_parentheses = false 160 | csharp_space_between_method_declaration_parameter_list_parentheses = false 161 | csharp_space_between_parentheses = false 162 | csharp_space_before_colon_in_inheritance_clause = true 163 | csharp_space_after_colon_in_inheritance_clause = true 164 | csharp_space_around_binary_operators = before_and_after 165 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 166 | csharp_space_between_method_call_name_and_opening_parenthesis = false 167 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 168 | csharp_space_after_comma = true 169 | csharp_space_after_dot = false 170 | 171 | # Wrapping preferences 172 | csharp_preserve_single_line_statements = false 173 | csharp_preserve_single_line_blocks = true -------------------------------------------------------------------------------- /.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/workflows/master.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ master ] 7 | paths: 8 | - 'FPS Counter.sln' 9 | - 'FPS Counter/**' 10 | - '.github/workflows/main.yml' 11 | 12 | jobs: 13 | Build: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: Setup dotnet 18 | uses: actions/setup-dotnet@v1 19 | with: 20 | dotnet-version: 5.0.x 21 | - name: GetStrippedRefs 22 | env: 23 | FILES_URL: ${{ secrets.BSFILES_URL }} 24 | run: wget --no-check-certificate "$FILES_URL" -q -O bsfiles.zip 25 | - name: ExtractRefs 26 | run: unzip -q -n bsfiles.zip -d ${{github.workspace}}/Refs 27 | - name: Download Mod Dependencies 28 | uses: Goobwabber/download-beatmods-deps@1.2 29 | with: 30 | manifest: ${{github.workspace}}/FPS Counter/manifest.json 31 | - name: Build 32 | id: Build 33 | run: dotnet build --configuration Release 34 | - name: GitStatus 35 | run: git status 36 | - name: Echo Filename 37 | run: echo $BUILDTEXT \($ASSEMBLYNAME\) 38 | env: 39 | BUILDTEXT: Filename=${{ steps.Build.outputs.filename }} 40 | ASSEMBLYNAME: AssemblyName=${{ steps.Build.outputs.assemblyname }} 41 | - name: Upload Artifact 42 | uses: actions/upload-artifact@v1 43 | with: 44 | name: ${{ steps.Build.outputs.filename }} 45 | path: ${{ steps.Build.outputs.artifactpath }} -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: PR Build 2 | 3 | on: 4 | pull_request: 5 | branches: [ master ] 6 | paths: 7 | - 'FPS Counter/**' 8 | - '.github/workflows/**.yml' 9 | 10 | jobs: 11 | Build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Setup dotnet 16 | uses: actions/setup-dotnet@v1 17 | with: 18 | dotnet-version: 5.0.x 19 | - name: GetStrippedRefs 20 | env: 21 | FILES_URL: ${{ secrets.BSFILES_URL }} 22 | run: wget --no-check-certificate "$FILES_URL" -q -O bsfiles.zip 23 | - name: ExtractRefs 24 | run: unzip -q -n bsfiles.zip -d ${{github.workspace}}/Refs 25 | - name: Download Mod Dependencies 26 | uses: Goobwabber/download-beatmods-deps@1.2 27 | with: 28 | manifest: ${{github.workspace}}/FPS Counter/manifest.json 29 | - name: Build 30 | id: Build 31 | run: dotnet build --configuration Release 32 | - name: GitStatus 33 | run: git status 34 | - name: Echo Filename 35 | run: echo $BUILDTEXT \($ASSEMBLYNAME\) 36 | env: 37 | BUILDTEXT: Filename=${{ steps.Build.outputs.filename }} 38 | ASSEMBLYNAME: AssemblyName=${{ steps.Build.outputs.assemblyname }} 39 | - name: Upload Artifact 40 | uses: actions/upload-artifact@v1 41 | with: 42 | name: ${{ steps.Build.outputs.filename }} 43 | path: ${{ steps.Build.outputs.artifactpath }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /FPS Counter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29728.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FPS Counter", "FPS Counter\FPS Counter.csproj", "{58993EA1-2BE4-40A6-A4E6-435E1DD05016}" 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 | {58993EA1-2BE4-40A6-A4E6-435E1DD05016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {58993EA1-2BE4-40A6-A4E6-435E1DD05016}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {58993EA1-2BE4-40A6-A4E6-435E1DD05016}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {58993EA1-2BE4-40A6-A4E6-435E1DD05016}.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 = {7770DED9-9B0C-4C4A-B32C-16AE6ABAB854} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /FPS Counter/Converters/FpsTargetPercentageColorValueConverter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace FPS_Counter.Converters 4 | { 5 | internal static class FpsTargetPercentageColorValueConverter 6 | { 7 | // Allocate beforehand, because invoking a color "constant" will create a new struct every time 8 | private static readonly Color Green = Color.green; 9 | private static readonly Color Yellow = Color.yellow; 10 | private static readonly Color Orange = new Color(1, 0.64f, 0); 11 | private static readonly Color Red = Color.red; 12 | 13 | public static Color Convert(float fpsTargetPercentage) 14 | { 15 | if (fpsTargetPercentage > 0.95f) 16 | { 17 | return Green; 18 | } 19 | 20 | if (fpsTargetPercentage > 0.7f) 21 | { 22 | return Yellow; 23 | } 24 | 25 | if (fpsTargetPercentage > 0.5f) 26 | { 27 | return Orange; 28 | } 29 | 30 | return Red; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /FPS Counter/Counters/FpsCounter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BeatSaberMarkupLanguage; 3 | using FPS_Counter.Settings; 4 | using FPS_Counter.Utilities; 5 | using HMUI; 6 | using SiraUtil.Logging; 7 | using TMPro; 8 | using UnityEngine; 9 | using UnityEngine.XR; 10 | using Zenject; 11 | 12 | namespace FPS_Counter.Counters 13 | { 14 | internal class FpsCounter : IInitializable, ITickable, IDisposable 15 | { 16 | private readonly SiraLog _logger; 17 | private readonly Configuration _config; 18 | private readonly FpsCounterUtils _fpsCounterUtils; 19 | 20 | private int _targetFramerate; 21 | private TMP_Text? _counter; 22 | private float _ringFillPercent = 1; 23 | private ImageView? _image; 24 | 25 | private float _timeLeft; 26 | private int _frameCount; 27 | private float _accumulatedTime; 28 | 29 | internal FpsCounter(SiraLog logger, Configuration config, FpsCounterUtils fpsCounterUtils) 30 | { 31 | _logger = logger; 32 | _config = config; 33 | _fpsCounterUtils = fpsCounterUtils; 34 | } 35 | 36 | public void Initialize() 37 | { 38 | try 39 | { 40 | _logger.Debug("Attempting to Initialize FPS Counter"); 41 | 42 | _targetFramerate = (int) Math.Round(XRDevice.refreshRate); 43 | _logger.Debug($"Target framerate = {_targetFramerate}"); 44 | 45 | var gameObject = new GameObject("FPS Counter"); 46 | 47 | var canvas = gameObject.AddComponent(); 48 | canvas.renderMode = RenderMode.WorldSpace; 49 | gameObject.transform.localScale = Vector3.one / 10; 50 | gameObject.transform.position = new Vector3(0, 3.5f, 8f); 51 | gameObject.transform.rotation = Quaternion.identity; 52 | gameObject.AddComponent().SetRadius(0f); 53 | 54 | var canvasTransform = canvas.transform as RectTransform; 55 | 56 | _counter = BeatSaberUI.CreateText(canvasTransform, string.Empty, Vector3.zero); 57 | _counter.alignment = TextAlignmentOptions.Center; 58 | _counter.fontSize = 2.5f; 59 | _counter.color = Color.white; 60 | _counter.lineSpacing = -50f; 61 | _counter.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 2f); 62 | _counter.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 2f); 63 | _counter.enableWordWrapping = false; 64 | _counter.overflowMode = TextOverflowModes.Overflow; 65 | 66 | if (!_config.ShowRing) 67 | { 68 | return; 69 | } 70 | 71 | _image = _fpsCounterUtils.CreateRing(canvas); 72 | var imageTransform = _image.rectTransform; 73 | imageTransform.anchoredPosition = _counter.rectTransform.anchoredPosition; 74 | imageTransform.localScale *= 0.1f; 75 | } 76 | catch (Exception ex) 77 | { 78 | _logger.Error("FPS Counter Done"); 79 | _logger.Error(ex); 80 | } 81 | } 82 | 83 | public void Tick() 84 | { 85 | _fpsCounterUtils.SharedTicker(ref _accumulatedTime, ref _timeLeft, ref _frameCount, ref _targetFramerate, ref _ringFillPercent, _image, _counter); 86 | } 87 | 88 | public void Dispose() 89 | { 90 | _logger.Debug("FPS Counter got yeeted"); 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /FPS Counter/Counters/FpsCounterCountersPlus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CountersPlus.Counters.Custom; 3 | using FPS_Counter.Settings; 4 | using FPS_Counter.Utilities; 5 | using HMUI; 6 | using SiraUtil.Logging; 7 | using TMPro; 8 | using UnityEngine; 9 | using UnityEngine.XR; 10 | using Zenject; 11 | 12 | namespace FPS_Counter.Counters 13 | { 14 | public class FpsCounterCountersPlus : BasicCustomCounter, ITickable 15 | { 16 | private readonly SiraLog _logger; 17 | private readonly Configuration _config; 18 | private readonly FpsCounterUtils _fpsCounterUtils; 19 | 20 | private readonly Vector3 _ringSize = Vector3.one; 21 | 22 | private int _targetFramerate; 23 | private TMP_Text? _counterText; 24 | private float _ringFillPercent = 1; 25 | private ImageView? _ringImage; 26 | 27 | private float _timeLeft; 28 | private int _frameCount; 29 | private float _accumulatedTime; 30 | 31 | internal FpsCounterCountersPlus(SiraLog logger, Configuration config, FpsCounterUtils fpsCounterUtils) 32 | { 33 | _logger = logger; 34 | _config = config; 35 | _fpsCounterUtils = fpsCounterUtils; 36 | } 37 | 38 | public override void CounterInit() 39 | { 40 | try 41 | { 42 | _logger.Debug("Attempting to Initialize FPS Counter"); 43 | 44 | _targetFramerate = (int) Math.Round(XRDevice.refreshRate); 45 | _logger.Debug($"Target framerate = {_targetFramerate}"); 46 | 47 | _counterText = CanvasUtility.CreateTextFromSettings(Settings); 48 | _counterText.color = Color.white; 49 | _counterText.fontSize = 2.5f; 50 | _counterText.lineSpacing = -50f; 51 | 52 | if (!_config.ShowRing) 53 | { 54 | return; 55 | } 56 | 57 | var canvas = CanvasUtility.GetCanvasFromID(Settings.CanvasID); 58 | if (canvas == null) 59 | { 60 | return; 61 | } 62 | 63 | _ringImage = _fpsCounterUtils.CreateRing(canvas); 64 | _ringImage.rectTransform.anchoredPosition = _counterText.rectTransform.anchoredPosition; 65 | _ringImage.transform.localScale = _ringSize / 10; 66 | } 67 | catch (Exception ex) 68 | { 69 | _logger.Error("FPS Counter Done"); 70 | _logger.Error(ex); 71 | } 72 | } 73 | 74 | public void Tick() 75 | { 76 | _fpsCounterUtils.SharedTicker(ref _accumulatedTime, ref _timeLeft, ref _frameCount, ref _targetFramerate, ref _ringFillPercent, _ringImage, _counterText); 77 | } 78 | 79 | public override void CounterDestroy() 80 | { 81 | _logger.Debug("FPS Counter got yeeted"); 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /FPS Counter/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | True 6 | BSIPA 7 | 8 | -------------------------------------------------------------------------------- /FPS Counter/FPS Counter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net48 4 | Library 5 | 8 6 | enable 7 | ..\Refs 8 | $(LocalRefsDir) 9 | $(MSBuildProjectDirectory)\ 10 | FPS_Counter 11 | FPSCounter 12 | 13 | 14 | 15 | full 16 | 17 | 18 | 19 | pdbonly 20 | 21 | 22 | 23 | True 24 | 25 | 26 | 27 | True 28 | True 29 | 30 | 31 | 32 | 33 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.dll 34 | false 35 | 36 | 37 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll 38 | false 39 | 40 | 41 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UIModule.dll 42 | false 43 | 44 | 45 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.VRModule.dll 46 | false 47 | 48 | 49 | $(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll 50 | false 51 | 52 | 53 | $(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll 54 | false 55 | 56 | 57 | $(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll 58 | false 59 | 60 | 61 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMUI.dll 62 | false 63 | 64 | 65 | $(BeatSaberDir)\Beat Saber_Data\Managed\HMLib.dll 66 | false 67 | 68 | 69 | $(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll 70 | false 71 | 72 | 73 | $(BeatSaberDir)\Libs\Hive.Versioning.dll 74 | false 75 | 76 | 77 | $(BeatSaberDir)\Plugins\BSML.dll 78 | false 79 | 80 | 81 | $(BeatSaberDir)\Beat Saber_Data\Managed\Zenject.dll 82 | false 83 | 84 | 85 | $(BeatSaberDir)\Beat Saber_Data\Managed\Zenject-usage.dll 86 | false 87 | 88 | 89 | $(BeatSaberDir)\Plugins\SiraUtil.dll 90 | false 91 | 92 | 93 | $(BeatSaberDir)\Plugins\Counters+.dll 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | all 112 | build; native; contentfiles; analyzers; buildtransitive 113 | 114 | 115 | -------------------------------------------------------------------------------- /FPS Counter/Installers/AppInstaller.cs: -------------------------------------------------------------------------------- 1 | using FPS_Counter.Settings; 2 | using FPS_Counter.Utilities; 3 | using Zenject; 4 | 5 | namespace FPS_Counter.Installers 6 | { 7 | internal class AppInstaller : Installer 8 | { 9 | private readonly Configuration _configuration; 10 | 11 | public AppInstaller(Configuration configuration) 12 | { 13 | _configuration = configuration; 14 | } 15 | 16 | public override void InstallBindings() 17 | { 18 | Container.BindInstance(_configuration).AsSingle().NonLazy(); 19 | 20 | Container.BindInterfacesAndSelfTo().AsSingle().NonLazy(); 21 | Container.BindInterfacesAndSelfTo().AsSingle(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /FPS Counter/Installers/GamePlayCoreInstaller.cs: -------------------------------------------------------------------------------- 1 | using FPS_Counter.Counters; 2 | using FPS_Counter.Utilities; 3 | using SiraUtil.Logging; 4 | using Zenject; 5 | 6 | namespace FPS_Counter.Installers 7 | { 8 | internal class GamePlayCoreInstaller : Installer 9 | { 10 | private readonly SiraLog _logger; 11 | private readonly GameplayCoreSceneSetupData? _gameplayCoreSceneSetupData; 12 | 13 | public GamePlayCoreInstaller(SiraLog logger, [InjectOptional] GameplayCoreSceneSetupData gameplayCoreSceneSetupData) 14 | { 15 | _logger = logger; 16 | _gameplayCoreSceneSetupData = gameplayCoreSceneSetupData; 17 | } 18 | 19 | public override void InstallBindings() 20 | { 21 | if ((!_gameplayCoreSceneSetupData?.playerSpecificSettings.noTextsAndHuds ?? false) && !Container.Resolve().IsCountersPlusPresent) 22 | { 23 | _logger.Debug($"Binding {nameof(FPSCounter)}"); 24 | 25 | Container.BindInterfacesAndSelfTo().AsSingle().NonLazy(); 26 | 27 | _logger.Debug($"Finished binding {nameof(FPSCounter)}"); 28 | } 29 | else 30 | { 31 | _logger.Debug("Either Counters+ is present or No Text and HUD enabled in PlayerSettings - Not constructing FpsCounter"); 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /FPS Counter/Installers/MenuInstaller.cs: -------------------------------------------------------------------------------- 1 | using FPS_Counter.Settings.UI; 2 | using FPS_Counter.Utilities; 3 | using Zenject; 4 | 5 | namespace FPS_Counter.Installers 6 | { 7 | internal class MenuInstaller : Installer 8 | { 9 | public override void InstallBindings() 10 | { 11 | if (!Container.Resolve().IsCountersPlusPresent) 12 | { 13 | Container.BindInterfacesAndSelfTo().AsSingle(); 14 | Container.BindInterfacesTo().AsSingle(); 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /FPS Counter/Plugin.cs: -------------------------------------------------------------------------------- 1 | using FPS_Counter.Installers; 2 | using FPS_Counter.Settings; 3 | using IPA; 4 | using IPA.Config; 5 | using IPA.Config.Stores; 6 | using IPA.Logging; 7 | using SiraUtil.Zenject; 8 | 9 | namespace FPS_Counter 10 | { 11 | [Plugin(RuntimeOptions.DynamicInit), NoEnableDisable] 12 | public class Plugin 13 | { 14 | [Init] 15 | public Plugin(Logger logger, Config config, Zenjector zenject) 16 | { 17 | zenject.UseLogger(logger); 18 | zenject.UseMetadataBinder(); 19 | 20 | zenject.Install(Location.App, config.Generated()); 21 | zenject.Install(Location.Menu); 22 | zenject.Install(Location.Player); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /FPS Counter/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ErisApps/FPS-Counter/5fa3b4141e9a9d347b9024c312486a82c0dbded3/FPS Counter/Resources/Icon.png -------------------------------------------------------------------------------- /FPS Counter/Settings/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using IPA.Config.Stores; 3 | 4 | [assembly: InternalsVisibleTo(GeneratedStore.AssemblyVisibilityTarget)] 5 | namespace FPS_Counter.Settings 6 | { 7 | internal class Configuration 8 | { 9 | public virtual float UpdateRate { get; set; } = 0.5f; 10 | public virtual bool ShowRing { get; set; } = true; 11 | public virtual bool UseColors { get; set; } = true; 12 | } 13 | } -------------------------------------------------------------------------------- /FPS Counter/Settings/UI/SettingsController.cs: -------------------------------------------------------------------------------- 1 | using BeatSaberMarkupLanguage.Attributes; 2 | 3 | namespace FPS_Counter.Settings.UI 4 | { 5 | internal class SettingsController 6 | { 7 | private readonly Configuration _configuration; 8 | 9 | public SettingsController(Configuration configuration) 10 | { 11 | _configuration = configuration; 12 | } 13 | 14 | [UIValue("update-rate")] 15 | public float FpsUpdateRate 16 | { 17 | get => _configuration.UpdateRate; 18 | set => _configuration.UpdateRate = value; 19 | } 20 | 21 | [UIValue("show-ring")] 22 | public bool ShowFpsRing 23 | { 24 | get => _configuration.ShowRing; 25 | set => _configuration.ShowRing = value; 26 | } 27 | 28 | [UIValue("use-colors")] 29 | public bool FpsUseColors 30 | { 31 | get => _configuration.UseColors; 32 | set => _configuration.UseColors = value; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /FPS Counter/Settings/UI/SettingsControllerManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BeatSaberMarkupLanguage.Settings; 3 | using FPS_Counter.Utilities; 4 | using IPA.Loader; 5 | using SiraUtil.Zenject; 6 | using Zenject; 7 | 8 | namespace FPS_Counter.Settings.UI 9 | { 10 | internal class SettingsControllerManager : IInitializable, IDisposable 11 | { 12 | private readonly PluginMetadata _pluginMetadata; 13 | private readonly PluginUtils _pluginUtils; 14 | private SettingsController? _settingsHost; 15 | 16 | [Inject] 17 | public SettingsControllerManager(UBinder pluginMetadata, PluginUtils pluginUtils, SettingsController settingsHost) 18 | { 19 | _pluginMetadata = pluginMetadata.Value; 20 | _pluginUtils = pluginUtils; 21 | _settingsHost = settingsHost; 22 | } 23 | 24 | public void Initialize() 25 | { 26 | if (!_pluginUtils.IsCountersPlusPresent) 27 | { 28 | BSMLSettings.instance.AddSettingsMenu(_pluginMetadata.Name, "FPS_Counter.Settings.UI.Views.mainSettings.bsml", _settingsHost); 29 | } 30 | } 31 | 32 | public void Dispose() 33 | { 34 | if (_settingsHost == null) 35 | { 36 | return; 37 | } 38 | 39 | BSMLSettings.instance.RemoveSettingsMenu(_settingsHost); 40 | _settingsHost = null!; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /FPS Counter/Settings/UI/Views/mainSettings.bsml: -------------------------------------------------------------------------------- 1 |  3 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FPS Counter/Settings/UI/Views/mainSettingsCountersPlus.bsml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FPS Counter/Utilities/FpsCounterUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using FPS_Counter.Converters; 4 | using FPS_Counter.Settings; 5 | using HMUI; 6 | using TMPro; 7 | using UnityEngine; 8 | using UnityEngine.UI; 9 | 10 | namespace FPS_Counter.Utilities 11 | { 12 | internal class FpsCounterUtils : IDisposable 13 | { 14 | private const string NO_GLOW_MATERIAL_NAME = "UINoGlow"; 15 | private const string MULTIPLIER_IMAGE_SPRITE_NAME = "Circle"; 16 | 17 | private readonly Configuration _config; 18 | 19 | private static Material? _noGlowMaterial; 20 | private static Sprite? _multiplierImageSprite; 21 | 22 | internal static Material NoGlowMaterial => _noGlowMaterial ??= new Material(Resources.FindObjectsOfTypeAll().First(m => m.name == NO_GLOW_MATERIAL_NAME)); 23 | internal static Sprite MultiplierImageSprite => _multiplierImageSprite ??= Resources.FindObjectsOfTypeAll().First(x => x.name == MULTIPLIER_IMAGE_SPRITE_NAME); 24 | 25 | public FpsCounterUtils(Configuration config) 26 | { 27 | _config = config; 28 | } 29 | 30 | public void Dispose() 31 | { 32 | _noGlowMaterial = null; 33 | _multiplierImageSprite = null; 34 | } 35 | 36 | // Pretty much yoinked from https://github.com/Caeden117/CountersPlus/blob/master/Counters%2B/Counters/ProgressCounter.cs#L93-L110 37 | // Please don't smite me 38 | internal ImageView CreateRing(Canvas canvas) 39 | { 40 | var ringGo = new GameObject("Ring Image", typeof(RectTransform)); 41 | ringGo.transform.SetParent(canvas.transform, false); 42 | var ringImage = ringGo.AddComponent(); 43 | ringImage.enabled = false; 44 | ringImage.material = NoGlowMaterial; 45 | ringImage.sprite = MultiplierImageSprite; 46 | ringImage.type = Image.Type.Filled; 47 | ringImage.fillClockwise = true; 48 | ringImage.fillOrigin = 2; 49 | ringImage.fillMethod = Image.FillMethod.Radial360; 50 | // ReSharper disable once Unity.InefficientPropertyAccess 51 | ringImage.enabled = true; 52 | return ringImage; 53 | } 54 | 55 | internal void SharedTicker(ref float accumulatedTime, ref float timeLeft, ref int frameCount, ref int targetFramerate, ref float ringFillPercent, Image? percentageRing, TMP_Text? text) 56 | { 57 | var localDeltaTime = Time.deltaTime; 58 | accumulatedTime += Time.timeScale / localDeltaTime; 59 | timeLeft -= localDeltaTime; 60 | ++frameCount; 61 | 62 | if (_config.ShowRing && percentageRing) 63 | { 64 | // Animate the ring Fps indicator to it's final value with every update invocation 65 | percentageRing!.fillAmount = Mathf.Lerp(percentageRing.fillAmount, ringFillPercent, 2 * localDeltaTime); 66 | } 67 | 68 | if (timeLeft > 0.0) 69 | { 70 | // The time to update hasn't come yet. 71 | return; 72 | } 73 | 74 | var fps = Mathf.Round(accumulatedTime / frameCount); 75 | text!.text = $"FPS\n{fps}"; 76 | ringFillPercent = fps / targetFramerate; 77 | 78 | if (_config.UseColors) 79 | { 80 | var color = FpsTargetPercentageColorValueConverter.Convert(ringFillPercent); 81 | text.color = color; 82 | if (percentageRing) 83 | { 84 | percentageRing!.color = color; 85 | } 86 | } 87 | 88 | timeLeft = _config.UpdateRate; 89 | accumulatedTime = 0.0f; 90 | frameCount = 0; 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /FPS Counter/Utilities/PluginUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using IPA.Loader; 4 | using SiraUtil.Logging; 5 | using Zenject; 6 | 7 | namespace FPS_Counter.Utilities 8 | { 9 | internal class PluginUtils : IInitializable, IDisposable 10 | { 11 | private const string COUNTERS_PLUS_MOD_ID = "Counters+"; 12 | 13 | private readonly SiraLog _logger; 14 | internal bool IsCountersPlusPresent { get; private set; } 15 | 16 | public PluginUtils(SiraLog logger) 17 | { 18 | _logger = logger; 19 | } 20 | 21 | public void Initialize() 22 | { 23 | RegisterPluginChangeListeners(); 24 | 25 | _logger.Info("Checking for Counters+"); 26 | var pluginMetaData = PluginManager.EnabledPlugins.FirstOrDefault(x => x.Id == COUNTERS_PLUS_MOD_ID); 27 | if (pluginMetaData == null) 28 | { 29 | return; 30 | } 31 | 32 | if (pluginMetaData.HVersion.Major < 2) 33 | { 34 | _logger.Warn($"Version {pluginMetaData.HVersion} of Counters+ has been found, but is deemed incompatible with FPS Counter. NOT INTEGRATING!"); 35 | return; 36 | } 37 | 38 | IsCountersPlusPresent = true; 39 | _logger.Info("Found Counters+"); 40 | } 41 | 42 | public void Dispose() 43 | { 44 | UnregisterPluginChangeListeners(); 45 | 46 | IsCountersPlusPresent = false; 47 | } 48 | 49 | private void RegisterPluginChangeListeners() 50 | { 51 | PluginManager.PluginEnabled += OnPluginEnabled; 52 | PluginManager.PluginDisabled += OnPluginDisabled; 53 | } 54 | 55 | private void UnregisterPluginChangeListeners() 56 | { 57 | PluginManager.PluginEnabled -= OnPluginEnabled; 58 | PluginManager.PluginDisabled -= OnPluginDisabled; 59 | } 60 | 61 | private void OnPluginEnabled(PluginMetadata plugin, bool needsRestart) 62 | { 63 | if (needsRestart) 64 | { 65 | return; 66 | } 67 | 68 | switch (plugin.Id) 69 | { 70 | case COUNTERS_PLUS_MOD_ID when plugin.HVersion.Major < 2: 71 | IsCountersPlusPresent = true; 72 | return; 73 | } 74 | } 75 | 76 | private void OnPluginDisabled(PluginMetadata plugin, bool needsRestart) 77 | { 78 | if (needsRestart) 79 | { 80 | return; 81 | } 82 | 83 | switch (plugin.Id) 84 | { 85 | case COUNTERS_PLUS_MOD_ID when plugin.HVersion.Major >= 2: 86 | IsCountersPlusPresent = false; 87 | return; 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /FPS Counter/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/beat-saber-modding-group/BSIPA-MetadataFileSchema/master/Schema.json", 3 | "id": "FPSCounter", 4 | "name": "FPS Counter", 5 | "icon": "FPS_Counter.Resources.Icon.png", 6 | "description": "A Beat Saber mod to show your fps in-game.", 7 | "author": "Eris", 8 | "gameVersion": "1.22.0", 9 | "version": "3.1.0", 10 | "dependsOn": { 11 | "BSIPA": "^4.2.2", 12 | "BeatSaberMarkupLanguage": "^1.6.3", 13 | "SiraUtil": "^3.0.6" 14 | }, 15 | "loadAfter": [ 16 | "Counters+" 17 | ], 18 | "features": { 19 | "CountersPlus.CustomCounter": { 20 | "Name": "FPS Counter", 21 | "CounterLocation": "FPS_Counter.Counters.FpsCounterCountersPlus", 22 | "MultiplayerReady": true, 23 | "BSML": { 24 | "Resource": "FPS_Counter.Settings.UI.Views.mainSettingsCountersPlus.bsml", 25 | "Host": "FPS_Counter.Settings.UI.SettingsController", 26 | "Icon": "FPS_Counter.Resources.Icon.png" 27 | } 28 | } 29 | }, 30 | "links": { 31 | "project-source": "https://github.com/ErisApps/FPS-Counter" 32 | } 33 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Steven 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FPS-Counter 2 | A Beat Saber mod to show your fps in-game. 3 | 4 | ## Installation 5 | 6 | Below, you can find the few mods that this mods requires. You'll also find the versions that I used to test. 7 | - BSIPA v4.2.2 or higher 8 | - BeatSaberMarkupLanguage v1.6.3 or higher 9 | - SiraUtil v3.0.6 or higher 10 | - Counters+ v2.0.0 or higher (Optional, use v2.3.0 or higher for multiplayer integration) 11 | 12 | Since version 3.0.0 of FPS Counter, support for Counters+ v1.x.x integration has been dropped because it was simply not possible. 13 | This doesn't mean that both mods can't be used simultaneously, however all the extra features that come along with the Counters+ integration won't be available. 14 | 15 | If you still insist on keeping Counters+ 1.x.x and want to preserve the FPS Counter integration, I recommend you to stay on version 2.2.6 of FPS Counter for a little while longer. 16 | However, as my time still is limited, keep in mind that I won't be offering support for the older 2.x.x versions. 17 | 18 | The installation itself is fairly simple. 19 | 20 | 1) Grab the latest plugin release from [the releases page](https://github.com/ErisApps/FPS-Counter/releases) 21 | 2) Drop the .dll file in the Plugins folder of your Beat Saber installation. 22 | 3) Boot it up (or reboot) 23 | 24 | ## For developers 25 | 26 | ### Contributing to FPS-Counter 27 | In order to build this project, please create the file `FPS Counter.csproj.user` and add your Beat Saber directory path to it in the project directory. 28 | This file should not be uploaded to GitHub and is in the .gitignore. 29 | 30 | ```xml 31 | 32 | 33 | 34 | 35 | D:\Program Files (x86)\Steam\steamapps\common\Beat Saber 36 | 37 | 38 | ``` 39 | 40 | If you plan on adding any new dependencies which are located in the Beat Saber directory, it would be nice if you edited the paths to use `$(BeatSaberDir)` in `FPS Counter.csproj` 41 | 42 | ```xml 43 | ... 44 | 45 | $(BeatSaberDir)\Plugins\BS_Utils.dll 46 | 47 | 48 | $(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll 49 | 50 | ... 51 | ``` 52 | 53 | 54 | ## Credits 55 | 56 | [**@DeadlyKitten**](https://github.com/DeadlyKitten) for creating the original mod 57 | 58 | [**@Pespiri**](https://github.com/Pespiri) for updating the mod to the more recent BS 1.7.0 and making the Counters+ mod optional 59 | --------------------------------------------------------------------------------