From af9c813c5bda5867094921331fb1610c51e8bec6 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Thu, 19 Oct 2017 09:48:27 -0400 Subject: [PATCH] Add files via upload --- BizHawk.Client.Common/tools/Cheat.cs | 66 +++++++++++++++++++++------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.Common/tools/Cheat.cs b/BizHawk.Client.Common/tools/Cheat.cs index 15ec5fb62a..4680168276 100644 --- a/BizHawk.Client.Common/tools/Cheat.cs +++ b/BizHawk.Client.Common/tools/Cheat.cs @@ -284,29 +284,61 @@ namespace BizHawk.Client.Common case WatchSize.Byte: return (byte?)_val; case WatchSize.Word: - if (addr == _watch.Address) + if (_watch.BigEndian) { + if (addr == _watch.Address) + { + return (byte)(_val & 0xFF); + } return (byte)(_val >> 8); } - - return (byte)(_val & 0xFF); - case WatchSize.DWord: - if (addr == _watch.Address) + else { + if (addr == _watch.Address) + { + return (byte)(_val >> 8); + } + return (byte)(_val & 0xFF); + } + case WatchSize.DWord: + if (_watch.BigEndian) + { + if (addr == _watch.Address) + { + return (byte)((_val >> 24) & 0xFF); + } + + if (addr == _watch.Address + 1) + { + return (byte)((_val >> 16) & 0xFF); + } + + if (addr == _watch.Address + 2) + { + return (byte)((_val >> 8) & 0xFF); + } + + return (byte)(_val & 0xFF); + } + else + { + if (addr == _watch.Address) + { + return (byte)(_val & 0xFF); + } + + if (addr == _watch.Address + 1) + { + return (byte)((_val >> 8) & 0xFF); + } + + if (addr == _watch.Address + 2) + { + return (byte)((_val >> 16) & 0xFF); + } + return (byte)((_val >> 24) & 0xFF); } - - if (addr == _watch.Address + 1) - { - return (byte)((_val >> 16) & 0xFF); - } - - if (addr == _watch.Address + 2) - { - return (byte)((_val >> 8) & 0xFF); - } - - return (byte)(_val & 0xFF); } }