diff --git a/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs b/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs index 01927e2522e..4a8fdd57568 100644 --- a/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs +++ b/src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs @@ -15,7 +15,6 @@ using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS; using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS; -using BizHawk.Emulation.Cores.Sony.PSX; namespace BizHawk.Client.Common { @@ -222,16 +221,6 @@ public void RefreshUserShader() padding.Bottom += GameExtraPadding.Bottom; } - // an experimental feature - if (source && GlobalEmulator is Octoshock psx) - { - var corePadding = psx.VideoProvider_Padding; - padding.Left += corePadding.Width / 2; - padding.Right += corePadding.Width - corePadding.Width / 2; - padding.Top += corePadding.Height / 2; - padding.Bottom += corePadding.Height - corePadding.Height / 2; - } - // apply user's crop selections as a negative padding (believe it or not, this largely works) // is there an issue with the aspect ratio? I don't know--but if there is, there would be with the padding too padding.Left -= GlobalConfig.DispCropLeft; diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index 2a8f48877fe..fb1dbc52f29 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.IO; -using System.IO.Compression; using System.Linq; using BizHawk.Common; @@ -11,7 +10,6 @@ using BizHawk.Emulation.Cores.Libretro; using BizHawk.Emulation.Cores.Nintendo.Sameboy; using BizHawk.Emulation.Cores.Nintendo.SNES; -using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Emulation.Cores.Arcades.MAME; using BizHawk.Emulation.DiscSystem; @@ -618,27 +616,6 @@ private bool TryLoadSiblingCue( out game); } - private void LoadPSF(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out RomGame rom, out GameInfo game) - { - // TODO: Why does the PSF loader need CbDeflater provided? Surely this is a matter internal to it. - static byte[] CbDeflater(Stream instream, int size) - { - return new GZipStream(instream, CompressionMode.Decompress).ReadAllBytes(); - } - var psf = new PSF(); - psf.Load(path, CbDeflater); - nextEmulator = new Octoshock( - nextComm, - psf, - GetCoreSettings(), - GetCoreSyncSettings() - ); - - // total garbage, this - rom = new RomGame(file); - game = rom.GameInfo; - } - // HACK due to MAME wanting CHDs as hard drives / handling it on its own (bad design, I know!) // only matters for XML, as CHDs are never the "main" rom for MAME // (in general, this is kind of bad as CHD hard drives might be useful for other future cores?) @@ -858,10 +835,12 @@ public bool LoadRom(string path, CoreComm nextComm, string launchLibretroCore, s if (!LoadXML(path, nextComm, file, forcedCoreName, out nextEmulator, out rom, out game)) return false; break; +#if false // was only wired up for Octoshock case ".psf": case ".minipsf": LoadPSF(path, nextComm, file, out nextEmulator, out rom, out game); break; +#endif case ".zip" when forcedCoreName is null: case ".7z" when forcedCoreName is null: LoadMAME(path: path, nextComm, file, ext: ext, out nextEmulator, out rom, out game, out cancel); diff --git a/src/BizHawk.Client.Common/config/Config.cs b/src/BizHawk.Client.Common/config/Config.cs index 3d15486c3f8..4ca9a1d2b50 100644 --- a/src/BizHawk.Client.Common/config/Config.cs +++ b/src/BizHawk.Client.Common/config/Config.cs @@ -44,8 +44,6 @@ public class Config [ CoreNames.QuickNes, CoreNames.NesHawk, CoreNames.SubNesHawk ]), ([ VSystemID.Raw.PCE, VSystemID.Raw.PCECD, VSystemID.Raw.SGX, VSystemID.Raw.SGXCD ], [ CoreNames.TurboNyma, CoreNames.HyperNyma, CoreNames.PceHawk ]), - ([ VSystemID.Raw.PSX ], - [ CoreNames.Nymashock, CoreNames.Octoshock ]), ([ VSystemID.Raw.SMS, VSystemID.Raw.GG, VSystemID.Raw.SG ], [ CoreNames.Gpgx, CoreNames.SMSHawk ]), ([ VSystemID.Raw.SNES ], diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 83c877d3f83..f1e4ac9d4f2 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -245,11 +245,6 @@ private void InitializeComponent() this.toolStripSeparator28 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); this.GBGPUViewerMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.GBPrinterViewerMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.PSXSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.PSXControllerSettingsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.PSXOptionsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.PSXDiscControlsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.PSXHashDiscsToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.SNESSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.SNESControllerConfigurationMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.toolStripSeparator18 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); @@ -393,7 +388,6 @@ private void InitializeComponent() this.TI83SubMenu, this.A7800SubMenu, this.GBSubMenu, - this.PSXSubMenu, this.SNESSubMenu, this.ColecoSubMenu, this.N64SubMenu, @@ -1625,36 +1619,6 @@ private void InitializeComponent() this.GBPrinterViewerMenuItem.Text = "&Printer Viewer"; this.GBPrinterViewerMenuItem.Click += new System.EventHandler(this.GbPrinterViewerMenuItem_Click); // - // PSXSubMenu - // - this.PSXSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.PSXControllerSettingsMenuItem, - this.PSXOptionsMenuItem, - this.PSXDiscControlsMenuItem, - this.PSXHashDiscsToolStripMenuItem}); - this.PSXSubMenu.Text = "PSX"; - this.PSXSubMenu.DropDownOpened += new System.EventHandler(this.PsxSubMenu_DropDownOpened); - // - // PSXControllerSettingsMenuItem - // - this.PSXControllerSettingsMenuItem.Text = "Controller / Memcard Settings"; - this.PSXControllerSettingsMenuItem.Click += new System.EventHandler(this.PsxControllerSettingsMenuItem_Click); - // - // PSXOptionsMenuItem - // - this.PSXOptionsMenuItem.Text = "&Options"; - this.PSXOptionsMenuItem.Click += new System.EventHandler(this.PsxOptionsMenuItem_Click); - // - // PSXDiscControlsMenuItem - // - this.PSXDiscControlsMenuItem.Text = "&Disc Controls"; - this.PSXDiscControlsMenuItem.Click += new System.EventHandler(this.PsxDiscControlsMenuItem_Click); - // - // PSXHashDiscsToolStripMenuItem - // - this.PSXHashDiscsToolStripMenuItem.Text = "&Hash Discs"; - this.PSXHashDiscsToolStripMenuItem.Click += new System.EventHandler(this.PsxHashDiscsMenuItem_Click); - // // SNESSubMenu // this.SNESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -2698,13 +2662,9 @@ private void InitializeComponent() private BizHawk.WinForms.Controls.ToolStripMenuItemEx BarcodeReaderMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx FeaturesMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx DebuggerMenuItem; - private BizHawk.WinForms.Controls.ToolStripMenuItemEx PSXSubMenu; - private BizHawk.WinForms.Controls.ToolStripMenuItemEx PSXOptionsMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx SaveRAMSubMenu; private BizHawk.WinForms.Controls.ToolStripMenuItemEx FlushSaveRAMMenuItem; - private BizHawk.WinForms.Controls.ToolStripMenuItemEx PSXDiscControlsMenuItem; private BizHawk.WinForms.Controls.StatusLabelEx UpdateNotification; - private BizHawk.WinForms.Controls.ToolStripMenuItemEx PSXControllerSettingsMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx MacroToolMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx AppleSubMenu; private BizHawk.WinForms.Controls.ToolStripMenuItemEx AppleDisksSubMenu; @@ -2713,7 +2673,6 @@ private void InitializeComponent() private BizHawk.WinForms.Controls.ToolStripMenuItemEx MusicRipperMenuItem; private BizHawk.WinForms.Controls.ToolStripSeparatorEx toolStripSeparator35; private BizHawk.WinForms.Controls.ToolStripMenuItemEx settingsToolStripMenuItem1; - private BizHawk.WinForms.Controls.ToolStripMenuItemEx PSXHashDiscsToolStripMenuItem; private System.Windows.Forms.Timer timerMouseIdle; private BizHawk.WinForms.Controls.ToolStripMenuItemEx miUnthrottled; private BizHawk.WinForms.Controls.ToolStripMenuItemEx toolStripMenuItem17; diff --git a/src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs b/src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs index 4cc5fe87a6f..bf15adee648 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Runtime.CompilerServices; using System.Windows.Forms; @@ -693,47 +692,6 @@ private void NesSubMenu_DropDownOpened(object sender, EventArgs e) - private DialogResult OpenOctoshockGamepadSettingsDialog(ISettingsAdapter settable) - { - using PSXControllerConfig form = new(settable); - return this.ShowDialogWithTempMute(form); - } - - private void PsxControllerSettingsMenuItem_Click(object sender, EventArgs e) - => _ = Emulator switch - { - Octoshock => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterForLoadedCore()), - _ => DialogResult.None - }; - - private DialogResult OpenOctoshockSettingsDialog(ISettingsAdapter settable, OctoshockDll.eVidStandard vidStandard, Size vidSize) - => PSXOptions.DoSettingsDialog(Config, this, settable, vidStandard, vidSize); - - private void PsxOptionsMenuItem_Click(object sender, EventArgs e) - { - var result = Emulator switch - { - Octoshock octoshock => OpenOctoshockSettingsDialog(GetSettingsAdapterForLoadedCore(), octoshock.SystemVidStandard, octoshock.CurrentVideoSize), - _ => DialogResult.None - }; - if (result.IsOk()) FrameBufferResized(); - } - - private void PsxDiscControlsMenuItem_Click(object sender, EventArgs e) - => Tools.Load().ScrollToPadSchema("Console"); - - private void PsxHashDiscsMenuItem_Click(object sender, EventArgs e) - { - if (Emulator is not IRedumpDiscChecksumInfo psx) return; - using PSXHashDiscs form = new() { _psx = psx }; - this.ShowDialogWithTempMute(form); - } - - private void PsxSubMenu_DropDownOpened(object sender, EventArgs e) - => PSXControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive(); - - - private DialogResult OpenOldBSNESGamepadSettingsDialog(ISettingsAdapter settable) { using SNESControllerSettings form = new(settable); @@ -1310,22 +1268,6 @@ ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, para // O2Hawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.O2Hawk, CreateGenericCoreConfigItem(CoreNames.O2Hawk))); - // Octoshock - var octoshockGamepadSettingsItem = CreateSettingsItem("Controller / Memcard Settings...", (_, _) => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterFor())); - var octoshockSettingsItem = CreateSettingsItem("Options...", PsxOptionsMenuItem_Click); - // using init buffer sizes here (in practice, they don't matter here, but might as well) - var octoshockNTSCSettingsItem = CreateSettingsItem("Options (as NTSC)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor(), OctoshockDll.eVidStandard.NTSC, new(280, 240))); - var octoshockPALSettingsItem = CreateSettingsItem("Options (as PAL)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor(), OctoshockDll.eVidStandard.PAL, new(280, 288))); - var octoshockSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Octoshock, octoshockGamepadSettingsItem, octoshockSettingsItem, octoshockNTSCSettingsItem, octoshockPALSettingsItem); - octoshockSubmenu.DropDownOpened += (_, _) => - { - var loadedCoreIsOctoshock = Emulator is Octoshock; - octoshockGamepadSettingsItem.Enabled = !loadedCoreIsOctoshock || MovieSession.Movie.NotActive(); - octoshockSettingsItem.Visible = loadedCoreIsOctoshock; - octoshockNTSCSettingsItem.Visible = octoshockPALSettingsItem.Visible = !loadedCoreIsOctoshock; - }; - items.Add(octoshockSubmenu); - // PCEHawk items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.PceHawk, CreateGenericCoreConfigItem(CoreNames.PceHawk))); @@ -1438,7 +1380,6 @@ private void HandlePlatformMenus() GBSubMenu.Visible = false; A7800SubMenu.Visible = false; SNESSubMenu.Visible = false; - PSXSubMenu.Visible = false; ColecoSubMenu.Visible = false; N64SubMenu.Visible = false; Ares64SubMenu.Visible = false; @@ -1481,9 +1422,6 @@ private void HandlePlatformMenus() case VSystemID.Raw.NES: NESSubMenu.Visible = true; break; - case VSystemID.Raw.PSX when Emulator is Octoshock: - PSXSubMenu.Visible = true; - break; case VSystemID.Raw.TI83: TI83SubMenu.Visible = true; LoadTIFileMenuItem.Visible = Emulator is TI83; diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index f9249cb0a1e..cea7baf97ec 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -333,7 +333,6 @@ private void SetImages() NESSoundChannelsMenuItem.Image = Properties.Resources.Audio; (KeypadMenuItem.Image, /*KeypadMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(TI83KeyPad)] = (/*TI83KeyPad.ToolIcon.ToBitmap()*/Properties.Resources.Calculator, "TI-83 Virtual KeyPad"); - PSXControllerSettingsMenuItem.Image = Properties.Resources.GameController; SNESControllerConfigurationMenuItem.Image = Properties.Resources.GameController; (SnesGfxDebuggerMenuItem.Image, /*SnesGfxDebuggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(SNESGraphicsDebugger)] = (/*SNESGraphicsDebugger.ToolIcon.ToBitmap()*/Properties.Resources.Bug, "Graphics Debugger"); diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.Designer.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.Designer.cs deleted file mode 100644 index 41ee7572306..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.Designer.cs +++ /dev/null @@ -1,431 +0,0 @@ -namespace BizHawk.Client.EmuHawk -{ - partial class PSXControllerConfig - { - /// - /// 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.cbMultitap_1 = new System.Windows.Forms.CheckBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.lbl_p_1_4 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_1_3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_1_2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_1_1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_1_4 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_1_3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_1_2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_1_1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.combo_1_4 = new System.Windows.Forms.ComboBox(); - this.combo_1_3 = new System.Windows.Forms.ComboBox(); - this.combo_1_2 = new System.Windows.Forms.ComboBox(); - this.combo_1_1 = new System.Windows.Forms.ComboBox(); - this.cbMemcard_1 = new System.Windows.Forms.CheckBox(); - this.btnOK = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.lbl_p_2_4 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_2_3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_2_2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_p_2_1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_2_4 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_2_3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_2_2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lbl_2_1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.combo_2_4 = new System.Windows.Forms.ComboBox(); - this.combo_2_3 = new System.Windows.Forms.ComboBox(); - this.combo_2_2 = new System.Windows.Forms.ComboBox(); - this.combo_2_1 = new System.Windows.Forms.ComboBox(); - this.cbMemcard_2 = new System.Windows.Forms.CheckBox(); - this.cbMultitap_2 = new System.Windows.Forms.CheckBox(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); - // - // cbMultitap_1 - // - this.cbMultitap_1.AutoSize = true; - this.cbMultitap_1.Location = new System.Drawing.Point(18, 43); - this.cbMultitap_1.Name = "cbMultitap_1"; - this.cbMultitap_1.Size = new System.Drawing.Size(63, 17); - this.cbMultitap_1.TabIndex = 0; - this.cbMultitap_1.Text = "Multitap"; - this.cbMultitap_1.UseVisualStyleBackColor = true; - this.cbMultitap_1.CheckedChanged += new System.EventHandler(this.Cb_Changed); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.lbl_p_1_4); - this.groupBox1.Controls.Add(this.lbl_p_1_3); - this.groupBox1.Controls.Add(this.lbl_p_1_2); - this.groupBox1.Controls.Add(this.lbl_p_1_1); - this.groupBox1.Controls.Add(this.lbl_1_4); - this.groupBox1.Controls.Add(this.lbl_1_3); - this.groupBox1.Controls.Add(this.lbl_1_2); - this.groupBox1.Controls.Add(this.lbl_1_1); - this.groupBox1.Controls.Add(this.combo_1_4); - this.groupBox1.Controls.Add(this.combo_1_3); - this.groupBox1.Controls.Add(this.combo_1_2); - this.groupBox1.Controls.Add(this.combo_1_1); - this.groupBox1.Controls.Add(this.cbMemcard_1); - this.groupBox1.Controls.Add(this.cbMultitap_1); - this.groupBox1.Location = new System.Drawing.Point(12, 12); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(273, 136); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Port 1"; - // - // lbl_p_1_4 - // - this.lbl_p_1_4.Location = new System.Drawing.Point(241, 105); - this.lbl_p_1_4.Name = "lbl_p_1_4"; - this.lbl_p_1_4.Text = "P1"; - this.lbl_p_1_4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_1_3 - // - this.lbl_p_1_3.Location = new System.Drawing.Point(241, 78); - this.lbl_p_1_3.Name = "lbl_p_1_3"; - this.lbl_p_1_3.Text = "P1"; - this.lbl_p_1_3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_1_2 - // - this.lbl_p_1_2.Location = new System.Drawing.Point(241, 50); - this.lbl_p_1_2.Name = "lbl_p_1_2"; - this.lbl_p_1_2.Text = "P1"; - this.lbl_p_1_2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_1_1 - // - this.lbl_p_1_1.Location = new System.Drawing.Point(241, 24); - this.lbl_p_1_1.Name = "lbl_p_1_1"; - this.lbl_p_1_1.Text = "P1"; - this.lbl_p_1_1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_1_4 - // - this.lbl_1_4.Location = new System.Drawing.Point(94, 105); - this.lbl_1_4.Name = "lbl_1_4"; - this.lbl_1_4.Text = "D"; - this.lbl_1_4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_1_3 - // - this.lbl_1_3.Location = new System.Drawing.Point(94, 78); - this.lbl_1_3.Name = "lbl_1_3"; - this.lbl_1_3.Text = "C"; - this.lbl_1_3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_1_2 - // - this.lbl_1_2.Location = new System.Drawing.Point(94, 51); - this.lbl_1_2.Name = "lbl_1_2"; - this.lbl_1_2.Text = "B"; - this.lbl_1_2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_1_1 - // - this.lbl_1_1.Location = new System.Drawing.Point(94, 24); - this.lbl_1_1.Name = "lbl_1_1"; - this.lbl_1_1.Text = "A"; - this.lbl_1_1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // combo_1_4 - // - this.combo_1_4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_1_4.FormattingEnabled = true; - this.combo_1_4.Location = new System.Drawing.Point(114, 102); - this.combo_1_4.Name = "combo_1_4"; - this.combo_1_4.Size = new System.Drawing.Size(121, 21); - this.combo_1_4.TabIndex = 5; - this.combo_1_4.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_1_3 - // - this.combo_1_3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_1_3.FormattingEnabled = true; - this.combo_1_3.Location = new System.Drawing.Point(114, 75); - this.combo_1_3.Name = "combo_1_3"; - this.combo_1_3.Size = new System.Drawing.Size(121, 21); - this.combo_1_3.TabIndex = 4; - this.combo_1_3.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_1_2 - // - this.combo_1_2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_1_2.FormattingEnabled = true; - this.combo_1_2.Location = new System.Drawing.Point(114, 48); - this.combo_1_2.Name = "combo_1_2"; - this.combo_1_2.Size = new System.Drawing.Size(121, 21); - this.combo_1_2.TabIndex = 3; - this.combo_1_2.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_1_1 - // - this.combo_1_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_1_1.FormattingEnabled = true; - this.combo_1_1.Location = new System.Drawing.Point(114, 21); - this.combo_1_1.Name = "combo_1_1"; - this.combo_1_1.Size = new System.Drawing.Size(121, 21); - this.combo_1_1.TabIndex = 2; - this.combo_1_1.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // cbMemcard_1 - // - this.cbMemcard_1.AutoSize = true; - this.cbMemcard_1.Location = new System.Drawing.Point(18, 21); - this.cbMemcard_1.Name = "cbMemcard_1"; - this.cbMemcard_1.Size = new System.Drawing.Size(70, 17); - this.cbMemcard_1.TabIndex = 1; - this.cbMemcard_1.Text = "Memcard"; - this.cbMemcard_1.UseVisualStyleBackColor = true; - this.cbMemcard_1.CheckedChanged += new System.EventHandler(this.Cb_Changed); - // - // btnOK - // - this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnOK.Location = new System.Drawing.Point(408, 163); - this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(75, 23); - this.btnOK.TabIndex = 2; - this.btnOK.Text = "OK"; - this.btnOK.UseVisualStyleBackColor = true; - this.btnOK.Click += new System.EventHandler(this.BtnOk_Click); - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(489, 163); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.lbl_p_2_4); - this.groupBox2.Controls.Add(this.lbl_p_2_3); - this.groupBox2.Controls.Add(this.lbl_p_2_2); - this.groupBox2.Controls.Add(this.lbl_p_2_1); - this.groupBox2.Controls.Add(this.lbl_2_4); - this.groupBox2.Controls.Add(this.lbl_2_3); - this.groupBox2.Controls.Add(this.lbl_2_2); - this.groupBox2.Controls.Add(this.lbl_2_1); - this.groupBox2.Controls.Add(this.combo_2_4); - this.groupBox2.Controls.Add(this.combo_2_3); - this.groupBox2.Controls.Add(this.combo_2_2); - this.groupBox2.Controls.Add(this.combo_2_1); - this.groupBox2.Controls.Add(this.cbMemcard_2); - this.groupBox2.Controls.Add(this.cbMultitap_2); - this.groupBox2.Location = new System.Drawing.Point(291, 12); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(273, 136); - this.groupBox2.TabIndex = 13; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Port 2"; - // - // lbl_p_2_4 - // - this.lbl_p_2_4.Location = new System.Drawing.Point(241, 105); - this.lbl_p_2_4.Name = "lbl_p_2_4"; - this.lbl_p_2_4.Text = "P1"; - this.lbl_p_2_4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_2_3 - // - this.lbl_p_2_3.Location = new System.Drawing.Point(241, 78); - this.lbl_p_2_3.Name = "lbl_p_2_3"; - this.lbl_p_2_3.Text = "P1"; - this.lbl_p_2_3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_2_2 - // - this.lbl_p_2_2.Location = new System.Drawing.Point(241, 50); - this.lbl_p_2_2.Name = "lbl_p_2_2"; - this.lbl_p_2_2.Text = "P1"; - this.lbl_p_2_2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_p_2_1 - // - this.lbl_p_2_1.Location = new System.Drawing.Point(241, 24); - this.lbl_p_2_1.Name = "lbl_p_2_1"; - this.lbl_p_2_1.Text = "P1"; - this.lbl_p_2_1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_2_4 - // - this.lbl_2_4.Location = new System.Drawing.Point(94, 105); - this.lbl_2_4.Name = "lbl_2_4"; - this.lbl_2_4.Text = "D"; - this.lbl_2_4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_2_3 - // - this.lbl_2_3.Location = new System.Drawing.Point(94, 78); - this.lbl_2_3.Name = "lbl_2_3"; - this.lbl_2_3.Text = "C"; - this.lbl_2_3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_2_2 - // - this.lbl_2_2.Location = new System.Drawing.Point(94, 51); - this.lbl_2_2.Name = "lbl_2_2"; - this.lbl_2_2.Text = "B"; - this.lbl_2_2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lbl_2_1 - // - this.lbl_2_1.Location = new System.Drawing.Point(94, 24); - this.lbl_2_1.Name = "lbl_2_1"; - this.lbl_2_1.Text = "A"; - this.lbl_2_1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // combo_2_4 - // - this.combo_2_4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_2_4.FormattingEnabled = true; - this.combo_2_4.Location = new System.Drawing.Point(114, 102); - this.combo_2_4.Name = "combo_2_4"; - this.combo_2_4.Size = new System.Drawing.Size(121, 21); - this.combo_2_4.TabIndex = 5; - this.combo_2_4.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_2_3 - // - this.combo_2_3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_2_3.FormattingEnabled = true; - this.combo_2_3.Location = new System.Drawing.Point(114, 75); - this.combo_2_3.Name = "combo_2_3"; - this.combo_2_3.Size = new System.Drawing.Size(121, 21); - this.combo_2_3.TabIndex = 4; - this.combo_2_3.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_2_2 - // - this.combo_2_2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_2_2.FormattingEnabled = true; - this.combo_2_2.Location = new System.Drawing.Point(114, 48); - this.combo_2_2.Name = "combo_2_2"; - this.combo_2_2.Size = new System.Drawing.Size(121, 21); - this.combo_2_2.TabIndex = 3; - this.combo_2_2.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // combo_2_1 - // - this.combo_2_1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.combo_2_1.FormattingEnabled = true; - this.combo_2_1.Location = new System.Drawing.Point(114, 21); - this.combo_2_1.Name = "combo_2_1"; - this.combo_2_1.Size = new System.Drawing.Size(121, 21); - this.combo_2_1.TabIndex = 2; - this.combo_2_1.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged); - // - // cbMemcard_2 - // - this.cbMemcard_2.AutoSize = true; - this.cbMemcard_2.Location = new System.Drawing.Point(18, 21); - this.cbMemcard_2.Name = "cbMemcard_2"; - this.cbMemcard_2.Size = new System.Drawing.Size(70, 17); - this.cbMemcard_2.TabIndex = 1; - this.cbMemcard_2.Text = "Memcard"; - this.cbMemcard_2.UseVisualStyleBackColor = true; - this.cbMemcard_2.CheckedChanged += new System.EventHandler(this.Cb_Changed); - // - // cbMultitap_2 - // - this.cbMultitap_2.AutoSize = true; - this.cbMultitap_2.Location = new System.Drawing.Point(18, 43); - this.cbMultitap_2.Name = "cbMultitap_2"; - this.cbMultitap_2.Size = new System.Drawing.Size(63, 17); - this.cbMultitap_2.TabIndex = 0; - this.cbMultitap_2.Text = "Multitap"; - this.cbMultitap_2.UseVisualStyleBackColor = true; - this.cbMultitap_2.CheckedChanged += new System.EventHandler(this.Cb_Changed); - // - // PSXControllerConfigNew - // - this.AcceptButton = this.btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(586, 201); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOK); - this.Controls.Add(this.groupBox1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PSXControllerConfig"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Controller / Memcard Configuration"; - this.Load += new System.EventHandler(this.PSXControllerConfigNew_Load); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.CheckBox cbMultitap_1; - private System.Windows.Forms.GroupBox groupBox1; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_1_4; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_1_3; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_1_2; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_1_1; - private BizHawk.WinForms.Controls.LocLabelEx lbl_1_4; - private BizHawk.WinForms.Controls.LocLabelEx lbl_1_3; - private BizHawk.WinForms.Controls.LocLabelEx lbl_1_2; - private BizHawk.WinForms.Controls.LocLabelEx lbl_1_1; - private System.Windows.Forms.ComboBox combo_1_4; - private System.Windows.Forms.ComboBox combo_1_3; - private System.Windows.Forms.ComboBox combo_1_2; - private System.Windows.Forms.ComboBox combo_1_1; - private System.Windows.Forms.CheckBox cbMemcard_1; - private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.GroupBox groupBox2; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_2_4; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_2_3; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_2_2; - private BizHawk.WinForms.Controls.LocLabelEx lbl_p_2_1; - private BizHawk.WinForms.Controls.LocLabelEx lbl_2_4; - private BizHawk.WinForms.Controls.LocLabelEx lbl_2_3; - private BizHawk.WinForms.Controls.LocLabelEx lbl_2_2; - private BizHawk.WinForms.Controls.LocLabelEx lbl_2_1; - private System.Windows.Forms.ComboBox combo_2_4; - private System.Windows.Forms.ComboBox combo_2_3; - private System.Windows.Forms.ComboBox combo_2_2; - private System.Windows.Forms.ComboBox combo_2_1; - private System.Windows.Forms.CheckBox cbMemcard_2; - private System.Windows.Forms.CheckBox cbMultitap_2; - } -} \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs deleted file mode 100644 index 00b8b74bdec..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System.Windows.Forms; - -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Sony.PSX; - -namespace BizHawk.Client.EmuHawk -{ - public partial class PSXControllerConfig : Form - { - private readonly ISettingsAdapter _settable; - - private readonly Octoshock.SyncSettings _syncSettings; - - public PSXControllerConfig(ISettingsAdapter settable) - { - _settable = settable; - _syncSettings = (Octoshock.SyncSettings) _settable.GetSyncSettings(); - InitializeComponent(); - Icon = Properties.Resources.GameControllerIcon; - } - - private void PSXControllerConfigNew_Load(object sender, EventArgs e) - { - // populate combo boxes - foreach (var combo in new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 }) - { - combo.Items.Add("-Nothing-"); - combo.Items.Add("Gamepad"); - combo.Items.Add("Dual Shock"); - combo.Items.Add("Dual Analog"); - combo.Items.Add("neGcon"); - combo.SelectedIndex = 0; - } - - GuiFromUserConfig(_syncSettings.FIOConfig); - RefreshLabels(); - } - - private void GuiFromUserConfig(OctoshockFIOConfigUser user) - { - cbMemcard_1.Checked = user.Memcards[0]; - cbMemcard_2.Checked = user.Memcards[1]; - cbMultitap_1.Checked = user.Multitaps[0]; - cbMultitap_2.Checked = user.Multitaps[1]; - - var combos = new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 }; - for (int i = 0; i < 8; i++) - { - var combo = combos[i]; - if (user.Devices8[i] == OctoshockDll.ePeripheralType.None) combo.SelectedIndex = 0; - if (user.Devices8[i] == OctoshockDll.ePeripheralType.Pad) combo.SelectedIndex = 1; - if (user.Devices8[i] == OctoshockDll.ePeripheralType.DualShock) combo.SelectedIndex = 2; - if (user.Devices8[i] == OctoshockDll.ePeripheralType.DualAnalog) combo.SelectedIndex = 3; - if (user.Devices8[i] == OctoshockDll.ePeripheralType.NegCon) combo.SelectedIndex = 4; - } - } - - private OctoshockFIOConfigUser UserConfigFromGui() - { - var uc = new OctoshockFIOConfigUser - { - Memcards = { [0] = cbMemcard_1.Checked, [1] = cbMemcard_2.Checked }, - Multitaps = { [0] = cbMultitap_1.Checked, [1] = cbMultitap_2.Checked } - }; - - var combos = new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 }; - for (int i = 0; i < 8; i++) - { - var combo = combos[i]; - uc.Devices8[i] = combo.SelectedIndex switch - { - 0 => OctoshockDll.ePeripheralType.None, - 1 => OctoshockDll.ePeripheralType.Pad, - 2 => OctoshockDll.ePeripheralType.DualShock, - 3 => OctoshockDll.ePeripheralType.DualAnalog, - 4 => OctoshockDll.ePeripheralType.NegCon, - _ => uc.Devices8[i] - }; - } - - return uc; - } - - private void RefreshLabels() - { - var uc = UserConfigFromGui(); - - bool b1 = uc.Multitaps[0]; - lbl_1_1.Visible = b1; - lbl_1_2.Visible = b1; - lbl_1_3.Visible = b1; - lbl_1_4.Visible = b1; - combo_1_2.Enabled = b1; - combo_1_3.Enabled = b1; - combo_1_4.Enabled = b1; - lbl_p_1_2.Visible = b1; - lbl_p_1_3.Visible = b1; - lbl_p_1_4.Visible = b1; - - bool b2 = uc.Multitaps[1]; - lbl_2_1.Visible = b2; - lbl_2_2.Visible = b2; - lbl_2_3.Visible = b2; - lbl_2_4.Visible = b2; - combo_2_2.Enabled = b2; - combo_2_3.Enabled = b2; - combo_2_4.Enabled = b2; - lbl_p_2_2.Visible = b2; - lbl_p_2_3.Visible = b2; - lbl_p_2_4.Visible = b2; - - var lc = uc.ToLogical(); - - var pLabels = new[] { lbl_p_1_1, lbl_p_1_2, lbl_p_1_3, lbl_p_1_4, lbl_p_2_1, lbl_p_2_2, lbl_p_2_3, lbl_p_2_4 }; - for (int i = 0; i < 8; i++) - { - var lbl = pLabels[i]; - if (lc.PlayerAssignments[i] == -1) - { - lbl.Visible = false; - } - else - { - lbl.Text = $"P{lc.PlayerAssignments[i]}"; - lbl.Visible = true; - } - } - } - - private void Cb_Changed(object sender, EventArgs e) - { - RefreshLabels(); - } - - private void Combo_SelectedIndexChanged(object sender, EventArgs e) - { - RefreshLabels(); - } - - private void BtnOk_Click(object sender, EventArgs e) - { - _syncSettings.FIOConfig = UserConfigFromGui(); - _settable.PutCoreSyncSettings(_syncSettings); - - DialogResult = DialogResult.OK; - Close(); - } - } -} diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.resx b/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.resx deleted file mode 100644 index 1af7de150c9..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.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/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.Designer.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.Designer.cs deleted file mode 100644 index d9a2737c5c9..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.Designer.cs +++ /dev/null @@ -1,555 +0,0 @@ -namespace BizHawk.Client.EmuHawk -{ - partial class PSXOptions - { - /// - /// 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.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PSXOptions)); - this.btnCancel = new System.Windows.Forms.Button(); - this.btnOk = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.lblTweakedMednafen = new BizHawk.WinForms.Controls.LocLabelEx(); - this.rbTweakedMednafenMode = new System.Windows.Forms.RadioButton(); - this.label3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.rbDebugMode = new System.Windows.Forms.RadioButton(); - this.btnNiceDisplayConfig = new System.Windows.Forms.Button(); - this.lblMednafen = new BizHawk.WinForms.Controls.LocLabelEx(); - this.rbMednafenMode = new System.Windows.Forms.RadioButton(); - this.lblPixelPro = new BizHawk.WinForms.Controls.LocLabelEx(); - this.rbPixelPro = new System.Windows.Forms.RadioButton(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.rbClipNone = new System.Windows.Forms.RadioButton(); - this.rbClipToFramebuffer = new System.Windows.Forms.RadioButton(); - this.rbClipBasic = new System.Windows.Forms.RadioButton(); - this.lblPAL = new BizHawk.WinForms.Controls.LocLabelEx(); - this.PAL_LastLineNumeric = new System.Windows.Forms.NumericUpDown(); - this.PAL_FirstLineNumeric = new System.Windows.Forms.NumericUpDown(); - this.lblNTSC = new BizHawk.WinForms.Controls.LocLabelEx(); - this.btnAreaFull = new System.Windows.Forms.Button(); - this.label4 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.label1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.NTSC_LastLineNumeric = new System.Windows.Forms.NumericUpDown(); - this.NTSC_FirstLineNumeric = new System.Windows.Forms.NumericUpDown(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.rbWeave = new System.Windows.Forms.RadioButton(); - this.rbBobOffset = new System.Windows.Forms.RadioButton(); - this.rbBob = new System.Windows.Forms.RadioButton(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.groupBox5 = new System.Windows.Forms.GroupBox(); - this.cbLEC = new System.Windows.Forms.CheckBox(); - this.cbGpuLag = new System.Windows.Forms.CheckBox(); - this.groupBox6 = new System.Windows.Forms.GroupBox(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).BeginInit(); - this.groupBox4.SuspendLayout(); - this.groupBox5.SuspendLayout(); - this.groupBox6.SuspendLayout(); - this.SuspendLayout(); - // - // btnCancel - // - this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(622, 370); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - // - // btnOk - // - this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnOk.Location = new System.Drawing.Point(541, 370); - this.btnOk.Name = "btnOk"; - this.btnOk.Size = new System.Drawing.Size(75, 23); - this.btnOk.TabIndex = 2; - this.btnOk.Text = "OK"; - this.btnOk.UseVisualStyleBackColor = true; - this.btnOk.Click += new System.EventHandler(this.BtnOk_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.linkLabel1); - this.groupBox1.Controls.Add(this.lblTweakedMednafen); - this.groupBox1.Controls.Add(this.rbTweakedMednafenMode); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.rbDebugMode); - this.groupBox1.Controls.Add(this.btnNiceDisplayConfig); - this.groupBox1.Controls.Add(this.lblMednafen); - this.groupBox1.Controls.Add(this.rbMednafenMode); - this.groupBox1.Controls.Add(this.lblPixelPro); - this.groupBox1.Controls.Add(this.rbPixelPro); - this.groupBox1.Location = new System.Drawing.Point(12, 7); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(474, 293); - this.groupBox1.TabIndex = 6; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Resolution Management"; - // - // linkLabel1 - // - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(326, 254); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(53, 13); - this.linkLabel1.TabIndex = 29; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "About Me"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked); - // - // lblTweakedMednafen - // - this.lblTweakedMednafen.Location = new System.Drawing.Point(249, 134); - this.lblTweakedMednafen.Name = "lblTweakedMednafen"; - this.lblTweakedMednafen.Text = resources.GetString("lblTweakedMednafen.Text"); - // - // rbTweakedMednafenMode - // - this.rbTweakedMednafenMode.AutoSize = true; - this.rbTweakedMednafenMode.Location = new System.Drawing.Point(246, 118); - this.rbTweakedMednafenMode.Name = "rbTweakedMednafenMode"; - this.rbTweakedMednafenMode.Size = new System.Drawing.Size(193, 17); - this.rbTweakedMednafenMode.TabIndex = 27; - this.rbTweakedMednafenMode.TabStop = true; - this.rbTweakedMednafenMode.Text = "Tweaked Mednafen Mode (4:3 AR)"; - this.rbTweakedMednafenMode.UseVisualStyleBackColor = true; - // - // label3 - // - this.label3.Location = new System.Drawing.Point(249, 35); - this.label3.Name = "label3"; - this.label3.Text = "Displays all content unmodified\r\n • Window size will constantly change\r\n • Aspect" + - " ratio is usually wrong\r\n • Recommended for hacking\r\n • Ideal for segmented AV d" + - "umping\r\n • Ideal for screen shots\r\n\r\n"; - // - // rbDebugMode - // - this.rbDebugMode.AutoSize = true; - this.rbDebugMode.Location = new System.Drawing.Point(246, 19); - this.rbDebugMode.Name = "rbDebugMode"; - this.rbDebugMode.Size = new System.Drawing.Size(134, 17); - this.rbDebugMode.TabIndex = 25; - this.rbDebugMode.TabStop = true; - this.rbDebugMode.Text = "Hardcore Debug Mode"; - this.rbDebugMode.UseVisualStyleBackColor = true; - // - // btnNiceDisplayConfig - // - this.btnNiceDisplayConfig.AutoSize = true; - this.btnNiceDisplayConfig.Location = new System.Drawing.Point(145, 244); - this.btnNiceDisplayConfig.Name = "btnNiceDisplayConfig"; - this.btnNiceDisplayConfig.Size = new System.Drawing.Size(173, 23); - this.btnNiceDisplayConfig.TabIndex = 24; - this.btnNiceDisplayConfig.Text = "Change My Display Options"; - this.btnNiceDisplayConfig.UseVisualStyleBackColor = true; - this.btnNiceDisplayConfig.Click += new System.EventHandler(this.BtnNiceDisplayConfig_Click); - // - // lblMednafen - // - this.lblMednafen.Location = new System.Drawing.Point(6, 134); - this.lblMednafen.Name = "lblMednafen"; - this.lblMednafen.Text = resources.GetString("lblMednafen.Text"); - // - // rbMednafenMode - // - this.rbMednafenMode.AutoSize = true; - this.rbMednafenMode.Location = new System.Drawing.Point(6, 118); - this.rbMednafenMode.Name = "rbMednafenMode"; - this.rbMednafenMode.Size = new System.Drawing.Size(145, 17); - this.rbMednafenMode.TabIndex = 22; - this.rbMednafenMode.TabStop = true; - this.rbMednafenMode.Text = "Mednafen Mode (4:3 AR)"; - this.rbMednafenMode.UseVisualStyleBackColor = true; - // - // lblPixelPro - // - this.lblPixelPro.Location = new System.Drawing.Point(6, 35); - this.lblPixelPro.Name = "lblPixelPro"; - this.lblPixelPro.Text = resources.GetString("lblPixelPro.Text"); - // - // rbPixelPro - // - this.rbPixelPro.AutoSize = true; - this.rbPixelPro.Location = new System.Drawing.Point(6, 19); - this.rbPixelPro.Name = "rbPixelPro"; - this.rbPixelPro.Size = new System.Drawing.Size(96, 17); - this.rbPixelPro.TabIndex = 0; - this.rbPixelPro.TabStop = true; - this.rbPixelPro.Text = "Pixel Pro Mode"; - this.rbPixelPro.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.groupBox3); - this.groupBox2.Controls.Add(this.lblPAL); - this.groupBox2.Controls.Add(this.PAL_LastLineNumeric); - this.groupBox2.Controls.Add(this.PAL_FirstLineNumeric); - this.groupBox2.Controls.Add(this.lblNTSC); - this.groupBox2.Controls.Add(this.btnAreaFull); - this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Controls.Add(this.NTSC_LastLineNumeric); - this.groupBox2.Controls.Add(this.NTSC_FirstLineNumeric); - this.groupBox2.Location = new System.Drawing.Point(492, 7); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(212, 239); - this.groupBox2.TabIndex = 31; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Drawing Area"; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.rbClipNone); - this.groupBox3.Controls.Add(this.rbClipToFramebuffer); - this.groupBox3.Controls.Add(this.rbClipBasic); - this.groupBox3.Location = new System.Drawing.Point(7, 131); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(197, 88); - this.groupBox3.TabIndex = 46; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Horizontal Overscan Clipping"; - // - // rbClipNone - // - this.rbClipNone.AutoSize = true; - this.rbClipNone.Location = new System.Drawing.Point(6, 19); - this.rbClipNone.Name = "rbClipNone"; - this.rbClipNone.Size = new System.Drawing.Size(51, 17); - this.rbClipNone.TabIndex = 48; - this.rbClipNone.TabStop = true; - this.rbClipNone.Text = "None"; - this.toolTip1.SetToolTip(this.rbClipNone, resources.GetString("rbClipNone.ToolTip")); - this.rbClipNone.UseVisualStyleBackColor = true; - this.rbClipNone.CheckedChanged += new System.EventHandler(this.RbClipNone_CheckedChanged); - // - // rbClipToFramebuffer - // - this.rbClipToFramebuffer.AutoSize = true; - this.rbClipToFramebuffer.Location = new System.Drawing.Point(6, 65); - this.rbClipToFramebuffer.Name = "rbClipToFramebuffer"; - this.rbClipToFramebuffer.Size = new System.Drawing.Size(117, 17); - this.rbClipToFramebuffer.TabIndex = 47; - this.rbClipToFramebuffer.TabStop = true; - this.rbClipToFramebuffer.Text = "Clip To Framebuffer"; - this.toolTip1.SetToolTip(this.rbClipToFramebuffer, "Subverts mednafen\'s internal video display field emulation to show only the game\'" + - "s framebuffer.\r\nHorizontal letterbox bars may be re-added in Mednafen-style reso" + - "lution modes to maintain correct AR."); - this.rbClipToFramebuffer.UseVisualStyleBackColor = true; - this.rbClipToFramebuffer.CheckedChanged += new System.EventHandler(this.RbClipToFramebuffer_CheckedChanged); - // - // rbClipBasic - // - this.rbClipBasic.AutoSize = true; - this.rbClipBasic.Location = new System.Drawing.Point(6, 42); - this.rbClipBasic.Name = "rbClipBasic"; - this.rbClipBasic.Size = new System.Drawing.Size(91, 17); - this.rbClipBasic.TabIndex = 46; - this.rbClipBasic.TabStop = true; - this.rbClipBasic.Text = "Basic Clipping"; - this.toolTip1.SetToolTip(this.rbClipBasic, "A mednafen option -- appears to be 5.5% horizontally"); - this.rbClipBasic.UseVisualStyleBackColor = true; - this.rbClipBasic.CheckedChanged += new System.EventHandler(this.RbClipHorizontal_CheckedChanged); - // - // lblPAL - // - this.lblPAL.Location = new System.Drawing.Point(131, 17); - this.lblPAL.Name = "lblPAL"; - this.lblPAL.Text = "PAL"; - // - // PAL_LastLineNumeric - // - this.PAL_LastLineNumeric.Location = new System.Drawing.Point(124, 62); - this.PAL_LastLineNumeric.Maximum = new decimal(new int[] { - 287, - 0, - 0, - 0}); - this.PAL_LastLineNumeric.Name = "PAL_LastLineNumeric"; - this.PAL_LastLineNumeric.Size = new System.Drawing.Size(47, 20); - this.PAL_LastLineNumeric.TabIndex = 43; - this.PAL_LastLineNumeric.Value = new decimal(new int[] { - 128, - 0, - 0, - 0}); - this.PAL_LastLineNumeric.ValueChanged += new System.EventHandler(this.DrawingArea_ValueChanged); - // - // PAL_FirstLineNumeric - // - this.PAL_FirstLineNumeric.Location = new System.Drawing.Point(124, 36); - this.PAL_FirstLineNumeric.Maximum = new decimal(new int[] { - 287, - 0, - 0, - 0}); - this.PAL_FirstLineNumeric.Name = "PAL_FirstLineNumeric"; - this.PAL_FirstLineNumeric.Size = new System.Drawing.Size(47, 20); - this.PAL_FirstLineNumeric.TabIndex = 42; - this.PAL_FirstLineNumeric.ValueChanged += new System.EventHandler(this.DrawingArea_ValueChanged); - // - // lblNTSC - // - this.lblNTSC.Location = new System.Drawing.Point(62, 17); - this.lblNTSC.Name = "lblNTSC"; - this.lblNTSC.Text = "NTSC"; - // - // btnAreaFull - // - this.btnAreaFull.Location = new System.Drawing.Point(8, 94); - this.btnAreaFull.Name = "btnAreaFull"; - this.btnAreaFull.Size = new System.Drawing.Size(163, 23); - this.btnAreaFull.TabIndex = 40; - this.btnAreaFull.Text = "Full [0,239] and [0,287]"; - this.btnAreaFull.UseVisualStyleBackColor = true; - this.btnAreaFull.Click += new System.EventHandler(this.BtnAreaFull_Click); - // - // label4 - // - this.label4.Location = new System.Drawing.Point(4, 64); - this.label4.Name = "label4"; - this.label4.Text = "Last line:"; - // - // label1 - // - this.label1.Location = new System.Drawing.Point(5, 38); - this.label1.Name = "label1"; - this.label1.Text = "First line:"; - // - // NTSC_LastLineNumeric - // - this.NTSC_LastLineNumeric.Location = new System.Drawing.Point(59, 62); - this.NTSC_LastLineNumeric.Maximum = new decimal(new int[] { - 239, - 0, - 0, - 0}); - this.NTSC_LastLineNumeric.Name = "NTSC_LastLineNumeric"; - this.NTSC_LastLineNumeric.Size = new System.Drawing.Size(47, 20); - this.NTSC_LastLineNumeric.TabIndex = 28; - this.NTSC_LastLineNumeric.Value = new decimal(new int[] { - 239, - 0, - 0, - 0}); - this.NTSC_LastLineNumeric.ValueChanged += new System.EventHandler(this.DrawingArea_ValueChanged); - // - // NTSC_FirstLineNumeric - // - this.NTSC_FirstLineNumeric.Location = new System.Drawing.Point(59, 36); - this.NTSC_FirstLineNumeric.Maximum = new decimal(new int[] { - 239, - 0, - 0, - 0}); - this.NTSC_FirstLineNumeric.Name = "NTSC_FirstLineNumeric"; - this.NTSC_FirstLineNumeric.Size = new System.Drawing.Size(47, 20); - this.NTSC_FirstLineNumeric.TabIndex = 21; - this.NTSC_FirstLineNumeric.ValueChanged += new System.EventHandler(this.DrawingArea_ValueChanged); - // - // rbWeave - // - this.rbWeave.AutoSize = true; - this.rbWeave.Location = new System.Drawing.Point(6, 19); - this.rbWeave.Name = "rbWeave"; - this.rbWeave.Size = new System.Drawing.Size(60, 17); - this.rbWeave.TabIndex = 48; - this.rbWeave.TabStop = true; - this.rbWeave.Text = "Weave"; - this.toolTip1.SetToolTip(this.rbWeave, "Good for low-motion video"); - this.rbWeave.UseVisualStyleBackColor = true; - // - // rbBobOffset - // - this.rbBobOffset.AutoSize = true; - this.rbBobOffset.Location = new System.Drawing.Point(122, 19); - this.rbBobOffset.Name = "rbBobOffset"; - this.rbBobOffset.Size = new System.Drawing.Size(75, 17); - this.rbBobOffset.TabIndex = 47; - this.rbBobOffset.TabStop = true; - this.rbBobOffset.Text = "Bob Offset"; - this.toolTip1.SetToolTip(this.rbBobOffset, "Good for high-motion video, but is a bit flickery; reduces the subjective vertica" + - "l resolution."); - this.rbBobOffset.UseVisualStyleBackColor = true; - // - // rbBob - // - this.rbBob.AutoSize = true; - this.rbBob.Location = new System.Drawing.Point(72, 19); - this.rbBob.Name = "rbBob"; - this.rbBob.Size = new System.Drawing.Size(44, 17); - this.rbBob.TabIndex = 46; - this.rbBob.TabStop = true; - this.rbBob.Text = "Bob"; - this.toolTip1.SetToolTip(this.rbBob, "Good for causing a headache. All glory to Bob."); - this.rbBob.UseVisualStyleBackColor = true; - // - // groupBox4 - // - this.groupBox4.Controls.Add(this.rbWeave); - this.groupBox4.Controls.Add(this.rbBobOffset); - this.groupBox4.Controls.Add(this.rbBob); - this.groupBox4.Location = new System.Drawing.Point(492, 251); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(212, 49); - this.groupBox4.TabIndex = 50; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "Deinterlacing"; - // - // groupBox5 - // - this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox5.Controls.Add(this.cbLEC); - this.groupBox5.Location = new System.Drawing.Point(12, 306); - this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(238, 85); - this.groupBox5.TabIndex = 47; - this.groupBox5.TabStop = false; - this.groupBox5.Text = "Emulation Sync Settings"; - // - // cbLEC - // - this.cbLEC.AutoSize = true; - this.cbLEC.Location = new System.Drawing.Point(9, 19); - this.cbLEC.Name = "cbLEC"; - this.cbLEC.Size = new System.Drawing.Size(222, 30); - this.cbLEC.TabIndex = 0; - this.cbLEC.Text = "Emulate Sector Error Correction\r\n(usually unneeded; breaks some patches)"; - this.cbLEC.UseVisualStyleBackColor = true; - // - // cbGpuLag - // - this.cbGpuLag.AutoSize = true; - this.cbGpuLag.Location = new System.Drawing.Point(16, 19); - this.cbGpuLag.Name = "cbGpuLag"; - this.cbGpuLag.Size = new System.Drawing.Size(181, 17); - this.cbGpuLag.TabIndex = 1; - this.cbGpuLag.Text = "Determine Lag from GPU Frames"; - this.cbGpuLag.UseVisualStyleBackColor = true; - // - // groupBox6 - // - this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox6.Controls.Add(this.cbGpuLag); - this.groupBox6.Location = new System.Drawing.Point(264, 308); - this.groupBox6.Name = "groupBox6"; - this.groupBox6.Size = new System.Drawing.Size(238, 85); - this.groupBox6.TabIndex = 48; - this.groupBox6.TabStop = false; - this.groupBox6.Text = "Emulation User Settings"; - // - // PSXOptions - // - this.AcceptButton = this.btnOk; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(713, 405); - this.Controls.Add(this.groupBox6); - this.Controls.Add(this.groupBox5); - this.Controls.Add(this.groupBox4); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOk); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PSXOptions"; - this.Text = "PSX Options"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).EndInit(); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); - this.groupBox5.ResumeLayout(false); - this.groupBox5.PerformLayout(); - this.groupBox6.ResumeLayout(false); - this.groupBox6.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.Button btnOk; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton rbPixelPro; - private System.Windows.Forms.Button btnNiceDisplayConfig; - private BizHawk.WinForms.Controls.LocLabelEx lblMednafen; - private System.Windows.Forms.RadioButton rbMednafenMode; - private BizHawk.WinForms.Controls.LocLabelEx lblPixelPro; - private BizHawk.WinForms.Controls.LocLabelEx label3; - private System.Windows.Forms.RadioButton rbDebugMode; - private BizHawk.WinForms.Controls.LocLabelEx lblTweakedMednafen; - private System.Windows.Forms.RadioButton rbTweakedMednafenMode; - private System.Windows.Forms.GroupBox groupBox2; - private BizHawk.WinForms.Controls.LocLabelEx lblPAL; - private System.Windows.Forms.NumericUpDown PAL_LastLineNumeric; - private System.Windows.Forms.NumericUpDown PAL_FirstLineNumeric; - private BizHawk.WinForms.Controls.LocLabelEx lblNTSC; - private System.Windows.Forms.Button btnAreaFull; - private BizHawk.WinForms.Controls.LocLabelEx label4; - private BizHawk.WinForms.Controls.LocLabelEx label1; - private System.Windows.Forms.NumericUpDown NTSC_LastLineNumeric; - private System.Windows.Forms.NumericUpDown NTSC_FirstLineNumeric; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.RadioButton rbClipNone; - private System.Windows.Forms.RadioButton rbClipToFramebuffer; - private System.Windows.Forms.RadioButton rbClipBasic; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.RadioButton rbWeave; - private System.Windows.Forms.RadioButton rbBobOffset; - private System.Windows.Forms.RadioButton rbBob; - private System.Windows.Forms.GroupBox groupBox5; - private System.Windows.Forms.CheckBox cbLEC; - private System.Windows.Forms.CheckBox cbGpuLag; - private System.Windows.Forms.GroupBox groupBox6; - } -} \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs deleted file mode 100644 index aa2b85f7492..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; - -using BizHawk.Emulation.Cores.Sony.PSX; -using BizHawk.Client.Common; -using BizHawk.Emulation.Common; - -namespace BizHawk.Client.EmuHawk -{ - public partial class PSXOptions : Form, IDialogParent - { - // backups of the labels for string replacing - private readonly string _lblPixelProText, _lblMednafenText, _lblTweakedMednafenText; - - private readonly ISettingsAdapter _settable; - - public IDialogController DialogController { get; } - - private PSXOptions( - Config config, - IDialogController dialogController, - ISettingsAdapter settable, - Octoshock.Settings settings, - Octoshock.SyncSettings syncSettings, - OctoshockDll.eVidStandard vidStandard, - Size currentVideoSize) - { - InitializeComponent(); - _config = config; - _settable = settable; - _settings = settings; - _syncSettings = syncSettings; - _previewVideoStandard = vidStandard; - _previewVideoSize = currentVideoSize; - DialogController = dialogController; - - if (_previewVideoStandard == OctoshockDll.eVidStandard.NTSC) - { - lblNTSC.Font = new Font(lblNTSC.Font, FontStyle.Bold); - } - else - { - lblPAL.Font = new Font(lblPAL.Font, FontStyle.Bold); - } - - _lblPixelProText = lblPixelPro.Text; - _lblMednafenText = lblMednafen.Text; - _lblTweakedMednafenText = lblTweakedMednafen.Text; - - rbPixelPro.Checked = _settings.ResolutionMode == Octoshock.eResolutionMode.PixelPro; - rbDebugMode.Checked = _settings.ResolutionMode == Octoshock.eResolutionMode.Debug; - rbMednafenMode.Checked = _settings.ResolutionMode == Octoshock.eResolutionMode.Mednafen; - rbTweakedMednafenMode.Checked = _settings.ResolutionMode == Octoshock.eResolutionMode.TweakedMednafen; - rbClipNone.Checked = _settings.HorizontalClipping == Octoshock.eHorizontalClipping.None; - rbClipBasic.Checked = _settings.HorizontalClipping == Octoshock.eHorizontalClipping.Basic; - rbClipToFramebuffer.Checked = _settings.HorizontalClipping == Octoshock.eHorizontalClipping.Framebuffer; - - cbLEC.Checked = _syncSettings.EnableLEC; - cbGpuLag.Checked = _settings.GPULag; - - rbWeave.Checked = _settings.DeinterlaceMode == Octoshock.eDeinterlaceMode.Weave; - rbBob.Checked = _settings.DeinterlaceMode == Octoshock.eDeinterlaceMode.Bob; - rbBobOffset.Checked = _settings.DeinterlaceMode == Octoshock.eDeinterlaceMode.BobOffset; - - NTSC_FirstLineNumeric.Value = _settings.ScanlineStart_NTSC; - NTSC_LastLineNumeric.Value = _settings.ScanlineEnd_NTSC; - PAL_FirstLineNumeric.Value = _settings.ScanlineStart_PAL; - PAL_LastLineNumeric.Value = _settings.ScanlineEnd_PAL; - } - - private Size _previewVideoSize; - private readonly Config _config; - private readonly OctoshockDll.eVidStandard _previewVideoStandard; - private readonly Octoshock.Settings _settings; - private readonly Octoshock.SyncSettings _syncSettings; - private bool _dispSettingsSet; - - private void BtnNiceDisplayConfig_Click(object sender, EventArgs e) - { - _dispSettingsSet = true; - DialogController.ShowMessageBox("Finetuned Display Options will take effect if you OK from PSX Options"); - } - - public static DialogResult DoSettingsDialog( - Config config, - IDialogParent dialogParent, - ISettingsAdapter settable, - OctoshockDll.eVidStandard vidStandard, - Size vidSize) - { - using PSXOptions dlg = new( - config, - dialogParent.DialogController, - settable, - (Octoshock.Settings) settable.GetSettings(), - (Octoshock.SyncSettings) settable.GetSyncSettings(), - vidStandard, - vidSize); - return dialogParent.ShowDialogAsChild(dlg); - } - - private void SyncSettingsFromGui(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings) - { - if (rbPixelPro.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.PixelPro; - if (rbDebugMode.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.Debug; - if (rbMednafenMode.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.Mednafen; - if (rbTweakedMednafenMode.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.TweakedMednafen; - - if (rbClipNone.Checked) settings.HorizontalClipping = Octoshock.eHorizontalClipping.None; - if (rbClipBasic.Checked) settings.HorizontalClipping = Octoshock.eHorizontalClipping.Basic; - if (rbClipToFramebuffer.Checked) settings.HorizontalClipping = Octoshock.eHorizontalClipping.Framebuffer; - - if (rbWeave.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Weave; - if (rbBob.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Bob; - if (rbBobOffset.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.BobOffset; - - settings.ScanlineStart_NTSC = (int)NTSC_FirstLineNumeric.Value; - settings.ScanlineEnd_NTSC = (int)NTSC_LastLineNumeric.Value; - settings.ScanlineStart_PAL = (int)PAL_FirstLineNumeric.Value; - settings.ScanlineEnd_PAL = (int)PAL_LastLineNumeric.Value; - - settings.GPULag = cbGpuLag.Checked; - - syncSettings.EnableLEC = cbLEC.Checked; - } - - private void BtnOk_Click(object sender, EventArgs e) - { - if (_dispSettingsSet) - { - _config.DispManagerAR = EDispManagerAR.System; - _config.DispFixAspectRatio = true; - _config.DispFixScaleInteger = false; - _config.DispFinalFilter = 1; // bilinear, I hope - } - - SyncSettingsFromGui(_settings, _syncSettings); - _settings.Validate(); - _settable.PutCoreSettings(_settings); - _settable.PutCoreSyncSettings(_syncSettings); - - DialogResult = DialogResult.OK; - Close(); - } - - private void BtnAreaFull_Click(object sender, EventArgs e) - { - NTSC_FirstLineNumeric.Value = 0; - NTSC_LastLineNumeric.Value = 239; - PAL_FirstLineNumeric.Value = 0; - PAL_LastLineNumeric.Value = 287; - SyncLabels(); - } - - private void SyncLabels() - { - var temp = _settings.Clone(); - var syncTemp = _syncSettings.Clone(); - SyncSettingsFromGui(temp, syncTemp); - _settings.Validate(); - - // actually, I think this is irrelevant. But it's nice in case we want to do some kind of a more detailed simulation later - int w = _previewVideoSize.Width; - int h = _previewVideoSize.Height; - - temp.ResolutionMode = Octoshock.eResolutionMode.PixelPro; - var ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h); - lblPixelPro.Text = _lblPixelProText.Replace("800x480", $"{ri.Resolution.Width}x{ri.Resolution.Height}"); - - temp.ResolutionMode = Octoshock.eResolutionMode.Mednafen; - ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h); - lblMednafen.Text = _lblMednafenText.Replace("320x240", $"{ri.Resolution.Width}x{ri.Resolution.Height}"); - - temp.ResolutionMode = Octoshock.eResolutionMode.TweakedMednafen; - ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h); - lblTweakedMednafen.Text = _lblTweakedMednafenText.Replace("400x300", $"{ri.Resolution.Width}x{ri.Resolution.Height}"); - } - - private void DrawingArea_ValueChanged(object sender, EventArgs e) - { - SyncLabels(); - } - - private void RbClipHorizontal_CheckedChanged(object sender, EventArgs e) - { - SyncLabels(); - } - - private void RbClipToFramebuffer_CheckedChanged(object sender, EventArgs e) - { - SyncLabels(); - } - - private void RbClipNone_CheckedChanged(object sender, EventArgs e) - { - SyncLabels(); - } - - private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - DialogController.ShowMessageBox($@"These options control BizHawk's Display Options to make it act quite a lot like Mednafen: - -{nameof(_config.DispManagerAR)} = System (Use emulator-recommended AR) -{nameof(_config.DispFixAspectRatio)} = true (Maintain aspect ratio [letterbox main window as needed]) -{nameof(_config.DispFinalFilter)} = bilinear (Like Mednafen) -{nameof(_config.DispFixScaleInteger)} = false (Generally unwanted with bilinear filtering) - -This is a good place to write that Mednafen's default behaviour is fantastic for gaming! -But: 1. we think we improved on it a tiny bit with the tweaked mode -And: 2. It's not suitable for detailed scrutinizing of graphics -"); - } - } -} diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.resx b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.resx deleted file mode 100644 index a36570c8e29..00000000000 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.resx +++ /dev/null @@ -1,154 +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 - - - Displays all content at a multiple of 400x300. - • Correct aspect ratio - • Generally enjoyable game presentation - • Detail loss at 1x in fewer cases - • Recommended for gaming - • Requires certain display configuration: - - - - Displays all content at a multiple of 320x240 - • Correct aspect ratio - • Generally enjoyable game presentation - • At 1x window size, detail can be lost - • Recommended for comparisons - • Requires certain display configuration: - - - - Converts content with nearest neighbor to -fit gracefully in a 800x480 window. - • Content is pixel perfect - • Aspect ratio is usually wrong - • Recommended for study - • Game may seen to have scale varying by mode - - - 17, 17 - - - Mednafen adds quite a bit overscan to closely emulate minor quirks of the psx's display output. -Using this option may result in objectionable levels of black bars, but will fix some rare quirks in games. - - - \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs index 8943a733945..cca51a5d007 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs @@ -2,7 +2,6 @@ using System.Windows.Forms; using BizHawk.Client.Common; using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Sony.PSX; namespace BizHawk.Client.EmuHawk { @@ -27,88 +26,18 @@ public VirtualPadDiscManager( _discSelectName = buttonNames[2]; // these need to follow InitializeComponent call - UpdateCoreAssociation(); UpdateValues(); } private readonly string _discSelectName; private readonly object _ownerEmulator; - private void UpdateCoreAssociation() - { - if (_ownerEmulator is not Octoshock psx) - { - return; - } - - var buttons = new List { "- NONE -" }; - buttons.AddRange(psx.HackyDiscButtons); - - lvDiscs.Items.Clear(); - - int idx = 0; - foreach (var button in buttons) - { - var lvi = new ListViewItem { Text = idx.ToString() }; - lvi.SubItems.Add(button); - lvDiscs.Items.Add(lvi); - idx++; - } - } - - public void Clear() { } public void UpdateValues() { - if (_ownerEmulator is Octoshock psx) - { - bool eject = psx.CurrentTrayOpen; - bool enableDiscs = eject; - bool refreshDiscs = true; - - //special logic: if this is frame 0, we can begin in any state - if (psx.Frame == 0) - { - lblTimeZero.Visible = true; - btnOpen.Enabled = true; - btnClose.Enabled = true; - - // if neither button is picked, start with 'closed' selected - // (kind of a hack for the initial update) - if (!btnClose.Checked && !btnOpen.Checked) - { - btnClose.Checked = true; - } - else - { - // while we're here, make sure this only happens the first time - refreshDiscs = false; - } - - enableDiscs = btnOpen.Checked; - } - else - { - lblTimeZero.Visible = false; - btnOpen.Enabled = !eject; - btnClose.Enabled = eject; - - if (!btnOpen.Enabled) btnOpen.Checked = false; - if (!btnClose.Enabled) btnClose.Checked = false; - } - - //if we're not ejected, then the disc is frozen in the current configuration - lvDiscs.Enabled = enableDiscs; - if (!eject && refreshDiscs) - { - lvDiscs.SelectedIndices.Clear(); - lvDiscs.SelectedIndices.Add(psx.CurrentDiscIndexMounted); - } - } - // make sure we try to keep something selected here, for clarity. // but maybe later we'll just make it so that unselecting means no disc and don't display the disc 0 if (lvDiscs.SelectedIndices.Count == 0) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs deleted file mode 100644 index 8cb60cfb062..00000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDebuggable.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System.Collections.Generic; -using BizHawk.Emulation.Common; - -namespace BizHawk.Emulation.Cores.Sony.PSX -{ - public unsafe partial class Octoshock : IDebuggable - { - // TODO: don't cast to int, and are any of these not 32 bit? - public IDictionary GetCpuFlagsAndRegisters() - { - Dictionary ret = new Dictionary(); - var regs = new OctoshockDll.ShockRegisters_CPU(); - - OctoshockDll.shock_GetRegisters_CPU(psx, ref regs); - - //ret[ "r1"] = (int)regs.GPR[ 1]; ret[ "r2"] = (int)regs.GPR[ 2]; ret[ "r3"] = (int)regs.GPR[ 3]; - //ret[ "r4"] = (int)regs.GPR[ 4]; ret[ "r5"] = (int)regs.GPR[ 5]; ret[ "r6"] = (int)regs.GPR[ 6]; ret[ "r7"] = (int)regs.GPR[ 7]; - //ret[ "r8"] = (int)regs.GPR[ 8]; ret[ "r9"] = (int)regs.GPR[ 9]; ret["r10"] = (int)regs.GPR[10]; ret["r11"] = (int)regs.GPR[11]; - //ret["r12"] = (int)regs.GPR[12]; ret["r13"] = (int)regs.GPR[13]; ret["r14"] = (int)regs.GPR[14]; ret["r15"] = (int)regs.GPR[15]; - //ret["r16"] = (int)regs.GPR[16]; ret["r17"] = (int)regs.GPR[17]; ret["r18"] = (int)regs.GPR[18]; ret["r19"] = (int)regs.GPR[19]; - //ret["r20"] = (int)regs.GPR[20]; ret["r21"] = (int)regs.GPR[21]; ret["r22"] = (int)regs.GPR[22]; ret["r23"] = (int)regs.GPR[23]; - //ret["r24"] = (int)regs.GPR[24]; ret["r25"] = (int)regs.GPR[25]; ret["r26"] = (int)regs.GPR[26]; ret["r27"] = (int)regs.GPR[27]; - //ret["r28"] = (int)regs.GPR[28]; ret["r29"] = (int)regs.GPR[29]; ret["r30"] = (int)regs.GPR[30]; ret["r31"] = (int)regs.GPR[31]; - - ret[ "at"] = (int)regs.GPR[ 1]; - ret[ "v0"] = (int)regs.GPR[ 2]; ret[ "v1"] = (int)regs.GPR[ 3]; - ret[ "a0"] = (int)regs.GPR[ 4]; ret[ "a1"] = (int)regs.GPR[ 5]; ret[ "a2"] = (int)regs.GPR[ 6]; ret[ "a3"] = (int)regs.GPR[ 7]; - ret[ "t0"] = (int)regs.GPR[ 8]; ret[ "t1"] = (int)regs.GPR[ 9]; ret[ "t2"] = (int)regs.GPR[10]; ret[ "t3"] = (int)regs.GPR[11]; - ret[ "t4"] = (int)regs.GPR[12]; ret[ "t5"] = (int)regs.GPR[13]; ret[ "t6"] = (int)regs.GPR[14]; ret[ "t7"] = (int)regs.GPR[15]; - ret[ "s0"] = (int)regs.GPR[16]; ret[ "s1"] = (int)regs.GPR[17]; ret[ "s2"] = (int)regs.GPR[18]; ret[ "s3"] = (int)regs.GPR[19]; - ret[ "s4"] = (int)regs.GPR[20]; ret[ "s5"] = (int)regs.GPR[21]; ret[ "s6"] = (int)regs.GPR[22]; ret[ "s7"] = (int)regs.GPR[23]; - ret[ "t8"] = (int)regs.GPR[24]; ret[ "t9"] = (int)regs.GPR[25]; - ret[ "k0"] = (int)regs.GPR[26]; ret[ "k1"] = (int)regs.GPR[27]; - ret[ "gp"] = (int)regs.GPR[28]; - ret[ "sp"] = (int)regs.GPR[29]; - ret[ "fp"] = (int)regs.GPR[30]; - ret[ "ra"] = (int)regs.GPR[31]; - - ret[ "pc"] = (int)regs.PC; - ret[ "lo"] = (int)regs.LO; - ret[ "hi"] = (int)regs.HI; - ret[ "sr"] = (int)regs.SR; - ret["cause"] = (int)regs.CAUSE; - ret[ "epc"] = (int)regs.EPC; - - return ret; - } - - private static readonly Dictionary CpuRegisterIndices = new Dictionary() { - { "r1", 1 }, { "r2", 2 }, { "r3", 3 }, { "r4", 4 }, { "r5", 5 }, { "r6", 6 }, { "r7", 7 }, - { "r8", 8 }, { "r9", 9 }, { "r10", 10 }, { "r11", 11 }, { "r12", 12 }, { "r13", 13 }, { "r14", 14 }, { "r15", 15 }, - { "r16", 16 }, { "r17", 17 }, { "r18", 18 }, { "r19", 19 }, { "r20", 20 }, { "r21", 21 }, { "r22", 22 }, { "r23", 23 }, - { "r24", 24 }, { "r25", 25 }, { "r26", 26 }, { "r27", 27 }, { "r28", 28 }, { "r29", 29 }, { "r30", 30 }, { "r31", 31 }, - - { "at", 1 }, { "v0", 2 }, { "v1", 3 }, - { "a0", 4 }, { "a1", 5 }, { "a2", 6 }, { "a3", 7 }, - { "t0", 8 }, { "t1", 9 }, { "t2", 10 }, { "t3", 11 }, { "t4", 12 }, { "t5", 13 }, { "t6", 14 }, { "t7", 15 }, - { "s0", 16 }, { "s1", 17 }, { "s2", 18 }, { "s3", 19 }, { "s4", 20 }, { "s5", 21 }, { "s6", 22 }, { "s7", 23 }, - { "t8", 24 }, { "t9", 25 }, - { "k0", 26 }, { "k1", 27 }, - { "gp", 28 }, { "sp", 29 }, { "fp", 30 }, { "ra", 31 }, - - { "pc", 32 }, - //33 - PC_NEXT - //34 - IN_BD_SLOT - { "lo", 35 }, - { "hi", 36 }, - { "sr", 37 }, - {"cause", 38 }, - { "epc", 39 }, - }; - - public void SetCpuRegister(string register, int value) - { - int index = CpuRegisterIndices[register]; - OctoshockDll.shock_SetRegister_CPU(psx, index, (uint)value); - } - - private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem(new[] { "System Bus" }); // Note: there is no system bus memory domain, but there's also no hard rule that the memory callback system domains have to correspond to actual domains in MemoryDomains, that could be good, or bad, but something to be careful about - public IMemoryCallbackSystem MemoryCallbacks => _memoryCallbacks; - - public bool CanStep(StepType type) => false; - - [FeatureNotImplemented] - public void Step(StepType type) => throw new NotImplementedException(); - - [FeatureNotImplemented] - public long TotalExecutedCycles => throw new NotImplementedException(); - - private OctoshockDll.ShockCallback_Mem mem_cb; - - private void ShockMemCallback(uint address, OctoshockDll.eShockMemCb type, uint size, uint value) - { - MemoryCallbackFlags flags = 0; - switch (type) - { - case OctoshockDll.eShockMemCb.Read: - flags |= MemoryCallbackFlags.AccessRead; - break; - case OctoshockDll.eShockMemCb.Write: - flags |= MemoryCallbackFlags.AccessWrite; - break; - case OctoshockDll.eShockMemCb.Execute: - flags |= MemoryCallbackFlags.AccessExecute; - break; - } - - MemoryCallbacks.CallMemoryCallbacks(address, value, (uint)flags, "System Bus"); - } - - private void InitMemCallbacks() - { - mem_cb = new OctoshockDll.ShockCallback_Mem(ShockMemCallback); - _memoryCallbacks.ActiveChanged += RefreshMemCallbacks; - } - - private void RefreshMemCallbacks() - { - OctoshockDll.eShockMemCb mask = OctoshockDll.eShockMemCb.None; - if (MemoryCallbacks.HasReads) mask |= OctoshockDll.eShockMemCb.Read; - if (MemoryCallbacks.HasWrites) mask |= OctoshockDll.eShockMemCb.Write; - if (MemoryCallbacks.HasExecutes) mask |= OctoshockDll.eShockMemCb.Execute; - OctoshockDll.shock_SetMemCb(psx, mem_cb, mask); - } - - private void SetMemoryDomains() - { - var mmd = new List(); - - OctoshockDll.shock_GetMemData(psx, out var ptr, out var size, OctoshockDll.eMemType.MainRAM); - mmd.Add(new MemoryDomainIntPtr("MainRAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.GPURAM); - mmd.Add(new MemoryDomainIntPtr("GPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.SPURAM); - mmd.Add(new MemoryDomainIntPtr("SPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.BiosROM); - mmd.Add(new MemoryDomainIntPtr("BiosROM", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.PIOMem); - mmd.Add(new MemoryDomainIntPtr("PIOMem", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.DCache); - mmd.Add(new MemoryDomainIntPtr("DCache", MemoryDomain.Endian.Little, ptr, size, true, 4)); - - mmd.Add(new MemoryDomainDelegate("System Bus", 0x1_0000_0000, MemoryDomain.Endian.Little, - (a) => { OctoshockDll.shock_PeekMemory(psx, (uint)a, out byte v); return v; }, - (a, v) => { OctoshockDll.shock_PokeMemory(psx, (uint)a, v); }, - 4)); - - MemoryDomains = new MemoryDomainList(mmd); - (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); - } - - private IMemoryDomains MemoryDomains; - } -} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDisassemblable.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDisassemblable.cs deleted file mode 100644 index 3d697e6fbbd..00000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.IDisassemblable.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using BizHawk.Emulation.Common; - -namespace BizHawk.Emulation.Cores.Sony.PSX -{ - public partial class Octoshock : IDisassemblable - { - public string Cpu - { - get => "R3000A"; - set { } - } - - public IEnumerable AvailableCpus { get; } = [ "R3000A" ]; - - public string PCRegisterName => "pc"; - - public string Disassemble(MemoryDomain m, uint addr, out int length) - { - length = 4; - var buf = new StringBuilder(32); - var result = OctoshockDll.shock_Util_DisassembleMIPS(addr, m.PeekUint(addr, false), buf, buf.Capacity); - return result==0?buf.ToString():""; - } - } -} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.ITraceable.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.ITraceable.cs deleted file mode 100644 index 74d5af3ef48..00000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.ITraceable.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Text; - -using BizHawk.Emulation.Common; -using BizHawk.Common.NumberExtensions; - -namespace BizHawk.Emulation.Cores.Sony.PSX -{ - public partial class Octoshock - { - public TraceBuffer Tracer { get; private set; } - - public const string TraceHeader = "R3000A: PC, machine code, mnemonic, operands, registers (GPRs, lo, hi, sr, cause, epc)"; - - private OctoshockDll.ShockCallback_Trace trace_cb; - - public void ShockTraceCallback(IntPtr opaque, uint PC, uint inst, string dis) - { - var regs = GetCpuFlagsAndRegisters(); - StringBuilder sb = new StringBuilder(); - - foreach (var r in regs) - { - if (r.Key != "pc") - sb.Append($"{r.Key}:{r.Value.Value.ToHexString(r.Value.BitSize / 4)} "); - } - - Tracer.Put(new(disassembly: $"{PC:X8}: {inst:X8} {dis.PadRight(30)}", registerInfo: sb.ToString().Trim())); - } - - private void ConnectTracer() - { - trace_cb = new OctoshockDll.ShockCallback_Trace(ShockTraceCallback); - Tracer = new TraceBuffer(TraceHeader); - ServiceProvider = new BasicServiceProvider(this); - (ServiceProvider as BasicServiceProvider).Register(Tracer); - } - } -} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index 6a387fb15d0..275998ecd30 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -1,258 +1,15 @@ -//TODO hook up newer file ID stuff, think about how to combine it with the disc ID -//TODO change display manager to not require 0xFF alpha channel set on videoproviders. check gdi+ and opengl! this will get us a speedup in some places -//TODO Disc.Structure.Sessions[0].length_aba was 0 -//TODO mednafen 0.9.37 changed some disc region detection heuristics. analyze and apply in c# side. also the SCEX id handling changed, maybe simplified - -//TODO - ok, think about this. we MUST load a state with the CDC completely intact. no quickly changing discs. that's madness. -//well, I could savestate the disc index and validate the disc collection when loading a state. -//the big problem is, it's completely at odds with the slider-based disc changing model. -//but, maybe it can be reconciled with that model by using the disc ejection to our advantage. -//perhaps moving the slider is meaningless if the disc is ejected--it only affects what disc is inserted when the disc gets inserted!! yeah! this might could save us! -//not exactly user friendly but maybe we can build it from there with a custom UI.. a disk-changer? dunno if that would help - -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.IO; -using System.Collections.Generic; -using System.Linq; +using System.ComponentModel; using Newtonsoft.Json; using BizHawk.Emulation.Common; using BizHawk.Common; using BizHawk.Common.CollectionExtensions; -using BizHawk.Emulation.DiscSystem; - -#pragma warning disable 649 //adelikat: Disable dumb warnings until this file is complete namespace BizHawk.Emulation.Cores.Sony.PSX { - [PortedCore(CoreNames.Octoshock, "Mednafen Team")] - public unsafe partial class Octoshock : IEmulator, IInputPollable, IRegionable, ISaveRam, - ISettable, ISoundProvider, IStatable, IVideoProvider, - IDriveLight, IRedumpDiscChecksumInfo + public static class Octoshock { - public Octoshock(CoreComm comm, PSF psf, Octoshock.Settings settings, Octoshock.SyncSettings syncSettings) - { - string romDetails = "It's a PSF, what do you want. Oh, tags maybe?"; - Load(comm, null, null, null, settings, syncSettings, psf, romDetails); - OctoshockDll.shock_PowerOn(psx); - } - - //note: its annoying that we have to have a disc before constructing this. - //might want to change that later. HOWEVER - we need to definitely have a region, at least - [CoreConstructor(VSystemID.Raw.PSX)] - public Octoshock(CoreLoadParameters lp) - { - Load( - lp.Comm, - lp.Discs.Select(d => d.DiscData).ToList(), - lp.Discs.Select(d => d.DiscName).ToList(), - lp.Roms.FirstOrDefault()?.RomData, - lp.Settings, - lp.SyncSettings, - null, - DiscChecksumUtils.GenQuickRomDetails(lp.Discs)); - OctoshockDll.shock_PowerOn(psx); - } - - private void Load( - CoreComm comm, List discs, List discNames, byte[] exe, - Octoshock.Settings settings, Octoshock.SyncSettings syncSettings, PSF psf, string romDetails) - { - RomDetails = romDetails; - ConnectTracer(); - DriveLightEnabled = true; - - _Settings = settings ?? new Settings(); - _SyncSettings = syncSettings ?? new SyncSettings(); - - Discs = discs; - - Attach(); - - //assume this region for EXE and PSF, maybe not correct though - string firmwareRegion = "U"; - SystemRegion = OctoshockDll.eRegion.NA; - - if (discs != null) - { - HackyDiscButtons.AddRange(discNames); - - foreach (var disc in discs) - { - var discInterface = new DiscInterface(disc, - di => - { - //if current disc this delegate disc, activity is happening - if (di == currentDiscInterface) - DriveLightOn = true; - }); - - discInterfaces.Add(discInterface); - } - } - else - { - //assume its NA region for test programs, for now. could it be read out of the ps-exe header? - } - - if (discInterfaces.Count != 0) - { - //determine region of one of the discs - OctoshockDll.shock_AnalyzeDisc(discInterfaces[0].OctoshockHandle, out var discInfo); - - //try to acquire the appropriate firmware - if (discInfo.region == OctoshockDll.eRegion.EU) firmwareRegion = "E"; - if (discInfo.region == OctoshockDll.eRegion.JP) firmwareRegion = "J"; - SystemRegion = discInfo.region; - } - - bool use_nocash_specs = false; - - if (use_nocash_specs) - { - //see http://problemkaputt.de/psx-spx.htm - int CpuClock_n = 44100 * 768; - int CpuClock_d = 1; - int VidClock_n = CpuClock_n * 11; - int VidClock_d = CpuClock_d * 7; - if (SystemRegion == OctoshockDll.eRegion.EU) - { - VsyncNumerator = VidClock_n; - VsyncDenominator = VidClock_d * 314 * 3406; - SystemVidStandard = OctoshockDll.eVidStandard.PAL; - } - else - { - VsyncNumerator = VidClock_n; - VsyncDenominator = VidClock_d * 263 * 3413; - SystemVidStandard = OctoshockDll.eVidStandard.NTSC; - } - } - else - { - //use mednafen specs - if (SystemRegion == OctoshockDll.eRegion.EU) - { - //https://github.com/TASEmulators/mednafen/blob/740d63996fc7cebffd39ee253a29ee434965db21/src/psx/gpu.cpp#L175 - // -> 838865530 / 65536 / 256 -> reduced - VsyncNumerator = 419432765; - VsyncDenominator = 8388608; - SystemVidStandard = OctoshockDll.eVidStandard.PAL; - } - else - { - //https://github.com/TASEmulators/mednafen/blob/740d63996fc7cebffd39ee253a29ee434965db21/src/psx/gpu.cpp#L183 - //-> 1005627336 / 65536 / 256 -> reduced - VsyncNumerator = 502813668; - VsyncDenominator = 8388608; - SystemVidStandard = OctoshockDll.eVidStandard.NTSC; - } - } - - //TODO - known bad firmware is a no-go. we should refuse to boot them. (that's the mednafen policy) - var firmware = comm.CoreFileProvider.GetFirmwareOrThrow(new("PSX", firmwareRegion), $"A PSX `{firmwareRegion}` region bios file is required"); - - //create the instance - fixed (byte* pFirmware = firmware) - OctoshockDll.shock_Create(out psx, SystemRegion, pFirmware); - - SetMemoryDomains(); - InitMemCallbacks(); - - //set a default framebuffer based on the first frame of emulation, to cut down on flickering or whatever - //this is probably quixotic, but we have to pick something - { - BufferWidth = 280; - BufferHeight = 240; - if (SystemVidStandard == OctoshockDll.eVidStandard.PAL) - { - BufferWidth = 280; - BufferHeight = 288; - } - CurrentVideoSize = new System.Drawing.Size(BufferWidth, BufferHeight); - var ri = CalculateResolution(SystemVidStandard, _Settings, BufferWidth, BufferHeight); - BufferWidth = VirtualWidth = ri.Resolution.Width; - BufferHeight = VirtualHeight = ri.Resolution.Height; - //VideoProvider_Padding = new System.Drawing.Size(50,50); - frameBuffer = new int[BufferWidth * BufferHeight]; - } - - if (discInterfaces.Count != 0) - { - //start with first disc inserted and tray closed. it's a sensible default. - //it will be possible for the user to specify a different initial configuration, but this will inform the UI - CurrentTrayOpen = false; - CurrentDiscIndexMounted = 1; - } - else if (psf == null) - { - //must be an exe - fixed (byte* pExeBuffer = exe) - OctoshockDll.shock_MountEXE(psx, pExeBuffer, exe.Length, false); - - //start with no disc inserted and tray closed - CurrentTrayOpen = false; - CurrentDiscIndexMounted = 0; - OctoshockDll.shock_CloseTray(psx); - } - else - { - //must be a psf - if (psf.LibData != null) - fixed (byte* pBuf = psf.LibData) - OctoshockDll.shock_MountEXE(psx, pBuf, psf.LibData.Length, true); - fixed (byte* pBuf = psf.Data) - OctoshockDll.shock_MountEXE(psx, pBuf, psf.Data.Length, false); - - //start with no disc inserted and tray closed - CurrentTrayOpen = false; - CurrentDiscIndexMounted = 0; - OctoshockDll.shock_CloseTray(psx); - } - - //setup the controller based on sync settings - SetControllerButtons(); - - var fioCfg = _SyncSettings.FIOConfig; - if (fioCfg.Multitaps[0]) - { - OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.Multitap); - OctoshockDll.shock_Peripheral_Connect(psx, 0x11, fioCfg.Devices8[0]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x21, fioCfg.Devices8[1]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x31, fioCfg.Devices8[2]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x41, fioCfg.Devices8[3]); - } - else - OctoshockDll.shock_Peripheral_Connect(psx, 0x01, fioCfg.Devices8[0]); - - if (fioCfg.Multitaps[1]) - { - OctoshockDll.shock_Peripheral_Connect(psx, 0x02, OctoshockDll.ePeripheralType.Multitap); - OctoshockDll.shock_Peripheral_Connect(psx, 0x12, fioCfg.Devices8[4]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x22, fioCfg.Devices8[5]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x32, fioCfg.Devices8[6]); - OctoshockDll.shock_Peripheral_Connect(psx, 0x42, fioCfg.Devices8[7]); - } - else - OctoshockDll.shock_Peripheral_Connect(psx, 0x02, fioCfg.Devices8[4]); - - var memcardTransaction = new OctoshockDll.ShockMemcardTransaction() - { - transaction = OctoshockDll.eShockMemcardTransaction.Connect - }; - if (fioCfg.Memcards[0]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x01, ref memcardTransaction); - if (fioCfg.Memcards[1]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x02, ref memcardTransaction); - - //do this after framebuffers and peripherals and whatever crap are setup. kind of lame, but that's how it is for now - StudySaveBufferSize(); - } - - public string RomDetails { get; private set; } - - public string SystemId => VSystemID.Raw.PSX; - public static ControllerDefinition CreateControllerDefinition(SyncSettings syncSettings) { ControllerDefinition definition = new("PSX Front Panel"); @@ -327,736 +84,6 @@ public static ControllerDefinition CreateControllerDefinition(SyncSettings syncS return definition.MakeImmutable(); } - private void SetControllerButtons() - { - ControllerDefinition = CreateControllerDefinition(_SyncSettings); - } - - private int[] frameBuffer = new int[0]; - private Random rand = new Random(); - - //we can only have one active core at a time, due to the lib being so static. - //so we'll track the current one here and detach the previous one whenever a new one is booted up. - private static Octoshock CurrOctoshockCore; - - private IntPtr psx; - - private bool disposed = false; - public void Dispose() - { - if (disposed) return; - - disposed = true; - - _memoryCallbacks.ActiveChanged -= RefreshMemCallbacks; - - //discs arent bound to shock core instances, but they may be mounted. kill the core instance first to effectively dereference the disc - OctoshockDll.shock_Destroy(psx); - psx = IntPtr.Zero; - - //destroy all discs we're managing (and the unmanaged octoshock resources) - foreach (var di in discInterfaces) - { - di.Disc.Dispose(); - di.Dispose(); - } - discInterfaces.Clear(); - } - - /// - /// Wraps the ShockDiscRef returned from the DLL and acts as a bridge between it and a DiscSystem disc - /// - private class DiscInterface : IDisposable - { - public DiscInterface(Disc disc, Action cbActivity) - { - this.Disc = disc; - cbReadTOC = ShockDisc_ReadTOC; - cbReadLBA = ShockDisc_ReadLBA2448; - this.cbActivity = cbActivity; - OctoshockDll.shock_CreateDisc(out OctoshockHandle, IntPtr.Zero, disc.Session1.LeadoutLBA, cbReadTOC, cbReadLBA, true); - } - - private OctoshockDll.ShockDisc_ReadTOC cbReadTOC; - private OctoshockDll.ShockDisc_ReadLBA cbReadLBA; - private readonly Action cbActivity; - - public readonly Disc Disc; - public IntPtr OctoshockHandle; - - public void Dispose() - { - OctoshockDll.shock_DestroyDisc(OctoshockHandle); - OctoshockHandle = IntPtr.Zero; - } - - private int ShockDisc_ReadTOC(IntPtr opaque, OctoshockDll.ShockTOC* read_target, OctoshockDll.ShockTOCTrack* tracks101) - { - read_target->disc_type = (byte)Disc.TOC.SessionFormat; - read_target->first_track = (byte)Disc.TOC.FirstRecordedTrackNumber; //i _think_ that's what is meant here - read_target->last_track = (byte)Disc.TOC.LastRecordedTrackNumber; //i _think_ that's what is meant here - - tracks101[0].lba = tracks101[0].adr = tracks101[0].control = 0; - - for (int i = 1; i < 100; i++) - { - var item = Disc.TOC.TOCItems[i]; - tracks101[i].adr = (byte)(item.Exists ? 1 : 0); - tracks101[i].lba = (uint)item.LBA; - tracks101[i].control = (byte)item.Control; - } - - ////the lead-out track is to be synthesized - tracks101[read_target->last_track + 1].adr = 1; - tracks101[read_target->last_track + 1].control = 0; - tracks101[read_target->last_track + 1].lba = (uint)Disc.TOC.LeadoutLBA; - - //element 100 is to be copied as the lead-out track - tracks101[100] = tracks101[read_target->last_track + 1]; - - return OctoshockDll.SHOCK_OK; - } - - private readonly byte[] SectorBuffer = new byte[2448]; - - private int ShockDisc_ReadLBA2448(IntPtr opaque, int lba, void* dst) - { - cbActivity(this); - - //todo - cache reader - var dsr = new DiscSectorReader(Disc); - int readed = dsr.ReadLBA_2448(lba, SectorBuffer, 0); - if (readed == 2448) - { - Marshal.Copy(SectorBuffer, 0, new IntPtr(dst), 2448); - return OctoshockDll.SHOCK_OK; - } - - return OctoshockDll.SHOCK_ERROR; - } - } - - public List Discs; - private readonly List discInterfaces = new List(); - private DiscInterface currentDiscInterface; - - public DisplayType Region => SystemVidStandard == OctoshockDll.eVidStandard.PAL ? DisplayType.PAL : DisplayType.NTSC; - - public OctoshockDll.eRegion SystemRegion { get; private set; } - public OctoshockDll.eVidStandard SystemVidStandard { get; private set; } - public System.Drawing.Size CurrentVideoSize { get; private set; } - - public bool CurrentTrayOpen { get; private set; } - public int CurrentDiscIndexMounted { get; private set; } - - public readonly IList HackyDiscButtons = new List(); - - public IEmulatorServiceProvider ServiceProvider { get; private set; } - - public bool DriveLightEnabled { get; private set; } - public bool DriveLightOn { get; private set; } - public string DriveLightIconDescription => "CD Drive Activity"; - - private void Attach() - { - //attach this core as the current - CurrOctoshockCore?.Dispose(); - CurrOctoshockCore = this; - - //the psx instance cant be created until the desired region is known, which needs a disc, so we need the dll static attached first - } - - static Octoshock() - { - } - - public string CalculateDiscHashes() - => DiscChecksumUtils.CalculateDiscHashesImpl(Discs); - - public void ResetCounters() - { - Frame = 0; - LagCount = 0; - IsLagFrame = false; - } - - private void SetInput() - { - var fioCfg = _SyncSettings.FIOConfig.ToLogical(); - - for (int port = 0; port < 2; port++) - { - for (int multiport = 0; multiport < 4; multiport++) - { - //note: I would not say this port addressing scheme has been completely successful - //however, it may be because i was constantly constrained by having to adapt it to mednafen.. i don't know. - - int portNum = (port + 1) + ((multiport + 1) << 4); - int slot = port * 4 + multiport; - - //no input to set - if (fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.None) - continue; - - //address differently if it isn't multitap - if (!fioCfg.Multitaps[port]) - portNum = port + 1; - - uint buttons = 0; - string pstring = "P" + fioCfg.PlayerAssignments[slot] + " "; - - if (fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.NegCon) - { - //1,2,4 skipped (would be Select, L3, R3 on other pads) - if (_controller.IsPressed(pstring + "Start")) buttons |= 8; - if (_controller.IsPressed(pstring + "Up")) buttons |= 16; - if (_controller.IsPressed(pstring + "Right")) buttons |= 32; - if (_controller.IsPressed(pstring + "Down")) buttons |= 64; - if (_controller.IsPressed(pstring + "Left")) buttons |= 128; - //256,512,1024 skipped (would be L2, R2, L1 on other pads) - if (_controller.IsPressed(pstring + "R")) buttons |= 2048; - if (_controller.IsPressed(pstring + "B")) buttons |= 4096; - if (_controller.IsPressed(pstring + "A")) buttons |= 8192; - - byte twist = (byte)_controller.AxisValue(pstring + "Twist"); - byte analog1 = (byte)_controller.AxisValue(pstring + "1"); - byte analog2 = (byte)_controller.AxisValue(pstring + "2"); - byte analogL = (byte)_controller.AxisValue(pstring + "L"); - - OctoshockDll.shock_Peripheral_SetPadInput(psx, portNum, buttons, twist, analog1, analog2, analogL); - } - else - { - if (_controller.IsPressed(pstring + "Select")) buttons |= 1; - if (_controller.IsPressed(pstring + "Start")) buttons |= 8; - if (_controller.IsPressed(pstring + "Up")) buttons |= 16; - if (_controller.IsPressed(pstring + "Right")) buttons |= 32; - if (_controller.IsPressed(pstring + "Down")) buttons |= 64; - if (_controller.IsPressed(pstring + "Left")) buttons |= 128; - if (_controller.IsPressed(pstring + "L2")) buttons |= 256; - if (_controller.IsPressed(pstring + "R2")) buttons |= 512; - if (_controller.IsPressed(pstring + "L1")) buttons |= 1024; - if (_controller.IsPressed(pstring + "R1")) buttons |= 2048; - if (_controller.IsPressed(pstring + "Triangle")) buttons |= 4096; - if (_controller.IsPressed(pstring + "Circle")) buttons |= 8192; - if (_controller.IsPressed(pstring + "Cross")) buttons |= 16384; - if (_controller.IsPressed(pstring + "Square")) buttons |= 32768; - - byte left_x = 0, left_y = 0, right_x = 0, right_y = 0; - if (fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualShock || fioCfg.Devices8[slot] == OctoshockDll.ePeripheralType.DualAnalog) - { - if (_controller.IsPressed(pstring + "L3")) buttons |= 2; - if (_controller.IsPressed(pstring + "R3")) buttons |= 4; - if (_controller.IsPressed(pstring + "MODE")) buttons |= 65536; - - left_x = (byte)_controller.AxisValue(pstring + "LStick X"); - left_y = (byte)_controller.AxisValue(pstring + "LStick Y"); - right_x = (byte)_controller.AxisValue(pstring + "RStick X"); - right_y = (byte)_controller.AxisValue(pstring + "RStick Y"); - } - - OctoshockDll.shock_Peripheral_SetPadInput(psx, portNum, buttons, left_x, left_y, right_x, right_y); - } - } - } - } - - public class ResolutionInfo - { - public System.Drawing.Size Resolution, Padding; - public System.Drawing.Size Total => System.Drawing.Size.Add(Resolution, Padding); - } - - /// - /// Calculates what the output resolution would be for the given input resolution and settings - /// - public static ResolutionInfo CalculateResolution(OctoshockDll.eVidStandard standard, Settings settings, int w, int h) - { - ResolutionInfo ret = new ResolutionInfo(); - - //some of this logic is duplicated in the c++ side, be sure to check there - //TODO - scanline control + framebuffer mode is majorly broken - - int virtual_width = 800; - if (settings.HorizontalClipping == eHorizontalClipping.Basic) virtual_width = 768; - if (settings.HorizontalClipping == eHorizontalClipping.Framebuffer) virtual_width = 736; - - int scanline_start = standard == OctoshockDll.eVidStandard.NTSC ? settings.ScanlineStart_NTSC : settings.ScanlineStart_PAL; - int scanline_end = standard == OctoshockDll.eVidStandard.NTSC ? settings.ScanlineEnd_NTSC : settings.ScanlineEnd_PAL; - int scanline_num = scanline_end - scanline_start + 1; - //int scanline_num = h; // I wanted to do this, but our logic for mednafen modes here is based on un-doubled resolution. i could do a hack to divide it by 2 though - int real_scanline_num = standard == OctoshockDll.eVidStandard.NTSC ? 240 : 288; - - int VirtualWidth=-1, VirtualHeight=-1; - switch (settings.ResolutionMode) - { - case eResolutionMode.Mednafen: - - //mednafen uses 320xScanlines as the 1x size - //it does change the 1x width when doing basic clipping. - //and it does easily change the height when doing scanline removal. - //now, our framebuffer cropping mode is more complex... - VirtualWidth = (standard == OctoshockDll.eVidStandard.NTSC) ? 320 : 363; - VirtualHeight = scanline_num; - - if (settings.HorizontalClipping == eHorizontalClipping.Basic) - VirtualWidth = (standard == OctoshockDll.eVidStandard.NTSC) ? 302 : 384; - - if (settings.HorizontalClipping == eHorizontalClipping.Framebuffer) - { - //mednafen typically sends us a framebuffer with overscan. 350x240 is a nominal example here. it's squished inward to 320x240 for correct PAR. - //ok: here we have a framebuffer without overscan. 320x240 nominal. So the VirtualWidth of what we got is off by a factor of 109.375% - //so a beginning approach would be this: - //VirtualWidth = (int)(VirtualWidth * 320.0f / 350); - //but that will shrink things which are already annoyingly shrunken. - //therefore, lets do that, but then scale the whole window by the same factor so the width becomes unscaled and now the height is scaled up! - //weird, huh? - VirtualHeight = (int)(VirtualHeight * 350.0f / 320); - - //now unfortunately we may have lost vertical pixels. common in the case of PAL (rendering 256 on a field of 288) - //therefore we'll be stretching way too much vertically here. - //lets add those pixels back with a new hack - if (standard == OctoshockDll.eVidStandard.PAL) - { - if (h > 288) ret.Padding = new System.Drawing.Size(0, 576 - h); - else ret.Padding = new System.Drawing.Size(0, 288 - h); - } - else - { - if (h > 288) ret.Padding = new System.Drawing.Size(0, 480 - h); - else ret.Padding = new System.Drawing.Size(0, 240 - h); - } - } - break; - - //384 / 288 = 1.3333333333333333333333333333333 - - case eResolutionMode.TweakedMednafen: - - if (standard == OctoshockDll.eVidStandard.NTSC) - { - //don't make this 430, it's already been turned into 400 from 368+30 and then some fudge factor - VirtualWidth = 400; - VirtualHeight = (int)(scanline_num * 300.0f / 240); - if (settings.HorizontalClipping == eHorizontalClipping.Basic) - VirtualWidth = 378; - } - else - { - //this is a bit tricky. we know we want 400 for the virtualwidth. - VirtualWidth = 400; - if (settings.HorizontalClipping == eHorizontalClipping.Basic) - VirtualWidth = 378; - //I'll be honest, I was just guessing here mostly - //I need the AR to basically work out to be 363/288 (that's what it was in mednafen mode) so... - VirtualHeight = (int)(scanline_num * (400.0f/363*288) / 288); - } - - if (settings.HorizontalClipping == eHorizontalClipping.Framebuffer) - { - //see discussion above - VirtualHeight = (int)(VirtualHeight * 350.0f / 320); - - if (standard == OctoshockDll.eVidStandard.PAL) - { - if (h > 288) ret.Padding = new System.Drawing.Size(0, 576 - h); - else ret.Padding = new System.Drawing.Size(0, 288 - h); - } - else - { - if (h > 288) ret.Padding = new System.Drawing.Size(0, 480 - h); - else ret.Padding = new System.Drawing.Size(0, 240 - h); - } - } - break; - - case eResolutionMode.PixelPro: - VirtualWidth = virtual_width; - VirtualHeight = scanline_num * 2; - break; - - case eResolutionMode.Debug: - VirtualWidth = w; - VirtualHeight = h; - break; - } - - ret.Resolution = new System.Drawing.Size(VirtualWidth, VirtualHeight); - return ret; - } - - private void PokeDisc() - { - if (CurrentDiscIndexMounted == 0) - { - currentDiscInterface = null; - OctoshockDll.shock_PokeDisc(psx, IntPtr.Zero); - } - else - { - currentDiscInterface = discInterfaces[CurrentDiscIndexMounted - 1]; - OctoshockDll.shock_PokeDisc(psx, currentDiscInterface.OctoshockHandle); - } - } - - private void FrameAdvance_PrepDiscState() - { - //reminder: if this is the beginning of time, we can begin with the disc ejected or inserted. - - //if tray open is requested, and valid, apply it - //in the first frame, go ahead and open it up so we have a chance to put a disc in it - if (_controller.IsPressed("Open") && !CurrentTrayOpen || Frame == 0) - { - OctoshockDll.shock_OpenTray(psx); - CurrentTrayOpen = true; - } - - //change the disc if needed, and valid - //also if frame is 0, we need to set a disc no matter what - int requestedDisc = _controller.AxisValue("Disc Select"); - if (requestedDisc != CurrentDiscIndexMounted && CurrentTrayOpen - || Frame == 0 - ) - { - //don't replace default disc with the leave-default placeholder! - if (requestedDisc == -1) - { - - } - else - { - CurrentDiscIndexMounted = requestedDisc; - } - - if (CurrentDiscIndexMounted == 0 || discInterfaces.Count == 0) - { - currentDiscInterface = null; - OctoshockDll.shock_SetDisc(psx, IntPtr.Zero); - } - else - { - currentDiscInterface = discInterfaces[CurrentDiscIndexMounted - 1]; - OctoshockDll.shock_SetDisc(psx, currentDiscInterface.OctoshockHandle); - } - } - - //if tray close is requested, and valid, apply it. - if (_controller.IsPressed("Close") && CurrentTrayOpen) - { - OctoshockDll.shock_CloseTray(psx); - CurrentTrayOpen = false; - } - - //if frame is 0 and user has made no preference, close the tray - if (!_controller.IsPressed("Close") && !_controller.IsPressed("Open") && Frame == 0 && CurrentTrayOpen) - { - OctoshockDll.shock_CloseTray(psx); - CurrentTrayOpen = false; - } - } - - private IController _controller; - - public bool FrameAdvance(IController controller, bool render, bool rendersound) - { - _controller = controller; - FrameAdvance_PrepDiscState(); - - //clear drive light. itll get set to light up by sector-reading callbacks - //TODO - debounce this by a frame or so perhaps? - //TODO - actually, make this feedback from the core. there should be a register or status which effectively corresponds to whether it's reading. - DriveLightOn = false; - - SetInput(); - - OctoshockDll.shock_SetLEC(psx, _SyncSettings.EnableLEC); - - var ropts = new OctoshockDll.ShockRenderOptions() - { - scanline_start = SystemVidStandard == OctoshockDll.eVidStandard.NTSC ? _Settings.ScanlineStart_NTSC : _Settings.ScanlineStart_PAL, - scanline_end = SystemVidStandard == OctoshockDll.eVidStandard.NTSC ? _Settings.ScanlineEnd_NTSC : _Settings.ScanlineEnd_PAL, - }; - if (_Settings.HorizontalClipping == eHorizontalClipping.Basic) - ropts.renderType = OctoshockDll.eShockRenderType.ClipOverscan; - if (_Settings.HorizontalClipping == eHorizontalClipping.Framebuffer) - ropts.renderType = OctoshockDll.eShockRenderType.Framebuffer; - - if (_Settings.DeinterlaceMode == eDeinterlaceMode.Weave) ropts.deinterlaceMode = OctoshockDll.eShockDeinterlaceMode.Weave; - if (_Settings.DeinterlaceMode == eDeinterlaceMode.Bob) ropts.deinterlaceMode = OctoshockDll.eShockDeinterlaceMode.Bob; - if (_Settings.DeinterlaceMode == eDeinterlaceMode.BobOffset) ropts.deinterlaceMode = OctoshockDll.eShockDeinterlaceMode.BobOffset; - - OctoshockDll.shock_SetRenderOptions(psx, ref ropts); - - //prep tracer - if (Tracer.IsEnabled()) - OctoshockDll.shock_SetTraceCallback(psx, IntPtr.Zero, trace_cb); - else - OctoshockDll.shock_SetTraceCallback(psx, IntPtr.Zero, null); - - //apply soft reset if needed - if (_controller.IsPressed("Reset")) - OctoshockDll.shock_SoftReset(psx); - - //------------------------ - OctoshockDll.shock_Step(psx, OctoshockDll.eShockStep.Frame); - //------------------------ - - //lag maintenance: - int pad1 = OctoshockDll.shock_Peripheral_PollActive(psx, 0x01, true); - int pad2 = OctoshockDll.shock_Peripheral_PollActive(psx, 0x02, true); - IsLagFrame = true; - if (pad1 == OctoshockDll.SHOCK_TRUE) IsLagFrame = false; - if (pad2 == OctoshockDll.SHOCK_TRUE) IsLagFrame = false; - if (_Settings.GPULag) - IsLagFrame = OctoshockDll.shock_GetGPUUnlagged(psx) != OctoshockDll.SHOCK_TRUE; - if (IsLagFrame) - LagCount++; - - //what happens to sound in this case? - if (!render) - { - Frame++; - return true; - } - - OctoshockDll.ShockFramebufferInfo fb = new OctoshockDll.ShockFramebufferInfo(); - - //run this once to get current logical size - OctoshockDll.shock_GetFramebuffer(psx, ref fb); - CurrentVideoSize = new System.Drawing.Size(fb.width, fb.height); - - if (_Settings.ResolutionMode == eResolutionMode.PixelPro) - fb.flags = OctoshockDll.eShockFramebufferFlags.Normalize; - - OctoshockDll.shock_GetFramebuffer(psx, ref fb); - - int w = fb.width; - int h = fb.height; - BufferWidth = w; - BufferHeight = h; - - var ri = CalculateResolution(this.SystemVidStandard, _Settings, w, h); - VirtualWidth = ri.Resolution.Width; - VirtualHeight = ri.Resolution.Height; - VideoProvider_Padding = ri.Padding; - - int len = w * h; - if (frameBuffer.Length != len) - { - Console.WriteLine("PSX FB size: {0},{1}", fb.width, fb.height); - frameBuffer = new int[len]; - } - - fixed (int* ptr = frameBuffer) - { - fb.ptr = ptr; - OctoshockDll.shock_GetFramebuffer(psx, ref fb); - } - - fixed (short* samples = sbuff) - { - sbuffcontains = OctoshockDll.shock_GetSamples(psx, null); - if (sbuffcontains * 2 > sbuff.Length) throw new InvalidOperationException($"{nameof(OctoshockDll.shock_GetSamples)} returned too many samples: {sbuffcontains}"); - OctoshockDll.shock_GetSamples(psx, samples); - } - - Frame++; - - return true; - } - - public ControllerDefinition ControllerDefinition { get; private set; } - - public int Frame { get; private set; } - public int LagCount { get; set; } - public bool IsLagFrame { get; set; } - - public IInputCallbackSystem InputCallbacks - { - [FeatureNotImplemented] - get => throw new NotImplementedException(); - } - - public bool DeterministicEmulation => true; - - public int[] GetVideoBuffer() => frameBuffer; - public int VirtualWidth { get; private set; } - public int VirtualHeight { get; private set; } - public int BufferWidth { get; private set; } - public int BufferHeight { get; private set; } - public int BackgroundColor => 0; - public int VsyncNumerator { get; private set; } - public int VsyncDenominator { get; private set; } - - public System.Drawing.Size VideoProvider_Padding { get; private set; } - - //private short[] sbuff = new short[1454 * 2]; //this is the most ive ever seen.. don't know why. two frames worth i guess - private readonly short[] sbuff = new short[1611 * 2]; //need this for pal - private int sbuffcontains = 0; - - public void GetSamplesSync(out short[] samples, out int nsamp) - { - samples = sbuff; - nsamp = sbuffcontains; - } - - public void DiscardSamples() - { - sbuffcontains = 0; - } - - public bool CanProvideAsync => false; - - public void SetSyncMode(SyncSoundMode mode) - { - if (mode == SyncSoundMode.Async) - { - throw new NotSupportedException("Async mode is not supported."); - } - } - - public SyncSoundMode SyncMode => SyncSoundMode.Sync; - - public void GetSamplesAsync(short[] samples) - { - throw new InvalidOperationException("Async mode is not supported."); - } - - public byte[] CloneSaveRam() - { - var cfg = _SyncSettings.FIOConfig.ToLogical(); - int nMemcards = cfg.NumMemcards; - var buf = new byte[128 * 1024 * nMemcards]; - for (int i = 0, idx = 0, addr=0x01; i < 2; i++, addr<<=1) - { - if (cfg.Memcards[i]) - { - fixed (byte* pbuf = buf) - { - var transaction = new OctoshockDll.ShockMemcardTransaction(); - transaction.buffer128k = pbuf + idx * 128 * 1024; - transaction.transaction = OctoshockDll.eShockMemcardTransaction.Read; - OctoshockDll.shock_Peripheral_MemcardTransact(psx, addr, ref transaction); - idx++; - } - } - } - return buf; - } - - public void StoreSaveRam(byte[] data) - { - var cfg = _SyncSettings.FIOConfig.ToLogical(); - for (int i = 0, idx = 0, addr = 0x01; i < 2; i++, addr <<= 1) - { - if (cfg.Memcards[i]) - { - fixed (byte* pbuf = data) - { - var transaction = new OctoshockDll.ShockMemcardTransaction(); - transaction.buffer128k = pbuf + idx * 128 * 1024; - transaction.transaction = OctoshockDll.eShockMemcardTransaction.Write; - OctoshockDll.shock_Peripheral_MemcardTransact(psx, addr, ref transaction); - idx++; - } - } - } - } - - public bool SaveRamModified - { - get - { - var cfg = _SyncSettings.FIOConfig.ToLogical(); - for (int i = 0, addr = 0x01; i < 2; i++, addr <<= 1) - { - if (cfg.Memcards[i]) - { - var transaction = new OctoshockDll.ShockMemcardTransaction(); - transaction.transaction = OctoshockDll.eShockMemcardTransaction.CheckDirty; - OctoshockDll.shock_Peripheral_MemcardTransact(psx, addr, ref transaction); - if (OctoshockDll.shock_Peripheral_MemcardTransact(psx, addr, ref transaction) == OctoshockDll.SHOCK_TRUE) - return true; - } - } - - return false; - } - } - - - //THIS IS STILL AWFUL - - private byte[] savebuff; - - private void StudySaveBufferSize() - { - var transaction = new OctoshockDll.ShockStateTransaction(); - transaction.transaction = OctoshockDll.eShockStateTransaction.BinarySize; - int size = OctoshockDll.shock_StateTransaction(psx, ref transaction); - savebuff = new byte[size]; - } - - public bool AvoidRewind => false; - - public void SaveStateBinary(BinaryWriter writer) - { - fixed (byte* psavebuff = savebuff) - { - var transaction = new OctoshockDll.ShockStateTransaction() - { - transaction = OctoshockDll.eShockStateTransaction.BinarySave, - buffer = psavebuff, - bufferLength = savebuff.Length - }; - - int result = OctoshockDll.shock_StateTransaction(psx, ref transaction); - if (result != OctoshockDll.SHOCK_OK) - throw new InvalidOperationException($"{nameof(OctoshockDll.eShockStateTransaction)}.{nameof(OctoshockDll.eShockStateTransaction.BinarySave)} returned error!"); - writer.Write(savebuff.Length); - writer.Write(savebuff); - - // other variables - writer.Write(IsLagFrame); - writer.Write(LagCount); - writer.Write(Frame); - writer.Write(CurrentTrayOpen); - writer.Write(CurrentDiscIndexMounted); - } - } - - public void LoadStateBinary(BinaryReader reader) - { - fixed (byte* psavebuff = savebuff) - { - var transaction = new OctoshockDll.ShockStateTransaction() - { - transaction = OctoshockDll.eShockStateTransaction.BinaryLoad, - buffer = psavebuff, - bufferLength = savebuff.Length - }; - - int length = reader.ReadInt32(); - if (length != savebuff.Length) - throw new InvalidOperationException("Save buffer size mismatch!"); - reader.Read(savebuff, 0, length); - int ret = OctoshockDll.shock_StateTransaction(psx, ref transaction); - if (ret != OctoshockDll.SHOCK_OK) - throw new InvalidOperationException($"{nameof(OctoshockDll.eShockStateTransaction)}.{nameof(OctoshockDll.eShockStateTransaction.BinaryLoad)} returned error!"); - - // other variables - IsLagFrame = reader.ReadBoolean(); - LagCount = reader.ReadInt32(); - Frame = reader.ReadInt32(); - CurrentTrayOpen = reader.ReadBoolean(); - CurrentDiscIndexMounted = reader.ReadInt32(); - PokeDisc(); - } - } - - private Settings _Settings = new Settings(); - private SyncSettings _SyncSettings; - public enum eResolutionMode { PixelPro, Debug, @@ -1168,40 +195,5 @@ public Settings Clone() return (Settings)MemberwiseClone(); } } - - public Settings GetSettings() - { - return _Settings.Clone(); - } - - public SyncSettings GetSyncSettings() - { - return _SyncSettings.Clone(); - } - - public PutSettingsDirtyBits PutSettings(Settings o) - { - _Settings.Validate(); - _Settings = o; - - //TODO - store settings into core? or we can just keep doing it before frameadvance - - return PutSettingsDirtyBits.None; - } - - public PutSettingsDirtyBits PutSyncSettings(SyncSettings o) - { - //currently LEC and pad settings changes both require reboot - bool reboot = true; - - //we could do it this way roughly if we need to - //if(JsonConvert.SerializeObject(o.FIOConfig) != JsonConvert.SerializeObject(_SyncSettings.FIOConfig) - - - _SyncSettings = o; - - - return reboot ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None; - } } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/OctoshockDll.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/OctoshockDll.cs index 85e805d76bd..b931c642445 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/OctoshockDll.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/OctoshockDll.cs @@ -1,71 +1,7 @@ -//TODO - make sure msvc builds with 32bit enums and get rid of the extra marshalling fluff here - -using System.Runtime.InteropServices; -using System.Text; - -using BizHawk.Emulation.Common; - namespace BizHawk.Emulation.Cores.Sony.PSX { - public static unsafe class OctoshockDll + public static class OctoshockDll { - private const CallingConvention cc = CallingConvention.Cdecl; - private const string dd = "octoshock.dll"; - - public enum eRegion : int - { - JP = 0, - NA = 1, - EU = 2, - NONE = 3 //TODO - whats the difference between unset, and region unknown? - } - - public enum eVidStandard : int - { - NTSC = 0, - PAL = 1, - } - - public enum eShockStep - { - Frame - } - - public enum eShockFramebufferFlags - { - None = 0, - Normalize = 1 - } - - public enum eMemType - { - MainRAM = 0, //2048K - BiosROM = 1, //512K - PIOMem = 2, //64K - GPURAM = 3, //512K - SPURAM = 4, //512K - DCache = 5 //1K - } - - public enum eShockStateTransaction : int - { - BinarySize = 0, - BinaryLoad = 1, - BinarySave = 2, - TextLoad = 3, - TextSave = 4 - } - - public enum eShockMemcardTransaction - { - Connect = 0, //connects it to the addressed port (not supported yet) - Disconnect = 1, //disconnects it from the addressed port (not supported yet) - Write = 2, //writes from the frontend to the memcard - Read = 3, //reads from the memcard to the frontend. Also clears the dirty flag - CheckDirty = 4, //checks whether the memcard is dirty - } - - public enum ePeripheralType : int { None = 0, //can be used to signify disconnection @@ -78,230 +14,5 @@ public enum ePeripheralType : int Multitap = 10, } - - /// - /// this is implemented as an overall render type instead of a horizontal clip control - /// in case the Framebuffer render type ever develops any differences in its Y-handling. - /// At that time, we might need to change the GUI to separate the vertical and horizontal components, or something like that - /// - public enum eShockRenderType : int - { - Normal, - ClipOverscan, - Framebuffer - } - - public enum eShockDeinterlaceMode : int - { - Weave, - Bob, - BobOffset - } - - [Flags] - public enum eShockMemCb : int - { - None = 0, - Read = 1, - Write = 2, - Execute = 4 - } - - public const int SHOCK_OK = 0; - public const int SHOCK_FALSE = 0; - public const int SHOCK_TRUE = 1; - public const int SHOCK_ERROR = -1; - public const int SHOCK_NOCANDO = -2; - public const int SHOCK_INVALID_ADDRESS = -3; - public const int SHOCK_OVERFLOW = -4; - - [StructLayout(LayoutKind.Sequential)] - public struct ShockDiscInfo - { - public eRegion region; - public unsafe fixed sbyte id[5]; //SCEI, SCEA, SCEE, etc. with null terminator - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockTOCTrack - { - public byte adr; - public byte control; - public uint lba; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockTOC - { - public byte first_track; - public byte last_track; - public byte disc_type; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockFramebufferInfo - { - public int width, height; - [MarshalAs(UnmanagedType.I4)] - public eShockFramebufferFlags flags; - public void* ptr; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockRenderOptions - { - public int scanline_start, scanline_end; - public eShockRenderType renderType; - public eShockDeinterlaceMode deinterlaceMode; - public bool skip; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockMemcardTransaction - { - [MarshalAs(UnmanagedType.I4)] - public eShockMemcardTransaction transaction; - public void* buffer128k; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockRegisters_CPU - { - public fixed uint GPR[32]; - public uint PC, PC_NEXT; - public uint IN_BD_SLOT; - public uint LO, HI; - public uint SR, CAUSE, EPC; - } - - [StructLayout(LayoutKind.Sequential)] - public struct ShockStateTransaction - { - public eShockStateTransaction transaction; - public void* buffer; - public int bufferLength; - public TextStateFPtrs ff; - } - - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void ShockCallback_Trace(IntPtr opaque, uint PC, uint inst, string dis); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int ShockDisc_ReadTOC(IntPtr opaque, ShockTOC* read_target, ShockTOCTrack* tracks101); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int ShockDisc_ReadLBA(IntPtr opaque, int lba, void* dst); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void ShockCallback_Mem(uint address, eShockMemCb type, uint size, uint value); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Util_DisassembleMIPS(uint PC, uint instr, StringBuilder outbuf, int buflen); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_CreateDisc(out IntPtr outDisc, IntPtr Opaque, int lbaCount, ShockDisc_ReadTOC ReadTOC, ShockDisc_ReadLBA ReadLBA2448, bool suppliesDeinterleavedSubcode); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_DestroyDisc(IntPtr disc); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_AnalyzeDisc(IntPtr disc, out ShockDiscInfo info); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Create(out IntPtr psx, eRegion region, void* firmware512k); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Destroy(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Peripheral_Connect( - IntPtr psx, - int address, - [MarshalAs(UnmanagedType.I4)] ePeripheralType type - ); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Peripheral_SetPadInput(IntPtr psx, int address, uint buttons, byte left_x, byte left_y, byte right_x, byte right_y); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Peripheral_SetNegconInput(IntPtr psx, int address, uint buttons, byte twist, byte analog1, byte analog2, byte analogL); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Peripheral_MemcardTransact(IntPtr psx, int address, ref ShockMemcardTransaction transaction); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Peripheral_PollActive(IntPtr psx, int address, bool clear); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_MountEXE(IntPtr psx, void* exebuf, int size, bool ignore_pcsp); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_PowerOn(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SoftReset(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_PowerOff(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_OpenTray(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetDisc(IntPtr psx, IntPtr disc); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_PokeDisc(IntPtr psx, IntPtr disc); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_CloseTray(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetRenderOptions(IntPtr psx, ref ShockRenderOptions opts); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_Step(IntPtr psx, eShockStep step); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_GetFramebuffer(IntPtr psx, ref ShockFramebufferInfo fb); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_GetSamples(IntPtr psx, void* buffer); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_GetMemData( - IntPtr psx, - out IntPtr ptr, - out int size, - [MarshalAs(UnmanagedType.I4)] eMemType memType - ); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_StateTransaction(IntPtr psx, ref ShockStateTransaction transaction); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_GetRegisters_CPU(IntPtr psx, ref ShockRegisters_CPU buffer); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetRegister_CPU(IntPtr psx, int index, uint value); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetTraceCallback(IntPtr psx, IntPtr opaque, ShockCallback_Trace callback); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetMemCb(IntPtr psx, ShockCallback_Mem cb, eShockMemCb cbMask); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_SetLEC(IntPtr psx, bool enable); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_GetGPUUnlagged(IntPtr psx); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_PeekMemory(IntPtr psx, uint address, out byte value); - - [DllImport(dd, CallingConvention = cc)] - public static extern int shock_PokeMemory(IntPtr psx, uint address, byte value); } } \ No newline at end of file diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/PSF.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/PSF.cs deleted file mode 100644 index 1bdb0c938f1..00000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/PSF.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.IO; -using System.Collections.Generic; - -using BizHawk.Common.IOExtensions; - -namespace BizHawk.Emulation.Cores.Sony.PSX -{ - public class PSF - { - public readonly IDictionary TagsDictionary = new Dictionary(); - public readonly IList LooseTags = new List(); - - public byte[] Data; - public byte[] LibData; - - public bool Load(string fpPSF, Func cbDeflater) - { - using(var fs = File.OpenRead(fpPSF)) - { - //not endian safe - var br = new BinaryReader(fs); - var sig = br.ReadStringFixedUtf8(4); - if (sig != "PSF\x1") - return false; - - int reserved_size = br.ReadInt32(); - int compressed_size = br.ReadInt32(); - int compressed_crc32 = br.ReadInt32(); - - //load tags - //tags run until the end of the file - fs.Position = 16 + reserved_size + compressed_size; - if (fs.Position + 5 > fs.Length) - { - //theres no space for tags, probably just no tags in the file - } - else - { - if (br.ReadStringFixedUtf8(5) == "[TAG]") - { - var tagstring = br.ReadStringFixedUtf8((int)(fs.Length - fs.Position)).Replace("\r\n", "\n"); - foreach (var tag in tagstring.Split('\n', '\x0')) - { - if (tag.Trim() == "") - continue; - int eq = tag.IndexOf('='); - if (eq != -1) - TagsDictionary[tag.Substring(0, eq)] = tag.Substring(eq + 1); - else - LooseTags.Add(tag); - } - } - } - - //load compressed section buffer - fs.Position = 16 + reserved_size; - Data = cbDeflater(fs, compressed_size); - - //load lib if needed - if (TagsDictionary.TryGetValue("_lib", out var relPath)) - { - var fpLib = Path.Combine(Path.GetDirectoryName(fpPSF), relPath); - if (!File.Exists(fpLib)) - return false; - PSF lib = new PSF(); - if (!lib.Load(fpLib,cbDeflater)) - return false; - LibData = lib.Data; - } - } - - return true; - } - } -} diff --git a/src/BizHawk.Emulation.Cores/CoreNames.cs b/src/BizHawk.Emulation.Cores/CoreNames.cs index e7457755702..70929688da3 100644 --- a/src/BizHawk.Emulation.Cores/CoreNames.cs +++ b/src/BizHawk.Emulation.Cores/CoreNames.cs @@ -43,7 +43,6 @@ public static class CoreNames public const string NeoPop = "NeoPop"; public const string Nymashock = "Nymashock"; public const string O2Hawk = "O2Hawk"; - public const string Octoshock = "Octoshock"; public const string PceHawk = "PCEHawk"; public const string PicoDrive = "PicoDrive"; public const string UAE = "UAE"; diff --git a/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs b/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs index c02d6f1d03e..a992e15debd 100644 --- a/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs +++ b/src/BizHawk.Emulation.Cores/vpads_schemata/PSXSchema.cs @@ -13,38 +13,7 @@ public class PsxSchema : IVirtualPadSchema { public IEnumerable GetPadSchemas(IEmulator core, Action showMessageBox) { - if (core is Octoshock octo) - { - var settings = octo.GetSyncSettings(); - - var fioConfig = settings.FIOConfig.ToLogical(); - for (int i = 0; i < fioConfig.DevicesPlayer.Length; i++) - { - if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.None) - { - continue; - } - - int pNum = i + 1; - if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualAnalog || fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.DualShock) - { - yield return DualShockController(pNum); - } - - if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.Pad) - { - yield return GamePadController(pNum); - } - - if (fioConfig.DevicesPlayer[i] == OctoshockDll.ePeripheralType.NegCon) - { - yield return NeGcon(pNum); - } - } - - yield return ConsoleButtons(octo); - } - else if (core is Nymashock nyma) + if (core is Nymashock nyma) { foreach (var result in nyma.ActualPortData) { @@ -69,45 +38,6 @@ public IEnumerable GetPadSchemas(IEmulator core, Action showM } } - private static PadSchema DualShockController(int controller) - { - var stickRanges = new[] { new AxisSpec(0.RangeTo(255), 128), new AxisSpec(0.RangeTo(255), 128, isReversed: true) }; - return new PadSchema - { - Size = new Size(500, 290), - DisplayName = $"DualShock Player{controller}", - Buttons = new PadSchemaControl[] - { - ButtonSchema.Up(32, 50, controller), - ButtonSchema.Down(32, 71, controller), - ButtonSchema.Left(11, 62, controller), - ButtonSchema.Right(53, 62, controller), - new ButtonSchema(3, 32, controller, "L1"), - new ButtonSchema(191, 32, controller, "R1"), - new ButtonSchema(3, 10, controller, "L2"), - new ButtonSchema(191, 10, controller, "R2"), - new ButtonSchema(72, 90, controller, "L3"), - new ButtonSchema(130, 90, controller, "R3"), - new ButtonSchema(148, 62, controller, "Square") { Icon = VGamepadButtonImage.Square }, - new ButtonSchema(169, 50, controller, "Triangle") { Icon = VGamepadButtonImage.Triangle }, - new ButtonSchema(190, 62, controller, "Circle") { Icon = VGamepadButtonImage.Circle }, - new ButtonSchema(169, 71, controller, "Cross") { Icon = VGamepadButtonImage.Cross }, - new ButtonSchema(112, 62, controller, "Start", "S"), - new ButtonSchema(90, 62, controller, "Select", "s"), - new AnalogSchema(3, 120, $"P{controller} LStick X") - { - Spec = stickRanges[0], - SecondarySpec = stickRanges[1] - }, - new AnalogSchema(260, 120, $"P{controller} RStick X") - { - Spec = stickRanges[0], - SecondarySpec = stickRanges[1] - } - } - }; - } - private static PadSchema NymaDualShockController(int controller) { var stickRanges = new[] { new AxisSpec(0.RangeTo(0xFF), 0x80), new AxisSpec(0.RangeTo(0xFF), 0x80, isReversed: true) }; @@ -149,32 +79,6 @@ private static PadSchema NymaDualShockController(int controller) }; } - private static PadSchema GamePadController(int controller) - { - return new PadSchema - { - Size = new Size(240, 115), - DisplayName = $"Gamepad Player{controller}", - Buttons = new[] - { - ButtonSchema.Up(37, 55, controller), - ButtonSchema.Down(37, 76, controller), - ButtonSchema.Left(16, 67, controller), - ButtonSchema.Right(58, 67, controller), - new ButtonSchema(8, 37, controller, "L1"), - new ButtonSchema(196, 37, controller, "R1"), - new ButtonSchema(8, 15, controller, "L2"), - new ButtonSchema(196, 15, controller, "R2"), - new ButtonSchema(153, 67, controller, "Square") { Icon = VGamepadButtonImage.Square }, - new ButtonSchema(174, 55, controller, "Triangle") { Icon = VGamepadButtonImage.Triangle }, - new ButtonSchema(195, 67, controller, "Circle") { Icon = VGamepadButtonImage.Circle }, - new ButtonSchema(174, 76, controller, "Cross") { Icon = VGamepadButtonImage.Cross }, - new ButtonSchema(112, 67, controller, "Start", "S"), - new ButtonSchema(90, 67, controller, "Select", "s") - } - }; - } - private static PadSchema NymaGamePadController(int controller) { return new PadSchema @@ -414,19 +318,6 @@ private static PadSchema NymaDancePad(int controller) }; } - private static PadSchema ConsoleButtons(Octoshock octo) - { - return new ConsoleSchema - { - Size = new Size(310, 400), - Buttons = new PadSchemaControl[] - { - new ButtonSchema(10, 15, "Reset"), - new DiscManagerSchema(10, 54, new Size(300, 300), octo, new[] { "Open", "Close", "Disc Select" }) - } - }; - } - private static PadSchema NymaConsoleButtons(AxisSpec diskRange) { return new ConsoleSchema