diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index b7a5bd93..c6967fd5 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -3265,8 +3265,21 @@ namespace SabreTools.Library.DatFiles
itemRom.SHA384 = Utilities.CleanHashData(itemRom.SHA384, Constants.SHA384Length);
itemRom.SHA512 = Utilities.CleanHashData(itemRom.SHA512, Constants.SHA512Length);
+ // If we have the case where there is SHA-1 and nothing else, we don't fill in any other part of the data
+ if (itemRom.Size == -1
+ && String.IsNullOrWhiteSpace(itemRom.CRC)
+ && String.IsNullOrWhiteSpace(itemRom.MD5)
+ && !String.IsNullOrWhiteSpace(itemRom.SHA1)
+ && String.IsNullOrWhiteSpace(itemRom.SHA256)
+ && String.IsNullOrWhiteSpace(itemRom.SHA384)
+ && String.IsNullOrWhiteSpace(itemRom.SHA512))
+ {
+ // No-op, just catch it so it doesn't go further
+ Globals.Logger.Verbose("{0}: Entry with only SHA-1 found - '{1}'", FileName, itemRom.Name);
+ }
+
// If we have a rom and it's missing size AND the hashes match a 0-byte file, fill in the rest of the info
- if ((itemRom.Size == 0 || itemRom.Size == -1)
+ else if ((itemRom.Size == 0 || itemRom.Size == -1)
&& ((itemRom.CRC == Constants.CRCZero || String.IsNullOrWhiteSpace(itemRom.CRC))
|| itemRom.MD5 == Constants.MD5Zero
|| itemRom.SHA1 == Constants.SHA1Zero
diff --git a/SabreTools.Library/DatFiles/OpenMSX.cs b/SabreTools.Library/DatFiles/OpenMSX.cs
index d2e0c1a6..b8c73d46 100644
--- a/SabreTools.Library/DatFiles/OpenMSX.cs
+++ b/SabreTools.Library/DatFiles/OpenMSX.cs
@@ -144,6 +144,7 @@ namespace SabreTools.Library.DatFiles
// Otherwise, add what is possible
reader.MoveToContent();
+ int diskno = 0;
bool containsItems = false;
// Create a new machine
@@ -183,7 +184,8 @@ namespace SabreTools.Library.DatFiles
reader.Read();
break;
case "dump":
- containsItems = ReadDump(reader.ReadSubtree(), machine, filename, sysid, srcid, keep, clean, remUnicode);
+ containsItems = ReadDump(reader.ReadSubtree(), machine, diskno, filename, sysid, srcid, keep, clean, remUnicode);
+ diskno++;
// Skip the dump now that we've processed it
reader.Skip();
@@ -218,6 +220,7 @@ namespace SabreTools.Library.DatFiles
///
/// XmlReader representing a part block
/// Machine information to pass to contained items
+ /// Disk number to use when outputting to other DAT formats
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
@@ -227,6 +230,7 @@ namespace SabreTools.Library.DatFiles
private bool ReadDump(
XmlReader reader,
Machine machine,
+ int diskno,
// Standard Dat parsing
string filename,
@@ -238,7 +242,6 @@ namespace SabreTools.Library.DatFiles
bool clean,
bool remUnicode)
{
- string temptype = reader.Name;
bool containsItems = false;
while (!reader.EOF)
@@ -254,19 +257,19 @@ namespace SabreTools.Library.DatFiles
switch (reader.Name)
{
case "rom":
- containsItems = ReadRom(reader.ReadSubtree(), machine, filename, sysid, srcid, keep, clean, remUnicode);
+ containsItems = ReadRom(reader.ReadSubtree(), machine, diskno, filename, sysid, srcid, keep, clean, remUnicode);
// Skip the rom now that we've processed it
reader.Skip();
break;
case "megarom":
- containsItems = ReadMegaRom(reader.ReadSubtree(), machine, filename, sysid, srcid, keep, clean, remUnicode);
+ containsItems = ReadMegaRom(reader.ReadSubtree(), machine, diskno, filename, sysid, srcid, keep, clean, remUnicode);
// Skip the megarom now that we've processed it
reader.Skip();
break;
case "sccpluscart":
- containsItems = ReadSccPlusCart(reader.ReadSubtree(), machine, filename, sysid, srcid, keep, clean, remUnicode);
+ containsItems = ReadSccPlusCart(reader.ReadSubtree(), machine, diskno, filename, sysid, srcid, keep, clean, remUnicode);
// Skip the sccpluscart now that we've processed it
reader.Skip();
@@ -288,18 +291,19 @@ namespace SabreTools.Library.DatFiles
///
/// Read rom information
///
- /// XmlReader representing a part block
+ /// XmlReader representing a rom block
/// Machine information to pass to contained items
+ /// Disk number to use when outputting to other DAT formats
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
/// True if full pathnames are to be kept, false otherwise (default)
/// True if game names are sanitized, false otherwise (default)
/// True if we should remove non-ASCII characters from output, false otherwise (default)
- /// TODO: Make sure that this outputs proper values since only SHA-1 is included
private bool ReadRom(
XmlReader reader,
Machine machine,
+ int diskno,
// Standard Dat parsing
string filename,
@@ -348,8 +352,9 @@ namespace SabreTools.Library.DatFiles
// Create and add the new rom
Rom rom = new Rom
{
- Name = machine.Name + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
+ Name = machine.Name + "_" + diskno + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
Offset = offset,
+ Size = -1,
SHA1 = Utilities.CleanHashData(hash, Constants.SHA1Length),
};
@@ -362,18 +367,19 @@ namespace SabreTools.Library.DatFiles
///
/// Read megarom information
///
- /// XmlReader representing a part block
+ /// XmlReader representing a megarom block
/// Machine information to pass to contained items
+ /// Disk number to use when outputting to other DAT formats
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
/// True if full pathnames are to be kept, false otherwise (default)
/// True if game names are sanitized, false otherwise (default)
/// True if we should remove non-ASCII characters from output, false otherwise (default)
- /// TODO: Make sure that this outputs proper values since only SHA-1 is included
private bool ReadMegaRom(
XmlReader reader,
Machine machine,
+ int diskno,
// Standard Dat parsing
string filename,
@@ -422,8 +428,9 @@ namespace SabreTools.Library.DatFiles
// Create and add the new rom
Rom rom = new Rom
{
- Name = machine.Name + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
+ Name = machine.Name + "_" + diskno + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
Offset = offset,
+ Size = -1,
SHA1 = Utilities.CleanHashData(hash, Constants.SHA1Length),
};
@@ -436,18 +443,19 @@ namespace SabreTools.Library.DatFiles
///
/// Read sccpluscart information
///
- /// XmlReader representing a part block
+ /// XmlReader representing a sccpluscart block
/// Machine information to pass to contained items
+ /// Disk number to use when outputting to other DAT formats
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
/// True if full pathnames are to be kept, false otherwise (default)
/// True if game names are sanitized, false otherwise (default)
/// True if we should remove non-ASCII characters from output, false otherwise (default)
- /// TODO: Make sure that this outputs proper values since only SHA-1 is included
private bool ReadSccPlusCart(
XmlReader reader,
Machine machine,
+ int diskno,
// Standard Dat parsing
string filename,
@@ -493,7 +501,8 @@ namespace SabreTools.Library.DatFiles
// Create and add the new rom
Rom rom = new Rom
{
- Name = machine.Name + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
+ Name = machine.Name + "_" + diskno + (!String.IsNullOrWhiteSpace(remark) ? " " + remark : ""),
+ Size = -1,
SHA1 = Utilities.CleanHashData(hash, Constants.SHA1Length),
};