public (bool, string) CompareAgainstFile(RolandMemory memory) { if (_primitiveTypeName == "string") { return(true, ""); } var memVal = 0; var retString = $"{Name} "; if (memory.Has(StartAddress, GetPrimitiveTypeLength())) { var val = memory.Get(StartAddress, GetPrimitiveTypeLength()); memVal = GetValue(val, _primitiveTypeBits * (int)_primitiveTypeLength, 0); retString += $"MemVal: 0x{memVal:x2} "; } else { if (int.TryParse(DefaultValue, out int defaultInt)) { memVal = defaultInt; retString += $"DefaultVal: 0x{memVal:x2} "; } else { retString += "NoDefaultVal/NoMemoryVal"; return(false, retString); } } var data = memory.GetFromFile(FileAddress, _primitiveTypeLength); if (data == null) { return(false, "file value does not exist"); } var fileVal = RolandValueStruct.DecodeValueAsInt(data, _primitiveTypeLength, _primitiveTypeBits); if (fileVal == memVal) { return(true, ""); } else { retString += $" fileVal 0x{fileVal:x2}"; return(false, retString); } }
public bool HasValue(RolandMemory memory) { return(memory.Has(StartAddress, GetPrimitiveTypeLength())); }
public override string GetDumpData(RolandMemory memory = null) { if (memory == null) { return(null); } var fileValueStr = ""; var valueStr = ""; var defaultStr = ""; var equalStr = ""; if (_primitiveTypeName == "int") { int?memVal = null; int?fileVal = null; int?defVal = null; if (memory.Has(StartAddress, GetPrimitiveTypeLength())) { var val = memory.Get(StartAddress, GetPrimitiveTypeLength()); memVal = GetValue(val, _primitiveTypeBits * (int)_primitiveTypeLength, 0); valueStr = $"MemVal: 0x{memVal:X} ({memVal})"; } var data = memory.GetFromFile(FileAddress, _primitiveTypeLength); if (data != null) { fileVal = RolandValueStruct.DecodeValueAsInt(data, _primitiveTypeLength, _primitiveTypeBits); fileValueStr = $"FileVal: 0x{fileVal:X} ({fileVal})"; } if (int.TryParse(DefaultValue, out int defaultInt)) { defVal = defaultInt; defaultStr = $"DefVal: 0x{defaultInt:X} ({defaultInt})"; } if (fileVal != null) { if (memVal != null) { if (fileVal == memVal) { equalStr = "EQ"; } } else { if (fileVal == 0) { equalStr = "EQ?"; } if (defVal != null) { if (fileVal == defVal) { equalStr = "EQ"; } } else { equalStr = "NODEFAULT"; } } } return($"{valueStr.PadRight(25)} {fileValueStr.PadRight(25)} {defaultStr.PadRight(25)} {equalStr}"); } return(""); throw new Exception( $"RolandValue.GetDumpData: Don't know how to handle the primitive {_primitiveTypeName} for {Type}"); }