From 60c3eb9883a5accf81cdd9d697d9877daaf39dfc Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 19 Jul 2015 22:15:10 -0500 Subject: [PATCH] cue files - prefer a pre-decoded wav over an mp3 with the same filename --- .../DiscFormats/CUE/CueFileResolver.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs b/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs index 55727a144d..51cb0ed6d3 100644 --- a/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs +++ b/BizHawk.Emulation.DiscSystem/DiscFormats/CUE/CueFileResolver.cs @@ -67,7 +67,9 @@ namespace BizHawk.Emulation.DiscSystem.CUE /// /// Performs cue-intelligent logic to acquire a file requested by the cue. /// Returns the resulting full path(s). - /// If there are multiple options, it returns them all + /// If there are multiple options, it returns them all. + /// Returns the requested path first in the list (if it was found) for more simple use. + /// Kind of an unusual design, I know. Consider them sorted by confidence. /// public List Resolve(string path) { @@ -109,8 +111,13 @@ namespace BizHawk.Emulation.DiscSystem.CUE //match files with another extension added on (likely to be mygame.bin.ecm) cmp = string.Compare(fragment, targetFile, !caseSensitive); if (cmp == 0) - results.Add(fi.FileInfo); - + { + //take care to add an exact match at the beginning + if (fi.FullName.ToLowerInvariant() == Path.Combine(baseDir,path).ToLowerInvariant()) + results.Insert(0, fi.FileInfo); + else + results.Add(fi.FileInfo); + } } var ret = new List(); foreach (var fi in results)