From a10592ebf32fb2b66c616298afa9e8ef426d6f5d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 13 May 2016 16:50:45 -0700 Subject: [PATCH] Maybe fixes the issue with source/system sorting? --- SabreHelper/RomManipulation.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/SabreHelper/RomManipulation.cs b/SabreHelper/RomManipulation.cs index 768cd5eb..2b79767f 100644 --- a/SabreHelper/RomManipulation.cs +++ b/SabreHelper/RomManipulation.cs @@ -647,14 +647,6 @@ namespace SabreTools.Helper { if (x.MD5 == y.MD5) { - if (x.SHA1 == y.SHA1) - { - if (x.SystemID == y.SystemID) - { - return x.SourceID - y.SourceID; - } - return x.SystemID - y.SystemID; - } return String.Compare(x.SHA1, y.SHA1); } return String.Compare(x.MD5, y.MD5); @@ -697,6 +689,24 @@ namespace SabreTools.Helper last.MD5 = (last.MD5 == "" && rom.MD5 != "" ? rom.MD5 : last.MD5); last.SHA1 = (last.SHA1 == "" && rom.SHA1 != "" ? rom.SHA1 : last.SHA1); + // If the current system has a lower ID than the previous, set the system accordingly + if (last.SystemID < rom.SystemID) + { + last.SystemID = rom.SystemID; + last.System = rom.System; + last.Game = rom.Game; + last.Name = rom.Name; + } + + // If the current source has a lower ID than the previous, set the source accordingly + if (last.SourceID < rom.SourceID) + { + last.SourceID = rom.SourceID; + last.Source = rom.Source; + last.Game = rom.Game; + last.Name = rom.Name; + } + // If the duplicate is external already or should be, set it if (last.Dupe >= DupeType.ExternalHash || last.SystemID != rom.SystemID || last.SourceID != rom.SourceID) {