From 8798d0c03ef1f34f286c896d7d032da2d7b8c506 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 25 May 2020 17:43:03 -0500 Subject: [PATCH] CheatList - remove some unused code --- src/BizHawk.Client.Common/tools/CheatList.cs | 73 -------------------- 1 file changed, 73 deletions(-) diff --git a/src/BizHawk.Client.Common/tools/CheatList.cs b/src/BizHawk.Client.Common/tools/CheatList.cs index 1434a10ff5..468a229c9a 100644 --- a/src/BizHawk.Client.Common/tools/CheatList.cs +++ b/src/BizHawk.Client.Common/tools/CheatList.cs @@ -171,19 +171,6 @@ namespace BizHawk.Client.Common return false; } - public bool Remove(Watch watch) - { - var cheat = _cheatList.FirstOrDefault(c => c == watch); - if (cheat != (Cheat)null) - { - _cheatList.Remove(cheat); - Changes = true; - return true; - } - - return false; - } - public bool Contains(Cheat cheat) { return _cheatList.Any(c => c == cheat); @@ -248,66 +235,6 @@ namespace BizHawk.Client.Common && cheat.Contains(address)); } - /// - /// Returns the value of a given byte in a cheat, If the cheat is a single byte this will be the same indexing the cheat, - /// But if the cheat is multi-byte, this will return just the cheat value for that specific byte - /// - /// Returns null if address is not a part of a cheat, else returns the value of that specific byte only - public byte? GetByteValue(MemoryDomain domain, long addr) - { - var activeCheat = _cheatList.FirstOrDefault(cheat => cheat.Contains(addr)); - if (activeCheat == (Cheat)null) - { - return null; - } - - return activeCheat.GetByteVal(addr); - } - - /// - /// Returns the value of a given cheat, or a partial value of a multi-byte cheat - /// Note that address + size MUST NOT exceed the range of the cheat or undefined behavior will occur - /// - /// The to apply cheats to - /// The starting address for which you will get the number of bytes - /// The number of bytes of the cheat to return - /// The value, or null if it can't resolve the address with a given cheat - public int? GetCheatValue(MemoryDomain domain, long addr, WatchSize size) - { - var activeCheat = _cheatList.FirstOrDefault(cheat => cheat.Contains(addr)); - if (activeCheat == (Cheat)null) - { - return null; - } - - switch (activeCheat.Size) - { - default: - case WatchSize.Byte: - return activeCheat.Value; - case WatchSize.Word: - return size == WatchSize.Byte - ? GetByteValue(domain, addr) - : activeCheat.Value; - case WatchSize.DWord: - if (size == WatchSize.Byte) - { - return GetByteValue(domain, addr); - } - else if (size == WatchSize.Word) - { - if (activeCheat.Address == addr) - { - return (activeCheat.Value.Value >> 16) & 0xFFFF; - } - - return activeCheat.Value.Value & 0xFFFF; - } - - return activeCheat.Value; - } - } - public void SaveOnClose() { if (Changes && _cheatList.Any())