diff --git a/BizHawk.Client.Common/tools/Watch.cs b/BizHawk.Client.Common/tools/Watch.cs index 3428693338..13c16c2684 100644 --- a/BizHawk.Client.Common/tools/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch.cs @@ -174,32 +174,44 @@ namespace BizHawk.Client.Common protected byte GetByte() { - return _domain.PeekByte(_address % _domain.Size); + if (_domain.Size == 0) + return _domain.PeekByte(_address); + else return _domain.PeekByte(_address % _domain.Size); } protected ushort GetWord() { - return _domain.PeekWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + if (_domain.Size == 0) + return _domain.PeekWord(_address, _bigEndian); + else return _domain.PeekWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain } protected uint GetDWord() { - return _domain.PeekDWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + if(_domain.Size == 0) + return _domain.PeekDWord(_address, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + else return _domain.PeekDWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain } protected void PokeByte(byte val) { - _domain.PokeByte(_address % _domain.Size, val); + if(_domain.Size == 0) + _domain.PokeByte(_address, val); + else _domain.PokeByte(_address % _domain.Size, val); } protected void PokeWord(ushort val) { - _domain.PokeWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + if (_domain.Size == 0) + _domain.PokeWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + else _domain.PokeWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain } protected void PokeDWord(uint val) { - _domain.PokeDWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + if (_domain.Size == 0) + _domain.PokeDWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain + else _domain.PokeDWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain } public void ClearChangeCount() { _changecount = 0; } @@ -208,7 +220,7 @@ namespace BizHawk.Client.Common { get { - return !IsSeparator && Address.Value >= Domain.Size; + return !IsSeparator && (Domain.Size != 0 && Address.Value >= Domain.Size); } } diff --git a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index 1041d26610..07104cd52e 100644 --- a/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -661,6 +661,9 @@ namespace BizHawk.Client.EmuHawk for (var i = 0; i < MemoryDomains.Count; i++) { + //zero 09-sep-2014 - what cases would have a MemoryDomain of size 0? + //1. unspecified malfunctions (please specify) + //2. full 32bit memorydomains if (MemoryDomains[i].Size > 0) { var str = MemoryDomains[i].ToString(); diff --git a/BizHawk.Common/Extensions/NumberExtensions.cs b/BizHawk.Common/Extensions/NumberExtensions.cs index 0c7522560b..f8ed99835d 100644 --- a/BizHawk.Common/Extensions/NumberExtensions.cs +++ b/BizHawk.Common/Extensions/NumberExtensions.cs @@ -60,6 +60,12 @@ namespace BizHawk.Common.NumberExtensions /// public static int NumHexDigits(this int i) { + //now this is a bit of a trick. if it was less than 0, it mustve been >= 0x80000000 and so takes all 8 digits + if (i < 0) + { + return 8; + } + if (i < 0x100) { return 2; diff --git a/BizHawk.Emulation.Common/MemoryDomain.cs b/BizHawk.Emulation.Common/MemoryDomain.cs index 08e4c5943f..ffb978a23d 100644 --- a/BizHawk.Emulation.Common/MemoryDomain.cs +++ b/BizHawk.Emulation.Common/MemoryDomain.cs @@ -10,6 +10,11 @@ namespace BizHawk.Emulation.Common public enum Endian { Big, Little, Unknown } public readonly string Name; + + /// + /// Special note: if this is 0, the memorydomain is 0x100000000 (full 32bits) in size. + /// This was judged to be less of a mess than using a bunch of longs everywhere. + /// public readonly int Size; public readonly Endian EndianType; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs index 3f7ae045da..a620c52357 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs @@ -129,7 +129,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 _memoryDomains.Add(new MemoryDomain ( name: "Sytem Bus", - size: int.MaxValue, + size: 0, //special case for full 32bit memorydomain endian: MemoryDomain.Endian.Big, peekByte: peekByte, pokeByte: pokeByte