Skip to content

Commit 595a207

Browse files
committed
add new field to gamedb to specify which core should be used.
allow it to be 'neshawk' or 'quicknes'. this should only be employed by end-users; we won't make those choices in the gamedb officially. the quicknes blacklist is still implemented separately. yeah, that's a lot of prioritization levels.
1 parent c7b639b commit 595a207

File tree

8 files changed

+427
-380
lines changed

8 files changed

+427
-380
lines changed

BizHawk.Client.Common/RomLoader.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -744,16 +744,29 @@ public bool LoadRom(string path, CoreComm nextComm, bool forceAccurateCore = fal
744744

745745
break;
746746
case "NES":
747-
if (!Global.Config.NES_InQuickNES || forceAccurateCore)
748747
{
749-
core = CoreInventory.Instance["NES", "NesHawk"];
750-
}
751-
else
752-
{
753-
core = CoreInventory.Instance["NES", "QuickNes"];
754-
}
748+
//apply main spur-of-the-moment switcheroo as lowest priority
749+
string preference = "neshawk";
750+
if(Global.Config.NES_InQuickNES) preference = "quicknes";
751+
752+
//if user has saw fit to override in gamedb, apply that
753+
if(Global.Config.CoreForcingViaGameDB)
754+
preference = game.ForcedCore;
755+
756+
//but only neshawk is accurate
757+
if (forceAccurateCore) preference = "neshawk";
755758

759+
if (preference == "neshawk")
760+
{
761+
core = CoreInventory.Instance["NES", "NesHawk"];
762+
}
763+
else
764+
{
765+
core = CoreInventory.Instance["NES", "QuickNes"];
766+
}
767+
}
756768
break;
769+
757770
case "GB":
758771
case "GBC":
759772
if (!Global.Config.GB_AsSGB)

BizHawk.Client.Common/config/Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ public AnalogBind(string Value, float Mult, float Deadzone)
513513
public bool NES_InQuickNES = true;
514514
public bool SNES_InSnes9x = false;
515515
public bool GBA_UsemGBA = false;
516+
public bool CoreForcingViaGameDB = true;
516517
public string LibretroCore;
517518
}
518519

BizHawk.Client.EmuHawk/MainForm.Designer.cs

Lines changed: 389 additions & 371 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BizHawk.Client.EmuHawk/MainForm.Events.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ private void CoresSubMenu_DropDownOpened(object sender, EventArgs e)
11731173
GBInSGBMenuItem.Checked = Global.Config.GB_AsSGB;
11741174
NesInQuickNESMenuItem.Checked = Global.Config.NES_InQuickNES;
11751175
gBAWithMGBAToolStripMenuItem.Checked = Global.Config.GBA_UsemGBA;
1176+
allowGameDBCoreOverridesToolStripMenuItem.Checked = Global.Config.CoreForcingViaGameDB;
11761177
}
11771178

11781179
private void CoreSNESSubMenu_DropDownOpened(object sender, EventArgs e)

BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4152,5 +4152,10 @@ private void coreToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
41524152
quickNESToolStripMenuItem.Checked = Global.Config.NES_InQuickNES == true;
41534153
nesHawkToolStripMenuItem.Checked = Global.Config.NES_InQuickNES == false;
41544154
}
4155+
4156+
private void allowGameDBCoreOverridesToolStripMenuItem_Click(object sender, EventArgs e)
4157+
{
4158+
Global.Config.CoreForcingViaGameDB ^= true;
4159+
}
41554160
}
41564161
}

BizHawk.Client.EmuHawk/MainForm.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
<data name="FirmwaresMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
139139
<value>
140140
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
141-
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABBDAAAQQwHDBU0eAAAAcElE
141+
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABBBAAAQQQG8+46XAAAAcElE
142142
QVQ4T82Q4QoAIQiDffR7804DY+pOov5c8GltwyiRR8YVTLTFOsWK2iA0eAapQkPOznwRGnJ25rX87AmK
143143
/3ruFCvhCR9oclI8PNggJHg7A46w4rf5zY6H8jlAxQQOKMPWBswSIpmloXkEFbeR8QKDpKJKL1M/dQAA
144144
AABJRU5ErkJggg==
@@ -563,7 +563,7 @@
563563
<data name="toolStripMenuItem11.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
564564
<value>
565565
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
566-
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABBDAAAQQwHDBU0eAAAAcElE
566+
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAABBBAAAQQQG8+46XAAAAcElE
567567
QVQ4T82Q4QoAIQiDffR7804DY+pOov5c8GltwyiRR8YVTLTFOsWK2iA0eAapQkPOznwRGnJ25rX87AmK
568568
/3ruFCvhCR9oclI8PNggJHg7A46w4rf5zY6H8jlAxQQOKMPWBswSIpmloXkEFbeR8QKDpKJKL1M/dQAA
569569
AABJRU5ErkJggg==

BizHawk.Emulation.Common/Database/Database.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class CompactGameInfo
1717
public string Hash { get; set; }
1818
public string Region { get; set; }
1919
public RomStatus Status { get; set; }
20+
public string ForcedCore { get; set; }
2021
}
2122

2223
public static class Database
@@ -192,6 +193,11 @@ public static void LoadDatabase(string path)
192193
game.System = items[3];
193194
game.MetaData = items.Length >= 6 ? items[5] : null;
194195
game.Region = items.Length >= 7 ? items[6] : string.Empty;
196+
game.ForcedCore = items.Length >= 8 ? items[7].ToLowerInvariant() : string.Empty;
197+
if (items.Length >= 8)
198+
{
199+
int zzz = 9;
200+
}
195201

196202
if (db.ContainsKey(game.Hash))
197203
{

BizHawk.Emulation.Common/Database/GameInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public bool IsRomStatusBad()
2020
public RomStatus Status = RomStatus.NotInDatabase;
2121
public bool NotInDatabase = true;
2222
public string FirmwareHash;
23+
public string ForcedCore;
2324

2425
Dictionary<string, string> Options = new Dictionary<string, string>();
2526

@@ -43,6 +44,7 @@ public static GameInfo NullInstance
4344
Hash = "",
4445
Region = "",
4546
Status = RomStatus.GoodDump,
47+
ForcedCore = "",
4648
NotInDatabase = false
4749
};
4850
}
@@ -60,6 +62,7 @@ internal GameInfo(CompactGameInfo cgi)
6062
Hash = cgi.Hash;
6163
Region = cgi.Region;
6264
Status = cgi.Status;
65+
ForcedCore = cgi.ForcedCore;
6366
NotInDatabase = false;
6467
ParseOptionsDictionary(cgi.MetaData);
6568
}

0 commit comments

Comments
 (0)