Split inner classes of FirmwareDatabase to own files
This commit is contained in:
parent
dd0fc1b0b3
commit
35f317a887
|
@ -13,10 +13,10 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public List<FirmwareEventArgs> RecentlyServed { get; } = new List<FirmwareEventArgs>();
|
||||
|
||||
private readonly Dictionary<FirmwareDatabase.FirmwareRecord, ResolutionInfo> _resolutionDictionary = new Dictionary<FirmwareDatabase.FirmwareRecord, ResolutionInfo>();
|
||||
private readonly Dictionary<FirmwareRecord, ResolutionInfo> _resolutionDictionary = new();
|
||||
|
||||
// purpose of forbidScan: sometimes this is called from a loop in Scan(). we don't want to repeatedly DoScanAndResolve in that case, its already been done.
|
||||
public ResolutionInfo Resolve(PathEntryCollection pathEntries, IDictionary<string, string> userSpecifications, FirmwareDatabase.FirmwareRecord record, bool forbidScan = false)
|
||||
public ResolutionInfo Resolve(PathEntryCollection pathEntries, IDictionary<string, string> userSpecifications, FirmwareRecord record, bool forbidScan = false)
|
||||
{
|
||||
_resolutionDictionary.TryGetValue(record, out var resolved);
|
||||
// couldn't find it! do a scan and resolve to try harder
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string Hash { get; set; }
|
||||
|
||||
public FirmwareDatabase.FirmwareFile KnownFirmwareFile { get; set; }
|
||||
public FirmwareFile KnownFirmwareFile { get; set; }
|
||||
|
||||
public bool KnownMismatching { get; set; }
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// for each type of firmware, try resolving and record the result
|
||||
foreach (ListViewItem lvi in lvFirmwares.Items)
|
||||
{
|
||||
var fr = (FirmwareDatabase.FirmwareRecord) lvi.Tag;
|
||||
var fr = (FirmwareRecord) lvi.Tag;
|
||||
var ri = Manager.Resolve(
|
||||
_pathEntries,
|
||||
_firmwareUserSpecifications,
|
||||
|
@ -446,7 +446,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// for each selected item, set the user choice (even though multiple selection for this operation is no longer allowed)
|
||||
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
|
||||
{
|
||||
var fr = (FirmwareDatabase.FirmwareRecord) lvi.Tag;
|
||||
var fr = (FirmwareRecord) lvi.Tag;
|
||||
string filePath = ofd.FileName;
|
||||
|
||||
// if the selected file is an archive, allow the user to pick the inside file
|
||||
|
@ -514,7 +514,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// for each selected item, clear the user choice
|
||||
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
|
||||
{
|
||||
var fr = (FirmwareDatabase.FirmwareRecord) lvi.Tag;
|
||||
var fr = (FirmwareRecord) lvi.Tag;
|
||||
_firmwareUserSpecifications.Remove(fr.ConfigKey);
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void TsmiInfo_Click(object sender, EventArgs e)
|
||||
{
|
||||
var lvi = lvFirmwares.SelectedItems[0];
|
||||
var fr = (FirmwareDatabase.FirmwareRecord)lvi.Tag;
|
||||
var fr = (FirmwareRecord) lvi.Tag;
|
||||
|
||||
// get all options for this firmware (in order)
|
||||
var options =
|
||||
|
@ -548,22 +548,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
||||
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
||||
var ff = FirmwareDatabase.FirmwareFilesByHash[o.Hash];
|
||||
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Ideal)
|
||||
if (o.Status == FirmwareOptionStatus.Ideal)
|
||||
{
|
||||
olvi.ImageIndex = FirmwaresConfigInfo.idIdeal;
|
||||
olvi.ToolTipText = FirmwaresConfigInfo.ttIdeal;
|
||||
}
|
||||
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Acceptable)
|
||||
if (o.Status == FirmwareOptionStatus.Acceptable)
|
||||
{
|
||||
olvi.ImageIndex = FirmwaresConfigInfo.idAcceptable;
|
||||
olvi.ToolTipText = FirmwaresConfigInfo.ttAcceptable;
|
||||
}
|
||||
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Unacceptable)
|
||||
if (o.Status == FirmwareOptionStatus.Unacceptable)
|
||||
{
|
||||
olvi.ImageIndex = FirmwaresConfigInfo.idUnacceptable;
|
||||
olvi.ToolTipText = FirmwaresConfigInfo.ttUnacceptable;
|
||||
}
|
||||
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Bad)
|
||||
if (o.Status == FirmwareOptionStatus.Bad)
|
||||
{
|
||||
olvi.ImageIndex = FirmwaresConfigInfo.idBad;
|
||||
olvi.ToolTipText = FirmwaresConfigInfo.ttBad;
|
||||
|
|
|
@ -333,51 +333,5 @@ namespace BizHawk.Emulation.Common
|
|||
FirmwareOptions = options;
|
||||
FirmwareRecords = records;
|
||||
}
|
||||
|
||||
public class FirmwareFile
|
||||
{
|
||||
public string Hash { get; set; }
|
||||
public long Size { get; set; }
|
||||
public string RecommendedName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Info { get; set; }
|
||||
public bool Bad { get; set; }
|
||||
}
|
||||
|
||||
public class FirmwareRecord
|
||||
{
|
||||
public string SystemId { get; set; }
|
||||
public string FirmwareId { get; set; }
|
||||
public string Descr { get; set; }
|
||||
|
||||
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||
}
|
||||
|
||||
public enum FirmwareOptionStatus
|
||||
{
|
||||
/// <summary>Preferred to get checkmarks, and for TASing</summary>
|
||||
Ideal,
|
||||
|
||||
/// <summary>Works with our core, but not preferred for TASing</summary>
|
||||
Acceptable,
|
||||
|
||||
/// <summary>A good file, but it doesn't work with our core</summary>
|
||||
Unacceptable,
|
||||
|
||||
/// <summary>Nonlegitimate files that are notable enough to be worth detecting, even if mainly to categorize as a BAD option</summary>
|
||||
Bad
|
||||
}
|
||||
|
||||
public class FirmwareOption
|
||||
{
|
||||
public string SystemId { get; set; }
|
||||
public string FirmwareId { get; set; }
|
||||
public string Hash { get; set; }
|
||||
public long Size { get; set; }
|
||||
public FirmwareOptionStatus Status { get; set; }
|
||||
|
||||
public bool IsAcceptableOrIdeal => Status == FirmwareOptionStatus.Ideal || Status == FirmwareOptionStatus.Acceptable;
|
||||
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||
}
|
||||
} // static class FirmwareDatabase
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class FirmwareFile
|
||||
{
|
||||
public bool Bad { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Hash { get; set; }
|
||||
|
||||
public string Info { get; set; }
|
||||
|
||||
public string RecommendedName { get; set; }
|
||||
|
||||
public long Size { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class FirmwareOption
|
||||
{
|
||||
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||
|
||||
public string FirmwareId { get; set; }
|
||||
|
||||
public string Hash { get; set; }
|
||||
|
||||
public bool IsAcceptableOrIdeal => Status == FirmwareOptionStatus.Ideal || Status == FirmwareOptionStatus.Acceptable;
|
||||
|
||||
public long Size { get; set; }
|
||||
|
||||
public FirmwareOptionStatus Status { get; set; }
|
||||
|
||||
public string SystemId { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public enum FirmwareOptionStatus
|
||||
{
|
||||
/// <summary>Preferred to get checkmarks, and for TASing</summary>
|
||||
Ideal,
|
||||
|
||||
/// <summary>Works with our core, but not preferred for TASing</summary>
|
||||
Acceptable,
|
||||
|
||||
/// <summary>A good file, but it doesn't work with our core</summary>
|
||||
Unacceptable,
|
||||
|
||||
/// <summary>Nonlegitimate files that are notable enough to be worth detecting, even if mainly to categorize as a BAD option</summary>
|
||||
Bad
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class FirmwareRecord
|
||||
{
|
||||
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||
|
||||
public string Descr { get; set; }
|
||||
|
||||
public string FirmwareId { get; set; }
|
||||
|
||||
public string SystemId { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue