Add NES Reset and Power as remappable controller buttons, remapping not hooked up to old config dialog, new config dialog - start console button remapping still has some bugs

This commit is contained in:
adelikat 2012-11-06 03:27:24 +00:00
parent ec82f11884
commit e7f3abdfc3
5 changed files with 64 additions and 2 deletions

View File

@ -172,6 +172,9 @@
<Compile Include="config\ControllerConfig\GamepadConfigPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="config\ControllerConfig\NESConsoleButtons.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="config\ControllerConfig\NESGamePad.cs">
<SubType>Component</SubType>
</Compile>

View File

@ -627,6 +627,7 @@ namespace BizHawk.MultiClient
public string SmsReset = "C";
public string SmsPause = "V, X1 Start";
public SMSControllerTemplate[] SMSController = new SMSControllerTemplate[2];
public SMSControllerTemplate[] SMSAutoController = new SMSControllerTemplate[2];
@ -653,7 +654,6 @@ namespace BizHawk.MultiClient
public ColecoVisionControllerTemplate ColecoController = new ColecoVisionControllerTemplate(true);
//NES settings
//public string NESReset = "Backspace";
public NESControllerTemplate[] NESController = new NESControllerTemplate[4];
public NESControllerTemplate[] NESAutoController = new NESControllerTemplate[4];
@ -709,6 +709,10 @@ namespace BizHawk.MultiClient
public bool Atari2600_ShowMissle2 = true;
public bool Atari2600_ShowBall = true;
public bool Atari2600_ShowPlayfield = true;
//NES Console buttons
public string NESReset = "";
public string NESPower = "";
}
public class SMSControllerTemplate

View File

@ -829,7 +829,6 @@ namespace BizHawk.MultiClient
}
Global.AutofireSNESControls = asnesControls;
var nesControls = new Controller(NES.NESController);
for (int i = 0; i < 2 /*TODO*/; i++)
{
@ -842,6 +841,10 @@ namespace BizHawk.MultiClient
nesControls.BindMulti("P" + (i + 1) + " Select", Global.Config.NESController[i].Select);
nesControls.BindMulti("P" + (i + 1) + " Start", Global.Config.NESController[i].Start);
}
nesControls.BindMulti("Reset", Global.Config.NESReset);
nesControls.BindMulti("Power", Global.Config.NESPower);
Global.NESControls = nesControls;
var anesControls = new AutofireController(NES.NESController);

View File

@ -103,6 +103,7 @@
this.NESAutofire2Panel = new BizHawk.MultiClient.NESGamePad();
this.NESAutofire3Panel = new BizHawk.MultiClient.NESGamePad();
this.NESAutofire4Panel = new BizHawk.MultiClient.NESGamePad();
this.NESConsolePad = new BizHawk.MultiClient.NESConsoleButtons();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabControl2.SuspendLayout();
@ -110,6 +111,7 @@
this.tabPage14.SuspendLayout();
this.tabPage15.SuspendLayout();
this.tabPage16.SuspendLayout();
this.tabPage17.SuspendLayout();
this.tabPage18.SuspendLayout();
this.tabPage19.SuspendLayout();
this.tabPage20.SuspendLayout();
@ -224,6 +226,7 @@
//
// tabPage17
//
this.tabPage17.Controls.Add(this.NESConsolePad);
this.tabPage17.Location = new System.Drawing.Point(4, 22);
this.tabPage17.Name = "tabPage17";
this.tabPage17.Size = new System.Drawing.Size(445, 378);
@ -891,6 +894,13 @@
this.NESAutofire4Panel.Size = new System.Drawing.Size(392, 332);
this.NESAutofire4Panel.TabIndex = 0;
//
// NESConsolePad
//
this.NESConsolePad.Location = new System.Drawing.Point(14, 13);
this.NESConsolePad.Name = "NESConsolePad";
this.NESConsolePad.Size = new System.Drawing.Size(392, 332);
this.NESConsolePad.TabIndex = 1;
//
// ControllerConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -911,6 +921,7 @@
this.tabPage14.ResumeLayout(false);
this.tabPage15.ResumeLayout(false);
this.tabPage16.ResumeLayout(false);
this.tabPage17.ResumeLayout(false);
this.tabPage18.ResumeLayout(false);
this.tabPage19.ResumeLayout(false);
this.tabPage20.ResumeLayout(false);
@ -1010,5 +1021,6 @@
private NESGamePad NESAutofire2Panel;
private NESGamePad NESAutofire3Panel;
private NESGamePad NESAutofire4Panel;
private NESConsoleButtons NESConsolePad;
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Reflection;
namespace BizHawk.MultiClient
{
class NESConsoleButtons : GamepadConfigPanel
{
public NESConsoleButtons()
{
buttons = new List<string> { "Power", "Reset"};
Startup();
}
public override void Save()
{
for (int button = 0; button < buttons.Count; button++)
{
NESControllerTemplate o = Global.Config.NESController[ControllerNumber - 1];
FieldInfo buttonF = o.GetType().GetField(buttons[button]);
buttonF.SetValue(o, Inputs[button].Text);
}
}
public void Load()
{
for (int button = 0; button < buttons.Count; button++)
{
NESControllerTemplate o = Global.Config.NESController[ControllerNumber - 1];
FieldInfo buttonF = o.GetType().GetField(buttons[button]);
object field = o.GetType().GetField(buttons[button]).GetValue(o);
Inputs[button].Text = field.ToString();
}
}
}
}