From abcf91f7d67a5c8b6fc1504eba175ee1fc7443c9 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 21 Jun 2020 06:05:21 +1000 Subject: [PATCH] A bit of Range cleanup --- src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs | 2 +- src/BizHawk.Common/Ranges.cs | 2 +- .../Base Implementations/MemoryDomainStream.cs | 2 +- src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index 90bd2cc832..1374d44913 100644 --- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -559,7 +559,7 @@ namespace BizHawk.Client.EmuHawk if (end <= start) return dict; - var range = new MutableRange(start, end - 1); + var range = start.RangeToExclusive(end); switch (dataSize) { diff --git a/src/BizHawk.Common/Ranges.cs b/src/BizHawk.Common/Ranges.cs index 8a9090993d..a61f0df377 100644 --- a/src/BizHawk.Common/Ranges.cs +++ b/src/BizHawk.Common/Ranges.cs @@ -20,7 +20,7 @@ namespace BizHawk.Common private (T Start, T EndInclusive) r; /// - public MutableRange(T start, T endInclusive) => Overwrite(start, endInclusive); + internal MutableRange(T start, T endInclusive) => Overwrite(start, endInclusive); /// (from setter) > public T Start diff --git a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomainStream.cs b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomainStream.cs index 056ae122fd..68ea50556f 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomainStream.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomainStream.cs @@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Common // TODO: Memory domain doesn't have the overload we need :( var poop = new byte[count]; // TODO: Range has the wrong end value - _d.BulkPeekByte(new MutableRange(Position, Position + count - 1), poop); + _d.BulkPeekByte(Position.RangeToExclusive(Position + count), poop); Array.Copy(poop, 0, buffer, offset, count); Position += count; return count; diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs index 92fa049999..430b66c5b6 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/VPC.cs @@ -357,7 +357,7 @@ namespace BizHawk.Emulation.Cores.PCEngine // clear inter-sprite priority buffer Array.Clear(InterSpritePriorityBuffer, 0, FrameWidth); - var testRange = new MutableRange(0, vdc.ActiveLine + 1); + var testRange = 0.MutableRangeTo(vdc.ActiveLine + 1); for (int i = 0; i < 64; i++) { int y = (vdc.SpriteAttributeTable[(i * 4) + 0] & 1023) - 64;