take 2
This commit is contained in:
parent
ec26c32dc1
commit
a782fdb315
|
@ -17,6 +17,8 @@ namespace BizHawk.Client.Common
|
|||
public string Hash { get; set; }
|
||||
}
|
||||
|
||||
public List<FirmwareEventArgs> RecentlyServed { get; private set; }
|
||||
|
||||
public class ResolutionInfo
|
||||
{
|
||||
public bool UserSpecified { get; set; }
|
||||
|
@ -38,9 +40,11 @@ namespace BizHawk.Client.Common
|
|||
public string FirmwareId { get; set; }
|
||||
}
|
||||
|
||||
public delegate void FirmwareEventHandler(object sender, FirmwareEventArgs e);
|
||||
public FirmwareManager()
|
||||
{
|
||||
RecentlyServed = new List<FirmwareEventArgs>();
|
||||
}
|
||||
|
||||
public event FirmwareEventHandler OnFirmwareRequestSatisfied;
|
||||
|
||||
public ResolutionInfo Resolve(string sysId, string firmwareId)
|
||||
{
|
||||
|
@ -75,17 +79,13 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var resolved = Resolve(sysId, firmwareId);
|
||||
if (resolved == null) return null;
|
||||
if (OnFirmwareRequestSatisfied != null)
|
||||
{
|
||||
OnFirmwareRequestSatisfied(this,
|
||||
new FirmwareEventArgs
|
||||
RecentlyServed.Add(new FirmwareEventArgs
|
||||
{
|
||||
SystemId = sysId,
|
||||
FirmwareId = firmwareId,
|
||||
Hash = resolved.Hash,
|
||||
Size = resolved.Size
|
||||
});
|
||||
}
|
||||
return resolved.FilePath;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Global.ControllerInputCoalescer = new ControllerInputCoalescer();
|
||||
Global.FirmwareManager = new FirmwareManager();
|
||||
Global.FirmwareManager.OnFirmwareRequestSatisfied += (o, e) => ActiveFirmwares[e.FirmwareId] = e.Hash;
|
||||
Global.MovieSession = new MovieSession
|
||||
{
|
||||
Movie = MovieService.DefaultInstance,
|
||||
|
@ -566,8 +565,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool RestoreReadWriteOnStop = false;
|
||||
public bool UpdateFrame = false;
|
||||
|
||||
public Dictionary<string, string> ActiveFirmwares = new Dictionary<string, string>();
|
||||
|
||||
private int? _pauseOnFrame;
|
||||
public int? PauseOnFrame // If set, upon completion of this frame, the client wil pause
|
||||
{
|
||||
|
@ -3311,7 +3308,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Deterministic = deterministic,
|
||||
MessageCallback = GlobalWin.OSD.AddMessage
|
||||
};
|
||||
ActiveFirmwares.Clear();
|
||||
Global.FirmwareManager.RecentlyServed.Clear();
|
||||
|
||||
loader.OnLoadError += ShowLoadError;
|
||||
loader.OnLoadSettings += CoreSettings;
|
||||
|
@ -3426,12 +3423,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadQuickSave("QuickSave" + Global.Config.SaveSlot);
|
||||
}
|
||||
|
||||
if (ActiveFirmwares.Count > 0)
|
||||
if (Global.FirmwareManager.RecentlyServed.Count > 0)
|
||||
{
|
||||
Console.WriteLine("Active Firmwares:");
|
||||
foreach (var kvp in ActiveFirmwares)
|
||||
foreach (var f in Global.FirmwareManager.RecentlyServed)
|
||||
{
|
||||
Console.WriteLine(" {0} : {1}", kvp.Key, kvp.Value);
|
||||
Console.WriteLine(" {0} : {1}", f.FirmwareId, f.Hash);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -312,15 +312,7 @@ namespace BizHawk.Emulation.Common
|
|||
&& fr.systemId == sysId
|
||||
select fr);
|
||||
|
||||
try
|
||||
{
|
||||
return found.First();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// list is empty;
|
||||
return null;
|
||||
}
|
||||
return found.FirstOrDefault();
|
||||
}
|
||||
|
||||
} //static class FirmwareDatabase
|
||||
|
|
Loading…
Reference in New Issue