From 09422e1ef2988188bed145afb927751f4c9cbd08 Mon Sep 17 00:00:00 2001 From: Travis Mcgeehan Date: Tue, 22 Aug 2023 18:45:48 -0400 Subject: [PATCH] Pragma a necessary non-local function in rcheevos and add docs --- contributing.md | 2 ++ src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index ff94122ffea..72b1533b2c1 100644 --- a/contributing.md +++ b/contributing.md @@ -76,7 +76,9 @@ It's probably a good idea to get the .NET SDK, even if you're not working on a . For EmuHawk and libraries in the main solution, which do not target .NET 6, we have [this page](https://github.com/TASEmulators/BizHawk/wiki/Available-C%23-and-.NET-features) documenting which features are actually available to use. +### Code Analysis +Visual Studio can detect and show issues and possible optimizations in the IDE before build time. In the Analyze menu pick Run Code Analysis -> On Solution. From there you can open the Error list in the bottom left and highlight issues of different severity level Errors/Warnings/Messages and adjust the scope as small as the open documents and as wide as the entire solution. Developers should target to have no code introduced flagging the Error and Warning levels. It's also good to minimize warnings at the Message severity level either by adopting the suggested fixes or by ignoring irrelevant Messages with `#pragma` directives. Many warnings can be auto-fixed by the `dotnet format` command or by the quick actions menu found on the left next to a line number when hovering a line. ## blip_buf > Audio resampling library. diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs index 0ba5efcd1b3..aff36902a3a 100644 --- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs +++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs @@ -412,9 +412,11 @@ public override void Restart() _activeModeUnlocksRequest = _inactiveModeUnlocksRequest = FailedRCheevosRequest.Singleton; } +#pragma warning disable IDE0039 // validate addresses now that we have cheevos init // ReSharper disable once ConvertToLocalFunction - bool peekcb(int address) => _readMap.ContainsKey(address); + LibRCheevos.rc_runtime_validate_address_t peekcb = address => _readMap.ContainsKey(address); +#pragma warning restore IDE0039 _lib.rc_runtime_validate_addresses(_runtime, _eventcb, peekcb); _gameInfoForm.Restart(_gameData.Title, _gameData.TotalCheevoPoints(HardcoreMode), CurrentRichPresence ?? "N/A");