Virtualpad misc cleanups

This commit is contained in:
adelikat 2017-05-24 09:07:03 -05:00
parent 47f2371953
commit 50b5f4a1a9
18 changed files with 63 additions and 53 deletions

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
void Set(IController controller);
/// <summary>
/// Gets or sets whether or not the user can change the state of the control
/// Gets or sets a value indicating whether or not the user can change the state of the control
/// </summary>
bool ReadOnly { get; set; }
}

View File

@ -179,15 +179,29 @@ namespace BizHawk.Client.EmuHawk
private void UpdateTickFrequency()
{
if (AnalogTrackBar == null) return;
//try to base it on the width, lets make a tick every 10 pixels at the minimum
if (AnalogTrackBar == null)
{
return;
}
// try to base it on the width, lets make a tick every 10 pixels at the minimum
int canDoTicks = AnalogTrackBar.Width / 10;
if (canDoTicks < 2) canDoTicks = 2;
if (canDoTicks < 2)
{
canDoTicks = 2;
}
int range = _maxValue - _minValue + 1;
if (range < canDoTicks)
{
canDoTicks = range;
}
if (canDoTicks <= 0)
{
canDoTicks = 1;
}
AnalogTrackBar.TickFrequency = range / canDoTicks;
}
@ -242,6 +256,7 @@ namespace BizHawk.Client.EmuHawk
_programmaticallyChangingValue = false;
}
}
protected override void OnPaint(PaintEventArgs e)
{
RefreshWidgets();

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
switch ((core as Atari7800).ControlAdapter.ControlType.Name)
switch (((Atari7800)core).ControlAdapter.ControlType.Name)
{
case "Atari 7800 Joystick Controller":
yield return JoystickController(1);
@ -37,7 +37,6 @@ namespace BizHawk.Client.EmuHawk
break;
}
yield return ConsoleButtons();
}
@ -197,7 +196,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " HPos",
}

View File

@ -402,7 +402,6 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(315, 90),
Type = PadSchema.PadInputType.Boolean
},
/************************** Row 5 **************************/
@ -427,7 +426,6 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(96, 114),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{

View File

@ -20,7 +20,8 @@ namespace BizHawk.Client.EmuHawk
{
break;
}
else if (ports[i] == typeof(StandardController))
if (ports[i] == typeof(StandardController))
{
yield return StandardController(i + 1);
}
@ -181,7 +182,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema TurboController(int controller)
private static PadSchema TurboController(int controller)
{
return new PadSchema
{
@ -213,7 +214,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema SuperActionController(int controller)
private static PadSchema SuperActionController(int controller)
{
return new PadSchema
{

View File

@ -3,7 +3,7 @@ using System.Drawing;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk.tools.VirtualPads.schema
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("DGB")]
public class DualGBSchema : IVirtualPadSchema
@ -86,5 +86,4 @@ namespace BizHawk.Client.EmuHawk.tools.VirtualPads.schema
};
}
}
}

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons();
}
public static PadSchema StandardController()
private static PadSchema StandardController()
{
return new PadSchema
{

View File

@ -48,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons();
}
public static PadSchema ThreeButtonController(int controller)
private static PadSchema ThreeButtonController(int controller)
{
return new PadSchema
{
@ -120,7 +120,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema SixButtonController(int controller)
private static PadSchema SixButtonController(int controller)
{
return new PadSchema
{
@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema LightGun(int controller)
private static PadSchema LightGun(int controller)
{
return new PadSchema
{
@ -229,7 +229,7 @@ namespace BizHawk.Client.EmuHawk
Type = PadSchema.PadInputType.TargetedPair,
MaxValue = 10000,
TargetSize = new Size(320, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Lightgun Y",
}
@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema Mouse(int controller)
private static PadSchema Mouse(int controller)
{
return new PadSchema
{
@ -268,7 +268,7 @@ namespace BizHawk.Client.EmuHawk
Type = PadSchema.PadInputType.AnalogStick,
MaxValue = 255,
TargetSize = new Size(520, 570),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Mouse Y",
}
@ -305,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema ConsoleButtons()
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
@ -332,7 +332,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema Activator(int controller)
private static PadSchema Activator(int controller)
{
return new PadSchema
{
@ -411,7 +411,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema XE1AP(int controller)
private static PadSchema XE1AP(int controller)
{
return new PadSchema
{

View File

@ -10,9 +10,9 @@ namespace BizHawk.Client.EmuHawk
[SchemaAttributes("INTV")]
public class IntvSchema : IVirtualPadSchema
{
private string UnpluggedControllerName { get { return typeof(UnpluggedController).DisplayName(); } }
private string StandardControllerName { get { return typeof(StandardController).DisplayName(); } }
private string AnalogControllerName { get { return typeof(FakeAnalogController).DisplayName(); } }
private string UnpluggedControllerName => typeof(UnpluggedController).DisplayName();
private string StandardControllerName => typeof(StandardController).DisplayName();
private string AnalogControllerName => typeof(FakeAnalogController).DisplayName();
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{

View File

@ -6,7 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("Lynx")]
public class LYNXSchema : IVirtualPadSchema
public class LynxSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
//yield return ConsoleButtons();
}
public static PadSchema StandardController()
private static PadSchema StandardController()
{
return new PadSchema
{

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public static PadSchema StandardController(int controller)
private static PadSchema StandardController(int controller)
{
return new PadSchema
{

View File

@ -16,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
{
if (core is NES)
{
var nes = core as NES;
var nes = (NES)core;
var ss = nes.GetSyncSettings();
var isFds = nes.IsFDS;
@ -46,7 +46,6 @@ namespace BizHawk.Client.EmuHawk
case "OekaKids":
yield return OekaKidsTablet(3);
break;
}
}
else
@ -129,7 +128,7 @@ namespace BizHawk.Client.EmuHawk
var ss = ((QuickNES)core).GetSyncSettings();
if (ss.LeftPortConnected == true && ss.RightPortConnected == true)
{
//Set both controllers
// Set both controllers
yield return StandardController(1);
yield return StandardController(2);
}
@ -141,6 +140,7 @@ namespace BizHawk.Client.EmuHawk
{
yield return StandardController(1);
}
yield return NesConsoleButtons();
}
}
@ -383,7 +383,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Zapper Y",
}
@ -543,7 +543,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Pen Y",
}

View File

@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
var psx = ((Octoshock)core);
var psx = (Octoshock)core;
var settings = psx.GetSyncSettings();
var fioConfig = settings.FIOConfig.ToLogical();
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons(psx);
}
public static PadSchema DualShockController(int controller)
private static PadSchema DualShockController(int controller)
{
return new PadSchema
{
@ -202,7 +202,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema GamePadController(int controller)
private static PadSchema GamePadController(int controller)
{
return new PadSchema
{
@ -456,12 +456,12 @@ namespace BizHawk.Client.EmuHawk
},
new PadSchema.ButtonSchema
{
Name = "Disc Select", //not really, but shuts up a warning
Name = "Disc Select", // not really, but shuts up a warning
Type = PadSchema.PadInputType.DiscManager,
Location = new Point(10,54),
TargetSize = new Size(300,300),
Location = new Point(10, 54),
TargetSize = new Size(300, 300),
OwnerEmulator = psx,
SecondaryNames = new [] { "Open", "Close", "Disc Select" }
SecondaryNames = new[] { "Open", "Close", "Disc Select" }
}
}
};

View File

@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public static PadSchema StandardController(int controller)
private static PadSchema StandardController(int controller)
{
return new PadSchema
{

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
yield return ConsoleButtons();
}
public static PadSchema StandardController(int controller)
private static PadSchema StandardController(int controller)
{
return new PadSchema
{

View File

@ -6,7 +6,7 @@ namespace BizHawk.Client.EmuHawk
public class SchemaAttributes : Attribute
{
/// <summary>
/// The system id associated with this schema
/// Gets the system id associated with this schema
/// </summary>
public string SystemId { get; private set; }

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
if ((core as SMS).IsGameGear)
if (((SMS)core).IsGameGear)
{
yield return GGController(1);
yield return GGConsoleButtons();
@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public static PadSchema StandardController(int controller)
private static PadSchema StandardController(int controller)
{
return new PadSchema
{
@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
};
}
public static PadSchema GGController(int controller)
private static PadSchema GGController(int controller)
{
return new PadSchema
{

View File

@ -36,7 +36,6 @@ namespace BizHawk.Client.EmuHawk
for (int j = 0; j < 4; j++)
{
yield return StandardController(playerNum + j);
}
offset += 3;
@ -118,8 +117,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(174, 10),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Select",
@ -222,7 +220,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Scope Y",
}
@ -275,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new []
SecondaryNames = new[]
{
"P" + controller + " Justifier Y",
}