Cleanup FirmwareManager, and some other Emulation.Common nitpicks
This commit is contained in:
parent
17fe836926
commit
ebe001b526
|
@ -129,7 +129,7 @@ namespace BizHawk.Client.Common
|
||||||
HashSet<long> sizes = new HashSet<long>();
|
HashSet<long> sizes = new HashSet<long>();
|
||||||
foreach (var ff in FirmwareDatabase.FirmwareFiles)
|
foreach (var ff in FirmwareDatabase.FirmwareFiles)
|
||||||
{
|
{
|
||||||
sizes.Add(ff.size);
|
sizes.Add(ff.Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = new RealFirmwareReader())
|
using (var reader = new RealFirmwareReader())
|
||||||
|
@ -172,13 +172,13 @@ namespace BizHawk.Client.Common
|
||||||
var fr1 = fr;
|
var fr1 = fr;
|
||||||
var options =
|
var options =
|
||||||
from fo in FirmwareDatabase.FirmwareOptions
|
from fo in FirmwareDatabase.FirmwareOptions
|
||||||
where fo.systemId == fr1.systemId && fo.firmwareId == fr1.firmwareId && fo.IsAcceptableOrIdeal
|
where fo.SystemId == fr1.SystemId && fo.FirmwareId == fr1.FirmwareId && fo.IsAcceptableOrIdeal
|
||||||
select fo;
|
select fo;
|
||||||
|
|
||||||
// try each option
|
// try each option
|
||||||
foreach (var fo in options)
|
foreach (var fo in options)
|
||||||
{
|
{
|
||||||
var hash = fo.hash;
|
var hash = fo.Hash;
|
||||||
|
|
||||||
// did we find this firmware?
|
// did we find this firmware?
|
||||||
if (reader.dict.ContainsKey(hash))
|
if (reader.dict.ContainsKey(hash))
|
||||||
|
@ -189,7 +189,7 @@ namespace BizHawk.Client.Common
|
||||||
FilePath = reader.dict[hash].FileInfo.FullName,
|
FilePath = reader.dict[hash].FileInfo.FullName,
|
||||||
KnownFirmwareFile = FirmwareDatabase.FirmwareFilesByHash[hash],
|
KnownFirmwareFile = FirmwareDatabase.FirmwareFilesByHash[hash],
|
||||||
Hash = hash,
|
Hash = hash,
|
||||||
Size = fo.size
|
Size = fo.Size
|
||||||
};
|
};
|
||||||
_resolutionDictionary[fr] = ri;
|
_resolutionDictionary[fr] = ri;
|
||||||
goto DONE_FIRMWARE;
|
goto DONE_FIRMWARE;
|
||||||
|
@ -243,7 +243,7 @@ namespace BizHawk.Client.Common
|
||||||
// if the known firmware file is for a different firmware, flag it so we can show a warning
|
// if the known firmware file is for a different firmware, flag it so we can show a warning
|
||||||
var option =
|
var option =
|
||||||
(from fo in FirmwareDatabase.FirmwareOptions
|
(from fo in FirmwareDatabase.FirmwareOptions
|
||||||
where fo.hash == rff.Hash && fo.ConfigKey != fr.ConfigKey
|
where fo.Hash == rff.Hash && fo.ConfigKey != fr.ConfigKey
|
||||||
select fr).FirstOrDefault();
|
select fr).FirstOrDefault();
|
||||||
|
|
||||||
if (option != null)
|
if (option != null)
|
||||||
|
|
|
@ -139,9 +139,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
lvi.UseItemStyleForSubItems = false;
|
lvi.UseItemStyleForSubItems = false;
|
||||||
lvi.ImageIndex = idUnsure;
|
lvi.ImageIndex = idUnsure;
|
||||||
lvi.ToolTipText = null;
|
lvi.ToolTipText = null;
|
||||||
lvi.SubItems.Add(fr.systemId);
|
lvi.SubItems.Add(fr.SystemId);
|
||||||
lvi.SubItems.Add(fr.firmwareId);
|
lvi.SubItems.Add(fr.FirmwareId);
|
||||||
lvi.SubItems.Add(fr.descr);
|
lvi.SubItems.Add(fr.Descr);
|
||||||
lvi.SubItems.Add(""); //resolved with
|
lvi.SubItems.Add(""); //resolved with
|
||||||
lvi.SubItems.Add(""); //location
|
lvi.SubItems.Add(""); //location
|
||||||
lvi.SubItems.Add(""); //size
|
lvi.SubItems.Add(""); //size
|
||||||
|
@ -151,16 +151,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
lvFirmwares.Items.Add(lvi);
|
lvFirmwares.Items.Add(lvi);
|
||||||
|
|
||||||
//build the groups in the listview as we go:
|
//build the groups in the listview as we go:
|
||||||
if (!groups.ContainsKey(fr.systemId))
|
if (!groups.ContainsKey(fr.SystemId))
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
if (!SystemGroupNames.TryGetValue(fr.systemId, out name))
|
if (!SystemGroupNames.TryGetValue(fr.SystemId, out name))
|
||||||
name = "FIX ME (FirmwaresConfig.cs)";
|
name = "FIX ME (FirmwaresConfig.cs)";
|
||||||
lvFirmwares.Groups.Add(fr.systemId, name);
|
lvFirmwares.Groups.Add(fr.SystemId, name);
|
||||||
var lvg = lvFirmwares.Groups[lvFirmwares.Groups.Count - 1];
|
var lvg = lvFirmwares.Groups[lvFirmwares.Groups.Count - 1];
|
||||||
groups[fr.systemId] = lvg;
|
groups[fr.SystemId] = lvg;
|
||||||
}
|
}
|
||||||
lvi.Group = groups[fr.systemId];
|
lvi.Group = groups[fr.SystemId];
|
||||||
}
|
}
|
||||||
|
|
||||||
//now that we have some items in the listview, we can size some columns to sensible widths
|
//now that we have some items in the listview, we can size some columns to sensible widths
|
||||||
|
@ -262,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
lvi.ImageIndex = idOk;
|
lvi.ImageIndex = idOk;
|
||||||
lvi.ToolTipText = "Good!";
|
lvi.ToolTipText = "Good!";
|
||||||
lvi.SubItems[4].Text = ri.KnownFirmwareFile.descr;
|
lvi.SubItems[4].Text = ri.KnownFirmwareFile.Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bolden the item if necessary
|
//bolden the item if necessary
|
||||||
|
@ -314,7 +314,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (ri.KnownFirmwareFile == null) continue;
|
if (ri.KnownFirmwareFile == null) continue;
|
||||||
if (ri.UserSpecified) continue;
|
if (ri.UserSpecified) continue;
|
||||||
|
|
||||||
string fpTarget = PathManager.StandardFirmwareName(ri.KnownFirmwareFile.recommendedName);
|
string fpTarget = PathManager.StandardFirmwareName(ri.KnownFirmwareFile.RecommendedName);
|
||||||
string fpSource = ri.FilePath;
|
string fpSource = ri.FilePath;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -395,11 +395,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//get all options for this firmware (in order)
|
//get all options for this firmware (in order)
|
||||||
var options =
|
var options =
|
||||||
from fo in FirmwareDatabase.FirmwareOptions
|
from fo in FirmwareDatabase.FirmwareOptions
|
||||||
where fo.systemId == fr.systemId && fo.firmwareId == fr.firmwareId
|
where fo.SystemId == fr.SystemId && fo.FirmwareId == fr.FirmwareId
|
||||||
select fo;
|
select fo;
|
||||||
|
|
||||||
FirmwaresConfigInfo fciDialog = new FirmwaresConfigInfo();
|
FirmwaresConfigInfo fciDialog = new FirmwaresConfigInfo();
|
||||||
fciDialog.lblFirmware.Text = string.Format("{0} : {1} ({2})", fr.systemId, fr.firmwareId, fr.descr);
|
fciDialog.lblFirmware.Text = string.Format("{0} : {1} ({2})", fr.SystemId, fr.FirmwareId, fr.Descr);
|
||||||
foreach (var o in options)
|
foreach (var o in options)
|
||||||
{
|
{
|
||||||
ListViewItem olvi = new ListViewItem();
|
ListViewItem olvi = new ListViewItem();
|
||||||
|
@ -407,24 +407,24 @@ namespace BizHawk.Client.EmuHawk
|
||||||
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
||||||
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
||||||
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
olvi.SubItems.Add(new ListViewItem.ListViewSubItem());
|
||||||
var ff = FirmwareDatabase.FirmwareFilesByHash[o.hash];
|
var ff = FirmwareDatabase.FirmwareFilesByHash[o.Hash];
|
||||||
if (o.status == FirmwareDatabase.FirmwareOptionStatus.Ideal)
|
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Ideal)
|
||||||
olvi.ImageIndex = FirmwaresConfigInfo.idIdeal;
|
olvi.ImageIndex = FirmwaresConfigInfo.idIdeal;
|
||||||
if (o.status == FirmwareDatabase.FirmwareOptionStatus.Acceptable)
|
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Acceptable)
|
||||||
olvi.ImageIndex = FirmwaresConfigInfo.idAcceptable;
|
olvi.ImageIndex = FirmwaresConfigInfo.idAcceptable;
|
||||||
if (o.status == FirmwareDatabase.FirmwareOptionStatus.Unacceptable)
|
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Unacceptable)
|
||||||
olvi.ImageIndex = FirmwaresConfigInfo.idUnacceptable;
|
olvi.ImageIndex = FirmwaresConfigInfo.idUnacceptable;
|
||||||
if (o.status == FirmwareDatabase.FirmwareOptionStatus.Bad)
|
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Bad)
|
||||||
olvi.ImageIndex = FirmwaresConfigInfo.idBad;
|
olvi.ImageIndex = FirmwaresConfigInfo.idBad;
|
||||||
olvi.SubItems[0].Text = ff.size.ToString();
|
olvi.SubItems[0].Text = ff.Size.ToString();
|
||||||
olvi.SubItems[0].Font = this.Font; //why doesnt this work?
|
olvi.SubItems[0].Font = this.Font; //why doesnt this work?
|
||||||
olvi.SubItems[1].Text = "sha1:" + o.hash;
|
olvi.SubItems[1].Text = "sha1:" + o.Hash;
|
||||||
olvi.SubItems[1].Font = fixedFont;
|
olvi.SubItems[1].Font = fixedFont;
|
||||||
olvi.SubItems[2].Text = ff.recommendedName;
|
olvi.SubItems[2].Text = ff.RecommendedName;
|
||||||
olvi.SubItems[2].Font = this.Font; //why doesnt this work?
|
olvi.SubItems[2].Font = this.Font; //why doesnt this work?
|
||||||
olvi.SubItems[3].Text = ff.descr;
|
olvi.SubItems[3].Text = ff.Description;
|
||||||
olvi.SubItems[3].Font = this.Font; //why doesnt this work?
|
olvi.SubItems[3].Font = this.Font; //why doesnt this work?
|
||||||
olvi.SubItems[4].Text = ff.info;
|
olvi.SubItems[4].Text = ff.Info;
|
||||||
olvi.SubItems[4].Font = this.Font; //why doesnt this work?
|
olvi.SubItems[4].Font = this.Font; //why doesnt this work?
|
||||||
fciDialog.lvOptions.Items.Add(olvi);
|
fciDialog.lvOptions.Items.Add(olvi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,40 +192,61 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
||||||
var returnType = baseMethod.ReturnType;
|
var returnType = baseMethod.ReturnType;
|
||||||
|
|
||||||
// create the delegate type
|
// create the delegate type
|
||||||
var delegateType = type.DefineNestedType("DelegateType" + baseMethod.Name,
|
var delegateType = type.DefineNestedType(
|
||||||
TypeAttributes.Class | TypeAttributes.NestedPrivate | TypeAttributes.Sealed, typeof(MulticastDelegate));
|
"DelegateType" + baseMethod.Name,
|
||||||
|
TypeAttributes.Class | TypeAttributes.NestedPrivate | TypeAttributes.Sealed,
|
||||||
|
typeof(MulticastDelegate));
|
||||||
|
|
||||||
var delegateCtor = delegateType.DefineConstructor(
|
var delegateCtor = delegateType.DefineConstructor(
|
||||||
MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public,
|
MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public,
|
||||||
CallingConventions.Standard, new Type[] { typeof(object), typeof(IntPtr) });
|
CallingConventions.Standard,
|
||||||
|
new[] { typeof(object), typeof(IntPtr) });
|
||||||
|
|
||||||
delegateCtor.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
|
delegateCtor.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
|
||||||
var delegateInvoke = delegateType.DefineMethod("Invoke",
|
|
||||||
MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual, returnType, paramTypes);
|
var delegateInvoke = delegateType.DefineMethod(
|
||||||
|
"Invoke",
|
||||||
|
MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual,
|
||||||
|
returnType,
|
||||||
|
paramTypes);
|
||||||
|
|
||||||
// we have to project all of the attributes from the baseMethod to the delegateInvoke
|
// we have to project all of the attributes from the baseMethod to the delegateInvoke
|
||||||
// so for something like [Out], the interop engine will see it and use it
|
// so for something like [Out], the interop engine will see it and use it
|
||||||
for (int i = 0; i < paramInfos.Length; i++)
|
for (int i = 0; i < paramInfos.Length; i++)
|
||||||
{
|
{
|
||||||
var p = delegateInvoke.DefineParameter(i + 1, ParameterAttributes.None, paramInfos[i].Name);
|
var p = delegateInvoke.DefineParameter(i + 1, ParameterAttributes.None, paramInfos[i].Name);
|
||||||
foreach (var a in paramInfos[i].GetCustomAttributes(false))
|
foreach (var a in paramInfos[i].GetCustomAttributes(false))
|
||||||
|
{
|
||||||
p.SetCustomAttribute(GetAttributeBuilder(a));
|
p.SetCustomAttribute(GetAttributeBuilder(a));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var p = delegateInvoke.DefineParameter(0, ParameterAttributes.Retval, baseMethod.ReturnParameter.Name);
|
var p = delegateInvoke.DefineParameter(0, ParameterAttributes.Retval, baseMethod.ReturnParameter.Name);
|
||||||
foreach (var a in baseMethod.ReturnParameter.GetCustomAttributes(false))
|
foreach (var a in baseMethod.ReturnParameter.GetCustomAttributes(false))
|
||||||
|
{
|
||||||
p.SetCustomAttribute(GetAttributeBuilder(a));
|
p.SetCustomAttribute(GetAttributeBuilder(a));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delegateInvoke.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
|
delegateInvoke.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
|
||||||
|
|
||||||
// add the [UnmanagedFunctionPointer] to the delegate so interop will know how to call it
|
// add the [UnmanagedFunctionPointer] to the delegate so interop will know how to call it
|
||||||
var attr = new CustomAttributeBuilder(typeof(UnmanagedFunctionPointerAttribute).GetConstructor(new[] { typeof(CallingConvention) }), new object[] { nativeCall });
|
var attr = new CustomAttributeBuilder(typeof(UnmanagedFunctionPointerAttribute).GetConstructor(new[] { typeof(CallingConvention) }), new object[] { nativeCall });
|
||||||
delegateType.SetCustomAttribute(attr);
|
delegateType.SetCustomAttribute(attr);
|
||||||
|
|
||||||
// define a field on the class to hold the delegate
|
// define a field on the class to hold the delegate
|
||||||
var field = type.DefineField("DelegateField" + baseMethod.Name, delegateType,
|
var field = type.DefineField(
|
||||||
|
"DelegateField" + baseMethod.Name,
|
||||||
|
delegateType,
|
||||||
FieldAttributes.Public);
|
FieldAttributes.Public);
|
||||||
|
|
||||||
var method = type.DefineMethod(baseMethod.Name, MethodAttributes.Virtual | MethodAttributes.Public,
|
var method = type.DefineMethod(
|
||||||
CallingConventions.HasThis, returnType, paramTypes);
|
baseMethod.Name,
|
||||||
|
MethodAttributes.Virtual | MethodAttributes.Public,
|
||||||
|
CallingConventions.HasThis,
|
||||||
|
returnType,
|
||||||
|
paramTypes);
|
||||||
|
|
||||||
var il = method.GetILGenerator();
|
var il = method.GetILGenerator();
|
||||||
|
|
||||||
Label exc = new Label();
|
Label exc = new Label();
|
||||||
|
@ -357,7 +378,7 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// load an IntPtr constant in an il stream
|
/// load an IntPtr constant in an IL stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void LoadConstant(ILGenerator il, IntPtr p)
|
private static void LoadConstant(ILGenerator il, IntPtr p)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +399,7 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// load a UIntPtr constant in an il stream
|
/// load a UIntPtr constant in an IL stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void LoadConstant(ILGenerator il, UIntPtr p)
|
private static void LoadConstant(ILGenerator il, UIntPtr p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common.BizInvoke
|
namespace BizHawk.Emulation.Common.BizInvoke
|
||||||
|
@ -61,8 +59,10 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
||||||
{
|
{
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr LoadLibrary(string dllToLoad);
|
public static extern IntPtr LoadLibrary(string dllToLoad);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern bool FreeLibrary(IntPtr hModule);
|
public static extern bool FreeLibrary(IntPtr hModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Linq;
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
|
@ -9,11 +8,11 @@ namespace BizHawk.Emulation.Common
|
||||||
static FirmwareDatabase()
|
static FirmwareDatabase()
|
||||||
{
|
{
|
||||||
// FDS has two OK variants (http://tcrf.net/Family_Computer_Disk_System)
|
// FDS has two OK variants (http://tcrf.net/Family_Computer_Disk_System)
|
||||||
var fds_nintendo = File("57FE1BDEE955BB48D357E463CCBF129496930B62", 8192, "disksys-nintendo.rom", "Bios (Nintendo)");
|
var fdsNintendo = File("57FE1BDEE955BB48D357E463CCBF129496930B62", 8192, "disksys-nintendo.rom", "Bios (Nintendo)");
|
||||||
var fds_twinfc = File("E4E41472C454F928E53EB10E0509BF7D1146ECC1", 8192, "disksys-nintendo.rom", "Bios (TwinFC)");
|
var fdsTwinfc = File("E4E41472C454F928E53EB10E0509BF7D1146ECC1", 8192, "disksys-nintendo.rom", "Bios (TwinFC)");
|
||||||
Firmware("NES", "Bios_FDS", "Bios");
|
Firmware("NES", "Bios_FDS", "Bios");
|
||||||
Option("NES", "Bios_FDS", fds_nintendo);
|
Option("NES", "Bios_FDS", fdsNintendo);
|
||||||
Option("NES", "Bios_FDS", fds_twinfc);
|
Option("NES", "Bios_FDS", fdsTwinfc);
|
||||||
|
|
||||||
FirmwareAndOption("973E10840DB683CF3FAF61BD443090786B3A9F04", 262144, "SNES", "Rom_SGB", "sgb.sfc", "Super GameBoy Rom"); // World (Rev B) ?
|
FirmwareAndOption("973E10840DB683CF3FAF61BD443090786B3A9F04", 262144, "SNES", "Rom_SGB", "sgb.sfc", "Super GameBoy Rom"); // World (Rev B) ?
|
||||||
FirmwareAndOption("A002F4EFBA42775A31185D443F3ED1790B0E949A", 3072, "SNES", "CX4", "cx4.rom", "CX4 Rom");
|
FirmwareAndOption("A002F4EFBA42775A31185D443F3ED1790B0E949A", 3072, "SNES", "CX4", "cx4.rom", "CX4 Rom");
|
||||||
|
@ -31,19 +30,16 @@ namespace BizHawk.Emulation.Common
|
||||||
FirmwareAndOption("A3AF676991391A6DD716C79022D4947206B78164", 4096, "A78", "Bios_HSC", "7800highscore.bin", "Highscore Bios");
|
FirmwareAndOption("A3AF676991391A6DD716C79022D4947206B78164", 4096, "A78", "Bios_HSC", "7800highscore.bin", "Highscore Bios");
|
||||||
FirmwareAndOption("45BEDC4CBDEAC66C7DF59E9E599195C778D86A92", 8192, "Coleco", "Bios", "ColecoBios.bin", "Bios");
|
FirmwareAndOption("45BEDC4CBDEAC66C7DF59E9E599195C778D86A92", 8192, "Coleco", "Bios", "ColecoBios.bin", "Bios");
|
||||||
|
|
||||||
{
|
var gbaNormal = File("300C20DF6731A33952DED8C436F7F186D25D3492", 16384, "gbabios.rom", "Bios (World)");
|
||||||
var GBA_JDebug = File("AA98A2AD32B86106340665D1222D7D973A1361C7", 16384, "gbabios.rom", "Bios (J Debug)");
|
var gbaJDebug = File("AA98A2AD32B86106340665D1222D7D973A1361C7", 16384, "gbabios.rom", "Bios (J Debug)");
|
||||||
var GBA_Normal = File("300C20DF6731A33952DED8C436F7F186D25D3492", 16384, "gbabios.rom", "Bios (World)");
|
Firmware("GBA", "Bios", "Bios");
|
||||||
Firmware("GBA", "Bios", "Bios");
|
Option("GBA", "Bios", gbaNormal);
|
||||||
Option("GBA", "Bios", GBA_Normal);
|
Option("GBA", "Bios", gbaJDebug);
|
||||||
Option("GBA", "Bios", GBA_JDebug);
|
|
||||||
}
|
|
||||||
|
|
||||||
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "lynxboot.img", "Boot Rom");
|
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "lynxboot.img", "Boot Rom");
|
||||||
|
|
||||||
|
////FirmwareAndOption("24F67BDEA115A2C847C8813A262502EE1607B7DF", "NDS", "Bios_Arm7", "biosnds7.rom", "ARM7 Bios");
|
||||||
//FirmwareAndOption("24F67BDEA115A2C847C8813A262502EE1607B7DF", "NDS", "Bios_Arm7", "biosnds7.rom", "ARM7 Bios");
|
////FirmwareAndOption("BFAAC75F101C135E32E2AAF541DE6B1BE4C8C62D", "NDS", "Bios_Arm9", "biosnds9.rom", "ARM9 Bios");
|
||||||
//FirmwareAndOption("BFAAC75F101C135E32E2AAF541DE6B1BE4C8C62D", "NDS", "Bios_Arm9", "biosnds9.rom", "ARM9 Bios");
|
|
||||||
FirmwareAndOption("5A65B922B562CB1F57DAB51B73151283F0E20C7A", 8192, "INTV", "EROM", "erom.bin", "Executive Rom");
|
FirmwareAndOption("5A65B922B562CB1F57DAB51B73151283F0E20C7A", 8192, "INTV", "EROM", "erom.bin", "Executive Rom");
|
||||||
FirmwareAndOption("F9608BB4AD1CFE3640D02844C7AD8E0BCD974917", 2048, "INTV", "GROM", "grom.bin", "Graphics Rom");
|
FirmwareAndOption("F9608BB4AD1CFE3640D02844C7AD8E0BCD974917", 2048, "INTV", "GROM", "grom.bin", "Graphics Rom");
|
||||||
|
|
||||||
|
@ -159,7 +155,7 @@ namespace BizHawk.Emulation.Common
|
||||||
var psone_r5e = File("DBC7339E5D85827C095764FC077B41F78FD2ECAE", 524288, "psone-45e.bin", "PSX BIOS (Version 4.5 05/25/00 E)", "Used on PSone SCPH-102 [g]. This is for Rev C PSone hardware [w].");
|
var psone_r5e = File("DBC7339E5D85827C095764FC077B41F78FD2ECAE", 524288, "psone-45e.bin", "PSX BIOS (Version 4.5 05/25/00 E)", "Used on PSone SCPH-102 [g]. This is for Rev C PSone hardware [w].");
|
||||||
var ps2_50j = File("D7D6BE084F51354BC951D8FA2D8D912AA70ABC5E", 4194304, "ps2-50j.bin", "PSX BIOS (Version 5.0 10/27/00 J)", "Found on a PS2 [p].");
|
var ps2_50j = File("D7D6BE084F51354BC951D8FA2D8D912AA70ABC5E", 4194304, "ps2-50j.bin", "PSX BIOS (Version 5.0 10/27/00 J)", "Found on a PS2 [p].");
|
||||||
|
|
||||||
ps_22j_bad.bad = ps_22j_bad2.bad = ps_30e_bad.bad = true;
|
ps_22j_bad.Bad = ps_22j_bad2.Bad = ps_30e_bad.Bad = true;
|
||||||
|
|
||||||
Firmware("PSX", "U", "BIOS (U)");
|
Firmware("PSX", "U", "BIOS (U)");
|
||||||
Firmware("PSX", "J", "BIOS (J)");
|
Firmware("PSX", "J", "BIOS (J)");
|
||||||
|
@ -197,11 +193,11 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
Firmware("AppleII", "AppleIIe", "AppleIIe.rom");
|
Firmware("AppleII", "AppleIIe", "AppleIIe.rom");
|
||||||
var appleII_AppleIIe = File("B8EA90ABE135A0031065E01697C4A3A20D51198B", 16384, "AppleIIe.rom", "Apple II e");
|
var appleII_AppleIIe = File("B8EA90ABE135A0031065E01697C4A3A20D51198B", 16384, "AppleIIe.rom", "Apple II e");
|
||||||
Option("AppleII", "AppleIIe", appleII_AppleIIe, FirmwareOptionStatus.Acceptable);
|
Option("AppleII", "AppleIIe", appleII_AppleIIe);
|
||||||
|
|
||||||
Firmware("AppleII", "DiskII", "DiskII.rom");
|
Firmware("AppleII", "DiskII", "DiskII.rom");
|
||||||
var appleII_DiskII = File("D4181C9F046AAFC3FB326B381BAAC809D9E38D16", 256, "DiskII.rom", "Disk II");
|
var appleII_DiskII = File("D4181C9F046AAFC3FB326B381BAAC809D9E38D16", 256, "DiskII.rom", "Disk II");
|
||||||
Option("AppleII", "DiskII", appleII_DiskII, FirmwareOptionStatus.Acceptable);
|
Option("AppleII", "DiskII", appleII_DiskII);
|
||||||
}
|
}
|
||||||
|
|
||||||
// adds a defined firmware ID to the database
|
// adds a defined firmware ID to the database
|
||||||
|
@ -209,9 +205,9 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
var fr = new FirmwareRecord
|
var fr = new FirmwareRecord
|
||||||
{
|
{
|
||||||
systemId = systemId,
|
SystemId = systemId,
|
||||||
firmwareId = id,
|
FirmwareId = id,
|
||||||
descr = descr
|
Descr = descr
|
||||||
};
|
};
|
||||||
|
|
||||||
FirmwareRecords.Add(fr);
|
FirmwareRecords.Add(fr);
|
||||||
|
@ -222,19 +218,19 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
var fo = new FirmwareOption
|
var fo = new FirmwareOption
|
||||||
{
|
{
|
||||||
systemId = systemId,
|
SystemId = systemId,
|
||||||
firmwareId = id,
|
FirmwareId = id,
|
||||||
hash = hash,
|
Hash = hash,
|
||||||
status = status,
|
Status = status,
|
||||||
size = size
|
Size = size
|
||||||
};
|
};
|
||||||
|
|
||||||
FirmwareOptions.Add(fo);
|
FirmwareOptions.Add(fo);
|
||||||
|
|
||||||
// first option is automatically ideal
|
// first option is automatically ideal
|
||||||
if (FirmwareOptions.Count == 1 && fo.status == FirmwareOptionStatus.Acceptable)
|
if (FirmwareOptions.Count == 1 && fo.Status == FirmwareOptionStatus.Acceptable)
|
||||||
{
|
{
|
||||||
fo.status = FirmwareOptionStatus.Ideal;
|
fo.Status = FirmwareOptionStatus.Ideal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fo;
|
return fo;
|
||||||
|
@ -243,12 +239,12 @@ namespace BizHawk.Emulation.Common
|
||||||
// adds an acceptable option for a firmware ID to the database
|
// adds an acceptable option for a firmware ID to the database
|
||||||
private static FirmwareOption Option(string systemId, string id, FirmwareFile ff, FirmwareOptionStatus status = FirmwareOptionStatus.Acceptable)
|
private static FirmwareOption Option(string systemId, string id, FirmwareFile ff, FirmwareOptionStatus status = FirmwareOptionStatus.Acceptable)
|
||||||
{
|
{
|
||||||
var fo = Option(ff.hash, ff.size, systemId, id, status);
|
var fo = Option(ff.Hash, ff.Size, systemId, id, status);
|
||||||
|
|
||||||
// make sure this goes in as bad
|
// make sure this goes in as bad
|
||||||
if (ff.bad)
|
if (ff.Bad)
|
||||||
{
|
{
|
||||||
fo.status = FirmwareOptionStatus.Bad;
|
fo.Status = FirmwareOptionStatus.Bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fo;
|
return fo;
|
||||||
|
@ -261,11 +257,11 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
var ff = new FirmwareFile
|
var ff = new FirmwareFile
|
||||||
{
|
{
|
||||||
hash = hashfix,
|
Hash = hashfix,
|
||||||
size = size,
|
Size = size,
|
||||||
recommendedName = recommendedName,
|
RecommendedName = recommendedName,
|
||||||
descr = descr,
|
Description = descr,
|
||||||
info = additionalInfo
|
Info = additionalInfo
|
||||||
};
|
};
|
||||||
FirmwareFiles.Add(ff);
|
FirmwareFiles.Add(ff);
|
||||||
FirmwareFilesByHash[hashfix] = ff;
|
FirmwareFilesByHash[hashfix] = ff;
|
||||||
|
@ -276,33 +272,33 @@ namespace BizHawk.Emulation.Common
|
||||||
private static void FirmwareAndOption(string hash, long size, string systemId, string id, string name, string descr)
|
private static void FirmwareAndOption(string hash, long size, string systemId, string id, string name, string descr)
|
||||||
{
|
{
|
||||||
Firmware(systemId, id, descr);
|
Firmware(systemId, id, descr);
|
||||||
File(hash, size, name, descr, "");
|
File(hash, size, name, descr, string.Empty);
|
||||||
Option(hash, size, systemId, id);
|
Option(hash, size, systemId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static readonly List<FirmwareRecord> FirmwareRecords = new List<FirmwareRecord>();
|
public static readonly List<FirmwareRecord> FirmwareRecords = new List<FirmwareRecord>();
|
||||||
public static readonly List<FirmwareOption> FirmwareOptions = new List<FirmwareOption>();
|
public static readonly List<FirmwareOption> FirmwareOptions = new List<FirmwareOption>();
|
||||||
public static readonly List<FirmwareFile> FirmwareFiles = new List<FirmwareFile>();
|
public static readonly List<FirmwareFile> FirmwareFiles = new List<FirmwareFile>();
|
||||||
|
|
||||||
public static Dictionary<string, FirmwareFile> FirmwareFilesByHash = new Dictionary<string, FirmwareFile>();
|
public static readonly Dictionary<string, FirmwareFile> FirmwareFilesByHash = new Dictionary<string, FirmwareFile>();
|
||||||
|
|
||||||
public class FirmwareFile
|
public class FirmwareFile
|
||||||
{
|
{
|
||||||
public string hash;
|
public string Hash { get; set; }
|
||||||
public long size;
|
public long Size { get; set; }
|
||||||
public string recommendedName;
|
public string RecommendedName { get; set; }
|
||||||
public string descr;
|
public string Description { get; set; }
|
||||||
public string info;
|
public string Info { get; set; }
|
||||||
public bool bad;
|
public bool Bad { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FirmwareRecord
|
public class FirmwareRecord
|
||||||
{
|
{
|
||||||
public string systemId;
|
public string SystemId { get; set; }
|
||||||
public string firmwareId;
|
public string FirmwareId { get; set; }
|
||||||
public string descr;
|
public string Descr { get; set; }
|
||||||
public string ConfigKey => $"{systemId}+{firmwareId}";
|
|
||||||
|
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FirmwareOptionStatus
|
public enum FirmwareOptionStatus
|
||||||
|
@ -312,23 +308,23 @@ namespace BizHawk.Emulation.Common
|
||||||
|
|
||||||
public class FirmwareOption
|
public class FirmwareOption
|
||||||
{
|
{
|
||||||
public string systemId;
|
public string SystemId { get; set; }
|
||||||
public string firmwareId;
|
public string FirmwareId { get; set; }
|
||||||
public string hash;
|
public string Hash { get; set; }
|
||||||
public long size;
|
public long Size { get; set; }
|
||||||
public FirmwareOptionStatus status;
|
public FirmwareOptionStatus Status { get; set; }
|
||||||
public bool IsAcceptableOrIdeal { get { return status == FirmwareOptionStatus.Ideal || status == FirmwareOptionStatus.Acceptable; } }
|
|
||||||
public string ConfigKey => $"{systemId}+{firmwareId}";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public bool IsAcceptableOrIdeal => Status == FirmwareOptionStatus.Ideal || Status == FirmwareOptionStatus.Acceptable;
|
||||||
|
public string ConfigKey => $"{SystemId}+{FirmwareId}";
|
||||||
|
}
|
||||||
|
|
||||||
public static FirmwareRecord LookupFirmwareRecord(string sysId, string firmwareId)
|
public static FirmwareRecord LookupFirmwareRecord(string sysId, string firmwareId)
|
||||||
{
|
{
|
||||||
var found =
|
var found =
|
||||||
(from fr in FirmwareRecords
|
from fr in FirmwareRecords
|
||||||
where fr.firmwareId == firmwareId
|
where fr.FirmwareId == firmwareId
|
||||||
&& fr.systemId == sysId
|
&& fr.SystemId == sysId
|
||||||
select fr);
|
select fr;
|
||||||
|
|
||||||
return found.FirstOrDefault();
|
return found.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue