diff --git a/BizHawk.Client.Common/Api/Classes/EmuApi.cs b/BizHawk.Client.Common/Api/Classes/EmuApi.cs index 80b9bb6ecf..a353ff8890 100644 --- a/BizHawk.Client.Common/Api/Classes/EmuApi.cs +++ b/BizHawk.Client.Common/Api/Classes/EmuApi.cs @@ -191,7 +191,7 @@ namespace BizHawk.Client.Common NES nes => nes.PutSettings((NES.NESSettings) settings), PCEngine pce => pce.PutSettings((PCEngine.PCESettings) settings), QuickNES quickNes => quickNes.PutSettings((QuickNES.QuickNESSettings) settings), - SMS sms => sms.PutSettings((SMS.SMSSettings) settings), + SMS sms => sms.PutSettings((SMS.SmsSettings) settings), WonderSwan ws => ws.PutSettings((WonderSwan.Settings) settings), _ => false }; diff --git a/BizHawk.Client.Common/movie/import/MmvImport.cs b/BizHawk.Client.Common/movie/import/MmvImport.cs index 8b008502dc..f90cd41135 100644 --- a/BizHawk.Client.Common/movie/import/MmvImport.cs +++ b/BizHawk.Client.Common/movie/import/MmvImport.cs @@ -93,9 +93,9 @@ namespace BizHawk.Client.Common.movie.import byte[] md5 = r.ReadBytes(16); Result.Movie.HeaderEntries[MD5] = md5.BytesToHexString().ToLower(); - var ss = new SMS.SMSSyncSettings + var ss = new SMS.SmsSyncSettings { - ControllerType = "Standard" + ControllerType = SMS.SmsSyncSettings.ControllerTypes.Standard }; var controllers = new SimpleController diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 8b6fd035b4..2f05a8fabe 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -382,9 +382,6 @@ - - - diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 574b9593b2..3b25976764 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -267,32 +267,7 @@ this.PCEAlwaysEqualizeVolumesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PCEArcadeCardRewindEnableMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SMSSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.SMSregionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsRegionExportMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsRegionJapanMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsRegionKoreaMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsRegionAutoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsDisplayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsDisplayNtscMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsDisplayPalMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsDisplayAutoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMSControllerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsControllerStandardMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsControllerPaddleMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsControllerLightPhaserMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsControllerSportsPadMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsControllerKeyboardMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMStoolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); - this.SmsEnableBiosMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsEnableFMChipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsOverclockMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsForceStereoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsSpriteLimitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsDisplayOverscanMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsFix3DGameDisplayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsShowClippedRegionsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SmsHighlightActiveDisplayRegionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SMSGraphicsSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SmsSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SmsMenuSeparator = new System.Windows.Forms.ToolStripSeparator(); this.SmsVdpViewerMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GGGameGenieMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -2484,20 +2459,7 @@ // SMSSubMenu // this.SMSSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SMSregionToolStripMenuItem, - this.SmsDisplayMenuItem, - this.SMSControllerToolStripMenuItem, - this.SMStoolStripMenuItem2, - this.SmsEnableBiosMenuItem, - this.SmsEnableFMChipMenuItem, - this.SmsOverclockMenuItem, - this.SmsForceStereoMenuItem, - this.SmsSpriteLimitMenuItem, - this.SmsDisplayOverscanMenuItem, - this.SmsFix3DGameDisplayMenuItem, - this.SmsShowClippedRegionsMenuItem, - this.SmsHighlightActiveDisplayRegionMenuItem, - this.SMSGraphicsSettingsMenuItem, + this.SmsSettingsMenuItem, this.SmsMenuSeparator, this.SmsVdpViewerMenuItem, this.GGGameGenieMenuItem}); @@ -2506,197 +2468,12 @@ this.SMSSubMenu.Text = "&SMS"; this.SMSSubMenu.DropDownOpened += new System.EventHandler(this.SmsSubMenu_DropDownOpened); // - // SMSregionToolStripMenuItem + // SmsSettingsMenuItem // - this.SMSregionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SmsRegionExportMenuItem, - this.SmsRegionJapanMenuItem, - this.SmsRegionKoreaMenuItem, - this.SmsRegionAutoMenuItem}); - this.SMSregionToolStripMenuItem.Name = "SMSregionToolStripMenuItem"; - this.SMSregionToolStripMenuItem.Size = new System.Drawing.Size(262, 22); - this.SMSregionToolStripMenuItem.Text = "Region"; - // - // SMSregionExportToolStripMenuItem - // - this.SmsRegionExportMenuItem.Name = "SmsRegionExportMenuItem"; - this.SmsRegionExportMenuItem.Size = new System.Drawing.Size(106, 22); - this.SmsRegionExportMenuItem.Text = "Export"; - this.SmsRegionExportMenuItem.Click += new System.EventHandler(this.SmsRegionExport_Click); - // - // SMSregionJapanToolStripMenuItem - // - this.SmsRegionJapanMenuItem.Name = "SmsRegionJapanMenuItem"; - this.SmsRegionJapanMenuItem.Size = new System.Drawing.Size(106, 22); - this.SmsRegionJapanMenuItem.Text = "Japan"; - this.SmsRegionJapanMenuItem.Click += new System.EventHandler(this.Sms_RegionJapan_Click); - // - // SMSregionKoreaToolStripMenuItem - // - this.SmsRegionKoreaMenuItem.Name = "SmsRegionKoreaMenuItem"; - this.SmsRegionKoreaMenuItem.Size = new System.Drawing.Size(106, 22); - this.SmsRegionKoreaMenuItem.Text = "Korea"; - this.SmsRegionKoreaMenuItem.Click += new System.EventHandler(this.Sms_RegionKorea_Click); - // - // SMSregionAutoToolStripMenuItem - // - this.SmsRegionAutoMenuItem.Name = "SmsRegionAutoMenuItem"; - this.SmsRegionAutoMenuItem.Size = new System.Drawing.Size(106, 22); - this.SmsRegionAutoMenuItem.Text = "Auto"; - this.SmsRegionAutoMenuItem.Click += new System.EventHandler(this.Sms_RegionAuto_Click); - // - // SMSdisplayToolStripMenuItem - // - this.SmsDisplayMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SmsDisplayNtscMenuItem, - this.SmsDisplayPalMenuItem, - this.SmsDisplayAutoMenuItem}); - this.SmsDisplayMenuItem.Name = "SmsDisplayMenuItem"; - this.SmsDisplayMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsDisplayMenuItem.Text = "Display Type"; - // - // SMSdisplayNtscToolStripMenuItem - // - this.SmsDisplayNtscMenuItem.Name = "SmsDisplayNtscMenuItem"; - this.SmsDisplayNtscMenuItem.Size = new System.Drawing.Size(100, 22); - this.SmsDisplayNtscMenuItem.Text = "NTSC"; - this.SmsDisplayNtscMenuItem.Click += new System.EventHandler(this.Sms_DisplayNtsc_Click); - // - // SMSdisplayPalToolStripMenuItem - // - this.SmsDisplayPalMenuItem.Name = "SmsDisplayPalMenuItem"; - this.SmsDisplayPalMenuItem.Size = new System.Drawing.Size(100, 22); - this.SmsDisplayPalMenuItem.Text = "PAL"; - this.SmsDisplayPalMenuItem.Click += new System.EventHandler(this.Sms_DisplayPal_Click); - // - // SMSdisplayAutoToolStripMenuItem - // - this.SmsDisplayAutoMenuItem.Name = "SmsDisplayAutoMenuItem"; - this.SmsDisplayAutoMenuItem.Size = new System.Drawing.Size(100, 22); - this.SmsDisplayAutoMenuItem.Text = "Auto"; - this.SmsDisplayAutoMenuItem.Click += new System.EventHandler(this.Sms_DisplayAuto_Click); - // - // SMSControllerToolStripMenuItem - // - this.SMSControllerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SmsControllerStandardMenuItem, - this.SmsControllerPaddleMenuItem, - this.SmsControllerLightPhaserMenuItem, - this.SmsControllerSportsPadMenuItem, - this.SmsControllerKeyboardMenuItem}); - this.SMSControllerToolStripMenuItem.Name = "SMSControllerToolStripMenuItem"; - this.SMSControllerToolStripMenuItem.Size = new System.Drawing.Size(262, 22); - this.SMSControllerToolStripMenuItem.Text = "&Controller Type"; - // - // SMSControllerStandardToolStripMenuItem - // - this.SmsControllerStandardMenuItem.Name = "SmsControllerStandardMenuItem"; - this.SmsControllerStandardMenuItem.Size = new System.Drawing.Size(133, 22); - this.SmsControllerStandardMenuItem.Text = "Standard"; - this.SmsControllerStandardMenuItem.Click += new System.EventHandler(this.SmsControllerStandardMenuItem_Click); - // - // SMSControllerPaddleToolStripMenuItem - // - this.SmsControllerPaddleMenuItem.Name = "SmsControllerPaddleMenuItem"; - this.SmsControllerPaddleMenuItem.Size = new System.Drawing.Size(133, 22); - this.SmsControllerPaddleMenuItem.Text = "Paddle"; - this.SmsControllerPaddleMenuItem.Click += new System.EventHandler(this.SmsControllerPaddleMenuItem_Click); - // - // SMSControllerLightPhaserToolStripMenuItem - // - this.SmsControllerLightPhaserMenuItem.Name = "SmsControllerLightPhaserMenuItem"; - this.SmsControllerLightPhaserMenuItem.Size = new System.Drawing.Size(133, 22); - this.SmsControllerLightPhaserMenuItem.Text = "Light Phaser"; - this.SmsControllerLightPhaserMenuItem.Click += new System.EventHandler(this.SmsControllerLightPhaserMenuItem_Click); - // - // SMSControllerSportsPadToolStripMenuItem - // - this.SmsControllerSportsPadMenuItem.Name = "SmsControllerSportsPadMenuItem"; - this.SmsControllerSportsPadMenuItem.Size = new System.Drawing.Size(133, 22); - this.SmsControllerSportsPadMenuItem.Text = "Sports Pad"; - this.SmsControllerSportsPadMenuItem.Click += new System.EventHandler(this.SmsControllerSportsPadMenuItem_Click); - // - // SMSControllerKeyboardToolStripMenuItem - // - this.SmsControllerKeyboardMenuItem.Name = "SmsControllerKeyboardMenuItem"; - this.SmsControllerKeyboardMenuItem.Size = new System.Drawing.Size(133, 22); - this.SmsControllerKeyboardMenuItem.Text = "Keyboard"; - this.SmsControllerKeyboardMenuItem.Click += new System.EventHandler(this.SmsControllerKeyboardMenuItem_Click); - // - // SMStoolStripMenuItem2 - // - this.SMStoolStripMenuItem2.Name = "SMStoolStripMenuItem2"; - this.SMStoolStripMenuItem2.Size = new System.Drawing.Size(259, 6); - // - // SMSenableBIOSToolStripMenuItem - // - this.SmsEnableBiosMenuItem.Name = "SmsEnableBiosMenuItem"; - this.SmsEnableBiosMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsEnableBiosMenuItem.Text = "Enable BIOS (Must be Enabled for TAS)"; - this.SmsEnableBiosMenuItem.Click += new System.EventHandler(this.SmsBiosMenuItem_Click); - // - // SMSEnableFMChipMenuItem - // - this.SmsEnableFMChipMenuItem.Name = "SmsEnableFMChipMenuItem"; - this.SmsEnableFMChipMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsEnableFMChipMenuItem.Text = "&Enable FM Chip"; - this.SmsEnableFMChipMenuItem.Click += new System.EventHandler(this.SmsEnableFmChipMenuItem_Click); - // - // SMSOverclockMenuItem - // - this.SmsOverclockMenuItem.Name = "SmsOverclockMenuItem"; - this.SmsOverclockMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsOverclockMenuItem.Text = "&Overclock when Known Safe"; - this.SmsOverclockMenuItem.Click += new System.EventHandler(this.SmsOverclockMenuItem_Click); - // - // SMSForceStereoMenuItem - // - this.SmsForceStereoMenuItem.Name = "SmsForceStereoMenuItem"; - this.SmsForceStereoMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsForceStereoMenuItem.Text = "&Force Stereo Separation"; - this.SmsForceStereoMenuItem.Click += new System.EventHandler(this.SmsForceStereoMenuItem_Click); - // - // SMSSpriteLimitMenuItem - // - this.SmsSpriteLimitMenuItem.Name = "SmsSpriteLimitMenuItem"; - this.SmsSpriteLimitMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsSpriteLimitMenuItem.Text = "Sprite &Limit"; - this.SmsSpriteLimitMenuItem.Click += new System.EventHandler(this.SmsSpriteLimitMenuItem_Click); - // - // SMSDisplayOverscanMenuItem - // - this.SmsDisplayOverscanMenuItem.Name = "SmsDisplayOverscanMenuItem"; - this.SmsDisplayOverscanMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsDisplayOverscanMenuItem.Text = "Display Overscan"; - this.SmsDisplayOverscanMenuItem.Click += new System.EventHandler(this.SmsDisplayOverscanMenuItem_Click); - // - // SMSFix3DGameDisplayToolStripMenuItem - // - this.SmsFix3DGameDisplayMenuItem.Name = "SmsFix3DGameDisplayMenuItem"; - this.SmsFix3DGameDisplayMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsFix3DGameDisplayMenuItem.Text = "Fix 3D Game Display"; - this.SmsFix3DGameDisplayMenuItem.Click += new System.EventHandler(this.SmsFix3DDisplayMenuItem_Click); - // - // ShowClippedRegionsMenuItem - // - this.SmsShowClippedRegionsMenuItem.Name = "SmsShowClippedRegionsMenuItem"; - this.SmsShowClippedRegionsMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsShowClippedRegionsMenuItem.Text = "&Show Clipped Regions"; - this.SmsShowClippedRegionsMenuItem.Click += new System.EventHandler(this.SmsShowClippedRegionsMenuItem_Click); - // - // HighlightActiveDisplayRegionMenuItem - // - this.SmsHighlightActiveDisplayRegionMenuItem.Name = "SmsHighlightActiveDisplayRegionMenuItem"; - this.SmsHighlightActiveDisplayRegionMenuItem.Size = new System.Drawing.Size(262, 22); - this.SmsHighlightActiveDisplayRegionMenuItem.Text = "&Highlight Active Display Region"; - this.SmsHighlightActiveDisplayRegionMenuItem.Click += new System.EventHandler(this.SmsHighlightActiveDisplayRegionMenuItem_Click); - // - // SMSGraphicsSettingsMenuItem - // - this.SMSGraphicsSettingsMenuItem.Name = "SMSGraphicsSettingsMenuItem"; - this.SMSGraphicsSettingsMenuItem.Size = new System.Drawing.Size(262, 22); - this.SMSGraphicsSettingsMenuItem.Text = "&Graphics Settings..."; - this.SMSGraphicsSettingsMenuItem.Click += new System.EventHandler(this.SmsGraphicsSettingsMenuItem_Click); + this.SmsSettingsMenuItem.Name = "SmsSettingsMenuItem"; + this.SmsSettingsMenuItem.Size = new System.Drawing.Size(262, 22); + this.SmsSettingsMenuItem.Text = "Settings..."; + this.SmsSettingsMenuItem.Click += new System.EventHandler(this.SmsBiosMenuItem_Click); // // toolStripSeparator24 // @@ -4465,12 +4242,6 @@ private System.Windows.Forms.ToolStripMenuItem PCEAlwaysEqualizeVolumesMenuItem; private System.Windows.Forms.ToolStripMenuItem PCEArcadeCardRewindEnableMenuItem; private System.Windows.Forms.ToolStripMenuItem SMSSubMenu; - private System.Windows.Forms.ToolStripMenuItem SMSGraphicsSettingsMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsEnableFMChipMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsOverclockMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsForceStereoMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsSpriteLimitMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsDisplayOverscanMenuItem; private System.Windows.Forms.ToolStripMenuItem PCEBGViewerMenuItem; private System.Windows.Forms.ToolStripMenuItem ScreenshotContextMenuItem; private System.Windows.Forms.ToolStripMenuItem AtariSubMenu; @@ -4488,9 +4259,7 @@ private System.Windows.Forms.ToolStripMenuItem SnesGBInSGBMenuItem; private System.Windows.Forms.ToolStripStatusLabel RebootStatusBarIcon; private System.Windows.Forms.ToolStripMenuItem TraceLoggerMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsShowClippedRegionsMenuItem; private System.Windows.Forms.ToolStripSeparator SmsMenuSeparator; - private System.Windows.Forms.ToolStripMenuItem SmsHighlightActiveDisplayRegionMenuItem; private System.Windows.Forms.ToolStripMenuItem FDSControlsMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveMovieMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveMovieContextMenuItem; @@ -4562,18 +4331,7 @@ private System.Windows.Forms.ToolStripMenuItem PCEtileViewerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem SmsVdpViewerMenuItem; private System.Windows.Forms.ToolStripMenuItem vDPViewerToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsFix3DGameDisplayMenuItem; - private System.Windows.Forms.ToolStripSeparator SMStoolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem SmsEnableBiosMenuItem; - private System.Windows.Forms.ToolStripMenuItem SMSregionToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsRegionExportMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsRegionJapanMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsRegionKoreaMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsRegionAutoMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsDisplayMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsDisplayNtscMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsDisplayPalMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsDisplayAutoMenuItem; + private System.Windows.Forms.ToolStripMenuItem SmsSettingsMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator26; private System.Windows.Forms.ToolStripMenuItem extensionsToolStripMenuItem; private System.Windows.Forms.ToolStripStatusLabel CoreNameStatusBarButton; @@ -4716,12 +4474,6 @@ private System.Windows.Forms.ToolStripMenuItem GBGBHawkMenuItem; private System.Windows.Forms.ToolStripMenuItem pCFXToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem3; - private System.Windows.Forms.ToolStripMenuItem SMSControllerToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsControllerStandardMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsControllerPaddleMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsControllerLightPhaserMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsControllerSportsPadMenuItem; - private System.Windows.Forms.ToolStripMenuItem SmsControllerKeyboardMenuItem; private System.Windows.Forms.ToolStripMenuItem zXSpectrumToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ZXSpectrumControllerConfigurationMenuItem; private System.Windows.Forms.ToolStripMenuItem ZXSpectrumCoreEmulationSettingsMenuItem; diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index a49d774cf8..ad98b6d966 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1811,221 +1811,12 @@ namespace BizHawk.Client.EmuHawk private void SmsSubMenu_DropDownOpened(object sender, EventArgs e) { - var s = ((SMS)Emulator).GetSettings(); - var ss = ((SMS)Emulator).GetSyncSettings(); - SmsRegionExportMenuItem.Checked = ss.ConsoleRegion == "Export"; - SmsRegionJapanMenuItem.Checked = ss.ConsoleRegion == "Japan"; - SmsRegionKoreaMenuItem.Checked = ss.ConsoleRegion == "Korea"; - SmsRegionAutoMenuItem.Checked = ss.ConsoleRegion == "Auto"; - SmsDisplayNtscMenuItem.Checked = ss.DisplayType == "NTSC"; - SmsDisplayPalMenuItem.Checked = ss.DisplayType == "PAL"; - SmsDisplayAutoMenuItem.Checked = ss.DisplayType == "Auto"; - SmsControllerStandardMenuItem.Checked = ss.ControllerType == "Standard"; - SmsControllerPaddleMenuItem.Checked = ss.ControllerType == "Paddle"; - SmsControllerLightPhaserMenuItem.Checked = ss.ControllerType == "Light Phaser"; - SmsControllerSportsPadMenuItem.Checked = ss.ControllerType == "Sports Pad"; - SmsControllerKeyboardMenuItem.Checked = ss.ControllerType == "Keyboard"; - SmsEnableBiosMenuItem.Checked = ss.UseBIOS; - SmsEnableFMChipMenuItem.Checked = ss.EnableFM; - SmsOverclockMenuItem.Checked = ss.AllowOverlock; - SmsForceStereoMenuItem.Checked = s.ForceStereoSeparation; - SmsSpriteLimitMenuItem.Checked = s.SpriteLimit; - SmsDisplayOverscanMenuItem.Checked = s.DisplayOverscan; - SmsFix3DGameDisplayMenuItem.Checked = s.Fix3D; - SmsShowClippedRegionsMenuItem.Checked = s.ShowClippedRegions; - SmsHighlightActiveDisplayRegionMenuItem.Checked = s.HighlightActiveDisplayRegion; - - SmsEnableFMChipMenuItem.Visible = - SmsFix3DGameDisplayMenuItem.Visible = - SmsEnableBiosMenuItem.Visible = - Game.System == "SMS"; - - SmsDisplayOverscanMenuItem.Visible = - Game.System == "SMS" || Game.System == "SG"; - - SmsOverclockMenuItem.Visible = - SmsForceStereoMenuItem.Visible = - SmsDisplayMenuItem.Visible = - Game.System != "GG"; - - SmsShowClippedRegionsMenuItem.Visible = - SmsHighlightActiveDisplayRegionMenuItem.Visible = - GGGameGenieMenuItem.Visible = - Game.System == "GG"; - - SmsOverclockMenuItem.Visible = - SmsVdpViewerMenuItem.Visible = - SmsMenuSeparator.Visible = - Game.System != "SG"; - } - - private void SmsRegionExport_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.ConsoleRegion = "Export"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_RegionJapan_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss =sms.GetSyncSettings(); - ss.ConsoleRegion = "Japan"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_RegionKorea_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.ConsoleRegion = "Korea"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_RegionAuto_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.ConsoleRegion = "Auto"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_DisplayNtsc_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.DisplayType = "NTSC"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_DisplayPal_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.DisplayType = "PAL"; - PutCoreSyncSettings(ss); - } - } - - private void Sms_DisplayAuto_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.DisplayType = "Auto"; - PutCoreSyncSettings(ss); - } + SmsVdpViewerMenuItem.Visible = Game.System != "SG"; } private void SmsBiosMenuItem_Click(object sender, EventArgs e) { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.UseBIOS ^= true; - PutCoreSyncSettings(ss); - } - } - - private void SmsEnableFmChipMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.EnableFM ^= true; - PutCoreSyncSettings(ss); - } - } - - private void SmsOverclockMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var ss = sms.GetSyncSettings(); - ss.AllowOverlock ^= true; - PutCoreSyncSettings(ss); - } - } - - private void SmsForceStereoMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.ForceStereoSeparation ^= true; - PutCoreSettings(s); - } - } - - private void SmsSpriteLimitMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.SpriteLimit ^= true; - PutCoreSettings(s); - } - } - - private void SmsDisplayOverscanMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.DisplayOverscan ^= true; - PutCoreSettings(s); - } - } - - private void SmsFix3DDisplayMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.Fix3D ^= true; - PutCoreSettings(s); - } - } - - private void SmsShowClippedRegionsMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.ShowClippedRegions ^= true; - PutCoreSettings(s); - } - } - - private void SmsHighlightActiveDisplayRegionMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSettings(); - s.HighlightActiveDisplayRegion ^= true; - PutCoreSettings(s); - } - } - - private void SmsGraphicsSettingsMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - using var form = new SmsGraphicsConfig(this, sms.GetSettings().Clone()); - form.ShowDialog(); - } + GenericCoreConfig.DoDialog(this, "SMS Settings"); } private void GgGameGenieMenuItem_Click(object sender, EventArgs e) @@ -2038,56 +1829,6 @@ namespace BizHawk.Client.EmuHawk Tools.Load(); } - private void SmsControllerStandardMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSyncSettings(); - s.ControllerType = "Standard"; - PutCoreSyncSettings(s); - } - } - - private void SmsControllerPaddleMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSyncSettings(); - s.ControllerType = "Paddle"; - PutCoreSyncSettings(s); - } - } - - private void SmsControllerLightPhaserMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSyncSettings(); - s.ControllerType = "Light Phaser"; - PutCoreSyncSettings(s); - } - } - - private void SmsControllerSportsPadMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSyncSettings(); - s.ControllerType = "Sports Pad"; - PutCoreSyncSettings(s); - } - } - - private void SmsControllerKeyboardMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is SMS sms) - { - var s = sms.GetSyncSettings(); - s.ControllerType = "Keyboard"; - PutCoreSyncSettings(s); - } - } - #endregion #region TI83 diff --git a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index c2cf428ef0..4a42c28a50 100644 --- a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -108,8 +108,8 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(genesisSettings); // SMS - var smsSettings = GetSyncSettings(); - smsSettings.UseBIOS = true; + var smsSettings = GetSyncSettings(); + smsSettings.UseBios = true; PutSyncSettings(smsSettings); // Coleco @@ -156,8 +156,8 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(genesisSettings); // SMS - var smsSettings = GetSyncSettings(); - smsSettings.UseBIOS = true; + var smsSettings = GetSyncSettings(); + smsSettings.UseBios = true; PutSyncSettings(smsSettings); // Coleco @@ -207,8 +207,8 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(genesisSettings); // SMS - var smsSettings = GetSyncSettings(); - smsSettings.UseBIOS = true; + var smsSettings = GetSyncSettings(); + smsSettings.UseBios = true; PutSyncSettings(smsSettings); // Coleco @@ -259,8 +259,8 @@ namespace BizHawk.Client.EmuHawk PutSyncSettings(genesisSettings); // SMS - var smsSettings = GetSyncSettings(); - smsSettings.UseBIOS = true; + var smsSettings = GetSyncSettings(); + smsSettings.UseBios = true; PutSyncSettings(smsSettings); // Coleco diff --git a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.Designer.cs deleted file mode 100644 index 71045e9419..0000000000 --- a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.Designer.cs +++ /dev/null @@ -1,128 +0,0 @@ -namespace BizHawk.Client.EmuHawk -{ - partial class SmsGraphicsConfig - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.OK = new System.Windows.Forms.Button(); - this.Cancel = new System.Windows.Forms.Button(); - this.DispOBJ = new System.Windows.Forms.CheckBox(); - this.DispBG = new System.Windows.Forms.CheckBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(62, 96); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 25); - this.OK.TabIndex = 0; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.Ok_Click); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(143, 96); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 25); - this.Cancel.TabIndex = 1; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - // - // DispOBJ - // - this.DispOBJ.AutoSize = true; - this.DispOBJ.Checked = true; - this.DispOBJ.CheckState = System.Windows.Forms.CheckState.Checked; - this.DispOBJ.Location = new System.Drawing.Point(6, 20); - this.DispOBJ.Name = "DispOBJ"; - this.DispOBJ.Size = new System.Drawing.Size(83, 18); - this.DispOBJ.TabIndex = 2; - this.DispOBJ.Text = "Display OBJ"; - this.DispOBJ.UseVisualStyleBackColor = true; - // - // DispBG - // - this.DispBG.AutoSize = true; - this.DispBG.Checked = true; - this.DispBG.CheckState = System.Windows.Forms.CheckState.Checked; - this.DispBG.Location = new System.Drawing.Point(6, 43); - this.DispBG.Name = "DispBG"; - this.DispBG.Size = new System.Drawing.Size(78, 18); - this.DispBG.TabIndex = 3; - this.DispBG.Text = "Display BG"; - this.DispBG.UseVisualStyleBackColor = true; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.DispOBJ); - this.groupBox1.Controls.Add(this.DispBG); - this.groupBox1.Location = new System.Drawing.Point(12, 13); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(200, 69); - this.groupBox1.TabIndex = 4; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Background and Sprites"; - // - // SMSGraphicsConfig - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(230, 134); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.Cancel); - this.Controls.Add(this.OK); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SmsGraphicsConfig"; - this.ShowIcon = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "SMS Graphics Settings"; - this.Load += new System.EventHandler(this.SMSGraphicsConfig_Load); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button OK; - private System.Windows.Forms.Button Cancel; - private System.Windows.Forms.CheckBox DispOBJ; - private System.Windows.Forms.CheckBox DispBG; - private System.Windows.Forms.GroupBox groupBox1; - } -} \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.cs b/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.cs deleted file mode 100644 index 819b4ecfba..0000000000 --- a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Windows.Forms; -using BizHawk.Emulation.Cores.Sega.MasterSystem; - -namespace BizHawk.Client.EmuHawk -{ - public partial class SmsGraphicsConfig : Form - { - private readonly MainForm _mainForm; - private readonly SMS.SMSSettings _settings; - public SmsGraphicsConfig( - MainForm mainForm, - SMS.SMSSettings settings) - { - _mainForm = mainForm; - _settings = settings; - InitializeComponent(); - } - - private void SMSGraphicsConfig_Load(object sender, EventArgs e) - { - DispOBJ.Checked = _settings.DispOBJ; - DispBG.Checked = _settings.DispBG; - } - - private void Ok_Click(object sender, EventArgs e) - { - _settings.DispOBJ = DispOBJ.Checked; - _settings.DispBG = DispBG.Checked; - _mainForm.PutCoreSettings(_settings); - Close(); - } - } -} diff --git a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.resx b/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.resx deleted file mode 100644 index 29dcb1b3a3..0000000000 --- a/BizHawk.Client.EmuHawk/config/SMS/SMSGraphicsConfig.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs index fa0b679944..ffda2cf9c6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.cs @@ -34,11 +34,11 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink CoreComm = comm; - var temp_set_L = new SMS.SMSSettings(); - var temp_set_R = new SMS.SMSSettings(); + var temp_set_L = new SMS.SmsSettings(); + var temp_set_R = new SMS.SmsSettings(); - var temp_sync_L = new SMS.SMSSyncSettings(); - var temp_sync_R = new SMS.SMSSyncSettings(); + var temp_sync_L = new SMS.SmsSyncSettings(); + var temp_sync_R = new SMS.SmsSyncSettings(); L = new SMS(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider }, game_L, rom_L, temp_set_L, temp_sync_L); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs index e3578436d4..5d1b049800 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IEmulator.cs @@ -17,20 +17,20 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } // Sorta a hack but why not - PortDEEnabled = SyncSettings.ControllerType == "Keyboard"; + PortDEEnabled = SyncSettings.ControllerType == SmsSyncSettings.ControllerTypes.Keyboard; switch(SyncSettings.ControllerType) { - case "Paddle": + case SmsSyncSettings.ControllerTypes.Paddle: return SMSPaddleController; - case "Light Phaser": + case SmsSyncSettings.ControllerTypes.LightPhaser: // scale the vertical to the display mode SMSLightPhaserController.FloatRanges[1] = new ControllerDefinition.FloatRange(0, Vdp.FrameHeight / 2, Vdp.FrameHeight - 1); return SMSLightPhaserController; - case "Sports Pad": + case SmsSyncSettings.ControllerTypes.SportsPad: return SMSSportsPadController; - case "Keyboard": + case SmsSyncSettings.ControllerTypes.Keyboard: return SMSKeyboardController; default: return SmsController; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ISettable.cs index fc24b04854..cc9dfefda0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ISettable.cs @@ -1,86 +1,122 @@ -using BizHawk.Emulation.Common; +using System.ComponentModel; +using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sega.MasterSystem { - public partial class SMS : ISettable + public partial class SMS : ISettable { - public SMSSettings GetSettings() - { - return Settings.Clone(); - } + public SmsSettings GetSettings() => Settings.Clone(); - public SMSSyncSettings GetSyncSettings() - { - return SyncSettings.Clone(); - } + public SmsSyncSettings GetSyncSettings() => SyncSettings.Clone(); - public bool PutSettings(SMSSettings o) + public bool PutSettings(SmsSettings o) { - bool ret = SMSSettings.RebootNeeded(Settings, o); + bool ret = SmsSettings.RebootNeeded(Settings, o); Settings = o; return ret; } - public bool PutSyncSettings(SMSSyncSettings o) + public bool PutSyncSettings(SmsSyncSettings o) { - bool ret = SMSSyncSettings.RebootNeeded(SyncSettings, o); + bool ret = SmsSyncSettings.RebootNeeded(SyncSettings, o); SyncSettings = o; return ret; } - internal SMSSettings Settings { get; private set; } - internal SMSSyncSettings SyncSettings { get; private set; } + internal SmsSettings Settings { get; private set; } + internal SmsSyncSettings SyncSettings { get; private set; } - public class SMSSettings + public class SmsSettings { // Game settings - public bool ForceStereoSeparation = false; - public bool SpriteLimit = false; - public bool Fix3D = true; - public bool DisplayOverscan = false; + public bool ForceStereoSeparation { get; set; } + public bool SpriteLimit { get; set; } - // GG settings - public bool ShowClippedRegions = false; - public bool HighlightActiveDisplayRegion = false; + [DisplayName("Fix 3D")] + [Description("SMS only")] + public bool Fix3D { get; set; } = true; + + [DisplayName("Display Overscan")] + [Description("Not applicable to Game Gear")] + public bool DisplayOverscan { get; set; } + + [DisplayName("Show Clipped Regions")] + [Description("Game Gear only")] + public bool ShowClippedRegions { get; set; } + + [DisplayName("Highlight Active Display Region")] + [Description("Game Gear only")] + public bool HighlightActiveDisplayRegion { get; set; } // graphics settings - public bool DispBG = true; - public bool DispOBJ = true; + [DisplayName("Display Background")] + public bool DispBG { get; set; } = true; - public SMSSettings Clone() - { - return (SMSSettings)MemberwiseClone(); - } + [DisplayName("Display Objects")] + public bool DispOBJ { get; set; } = true; - public static bool RebootNeeded(SMSSettings x, SMSSettings y) - { - return false; - } + public SmsSettings Clone() => (SmsSettings)MemberwiseClone(); + + public static bool RebootNeeded(SmsSettings x, SmsSettings y) => false; } - public class SMSSyncSettings + public class SmsSyncSettings { - public bool EnableFM = true; - public bool AllowOverlock = false; - public bool UseBIOS = true; - public string ConsoleRegion = "Auto"; - public string DisplayType = "Auto"; - public string ControllerType = "Standard"; + [DisplayName("Enable FM")] + [Description("SMS only")] + public bool EnableFm { get; set; } = true; - public SMSSyncSettings Clone() - { - return (SMSSyncSettings)MemberwiseClone(); - } + [DisplayName("Allow Overclock")] + [Description("SMS only")] + public bool AllowOverClock { get; set; } - public static bool RebootNeeded(SMSSyncSettings x, SMSSyncSettings y) + [DisplayName("Use BIOS")] + [Description("Must be Enabled for TAS")] + public bool UseBios { get; set; } = true; + + [DisplayName("Region")] + public Regions ConsoleRegion { get; set; } = Regions.Auto; + + [DisplayName("Display Type")] + public DisplayTypes DisplayType { get; set; } = DisplayTypes.Auto; + + [DisplayName("Controller Type")] + [Description("Currently controllers can not be configured separately")] + public ControllerTypes ControllerType { get; set; } = ControllerTypes.Standard; + + public SmsSyncSettings Clone() => (SmsSyncSettings)MemberwiseClone(); + + public static bool RebootNeeded(SmsSyncSettings x, SmsSyncSettings y) { return - x.EnableFM != y.EnableFM || - x.AllowOverlock != y.AllowOverlock || - x.UseBIOS != y.UseBIOS || - x.ConsoleRegion != y.ConsoleRegion || - x.DisplayType != y.DisplayType || - x.ControllerType != y.ControllerType; + x.EnableFm != y.EnableFm + || x.AllowOverClock != y.AllowOverClock + || x.UseBios != y.UseBios + || x.ConsoleRegion != y.ConsoleRegion + || x.DisplayType != y.DisplayType + || x.ControllerType != y.ControllerType; + } + + public enum ControllerTypes + { + Standard, + Paddle, + LightPhaser, + SportsPad, + Keyboard + } + + public enum Regions + { + Export, + Japan, + Korea, + Auto + } + + public enum DisplayTypes + { + Ntsc, Pal, Auto } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs index 45ff29f103..5590849b1d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.Input.cs @@ -143,7 +143,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem switch (SyncSettings.ControllerType) { - case "Paddle": + case SmsSyncSettings.ControllerTypes.Paddle: { // use analog values from a controller, see http://www.smspower.org/Development/Paddle @@ -200,11 +200,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } break; - case "Light Phaser": + case SmsSyncSettings.ControllerTypes.LightPhaser: if (_controller.IsPressed("P1 Trigger")) value &= 0xEF; break; - case "Sports Pad": + case SmsSyncSettings.ControllerTypes.SportsPad: { int p1X; if (_controller.IsPressed("P1 Left")) @@ -238,7 +238,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem else p2Y = (int)_controller.GetFloat("P2 Y"); - if (_region == "Japan") + if (_region == SmsSyncSettings.Regions.Japan) { p1X += 128; p1Y += 128; @@ -262,7 +262,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } else if (!Controller1SelectHigh && (Controller1State % 2 == 1)) { - if (++Controller1State == (_region == "Japan" ? 6 : 4)) + if (++Controller1State == (_region == SmsSyncSettings.Regions.Japan ? 6 : 4)) Controller1State = 0; } if (Controller2SelectHigh && (Controller2State % 2 == 0)) @@ -271,7 +271,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } else if (!Controller2SelectHigh && (Controller2State % 2 == 1)) { - if (++Controller2State == (_region == "Japan" ? 6 : 4)) + if (++Controller2State == (_region == SmsSyncSettings.Regions.Japan ? 6 : 4)) Controller2State = 0; } @@ -312,7 +312,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem break; } - if (_region != "Japan") + if (_region != SmsSyncSettings.Regions.Japan) { // Buttons like normal in Export if (_controller.IsPressed("P1 B1")) value &= 0xEF; @@ -353,7 +353,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } break; - case "Keyboard": + case SmsSyncSettings.ControllerTypes.Keyboard: { // use keyboard map to get each bit @@ -395,7 +395,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem switch (SyncSettings.ControllerType) { - case "Paddle": + case SmsSyncSettings.ControllerTypes.Paddle: { // use analog values from a controller, see http://www.smspower.org/Development/Paddle @@ -427,7 +427,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } break; - case "Light Phaser": + case SmsSyncSettings.ControllerTypes.LightPhaser: if (LatchLightPhaser) { value &= 0xBF; @@ -435,7 +435,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } break; - case "Sports Pad": + case SmsSyncSettings.ControllerTypes.SportsPad: { int p2X; if (_controller.IsPressed("P2 Left")) @@ -453,7 +453,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem else p2Y = (int)_controller.GetFloat("P2 Y"); - if (_region == "Japan") + if (_region == SmsSyncSettings.Regions.Japan) { p2X += 128; p2Y += 128; @@ -472,7 +472,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } else if (!Controller2SelectHigh && (Controller2State % 2 == 1)) { - if (++Controller2State == (_region == "Japan" ? 6 : 4)) + if (++Controller2State == (_region == SmsSyncSettings.Regions.Japan ? 6 : 4)) Controller2State = 0; } @@ -495,7 +495,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if ((p2Y & 0x08) == 0) value &= 0xFD; break; } - if (_region != "Japan") + if (_region != SmsSyncSettings.Regions.Japan) { // Buttons like normal in Export if (_controller.IsPressed("P2 B1")) value &= 0xFB; @@ -510,7 +510,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } break; - case "Keyboard": + case SmsSyncSettings.ControllerTypes.Keyboard: { value &= 0x7F; @@ -542,7 +542,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem if ((Port3F & 0x0F) == 5) { - if (_region == "Japan") + if (_region == SmsSyncSettings.Regions.Japan) { value &= 0x3F; } @@ -563,7 +563,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem const int phaserRadius = 4; // specifically lightgun needs to do things on a per-line basis - if (SyncSettings.ControllerType == "Light Phaser") + if (SyncSettings.ControllerType == SmsSyncSettings.ControllerTypes.LightPhaser) { byte phaserX = (byte)(_controller.GetFloat("P1 X") + 20); int phaserY = (int)_controller.GetFloat("P1 Y"); @@ -601,7 +601,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem value ^= 0x80; } - if (RegionStr == "Japan") + if (_region == SmsSyncSettings.Regions.Japan) { value ^= 0x40; } @@ -614,7 +614,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem // The 3F port's TH slot is also used on games in some games in Export BIOS to clock the paddle state // Re: the paddle: Yes it's silly considering the paddle was never released outside Japan but the games think otherwise - if (_region != "Japan") + if (_region != SmsSyncSettings.Regions.Japan) { if ((Port3F & 0x02) == 0x00) { @@ -637,7 +637,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private void PostsetControllerState(int pin) { // for the benefit of the Japan region - if (_region == "Japan" && (++ControllerTick) == 2) + if (_region == SmsSyncSettings.Regions.Japan && (++ControllerTick) == 2) { ControllerTick = 0; @@ -653,4 +653,4 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 50f189af38..a3475017ff 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -22,14 +22,14 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem isReleased: true)] [ServiceNotApplicable(typeof(IDriveLight))] public partial class SMS : IEmulator, ISaveRam, IStatable, IInputPollable, IRegionable, - IDebuggable, ISettable, ICodeDataLogger + IDebuggable, ISettable, ICodeDataLogger { [CoreConstructor("SMS", "SG", "GG")] public SMS(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings) { ServiceProvider = new BasicServiceProvider(this); - Settings = (SMSSettings)settings ?? new SMSSettings(); - SyncSettings = (SMSSyncSettings)syncSettings ?? new SMSSyncSettings(); + Settings = (SmsSettings)settings ?? new SmsSettings(); + SyncSettings = (SmsSyncSettings)syncSettings ?? new SmsSyncSettings(); CoreComm = comm; MemoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" }); @@ -57,25 +57,25 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem Region = DisplayType.NTSC; // all game gears run at 60hz/NTSC mode } - RegionStr = SyncSettings.ConsoleRegion; - if (RegionStr == "Auto") + _region = SyncSettings.ConsoleRegion; + if (_region == SmsSyncSettings.Regions.Auto) { - RegionStr = DetermineRegion(game.Region); + _region = DetermineRegion(game.Region); } - if (game["Japan"] && RegionStr != "Japan") + if (game["Japan"] && _region != SmsSyncSettings.Regions.Japan) { - RegionStr = "Japan"; + _region = SmsSyncSettings.Regions.Japan; CoreComm.Notify("Region was forced to Japan for game compatibility."); } - if (game["Korea"] && RegionStr != "Korea") + if (game["Korea"] && _region != SmsSyncSettings.Regions.Korea) { - RegionStr = "Korea"; + _region = SmsSyncSettings.Regions.Korea; CoreComm.Notify("Region was forced to Korea for game compatibility."); } - if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFM && !IsGameGear) + if ((game.NotInDatabase || game["FM"]) && SyncSettings.EnableFm && !IsGameGear) { HasYM2413 = true; } @@ -147,7 +147,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem PSG.Set_Panning(ForceStereoByte); } - if (SyncSettings.AllowOverlock && game["OverclockSafe"]) + if (SyncSettings.AllowOverClock && game["OverclockSafe"]) Vdp.IPeriod = 512; if (Settings.SpriteLimit) @@ -161,15 +161,16 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem Port3E = 0xF7; // Disable cartridge, enable BIOS rom InitBiosMapper(); } - else if ((game.System == "SMS") && !game["GG_in_SMS"]) + else if (game.System == "SMS" && !game["GG_in_SMS"]) { - BiosRom = comm.CoreFileProvider.GetFirmware("SMS", RegionStr, false); + BiosRom = comm.CoreFileProvider.GetFirmware("SMS", _region.ToString(), false); if (BiosRom == null) { throw new MissingFirmwareException("No BIOS found"); - } - else if (!game["RequireBios"] && !SyncSettings.UseBIOS) + } + + if (!game["RequireBios"] && !SyncSettings.UseBios) { // we are skipping the BIOS // but only if it won't break the game @@ -268,29 +269,29 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem private readonly ITraceable Tracer; - string DetermineRegion(string gameRegion) + SmsSyncSettings.Regions DetermineRegion(string gameRegion) { if (gameRegion == null) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("USA") >= 0) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("Europe") >= 0) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("World") >= 0) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("Brazil") >= 0) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("Australia") >= 0) - return "Export"; + return SmsSyncSettings.Regions.Export; if (gameRegion.IndexOf("Korea") >= 0) - return "Korea"; - return "Japan"; + return SmsSyncSettings.Regions.Korea; + return SmsSyncSettings.Regions.Japan; } - private DisplayType DetermineDisplayType(string display, string region) + private DisplayType DetermineDisplayType(SmsSyncSettings.DisplayTypes display, string region) { - if (display == "NTSC") return DisplayType.NTSC; - if (display == "PAL") return DisplayType.PAL; + if (display == SmsSyncSettings.DisplayTypes.Ntsc) return DisplayType.NTSC; + if (display == SmsSyncSettings.DisplayTypes.Pal) return DisplayType.PAL; if (region != null && region == "Europe") return DisplayType.PAL; return DisplayType.NTSC; } @@ -417,21 +418,6 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem else if (port == 0xF2 && HasYM2413) YM2413.DetectionValue = value; } - public string _region; - public string RegionStr - { - get => _region; - set - { - if (value.NotIn(validRegions)) - { - throw new Exception("Passed value " + value + " is not a valid region!"); - } - - _region = value; - } - } - - private readonly string[] validRegions = { "Export", "Japan", "Korea" , "Auto" }; + private SmsSyncSettings.Regions _region; } }