Skip to content

Commit

Permalink
Pragma a necessary non-local function in rcheevos and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TiKevin83 committed Aug 22, 2023
1 parent 0503f7d commit 09422e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 09422e1

Please sign in to comment.