psx - revise disc swapping method. way cooler now, you get a list of discs in the virtualpad box, and changing between them maps to physical operations more logically.
This commit is contained in:
parent
bbbb891820
commit
4dc4745122
|
@ -216,6 +216,7 @@ namespace BizHawk.Client.Common
|
|||
//load discs for all the m3u
|
||||
m3u.Rebase(Path.GetDirectoryName(path));
|
||||
List<Disc> discs = new List<Disc>();
|
||||
List<string> discNames = new List<string>();
|
||||
foreach (var e in m3u.Entries)
|
||||
{
|
||||
Disc disc = null;
|
||||
|
@ -229,9 +230,10 @@ namespace BizHawk.Client.Common
|
|||
disc = Disc.FromCCDPath(discPath);
|
||||
if(disc == null)
|
||||
throw new InvalidOperationException("Can't load one of the files specified in the M3U");
|
||||
discNames.Add(Path.GetFileNameWithoutExtension(discPath));
|
||||
discs.Add(disc);
|
||||
}
|
||||
nextEmulator = new Octoshock(nextComm, discs, null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator = new Octoshock(nextComm, discs, discNames, null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
||||
game = new GameInfo { Name = Path.GetFileNameWithoutExtension(file.Name) };
|
||||
game.System = "PSX";
|
||||
|
@ -292,7 +294,7 @@ namespace BizHawk.Client.Common
|
|||
nextEmulator = new PSP(nextComm, file.Name);
|
||||
break;
|
||||
case "PSX":
|
||||
nextEmulator = new Octoshock(nextComm, new List<Disc>(new[]{disc}), null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator = new Octoshock(nextComm, new List<Disc>(new[]{disc}), new List<string>(new[]{Path.GetFileNameWithoutExtension(path)}), null, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
||||
break;
|
||||
case "PCE":
|
||||
|
@ -454,7 +456,7 @@ namespace BizHawk.Client.Common
|
|||
core = CoreInventory.Instance["GBA", "VBA-Next"];
|
||||
break;
|
||||
case "PSX":
|
||||
nextEmulator = new Octoshock(nextComm, null, rom.FileData, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator = new Octoshock(nextComm, null, null, rom.FileData, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||
nextEmulator.CoreComm.RomStatusDetails = "PSX etc.";
|
||||
break;
|
||||
case "DEBUG":
|
||||
|
|
|
@ -982,6 +982,12 @@
|
|||
<Compile Include="tools\VirtualPads\controls\VirtualPadButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadDiscManager.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadDiscManager.Designer.cs">
|
||||
<DependentUpon>VirtualPadDiscManager.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadTargetScreen.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -1364,6 +1370,9 @@
|
|||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadAnalogStick.resx">
|
||||
<DependentUpon>VirtualPadAnalogStick.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadDiscManager.resx">
|
||||
<DependentUpon>VirtualPadDiscManager.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadTargetScreen.resx">
|
||||
<DependentUpon>VirtualPadTargetScreen.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1769,6 +1769,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void PSXDiscControlsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.Tools.Load<VirtualpadTool>().ScrollToPadSchema("Console");
|
||||
}
|
||||
|
||||
private void FlushSaveRAMMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveRam();
|
||||
|
|
|
@ -3737,6 +3737,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
FeaturesMenuItem.Visible = VersionInfo.DeveloperBuild;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// Loads the tool dialog T, if it does not exist it will be created, if it is already open, it will be focused
|
||||
/// </summary>
|
||||
public IToolForm Load<T>() where T : IToolForm
|
||||
public T Load<T>() where T : IToolForm
|
||||
{
|
||||
return Load(typeof(T));
|
||||
return (T)Load(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -28,6 +28,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public string PadSchemaDisplayName { get { return _schema.DisplayName; } }
|
||||
|
||||
public bool ReadOnly
|
||||
{
|
||||
get
|
||||
|
@ -103,6 +105,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
MaxValue = button.MaxValue
|
||||
});
|
||||
break;
|
||||
case PadSchema.PadInputType.DiscManager:
|
||||
PadBox.Controls.Add(new VirtualPadDiscManager(button.SecondaryNames)
|
||||
{
|
||||
Name = button.Name,
|
||||
//DisplayName = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Size = button.TargetSize,
|
||||
OwnerEmulator = button.OwnerEmulator
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,11 @@
|
|||
this.PadBoxContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.clearAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.StickyContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ControllerPanel = new System.Windows.Forms.Panel();
|
||||
this.PadMenu = new MenuStripEx();
|
||||
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ClearClearsAnalogInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -47,8 +50,7 @@
|
|||
this.PadsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ClearAllMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.StickyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ClearClearsAnalogInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ControllerBox.SuspendLayout();
|
||||
this.PadBoxContextMenu.SuspendLayout();
|
||||
this.PadMenu.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -59,6 +61,7 @@
|
|||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ControllerBox.ContextMenuStrip = this.PadBoxContextMenu;
|
||||
this.ControllerBox.Controls.Add(this.ControllerPanel);
|
||||
this.ControllerBox.Location = new System.Drawing.Point(12, 27);
|
||||
this.ControllerBox.Name = "ControllerBox";
|
||||
this.ControllerBox.Size = new System.Drawing.Size(431, 277);
|
||||
|
@ -72,24 +75,33 @@
|
|||
this.clearAllToolStripMenuItem,
|
||||
this.StickyContextMenuItem});
|
||||
this.PadBoxContextMenu.Name = "PadBoxContextMenu";
|
||||
this.PadBoxContextMenu.Size = new System.Drawing.Size(143, 48);
|
||||
this.PadBoxContextMenu.Size = new System.Drawing.Size(136, 48);
|
||||
this.PadBoxContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.PadBoxContextMenu_Opening);
|
||||
//
|
||||
// clearAllToolStripMenuItem
|
||||
//
|
||||
this.clearAllToolStripMenuItem.Name = "clearAllToolStripMenuItem";
|
||||
this.clearAllToolStripMenuItem.ShortcutKeyDisplayString = "Del";
|
||||
this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
|
||||
this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.clearAllToolStripMenuItem.Text = "Clear All";
|
||||
this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.ClearAllMenuItem_Click);
|
||||
//
|
||||
// StickyContextMenuItem
|
||||
//
|
||||
this.StickyContextMenuItem.Name = "StickyContextMenuItem";
|
||||
this.StickyContextMenuItem.Size = new System.Drawing.Size(142, 22);
|
||||
this.StickyContextMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.StickyContextMenuItem.Text = "Sticky";
|
||||
this.StickyContextMenuItem.Click += new System.EventHandler(this.StickyMenuItem_Click);
|
||||
//
|
||||
// ControllerPanel
|
||||
//
|
||||
this.ControllerPanel.AutoScroll = true;
|
||||
this.ControllerPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ControllerPanel.Location = new System.Drawing.Point(3, 16);
|
||||
this.ControllerPanel.Name = "ControllerPanel";
|
||||
this.ControllerPanel.Size = new System.Drawing.Size(425, 258);
|
||||
this.ControllerPanel.TabIndex = 0;
|
||||
//
|
||||
// PadMenu
|
||||
//
|
||||
this.PadMenu.ClickThrough = true;
|
||||
|
@ -116,60 +128,72 @@
|
|||
this.toolStripSeparator1,
|
||||
this.ExitMenuItem});
|
||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(56, 20);
|
||||
this.OptionsSubMenu.Text = "&Options";
|
||||
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
// ClearClearsAnalogInputMenuItem
|
||||
//
|
||||
this.ClearClearsAnalogInputMenuItem.Name = "ClearClearsAnalogInputMenuItem";
|
||||
this.ClearClearsAnalogInputMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.ClearClearsAnalogInputMenuItem.Text = "&Clear clears Analog Input";
|
||||
this.ClearClearsAnalogInputMenuItem.Click += new System.EventHandler(this.ClearClearsAnalogInputMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(192, 6);
|
||||
//
|
||||
// AutoloadMenuItem
|
||||
//
|
||||
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
|
||||
this.AutoloadMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.AutoloadMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.AutoloadMenuItem.Text = "&Autoload";
|
||||
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
|
||||
//
|
||||
// SaveWindowPositionMenuItem
|
||||
//
|
||||
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
|
||||
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.SaveWindowPositionMenuItem.Text = "&Save Window Position";
|
||||
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
|
||||
//
|
||||
// AlwaysOnTopMenuItem
|
||||
//
|
||||
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
|
||||
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.AlwaysOnTopMenuItem.Text = "Always On Top";
|
||||
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
|
||||
//
|
||||
// FloatingWindowMenuItem
|
||||
//
|
||||
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
|
||||
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(203, 6);
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(192, 6);
|
||||
//
|
||||
// RestoreDefaultSettingsMenuItem
|
||||
//
|
||||
this.RestoreDefaultSettingsMenuItem.Name = "RestoreDefaultSettingsMenuItem";
|
||||
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.RestoreDefaultSettingsMenuItem.Text = "Restore Default Settings";
|
||||
this.RestoreDefaultSettingsMenuItem.Click += new System.EventHandler(this.RestoreDefaultSettingsMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(203, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(192, 6);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.ExitMenuItem.Text = "E&xit";
|
||||
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||
//
|
||||
|
@ -179,7 +203,7 @@
|
|||
this.ClearAllMenuItem,
|
||||
this.StickyMenuItem});
|
||||
this.PadsSubMenu.Name = "PadsSubMenu";
|
||||
this.PadsSubMenu.Size = new System.Drawing.Size(44, 20);
|
||||
this.PadsSubMenu.Size = new System.Drawing.Size(42, 20);
|
||||
this.PadsSubMenu.Text = "&Pads";
|
||||
this.PadsSubMenu.DropDownOpened += new System.EventHandler(this.PadsSubMenu_DropDownOpened);
|
||||
//
|
||||
|
@ -187,29 +211,17 @@
|
|||
//
|
||||
this.ClearAllMenuItem.Name = "ClearAllMenuItem";
|
||||
this.ClearAllMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.ClearAllMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ClearAllMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.ClearAllMenuItem.Text = "&Clear All";
|
||||
this.ClearAllMenuItem.Click += new System.EventHandler(this.ClearAllMenuItem_Click);
|
||||
//
|
||||
// StickyMenuItem
|
||||
//
|
||||
this.StickyMenuItem.Name = "StickyMenuItem";
|
||||
this.StickyMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.StickyMenuItem.Size = new System.Drawing.Size(135, 22);
|
||||
this.StickyMenuItem.Text = "Sticky";
|
||||
this.StickyMenuItem.Click += new System.EventHandler(this.StickyMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(203, 6);
|
||||
//
|
||||
// ClearClearsAnalogInputMenuItem
|
||||
//
|
||||
this.ClearClearsAnalogInputMenuItem.Name = "ClearClearsAnalogInputMenuItem";
|
||||
this.ClearClearsAnalogInputMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||
this.ClearClearsAnalogInputMenuItem.Text = "&Clear clears Analog Input";
|
||||
this.ClearClearsAnalogInputMenuItem.Click += new System.EventHandler(this.ClearClearsAnalogInputMenuItem_Click);
|
||||
//
|
||||
// VirtualpadTool
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -221,6 +233,7 @@
|
|||
this.Name = "VirtualpadTool";
|
||||
this.Text = "Virtual Pads";
|
||||
this.Load += new System.EventHandler(this.VirtualpadTool_Load);
|
||||
this.ControllerBox.ResumeLayout(false);
|
||||
this.PadBoxContextMenu.ResumeLayout(false);
|
||||
this.PadMenu.ResumeLayout(false);
|
||||
this.PadMenu.PerformLayout();
|
||||
|
@ -250,5 +263,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem StickyContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearClearsAnalogInputMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.Panel ControllerPanel;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
get
|
||||
{
|
||||
return ControllerBox.Controls
|
||||
return ControllerPanel.Controls
|
||||
.OfType<VirtualPad>()
|
||||
.ToList();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CreatePads()
|
||||
{
|
||||
ControllerBox.Controls.Clear();
|
||||
ControllerPanel.Controls.Clear();
|
||||
|
||||
var schemaType = Assembly
|
||||
.GetExecutingAssembly()
|
||||
|
@ -107,11 +107,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (pads.Any())
|
||||
{
|
||||
ControllerBox.Controls.AddRange(pads.Reverse().ToArray());
|
||||
ControllerPanel.Controls.AddRange(pads.Reverse().ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ScrollToPadSchema(string padSchemaName)
|
||||
{
|
||||
foreach (var control in ControllerPanel.Controls)
|
||||
{
|
||||
VirtualPad vp = control as VirtualPad;
|
||||
if (vp == null) continue;
|
||||
if (vp.PadSchemaDisplayName == padSchemaName)
|
||||
ControllerPanel.ScrollControlIntoView(vp);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckPads(IEnumerable<PadSchema> schemas, BizHawk.Emulation.Common.ControllerDefinition def)
|
||||
{
|
||||
HashSet<string> analogs = new HashSet<string>(def.FloatControls);
|
||||
|
@ -133,6 +144,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
case PadSchema.PadInputType.Boolean:
|
||||
searchset = bools;
|
||||
break;
|
||||
case PadSchema.PadInputType.DiscManager:
|
||||
searchset = bools;
|
||||
searchset.UnionWith(analogs);
|
||||
break;
|
||||
}
|
||||
if (!searchset.Contains(button.Name))
|
||||
{
|
||||
|
|
136
BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs
generated
Normal file
136
BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs
generated
Normal file
|
@ -0,0 +1,136 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class VirtualPadDiscManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.lvDiscs = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnInsert = new BizHawk.Client.EmuHawk.VirtualPadButton();
|
||||
this.btnEject = new BizHawk.Client.EmuHawk.VirtualPadButton();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox1.Controls.Add(this.lvDiscs);
|
||||
this.groupBox1.Location = new System.Drawing.Point(3, 32);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(279, 207);
|
||||
this.groupBox1.TabIndex = 1;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Discs";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
|
||||
//
|
||||
// lvDiscs
|
||||
//
|
||||
this.lvDiscs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.lvDiscs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvDiscs.FullRowSelect = true;
|
||||
this.lvDiscs.GridLines = true;
|
||||
this.lvDiscs.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.lvDiscs.HideSelection = false;
|
||||
this.lvDiscs.Location = new System.Drawing.Point(3, 16);
|
||||
this.lvDiscs.MultiSelect = false;
|
||||
this.lvDiscs.Name = "lvDiscs";
|
||||
this.lvDiscs.Size = new System.Drawing.Size(273, 188);
|
||||
this.lvDiscs.TabIndex = 0;
|
||||
this.lvDiscs.UseCompatibleStateImageBehavior = false;
|
||||
this.lvDiscs.View = System.Windows.Forms.View.Details;
|
||||
this.lvDiscs.SelectedIndexChanged += new System.EventHandler(this.lvDiscs_SelectedIndexChanged);
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Text = "#";
|
||||
this.columnHeader1.Width = 27;
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "Name";
|
||||
this.columnHeader2.Width = 228;
|
||||
//
|
||||
// btnInsert
|
||||
//
|
||||
this.btnInsert.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.btnInsert.AutoSize = true;
|
||||
this.btnInsert.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.btnInsert.Location = new System.Drawing.Point(50, 3);
|
||||
this.btnInsert.Name = "btnInsert";
|
||||
this.btnInsert.ReadOnly = false;
|
||||
this.btnInsert.RightClicked = false;
|
||||
this.btnInsert.Size = new System.Drawing.Size(43, 23);
|
||||
this.btnInsert.TabIndex = 2;
|
||||
this.btnInsert.Text = "Insert";
|
||||
this.btnInsert.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnEject
|
||||
//
|
||||
this.btnEject.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.btnEject.AutoSize = true;
|
||||
this.btnEject.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.btnEject.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnEject.Name = "btnEject";
|
||||
this.btnEject.ReadOnly = false;
|
||||
this.btnEject.RightClicked = false;
|
||||
this.btnEject.Size = new System.Drawing.Size(41, 23);
|
||||
this.btnEject.TabIndex = 0;
|
||||
this.btnEject.Text = "Eject";
|
||||
this.btnEject.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// VirtualPadDiscManager
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.Controls.Add(this.btnInsert);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.btnEject);
|
||||
this.Name = "VirtualPadDiscManager";
|
||||
this.Size = new System.Drawing.Size(286, 244);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private VirtualPadButton btnEject;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ListView lvDiscs;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private VirtualPadButton btnInsert;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Sony.PSX;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class VirtualPadDiscManager : UserControl, IVirtualPadControl
|
||||
{
|
||||
public VirtualPadDiscManager(string[] buttonNames)
|
||||
{
|
||||
InitializeComponent();
|
||||
btnEject.Name = buttonNames[0];
|
||||
btnInsert.Name = buttonNames[1];
|
||||
_discSelectName = buttonNames[2];
|
||||
}
|
||||
|
||||
string _discSelectName;
|
||||
public object OwnerEmulator { get; set; }
|
||||
|
||||
object lastCoreOwner;
|
||||
|
||||
void UpdateCoreAssociation()
|
||||
{
|
||||
if (lastCoreOwner == OwnerEmulator)
|
||||
return;
|
||||
|
||||
lastCoreOwner = OwnerEmulator;
|
||||
|
||||
if (!(OwnerEmulator is Octoshock))
|
||||
return;
|
||||
|
||||
var psx = OwnerEmulator as Octoshock;
|
||||
List<string> buttons = new List<string>();
|
||||
buttons.Add("- NONE -");
|
||||
buttons.AddRange(psx.HackyDiscButtons);
|
||||
|
||||
lvDiscs.Items.Clear();
|
||||
|
||||
int idx = 0;
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
var lvi = new ListViewItem();
|
||||
lvi.Text = idx.ToString();
|
||||
lvi.SubItems.Add(button);
|
||||
lvDiscs.Items.Add(lvi);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region IVirtualPadControl
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
UpdateCoreAssociation();
|
||||
if (OwnerEmulator is Octoshock)
|
||||
{
|
||||
var psx = OwnerEmulator as Octoshock;
|
||||
bool eject = psx.CurrentDiscEjected;
|
||||
|
||||
btnEject.Enabled = !eject;
|
||||
btnInsert.Enabled = eject;
|
||||
|
||||
if (!btnEject.Enabled) btnEject.Checked = false;
|
||||
if (!btnInsert.Enabled) btnInsert.Checked = false;
|
||||
|
||||
//if we're not ejected, then the disc is frozen in the current configuration
|
||||
lvDiscs.Enabled = eject;
|
||||
if (!eject)
|
||||
{
|
||||
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 dont display the disc 0
|
||||
if (lvDiscs.SelectedIndices.Count == 0)
|
||||
lvDiscs.SelectedIndices.Add(0);
|
||||
}
|
||||
|
||||
public void Set(IController controller)
|
||||
{
|
||||
//controller.GetFloat("Disc Select")
|
||||
}
|
||||
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
#endregion //IVirtualPadControl
|
||||
|
||||
private void groupBox1_Enter(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void lvDiscs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
//not a valid way to fight unselection, it results in craptons of ping-ponging logic and eventual malfunction
|
||||
//if (lvDiscs.SelectedIndices.Count == 0)
|
||||
// lvDiscs.SelectedIndices.Add(0);
|
||||
//Global.StickyXORAdapter.SetFloat(_discSelectName, lvDiscs.SelectedIndices[0]);
|
||||
|
||||
//emergency measure: if no selection, set no disc
|
||||
if (lvDiscs.SelectedIndices.Count == 0)
|
||||
Global.StickyXORAdapter.SetFloat(_discSelectName, 0);
|
||||
else Global.StickyXORAdapter.SetFloat(_discSelectName, lvDiscs.SelectedIndices[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -11,9 +11,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public IEnumerable<PadSchema> GetPadSchemas()
|
||||
{
|
||||
var psx = ((Octoshock)Global.Emulator);
|
||||
yield return DualShockController(1);
|
||||
yield return DualShockController(2);
|
||||
yield return ConsoleButtons();
|
||||
yield return ConsoleButtons(psx);
|
||||
}
|
||||
|
||||
public static PadSchema DualShockController(int controller)
|
||||
|
@ -22,6 +23,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(420, 260),
|
||||
DisplayName = "DualShock Player" + controller,
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonScema
|
||||
|
@ -152,7 +154,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Location = new Point(3, 120),
|
||||
Type = PadSchema.PadInputType.AnalogStick
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "P" + controller + " RStick X",
|
||||
MaxValue = 127,
|
||||
|
@ -163,38 +165,30 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
};
|
||||
}
|
||||
private static PadSchema ConsoleButtons()
|
||||
private static PadSchema ConsoleButtons(Octoshock psx)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = "Console",
|
||||
IsConsole = true,
|
||||
DefaultSize = new Size(360, 250),
|
||||
DefaultSize = new Size(310, 400),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "Eject",
|
||||
DisplayName = "Eject",
|
||||
Name = "Reset",
|
||||
DisplayName = "Reset",
|
||||
Location = new Point(10, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "Reset",
|
||||
DisplayName = "Reset",
|
||||
Location = new Point(60, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "Disc Select",
|
||||
MinValue = 1,
|
||||
MaxValue = 5,
|
||||
DisplayName = "Disc Select",
|
||||
Location = new Point(10, 40),
|
||||
TargetSize = new Size(300,100),
|
||||
Type = PadSchema.PadInputType.FloatSingle
|
||||
Name = "Disc Select", //not really, but shuts up a warning
|
||||
Type = PadSchema.PadInputType.DiscManager,
|
||||
Location = new Point(10,54),
|
||||
TargetSize = new Size(300,300),
|
||||
OwnerEmulator = psx,
|
||||
SecondaryNames = new [] { "Eject", "Insert", "Disc Select" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Boolean, // A single on/off button
|
||||
AnalogStick, // An analog stick X,Y Pair
|
||||
FloatSingle, // A single analog button (pressure sensitive button for instance)
|
||||
TargetedPair // A X,Y pair intended to be a screen cooridnate (for zappers, mouse, stylus, etc)
|
||||
TargetedPair, // A X,Y pair intended to be a screen cooridnate (for zappers, mouse, stylus, etc)
|
||||
DiscManager
|
||||
}
|
||||
|
||||
// Default size of the pad
|
||||
|
@ -31,6 +32,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string[] SecondaryNames { get; set; } // Any other buttons necessary to operate (such as the Y axis)
|
||||
public int MaxValue { get; set; } // For non-boolean values, specifies the maximum value the button allows
|
||||
public int MinValue { get; set; } // For non-boolean values, specifies the minimum value the button allows
|
||||
public object OwnerEmulator { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
{
|
||||
public string SystemId { get { return "PSX"; } }
|
||||
|
||||
public static readonly ControllerDefinition DualShockController = new ControllerDefinition
|
||||
public static readonly ControllerDefinition PSXControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "DualShock Controller",
|
||||
BoolButtons =
|
||||
|
@ -44,7 +44,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
"P1 R1", "P1 L2", "P1 R2", "P1 L3", "P1 R3", "P1 MODE",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Select", "P2 Start", "P2 Square", "P2 Triangle", "P2 Circle", "P2 Cross", "P2 L1",
|
||||
"P2 R1", "P2 L2", "P2 R2", "P2 L3", "P2 R3", "P2 MODE",
|
||||
"Eject", "Reset",
|
||||
"Eject", "Insert", "Reset",
|
||||
},
|
||||
FloatControls =
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
new[] {0.0f, 128.0f, 255.0f},
|
||||
new[] {255.0f, 128.0f, 0.0f},
|
||||
new[] {1.0f,1.0f,5.0f},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
@ -190,23 +190,27 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
public OctoshockDll.eRegion SystemRegion { get; private set; }
|
||||
public OctoshockDll.eVidStandard SystemVidStandard { get; private set; }
|
||||
public System.Drawing.Size CurrentVideoSize { get; private set; }
|
||||
|
||||
public bool CurrentDiscEjected { get; private set; }
|
||||
public int CurrentDiscIndexMounted { get; private set; }
|
||||
|
||||
public List<string> HackyDiscButtons = new List<string>();
|
||||
|
||||
//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
|
||||
public Octoshock(CoreComm comm, List<DiscSystem.Disc> discs, byte[] exe, object settings, object syncSettings)
|
||||
public Octoshock(CoreComm comm, List<DiscSystem.Disc> discs, List<string> discNames, byte[] exe, object settings, object syncSettings)
|
||||
{
|
||||
//analyze our first disc from the list by default, because i dont know
|
||||
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
CoreComm = comm;
|
||||
DriveLightEnabled = true;
|
||||
|
||||
_Settings = (Settings)settings ?? new Settings();
|
||||
_SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
|
||||
|
||||
DriveLightEnabled = true;
|
||||
|
||||
Attach();
|
||||
|
||||
HackyDiscButtons.AddRange(discNames);
|
||||
|
||||
//assume this region for EXE and PSF, maybe not correct though
|
||||
string firmwareRegion = "U";
|
||||
SystemRegion = OctoshockDll.eRegion.NA;
|
||||
|
@ -287,15 +291,27 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
frameBuffer = new int[BufferWidth * BufferHeight];
|
||||
}
|
||||
|
||||
//TODO - should be able to cold boot system with disc isnerted
|
||||
if (discInterfaces.Count != 0)
|
||||
{
|
||||
//disc will be set during first frame advance
|
||||
//start with first disc inserted and tray closed
|
||||
CurrentDiscEjected = false;
|
||||
CurrentDiscIndexMounted = 1;
|
||||
currentDiscInterface = discInterfaces[CurrentDiscIndexMounted - 1];
|
||||
OctoshockDll.shock_OpenTray(psx);
|
||||
OctoshockDll.shock_SetDisc(psx, currentDiscInterface.OctoshockHandle);
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
else
|
||||
{
|
||||
//must be an exe
|
||||
fixed (byte* pExeBuffer = exe)
|
||||
OctoshockDll.shock_MountEXE(psx, pExeBuffer, exe.Length);
|
||||
|
||||
//start with no disc inserted and tray closed
|
||||
CurrentDiscEjected = false;
|
||||
CurrentDiscIndexMounted = 0;
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
|
||||
//connect two dualshocks, thats all we're doing right now
|
||||
|
@ -431,28 +447,53 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
return new System.Drawing.Size(VirtualWidth, VirtualHeight);
|
||||
}
|
||||
|
||||
void FrameAdvance_PrepDiscState()
|
||||
{
|
||||
//if eject is requested, and valid, apply it
|
||||
if (Controller["Eject"] && !CurrentDiscEjected)
|
||||
{
|
||||
OctoshockDll.shock_OpenTray(psx);
|
||||
CurrentDiscEjected = true;
|
||||
}
|
||||
|
||||
//change the disc if needed, and valid
|
||||
//TODO - warning if zero time change?
|
||||
int requestedDisc = (int)Controller.GetFloat("Disc Select");
|
||||
if (requestedDisc != CurrentDiscIndexMounted && CurrentDiscEjected)
|
||||
{
|
||||
CurrentDiscIndexMounted = requestedDisc;
|
||||
if (CurrentDiscIndexMounted == 0)
|
||||
{
|
||||
currentDiscInterface = null;
|
||||
OctoshockDll.shock_SetDisc(psx, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDiscInterface = discInterfaces[CurrentDiscIndexMounted - 1];
|
||||
OctoshockDll.shock_SetDisc(psx, currentDiscInterface.OctoshockHandle);
|
||||
}
|
||||
}
|
||||
|
||||
//if insert is requested, and valid, apply it
|
||||
if (Controller["Insert"] && CurrentDiscEjected)
|
||||
{
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
CurrentDiscEjected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
Frame++;
|
||||
|
||||
//clear drive light. itll get set to light up by sector-reading callbacks
|
||||
//TODO - debounce this by a frame or so perhaps?
|
||||
DriveLightOn = false;
|
||||
|
||||
FrameAdvance_PrepDiscState();
|
||||
|
||||
SetInput();
|
||||
|
||||
if (Controller["Eject"]) OctoshockDll.shock_OpenTray(psx);
|
||||
|
||||
//if requested disc is not matching current disc, set it now
|
||||
int discChoice = (int)Controller.GetFloat("Disc Select") - 1;
|
||||
if (discChoice >= discInterfaces.Count)
|
||||
discChoice = discInterfaces.Count - 1;
|
||||
if (discInterfaces[discChoice] != currentDiscInterface)
|
||||
{
|
||||
currentDiscInterface = discInterfaces[discChoice];
|
||||
if (!Controller["Eject"]) OctoshockDll.shock_OpenTray(psx); //open tray if needed
|
||||
OctoshockDll.shock_SetDisc(psx, currentDiscInterface.OctoshockHandle);
|
||||
}
|
||||
|
||||
if (!Controller["Eject"]) OctoshockDll.shock_CloseTray(psx);
|
||||
|
||||
var ropts = new OctoshockDll.ShockRenderOptions()
|
||||
{
|
||||
scanline_start = SystemVidStandard == OctoshockDll.eVidStandard.NTSC ? _Settings.ScanlineStart_NTSC : _Settings.ScanlineStart_PAL,
|
||||
|
@ -515,7 +556,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
}
|
||||
}
|
||||
|
||||
public ControllerDefinition ControllerDefinition { get { return DualShockController; } }
|
||||
public ControllerDefinition ControllerDefinition { get { return PSXControllerDefinition; } }
|
||||
public IController Controller { get; set; }
|
||||
|
||||
public int Frame { get; private set; }
|
||||
|
@ -638,6 +679,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
public int Frame;
|
||||
public int LagCount;
|
||||
public bool IsLagFrame;
|
||||
public bool CurrentDiscEjected;
|
||||
public int CurrentDiscIndexMounted;
|
||||
}
|
||||
|
||||
public void SaveStateText(TextWriter writer)
|
||||
|
@ -657,6 +700,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
s.ExtraData.IsLagFrame = IsLagFrame;
|
||||
s.ExtraData.LagCount = LagCount;
|
||||
s.ExtraData.Frame = Frame;
|
||||
s.ExtraData.CurrentDiscEjected = CurrentDiscEjected;
|
||||
s.ExtraData.CurrentDiscIndexMounted = CurrentDiscIndexMounted;
|
||||
|
||||
ser.Serialize(writer, s);
|
||||
// TODO write extra copy of stuff we don't use (WHY?)
|
||||
|
@ -679,6 +724,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
IsLagFrame = s.ExtraData.IsLagFrame;
|
||||
LagCount = s.ExtraData.LagCount;
|
||||
Frame = s.ExtraData.Frame;
|
||||
CurrentDiscEjected = s.ExtraData.CurrentDiscEjected;
|
||||
CurrentDiscIndexMounted = s.ExtraData.CurrentDiscIndexMounted;
|
||||
}
|
||||
|
||||
byte[] savebuff;
|
||||
|
@ -690,7 +737,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
transaction.transaction = OctoshockDll.eShockStateTransaction.BinarySize;
|
||||
int size = OctoshockDll.shock_StateTransaction(psx, ref transaction);
|
||||
savebuff = new byte[size];
|
||||
savebuff2 = new byte[savebuff.Length + 13];
|
||||
savebuff2 = new byte[savebuff.Length + 4+ 4+4+1+1+4];
|
||||
}
|
||||
|
||||
public void SaveStateBinary(BinaryWriter writer)
|
||||
|
@ -714,6 +761,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
writer.Write(IsLagFrame);
|
||||
writer.Write(LagCount);
|
||||
writer.Write(Frame);
|
||||
writer.Write(CurrentDiscEjected);
|
||||
writer.Write(CurrentDiscIndexMounted);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,6 +789,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
IsLagFrame = reader.ReadBoolean();
|
||||
LagCount = reader.ReadInt32();
|
||||
Frame = reader.ReadInt32();
|
||||
CurrentDiscEjected = reader.ReadBoolean();
|
||||
CurrentDiscIndexMounted = reader.ReadInt32();
|
||||
|
||||
//TODO - need a method to sneak the required disc, without having to do a proper eject sequence
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1262,6 +1262,7 @@ EW_EXPORT s32 shock_PowerOn(void* psx)
|
|||
{
|
||||
if(s_ShockState.power) return SHOCK_NOCANDO;
|
||||
|
||||
s_ShockState.power = true;
|
||||
PSX_Power(true);
|
||||
|
||||
return SHOCK_OK;
|
||||
|
@ -1844,9 +1845,16 @@ EW_EXPORT s32 shock_SetDisc(void* psx, ShockDiscRef* disc)
|
|||
//TODO - non-psx disc is legal here. should pass null ID to CDC setdisc
|
||||
|
||||
//analyze disc so we dont have to annoyingly manage it from client
|
||||
|
||||
//TODO - so junky
|
||||
ShockDiscInfo info;
|
||||
s32 ret = shock_AnalyzeDisc(disc,&info);
|
||||
if(ret != SHOCK_OK) return ret;
|
||||
strcpy(info.id,"\0\0\0\0");
|
||||
info.region = REGION_NONE;
|
||||
if(disc != NULL)
|
||||
{
|
||||
s32 ret = shock_AnalyzeDisc(disc,&info);
|
||||
if(ret != SHOCK_OK) return ret;
|
||||
}
|
||||
|
||||
//heres a comment from some old savestating code. something to keep in mind (maybe or maybe not a surprise depending on your point of view)
|
||||
//"Call SetDisc() BEFORE we load CDC state, since SetDisc() has emulation side effects. We might want to clean this up in the future."
|
||||
|
|
Loading…
Reference in New Issue