Esempio n. 1
0
		public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, bool bigendian, int prev, int changecount)
		{
			switch (size)
			{
				default:
				case WatchSize.Separator:
					return SeparatorWatch.Instance;
				case WatchSize.Byte:
					return new ByteWatch(domain, address, type, bigendian, (byte)prev, changecount);
				case WatchSize.Word:
					return new WordWatch(domain, address, type, bigendian, (ushort)prev, changecount);
				case WatchSize.DWord:
					return new DWordWatch(domain, address, type, bigendian, (uint)prev, changecount);
			}
		}
Esempio n. 2
0
		public static List<DisplayType> AvailableTypes(WatchSize size)
		{
			switch (size)
			{
				default:
				case WatchSize.Separator:
					return SeparatorWatch.ValidTypes;
				case WatchSize.Byte:
					return ByteWatch.ValidTypes;
				case WatchSize.Word:
					return WordWatch.ValidTypes;
				case WatchSize.DWord:
					return DWordWatch.ValidTypes;
			}
		}
Esempio n. 3
0
		public void SetToAddresses(IEnumerable<long> addresses, MemoryDomain domain, WatchSize size)
		{
			DataSize = (int)size;
			SetDataSize(DataSize);
			var addrList = addresses.ToList();
			if (addrList.Any())
			{
				SetDomain(domain);
				SetHighlighted(addrList[0]);
				_secondaryHighlightedAddresses.Clear();
				_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]).ToList());
				ClearNibbles();
				UpdateValues();
				MemoryViewerBox.Refresh();
				AddressLabel.Text = GenerateAddressString();
			}
		}
Esempio n. 4
0
		public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, string notes, bool bigEndian)
		{
			switch (size)
			{
				default:
				case WatchSize.Separator:
					return SeparatorWatch.Instance;
				case WatchSize.Byte:
					return new ByteWatch(domain, address, type, bigEndian, notes);
				case WatchSize.Word:
					return new WordWatch(domain, address, type, bigEndian, notes);
				case WatchSize.DWord:
					return new DWordWatch(domain, address, type, bigEndian, notes);
			}
		}
Esempio n. 5
0
		public static void ViewInHexEditor(MemoryDomain domain, IEnumerable<long> addresses, WatchSize size)
		{
			GlobalWin.Tools.Load<HexEditor>();
			GlobalWin.Tools.HexEditor.SetToAddresses(addresses, domain, size);
		}
Esempio n. 6
0
 /// <summary>
 /// Generates a new <see cref="Watch"/> instance
 /// Can be either <see cref="ByteWatch"/>, <see cref="WordWatch"/>, <see cref="DWordWatch"/> or <see cref="SeparatorWatch"/>
 /// </summary>
 /// <param name="domain">The <see cref="MemoryDomain"/> where you want to watch</param>
 /// <param name="address">The address into the <see cref="MemoryDomain"/></param>
 /// <param name="size">The size</param>
 /// <param name="type">How the watch will be displayed</param>
 /// <param name="bigEndian">Endianess (true for big endian)</param>
 /// <returns>New <see cref="Watch"/> instance. True type is depending of size parameter</returns>
 public static Watch GenerateWatch(MemoryDomain domain, long address, WatchSize size, DisplayType type, bool bigEndian)
 {
     return(GenerateWatch(domain, address, size, type, bigEndian, string.Empty, 0, 0, 0));
 }
Esempio n. 7
0
 public void ViewInHexEditor(MemoryDomain domain, IEnumerable <long> addresses, WatchSize size)
 {
     Tools.Load <HexEditor>();
     Tools.HexEditor.SetToAddresses(addresses, domain, size);
 }
Esempio n. 8
0
		private void HardSetSizeDropDown(WatchSize size)
		{
			switch (size)
			{
				case WatchSize.Byte:
					SizeDropdown.SelectedIndex = 0;
					break;
				case WatchSize.Word:
					SizeDropdown.SelectedIndex = 1;
					break;
				case WatchSize.DWord:
					SizeDropdown.SelectedIndex = 2;
					break;
			}
		}
Esempio n. 9
0
		private void SetSize(WatchSize size)
		{
			_settings.Size = size;
            SpecificValueBox.ByteSize = size;
			if (!string.IsNullOrEmpty(SpecificAddressBox.Text))
			{
				SpecificAddressBox.Text = "0";
			}

			if (!string.IsNullOrEmpty(SpecificValueBox.Text))
			{
				SpecificValueBox.Text = "0";
			}

			bool isTypeCompatible = false;
			switch (size)
			{
				case WatchSize.Byte:
					isTypeCompatible = ByteWatch.ValidTypes.Any(t => t == _settings.Type);
					SizeDropdown.SelectedIndex = 0;
					break;

				case WatchSize.Word:
					isTypeCompatible = WordWatch.ValidTypes.Any(t => t == _settings.Type);
					SizeDropdown.SelectedIndex = 1;
					break;

				case WatchSize.DWord:
					isTypeCompatible = DWordWatch.ValidTypes.Any(t => t == _settings.Type);
					SizeDropdown.SelectedIndex = 2;
					break;
			}

			if (!isTypeCompatible)
			{
				_settings.Type = Client.Common.DisplayType.Unsigned;
			}

			_dropdownDontfire = true;

			PopulateTypeDropDown();
			_dropdownDontfire = false;
			SpecificValueBox.Type = _settings.Type;
			SetReboot(true);
			NewSearch();
		}
Esempio n. 10
0
        public void TestCheatcodeParsing(string systemID, string code, int address, int value, int?compare, WatchSize size)
        {
            var result = new GameSharkDecoder(null, systemID).Decode(code);

            Assert.IsTrue(result.IsValid(out var valid), "failed to parse");
            Assert.AreEqual(address, valid.Address, "wrong addr");
            Assert.AreEqual(size, valid.Size, "wrong size");
            Assert.AreEqual(
                value,
                valid.Size switch
            {
                WatchSize.Byte => valid.Value & 0xFF,
                WatchSize.Word => valid.Value & 0xFFFF,
                _ => valid.Value
            },
Esempio n. 11
0
		private void SetSizeSelected(WatchSize size)
		{
			switch (size)
			{
				default:
				case WatchSize.Byte:
					SizeDropDown.SelectedIndex = 0;
					break;
				case WatchSize.Word:
					SizeDropDown.SelectedIndex = 1;
					break;
				case WatchSize.DWord:
					SizeDropDown.SelectedIndex = 2;
					break;
			}
		}