public WatchVariable(string memoryTypeName, string specialType, BaseAddressTypeEnum baseAddress, uint?offsetUS, uint?offsetJP, uint?offsetPAL, uint?offsetDefault, uint?mask) { BaseAddressType = baseAddress; OffsetUS = offsetUS; OffsetJP = offsetJP; OffsetPAL = offsetPAL; OffsetDefault = offsetDefault; SpecialType = specialType; MemoryTypeName = memoryTypeName; MemoryType = memoryTypeName == null ? null : WatchVariableUtilities.StringToType[MemoryTypeName]; ByteCount = memoryTypeName == null ? (int?)null : WatchVariableUtilities.TypeSize[MemoryType]; NibbleCount = memoryTypeName == null ? (int?)null : WatchVariableUtilities.TypeSize[MemoryType] * 2; SignedType = memoryTypeName == null ? (bool?)null : WatchVariableUtilities.TypeSign[MemoryType]; Mask = mask; // Created getter/setter functions if (IsSpecial) { (_getterFunction, _setterFunction) = WatchVariableSpecialUtilities.CreateGetterSetterFunctions(SpecialType); } else { _getterFunction = (uint address) => { return(Config.Stream.GetValue(MemoryType, address, UseAbsoluteAddressing, Mask).ToString()); }; _setterFunction = (string value, uint address) => { return(Config.Stream.SetValueRoundingWrapping( MemoryType, value, address, UseAbsoluteAddressing, Mask)); }; } }
public WatchVariable(string memoryTypeName, string specialType, BaseAddressTypeEnum baseAddressType, uint?offsetUS, uint?offsetJP, uint?offsetPAL, uint?offsetDefault, uint?mask, int?shift) { if (offsetDefault.HasValue && (offsetUS.HasValue || offsetJP.HasValue || offsetPAL.HasValue)) { throw new ArgumentOutOfRangeException("Can't have both a default offset value and a rom-specific offset value"); } if (specialType != null) { if (baseAddressType != BaseAddressTypeEnum.None && baseAddressType != BaseAddressTypeEnum.Object && baseAddressType != BaseAddressTypeEnum.ProcessGroup && baseAddressType != BaseAddressTypeEnum.Ghost && baseAddressType != BaseAddressTypeEnum.LastCoin && baseAddressType != BaseAddressTypeEnum.File && baseAddressType != BaseAddressTypeEnum.MainSave && baseAddressType != BaseAddressTypeEnum.Triangle) { throw new ArgumentOutOfRangeException("Special var cannot have base address type " + baseAddressType); } if (offsetDefault.HasValue || offsetUS.HasValue || offsetJP.HasValue || offsetPAL.HasValue) { throw new ArgumentOutOfRangeException("Special var cannot have any type of offset"); } if (mask != null) { throw new ArgumentOutOfRangeException("Special var cannot have mask"); } } BaseAddressType = baseAddressType; OffsetUS = offsetUS; OffsetJP = offsetJP; OffsetPAL = offsetPAL; OffsetDefault = offsetDefault; SpecialType = specialType; MemoryTypeName = memoryTypeName; MemoryType = memoryTypeName == null ? null : TypeUtilities.StringToType[MemoryTypeName]; ByteCount = memoryTypeName == null ? (int?)null : TypeUtilities.TypeSize[MemoryType]; NibbleCount = memoryTypeName == null ? (int?)null : TypeUtilities.TypeSize[MemoryType] * 2; SignedType = memoryTypeName == null ? (bool?)null : TypeUtilities.TypeSign[MemoryType]; Mask = mask; Shift = shift; // Created getter/setter functions if (IsSpecial) { (_getterFunction, _setterFunction) = WatchVariableSpecialUtilities.CreateGetterSetterFunctions(SpecialType); } else { _getterFunction = (uint address) => { return(Config.Stream.GetValue( MemoryType, address, UseAbsoluteAddressing, Mask, Shift)); }; _setterFunction = (object value, uint address) => { return(Config.Stream.SetValueRoundingWrapping( MemoryType, value, address, UseAbsoluteAddressing, Mask, Shift)); }; } }