diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index dc7329e061..da08390abe 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -230,11 +230,14 @@ this.PCEArcadeCardRewindEnableMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PCEGraphicsSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SMSSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.SMSexportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMSjapanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMStoolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); - this.SMS_NTSCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMS_PALToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSregionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSregionExportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSregionJapanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSregionAutoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSdisplayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSdisplayNtscToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSdisplayPalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SMSdisplayAutoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SMStoolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.SMSenableBIOSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SMSEnableFMChipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -2069,11 +2072,8 @@ // SMSSubMenu // this.SMSSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SMSexportToolStripMenuItem, - this.SMSjapanToolStripMenuItem, - this.SMStoolStripMenuItem1, - this.SMS_NTSCToolStripMenuItem, - this.SMS_PALToolStripMenuItem, + this.SMSregionToolStripMenuItem, + this.SMSdisplayToolStripMenuItem, this.SMStoolStripMenuItem2, this.SMSenableBIOSToolStripMenuItem, this.SMSEnableFMChipMenuItem, @@ -2092,38 +2092,67 @@ this.SMSSubMenu.Text = "&SMS"; this.SMSSubMenu.DropDownOpened += new System.EventHandler(this.SMSSubMenu_DropDownOpened); // - // SMSexportToolStripMenuItem + // SMSregionToolStripMenuItem // - this.SMSexportToolStripMenuItem.Name = "SMSexportToolStripMenuItem"; - this.SMSexportToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.SMSexportToolStripMenuItem.Text = "Export"; - this.SMSexportToolStripMenuItem.Click += new System.EventHandler(this.SMS_Export_Click); + this.SMSregionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.SMSregionExportToolStripMenuItem, + this.SMSregionJapanToolStripMenuItem, + this.SMSregionAutoToolStripMenuItem}); + this.SMSregionToolStripMenuItem.Name = "SMSregionToolStripMenuItem"; + this.SMSregionToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.SMSregionToolStripMenuItem.Text = "Region"; // - // SMSjapanToolStripMenuItem + // SMSregionExportToolStripMenuItem // - this.SMSjapanToolStripMenuItem.Name = "SMSjapanToolStripMenuItem"; - this.SMSjapanToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.SMSjapanToolStripMenuItem.Text = "Japan"; - this.SMSjapanToolStripMenuItem.Click += new System.EventHandler(this.SMS_Japan_Click); + this.SMSregionExportToolStripMenuItem.Name = "SMSregionExportToolStripMenuItem"; + this.SMSregionExportToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSregionExportToolStripMenuItem.Text = "Export"; + this.SMSregionExportToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionExport_Click); // - // SMStoolStripMenuItem1 + // SMSregionJapanToolStripMenuItem // - this.SMStoolStripMenuItem1.Name = "SMStoolStripMenuItem1"; - this.SMStoolStripMenuItem1.Size = new System.Drawing.Size(238, 6); + this.SMSregionJapanToolStripMenuItem.Name = "SMSregionJapanToolStripMenuItem"; + this.SMSregionJapanToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSregionJapanToolStripMenuItem.Text = "Japan"; + this.SMSregionJapanToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionJapan_Click); // - // SMS_NTSCToolStripMenuItem + // SMSregionAutoToolStripMenuItem // - this.SMS_NTSCToolStripMenuItem.Name = "SMS_NTSCToolStripMenuItem"; - this.SMS_NTSCToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.SMS_NTSCToolStripMenuItem.Text = "NTSC"; - this.SMS_NTSCToolStripMenuItem.Click += new System.EventHandler(this.SMS_NTSC_Click); + this.SMSregionAutoToolStripMenuItem.Name = "SMSregionAutoToolStripMenuItem"; + this.SMSregionAutoToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSregionAutoToolStripMenuItem.Text = "Auto"; + this.SMSregionAutoToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionAuto_Click); // - // SMS_PALToolStripMenuItem + // SMSdisplayToolStripMenuItem // - this.SMS_PALToolStripMenuItem.Name = "SMS_PALToolStripMenuItem"; - this.SMS_PALToolStripMenuItem.Size = new System.Drawing.Size(241, 22); - this.SMS_PALToolStripMenuItem.Text = "PAL"; - this.SMS_PALToolStripMenuItem.Click += new System.EventHandler(this.SMS_PAL_Click); + this.SMSdisplayToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.SMSdisplayNtscToolStripMenuItem, + this.SMSdisplayPalToolStripMenuItem, + this.SMSdisplayAutoToolStripMenuItem}); + this.SMSdisplayToolStripMenuItem.Name = "SMSdisplayToolStripMenuItem"; + this.SMSdisplayToolStripMenuItem.Size = new System.Drawing.Size(241, 22); + this.SMSdisplayToolStripMenuItem.Text = "Display Type"; + // + // SMSdisplayNtscToolStripMenuItem + // + this.SMSdisplayNtscToolStripMenuItem.Name = "SMSdisplayNtscToolStripMenuItem"; + this.SMSdisplayNtscToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSdisplayNtscToolStripMenuItem.Text = "NTSC"; + this.SMSdisplayNtscToolStripMenuItem.Click += new System.EventHandler(this.SMS_DisplayNTSC_Click); + // + // SMSdisplayPalToolStripMenuItem + // + this.SMSdisplayPalToolStripMenuItem.Name = "SMSdisplayPalToolStripMenuItem"; + this.SMSdisplayPalToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSdisplayPalToolStripMenuItem.Text = "PAL"; + this.SMSdisplayPalToolStripMenuItem.Click += new System.EventHandler(this.SMS_DisplayPAL_Click); + // + // SMSdisplayAutoToolStripMenuItem + // + this.SMSdisplayAutoToolStripMenuItem.Name = "SMSdisplayAutoToolStripMenuItem"; + this.SMSdisplayAutoToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.SMSdisplayAutoToolStripMenuItem.Text = "Auto"; + this.SMSdisplayAutoToolStripMenuItem.Click += new System.EventHandler(this.SMS_DisplayAuto_Click); // // SMStoolStripMenuItem2 // @@ -3438,12 +3467,15 @@ private System.Windows.Forms.ToolStripMenuItem vDPViewerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem SMSFix3DGameDisplayToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator SMStoolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem SMSexportToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem SMSjapanToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator SMStoolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem SMS_NTSCToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem SMS_PALToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem SMSenableBIOSToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSregionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSregionExportToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSregionJapanToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSregionAutoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSdisplayToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSdisplayNtscToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSdisplayPalToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SMSdisplayAutoToolStripMenuItem; } } diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 6574c8787c..74bf18852d 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1290,10 +1290,12 @@ namespace BizHawk.Client.EmuHawk { var s = (SMS.SMSSettings)Global.Emulator.GetSettings(); var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); - SMSexportToolStripMenuItem.Checked = ss.ExportRegion; - SMSjapanToolStripMenuItem.Checked = !ss.ExportRegion; - SMS_NTSCToolStripMenuItem.Checked = !ss.UsePAL; - SMS_PALToolStripMenuItem.Checked = ss.UsePAL; + SMSregionExportToolStripMenuItem.Checked = ss.ConsoleRegion == "Export"; + SMSregionJapanToolStripMenuItem.Checked = ss.ConsoleRegion == "Japan"; + SMSregionAutoToolStripMenuItem.Checked = ss.ConsoleRegion == "Auto"; + SMSdisplayNtscToolStripMenuItem.Checked = ss.DisplayType == "NTSC"; + SMSdisplayPalToolStripMenuItem.Checked = ss.DisplayType == "PAL"; + SMSdisplayAutoToolStripMenuItem.Checked = ss.DisplayType == "Auto"; SMSenableBIOSToolStripMenuItem.Checked = ss.UseBIOS; SMSEnableFMChipMenuItem.Checked = ss.EnableFM; SMSOverclockMenuItem.Checked = ss.AllowOverlock; @@ -1310,45 +1312,61 @@ namespace BizHawk.Client.EmuHawk SMSOverclockMenuItem.Visible = SMSForceStereoMenuItem.Visible = - SMS_NTSCToolStripMenuItem.Visible = - SMS_PALToolStripMenuItem.Visible = - SMStoolStripMenuItem2.Visible = + SMSdisplayToolStripMenuItem.Visible = Global.Game.System != "GG"; ShowClippedRegionsMenuItem.Visible = HighlightActiveDisplayRegionMenuItem.Visible = GGGameGenieMenuItem.Visible = Global.Game.System == "GG"; + + SMSOverclockMenuItem.Visible = + SMSVDPViewerToolStripMenuItem.Visible = + Global.Game.System != "SG"; } - private void SMS_Export_Click(object sender, EventArgs e) + private void SMS_RegionExport_Click(object sender, EventArgs e) { var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); - ss.ExportRegion = true; + ss.ConsoleRegion = "Export"; PutCoreSyncSettings(ss); } - private void SMS_Japan_Click(object sender, EventArgs e) + private void SMS_RegionJapan_Click(object sender, EventArgs e) { var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); - ss.ExportRegion = false; + ss.ConsoleRegion = "Japan"; PutCoreSyncSettings(ss); } - private void SMS_NTSC_Click(object sender, EventArgs e) + private void SMS_RegionAuto_Click(object sender, EventArgs e) { var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); - ss.UsePAL = false; + ss.ConsoleRegion = "Auto"; PutCoreSyncSettings(ss); } - private void SMS_PAL_Click(object sender, EventArgs e) + private void SMS_DisplayNTSC_Click(object sender, EventArgs e) { var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); - ss.UsePAL = true; + ss.DisplayType = "NTSC"; PutCoreSyncSettings(ss); } - + + private void SMS_DisplayPAL_Click(object sender, EventArgs e) + { + var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); + ss.DisplayType = "PAL"; + PutCoreSyncSettings(ss); + } + + private void SMS_DisplayAuto_Click(object sender, EventArgs e) + { + var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); + ss.DisplayType = "Auto"; + PutCoreSyncSettings(ss); + } + private void SMS_BIOS_Click(object sender, EventArgs e) { var ss = (SMS.SMSSyncSettings)Global.Emulator.GetSyncSettings(); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 1a597cbf90..1a2942e67c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -14,8 +14,6 @@ using BizHawk.Emulation.Cores.Components.Z80; + Try to clean up the organization of the source code. + Lightgun/Paddle/etc if I get really bored + Mode 1 not implemented in VDP TMS modes. (I dont have a test case in SG1000 or Coleco) - + Still need a "disable bios for japan-only games when bios is enabled and region is export" functionality - + Or a "force region to japan if game is only for japan" thing. Which one is better? **********************************************************/ @@ -98,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize); RomBanks = (byte)(RomData.Length / BankSize); - DisplayType = SyncSettings.UsePAL ? DisplayType.PAL : DisplayType.NTSC; + DisplayType = DetermineDisplayType(SyncSettings.DisplayType, game.Region); if (game["PAL"] && DisplayType != DisplayType.PAL) { DisplayType = DisplayType.PAL; @@ -109,7 +107,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem CoreComm.VsyncNum = DisplayType == DisplayType.NTSC ? 60 : 50; CoreComm.VsyncDen = 1; - Region = SyncSettings.ExportRegion ? "Export" : "Japan"; + Region = SyncSettings.ConsoleRegion; + if (Region == "Auto") Region = DetermineRegion(game.Region); + if (game["Japan"] && Region != "Japan") { Region = "Japan"; @@ -197,6 +197,29 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem SetupMemoryDomains(); } + string DetermineRegion(string gameRegion) + { + if (gameRegion.IndexOf("USA") >= 0) + return "Export"; + if (gameRegion.IndexOf("Europe") >= 0) + return "Export"; + if (gameRegion.IndexOf("World") >= 0) + return "Export"; + if (gameRegion.IndexOf("Brazil") >= 0) + return "Export"; + if (gameRegion.IndexOf("Australia") >= 0) + return "Export"; + return "Japan"; + } + + DisplayType DetermineDisplayType(string display, string region) + { + if (display == "NTSC") return DisplayType.NTSC; + if (display == "PAL") return DisplayType.PAL; + if (region == "Europe") return DisplayType.PAL; + return DisplayType.NTSC; + } + public void ResetCounters() { Frame = 0; @@ -399,7 +422,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } } - readonly string[] validRegions = { "Export", "Japan" }; + readonly string[] validRegions = { "Export", "Japan", "Auto" }; MemoryDomainList memoryDomains; @@ -537,8 +560,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem public bool EnableFM = true; public bool AllowOverlock = false; public bool UseBIOS = false; - public bool ExportRegion = true; - public bool UsePAL = false; + public string ConsoleRegion = "Export"; + public string DisplayType = "NTSC"; public SMSSyncSettings Clone() { @@ -550,8 +573,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem x.EnableFM != y.EnableFM || x.AllowOverlock != y.AllowOverlock || x.UseBIOS != y.UseBIOS || - x.ExportRegion != y.ExportRegion || - x.UsePAL != y.UsePAL; + x.ConsoleRegion != y.ConsoleRegion || + x.DisplayType != y.DisplayType; } } }