remove "SGB" systemid because its gonna cause a lot of trouble if we dont hook it up in a lot of places.. why can't we set it up as just a regular snes core? and run the sgb rom through the snes firmwares directory.

This commit is contained in:
zeromus 2012-10-05 04:47:45 +00:00
parent af9390f569
commit 96089026cd
7 changed files with 997 additions and 1030 deletions

View File

@ -284,6 +284,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public unsafe class LibsnesCore : IEmulator, IVideoProvider, ISoundProvider public unsafe class LibsnesCore : IEmulator, IVideoProvider, ISoundProvider
{ {
public bool IsSGB { get; private set; }
bool disposed = false; bool disposed = false;
public void Dispose() public void Dispose()
{ {
@ -337,7 +339,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
ScanlineHookManager.HandleScanline(line); ScanlineHookManager.HandleScanline(line);
} }
string snes_path_request_t(int slot, string hint) string snes_path_request(int slot, string hint)
{ {
//every rom requests this byuu homemade rom //every rom requests this byuu homemade rom
if (hint == "msu1.rom") return ""; if (hint == "msu1.rom") return "";
@ -348,7 +350,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
//does it exist? //does it exist?
if (!File.Exists(test)) if (!File.Exists(test))
{ {
System.Windows.Forms.MessageBox.Show("libsneshawk is requesting a firmware file which could not be found. make sure it's in your snes firmwares folder. the name is: " + hint); System.Windows.Forms.MessageBox.Show("The SNES core is referencing a firmware file which could not be found. Please make sure it's in your configured SNES firmwares folder. The referenced filename is: " + hint);
return ""; return "";
} }
@ -388,7 +390,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
soundcb = new LibsnesDll.snes_audio_sample_t(snes_audio_sample); soundcb = new LibsnesDll.snes_audio_sample_t(snes_audio_sample);
BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_audio_sample(soundcb); BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_audio_sample(soundcb);
pathRequest_cb = new LibsnesDll.snes_path_request_t(snes_path_request_t); pathRequest_cb = new LibsnesDll.snes_path_request_t(snes_path_request);
BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_path_request(pathRequest_cb); BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_path_request(pathRequest_cb);
@ -407,7 +409,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
if (game["SGB"]) if (game["SGB"])
{ {
SystemId = "SGB"; IsSGB = true;
SystemId = "SNES";
if (!LibsnesDll.snes_load_cartridge_super_game_boy(null, sgbRomData, (uint)sgbRomData.Length, null, romData, (uint)romData.Length)) if (!LibsnesDll.snes_load_cartridge_super_game_boy(null, sgbRomData, (uint)sgbRomData.Length, null, romData, (uint)romData.Length))
throw new Exception("snes_load_cartridge_super_game_boy() failed"); throw new Exception("snes_load_cartridge_super_game_boy() failed");
} }

View File

@ -154,7 +154,6 @@ namespace BizHawk.MultiClient
public string PathPCEBios = Path.Combine(".", "PCECDBios.pce"); public string PathPCEBios = Path.Combine(".", "PCECDBios.pce");
public string PathINTVGROM = Path.Combine(".", "grom.bin"); public string PathINTVGROM = Path.Combine(".", "grom.bin");
public string PathINTVEROM = Path.Combine(".", "erom.bin"); public string PathINTVEROM = Path.Combine(".", "erom.bin");
public string PathSGBRom = Path.Combine(".", "Super Game Boy (UE) (V1.2) [!].smc");
public string FFMpegPath = "%exe%/ffmpeg.exe"; public string FFMpegPath = "%exe%/ffmpeg.exe";

View File

@ -1179,7 +1179,8 @@ namespace BizHawk.MultiClient
sNESToolStripMenuItem.Visible = true; sNESToolStripMenuItem.Visible = true;
break; break;
case "SGB": case "SGB":
sNESToolStripMenuItem.Text = "&SGB"; if((Global.Emulator as LibsnesCore).IsSGB)
sNESToolStripMenuItem.Text = "&SGB";
sNESToolStripMenuItem.Visible = true; sNESToolStripMenuItem.Visible = true;
break; break;
default: default:
@ -1227,7 +1228,6 @@ namespace BizHawk.MultiClient
Global.AutoFireController = Global.AutofireNESControls; Global.AutoFireController = Global.AutofireNESControls;
break; break;
case "SNES": case "SNES":
case "SGB":
Global.ActiveController = Global.SNESControls; Global.ActiveController = Global.SNESControls;
Global.AutoFireController = Global.AutofireSNESControls; Global.AutoFireController = Global.AutofireSNESControls;
break; break;
@ -1395,6 +1395,7 @@ namespace BizHawk.MultiClient
rom = new RomGame(file); rom = new RomGame(file);
game = rom.GameInfo; game = rom.GameInfo;
RETRY:
switch (game.System) switch (game.System)
{ {
case "SNES": case "SNES":
@ -1476,11 +1477,22 @@ namespace BizHawk.MultiClient
} }
else else
{ {
// todo: get these bioses into a gamedb?? // todo: get these bioses into a gamedb?? then we could demand different filenames for different regions?
byte[] sgbrom; string sgbromPath = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSNESFirmwares, "SNES"), "sgb.sfc");
byte[] sgbrom = null;
try try
{ {
sgbrom = File.ReadAllBytes(PathManager.MakeAbsolutePath(Global.Config.PathSGBRom, "SGB")); if (File.Exists(sgbromPath))
{
sgbrom = File.ReadAllBytes(sgbromPath);
}
else
{
MessageBox.Show("Couldn't open sgb.smc from the configured SNES firmwares path, which is:\n\n" + PathManager.MakeAbsolutePath(Global.Config.PathSNESFirmwares, "SNES") + "\n\nPlease make sure it is available and try again.\n\nWe're going to disable SGB for now; please re-enable it when you've set up the file.");
Global.Config.GB_AsSGB = false;
game.System = "GB";
goto RETRY;
}
} }
catch (Exception) catch (Exception)
{ {
@ -1488,11 +1500,13 @@ namespace BizHawk.MultiClient
Global.Config.GB_AsSGB = false; Global.Config.GB_AsSGB = false;
throw; throw;
} }
game.AddOption("SGB"); if (sgbrom != null)
game.System = "SGB"; {
var snes = new LibsnesCore(); game.AddOption("SGB");
nextEmulator = snes; var snes = new LibsnesCore();
snes.Load(game, rom.FileData, sgbrom, deterministicemulation); nextEmulator = snes;
snes.Load(game, rom.FileData, sgbrom, deterministicemulation);
}
} }
break; break;
case "COLV": case "COLV":
@ -3731,7 +3745,7 @@ namespace BizHawk.MultiClient
private void sNESToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void sNESToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{ {
if (Global.Emulator.SystemId == "SGB") if ((Global.Emulator as LibsnesCore).IsSGB)
{ {
loadGBInSGBToolStripMenuItem.Visible = true; loadGBInSGBToolStripMenuItem.Visible = true;
loadGBInSGBToolStripMenuItem.Checked = Global.Config.GB_AsSGB; loadGBInSGBToolStripMenuItem.Checked = Global.Config.GB_AsSGB;

View File

@ -84,9 +84,6 @@
this.SNESBrowseFirmwares = new System.Windows.Forms.Button(); this.SNESBrowseFirmwares = new System.Windows.Forms.Button();
this.SNESFirmwaresBox = new System.Windows.Forms.TextBox(); this.SNESFirmwaresBox = new System.Windows.Forms.TextBox();
this.SNESBaseBox = new System.Windows.Forms.TextBox(); this.SNESBaseBox = new System.Windows.Forms.TextBox();
this.SNESSGBDescription = new System.Windows.Forms.Label();
this.SNESBrowseSGB = new System.Windows.Forms.Button();
this.SNESSGBBox = new System.Windows.Forms.TextBox();
this.SNESCheatsDescription = new System.Windows.Forms.Label(); this.SNESCheatsDescription = new System.Windows.Forms.Label();
this.SNESBrowseCheats = new System.Windows.Forms.Button(); this.SNESBrowseCheats = new System.Windows.Forms.Button();
this.SNESCheatsBox = new System.Windows.Forms.TextBox(); this.SNESCheatsBox = new System.Windows.Forms.TextBox();
@ -844,9 +841,6 @@
this.tabPage12.Controls.Add(this.SNESBrowseFirmwares); this.tabPage12.Controls.Add(this.SNESBrowseFirmwares);
this.tabPage12.Controls.Add(this.SNESFirmwaresBox); this.tabPage12.Controls.Add(this.SNESFirmwaresBox);
this.tabPage12.Controls.Add(this.SNESBaseBox); this.tabPage12.Controls.Add(this.SNESBaseBox);
this.tabPage12.Controls.Add(this.SNESSGBDescription);
this.tabPage12.Controls.Add(this.SNESBrowseSGB);
this.tabPage12.Controls.Add(this.SNESSGBBox);
this.tabPage12.Controls.Add(this.SNESCheatsDescription); this.tabPage12.Controls.Add(this.SNESCheatsDescription);
this.tabPage12.Controls.Add(this.SNESBrowseCheats); this.tabPage12.Controls.Add(this.SNESBrowseCheats);
this.tabPage12.Controls.Add(this.SNESCheatsBox); this.tabPage12.Controls.Add(this.SNESCheatsBox);
@ -875,7 +869,7 @@
// //
this.SNESFirmwaresDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.SNESFirmwaresDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.SNESFirmwaresDescription.AutoSize = true; this.SNESFirmwaresDescription.AutoSize = true;
this.SNESFirmwaresDescription.Location = new System.Drawing.Point(474, 240); this.SNESFirmwaresDescription.Location = new System.Drawing.Point(474, 211);
this.SNESFirmwaresDescription.Name = "SNESFirmwaresDescription"; this.SNESFirmwaresDescription.Name = "SNESFirmwaresDescription";
this.SNESFirmwaresDescription.Size = new System.Drawing.Size(54, 13); this.SNESFirmwaresDescription.Size = new System.Drawing.Size(54, 13);
this.SNESFirmwaresDescription.TabIndex = 94; this.SNESFirmwaresDescription.TabIndex = 94;
@ -885,7 +879,7 @@
// //
this.SNESBrowseFirmwares.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.SNESBrowseFirmwares.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.SNESBrowseFirmwares.Image = ((System.Drawing.Image)(resources.GetObject("SNESBrowseFirmwares.Image"))); this.SNESBrowseFirmwares.Image = ((System.Drawing.Image)(resources.GetObject("SNESBrowseFirmwares.Image")));
this.SNESBrowseFirmwares.Location = new System.Drawing.Point(442, 237); this.SNESBrowseFirmwares.Location = new System.Drawing.Point(442, 208);
this.SNESBrowseFirmwares.Name = "SNESBrowseFirmwares"; this.SNESBrowseFirmwares.Name = "SNESBrowseFirmwares";
this.SNESBrowseFirmwares.Size = new System.Drawing.Size(26, 23); this.SNESBrowseFirmwares.Size = new System.Drawing.Size(26, 23);
this.SNESBrowseFirmwares.TabIndex = 93; this.SNESBrowseFirmwares.TabIndex = 93;
@ -896,7 +890,7 @@
// //
this.SNESFirmwaresBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.SNESFirmwaresBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.SNESFirmwaresBox.Location = new System.Drawing.Point(13, 237); this.SNESFirmwaresBox.Location = new System.Drawing.Point(13, 208);
this.SNESFirmwaresBox.Name = "SNESFirmwaresBox"; this.SNESFirmwaresBox.Name = "SNESFirmwaresBox";
this.SNESFirmwaresBox.Size = new System.Drawing.Size(421, 20); this.SNESFirmwaresBox.Size = new System.Drawing.Size(421, 20);
this.SNESFirmwaresBox.TabIndex = 92; this.SNESFirmwaresBox.TabIndex = 92;
@ -910,34 +904,6 @@
this.SNESBaseBox.Size = new System.Drawing.Size(421, 20); this.SNESBaseBox.Size = new System.Drawing.Size(421, 20);
this.SNESBaseBox.TabIndex = 27; this.SNESBaseBox.TabIndex = 27;
// //
// SNESSGBDescription
//
this.SNESSGBDescription.AutoSize = true;
this.SNESSGBDescription.Location = new System.Drawing.Point(474, 214);
this.SNESSGBDescription.Name = "SNESSGBDescription";
this.SNESSGBDescription.Size = new System.Drawing.Size(54, 13);
this.SNESSGBDescription.TabIndex = 47;
this.SNESSGBDescription.Text = "SGB Rom";
//
// SNESBrowseSGB
//
this.SNESBrowseSGB.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile;
this.SNESBrowseSGB.Location = new System.Drawing.Point(442, 209);
this.SNESBrowseSGB.Name = "SNESBrowseSGB";
this.SNESBrowseSGB.Size = new System.Drawing.Size(26, 23);
this.SNESBrowseSGB.TabIndex = 46;
this.SNESBrowseSGB.UseVisualStyleBackColor = true;
this.SNESBrowseSGB.Click += new System.EventHandler(this.SNESBrowseSGB_Click);
//
// SNESSGBBox
//
this.SNESSGBBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.SNESSGBBox.Location = new System.Drawing.Point(13, 211);
this.SNESSGBBox.Name = "SNESSGBBox";
this.SNESSGBBox.Size = new System.Drawing.Size(421, 20);
this.SNESSGBBox.TabIndex = 45;
//
// SNESCheatsDescription // SNESCheatsDescription
// //
this.SNESCheatsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.SNESCheatsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -3458,9 +3424,6 @@
private System.Windows.Forms.Label SNESROMsDescription; private System.Windows.Forms.Label SNESROMsDescription;
private System.Windows.Forms.TextBox SNESSaveRAMBox; private System.Windows.Forms.TextBox SNESSaveRAMBox;
private System.Windows.Forms.Button BrowseSNESROMs; private System.Windows.Forms.Button BrowseSNESROMs;
private System.Windows.Forms.Label SNESSGBDescription;
private System.Windows.Forms.Button SNESBrowseSGB;
private System.Windows.Forms.TextBox SNESSGBBox;
private System.Windows.Forms.Label SNESFirmwaresDescription; private System.Windows.Forms.Label SNESFirmwaresDescription;
private System.Windows.Forms.Button SNESBrowseFirmwares; private System.Windows.Forms.Button SNESBrowseFirmwares;
private System.Windows.Forms.TextBox SNESFirmwaresBox; private System.Windows.Forms.TextBox SNESFirmwaresBox;

View File

@ -73,7 +73,6 @@ namespace BizHawk.MultiClient
SNESSaveRAMBox.Text = Global.Config.PathSNESSaveRAM; SNESSaveRAMBox.Text = Global.Config.PathSNESSaveRAM;
SNESScreenshotsBox.Text = Global.Config.PathSNESScreenshots; SNESScreenshotsBox.Text = Global.Config.PathSNESScreenshots;
SNESCheatsBox.Text = Global.Config.PathSNESCheats; SNESCheatsBox.Text = Global.Config.PathSNESCheats;
SNESSGBBox.Text = Global.Config.PathSGBRom;
SNESFirmwaresBox.Text = Global.Config.PathSNESFirmwares; SNESFirmwaresBox.Text = Global.Config.PathSNESFirmwares;
Sega8BaseBox.Text = Global.Config.BaseSMS; Sega8BaseBox.Text = Global.Config.BaseSMS;
@ -177,7 +176,6 @@ namespace BizHawk.MultiClient
Global.Config.PathSNESSaveRAM = SNESSaveRAMBox.Text; Global.Config.PathSNESSaveRAM = SNESSaveRAMBox.Text;
Global.Config.PathSNESScreenshots = SNESScreenshotsBox.Text; Global.Config.PathSNESScreenshots = SNESScreenshotsBox.Text;
Global.Config.PathSNESCheats = SNESCheatsBox.Text; Global.Config.PathSNESCheats = SNESCheatsBox.Text;
Global.Config.PathSGBRom = SNESSGBBox.Text;
Global.Config.PathSNESFirmwares = SNESFirmwaresBox.Text; Global.Config.PathSNESFirmwares = SNESFirmwaresBox.Text;
Global.Config.BaseSMS = Sega8BaseBox.Text; Global.Config.BaseSMS = Sega8BaseBox.Text;
@ -729,15 +727,6 @@ namespace BizHawk.MultiClient
BrowseFolder(SNESCheatsBox, SNESCheatsDescription.Text, "SNES"); BrowseFolder(SNESCheatsBox, SNESCheatsDescription.Text, "SNES");
} }
private void SNESBrowseSGB_Click(object sender, EventArgs e)
{
BrowseForBios(
"SGB Rom (*.smc;*.sfc)|*.smc;*.sfc|All Files|*.*",
Global.Config.PathSGBRom,
SNESSGBBox);
}
private void SNESBrowseFirmwares_Click(object sender, EventArgs e) private void SNESBrowseFirmwares_Click(object sender, EventArgs e)
{ {
BrowseFolder(SNESFirmwaresBox, SNESFirmwaresDescription.Text); BrowseFolder(SNESFirmwaresBox, SNESFirmwaresDescription.Text);

File diff suppressed because it is too large Load Diff

View File

@ -345,7 +345,6 @@ namespace BizHawk.MultiClient
case "NES": case "NES":
return "|.|........|........|........|........|"; return "|.|........|........|........|........|";
case "SNES": case "SNES":
case "SGB":
return "|.|............|............|............|............|"; return "|.|............|............|............|............|";
case "SMS": case "SMS":
case "GG": case "GG":