psx - revise disc switch schema stuff; add MinValue support to analog button and tweak the pip positioning
This commit is contained in:
parent
14e2b280ac
commit
c43dd9fc34
|
@ -99,6 +99,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
DisplayName = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Size = button.TargetSize,
|
||||
MinValue = button.MinValue,
|
||||
MaxValue = button.MaxValue
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class VirtualPadAnalogButton : UserControl, IVirtualPadControl
|
||||
{
|
||||
private string _displayName = string.Empty;
|
||||
private int _maxValue;
|
||||
private int _maxValue, _minValue;
|
||||
private bool _programmaticallyChangingValue;
|
||||
private bool _readonly;
|
||||
|
||||
|
@ -130,11 +130,43 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (AnalogTrackBar != null)
|
||||
{
|
||||
AnalogTrackBar.Maximum = _maxValue;
|
||||
AnalogTrackBar.TickFrequency = _maxValue / 10;
|
||||
UpdateTickFrequency();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MinValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _minValue;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_minValue = value;
|
||||
if (AnalogTrackBar != null)
|
||||
{
|
||||
AnalogTrackBar.Minimum = _minValue;
|
||||
UpdateTickFrequency();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTickFrequency()
|
||||
{
|
||||
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;
|
||||
int range = _maxValue - _minValue + 1;
|
||||
if (range < canDoTicks)
|
||||
canDoTicks = range;
|
||||
if (canDoTicks <= 0)
|
||||
canDoTicks = 1;
|
||||
AnalogTrackBar.TickFrequency = range / canDoTicks;
|
||||
}
|
||||
|
||||
public int CurrentValue
|
||||
{
|
||||
get
|
||||
|
|
|
@ -12,16 +12,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
public IEnumerable<PadSchema> GetPadSchemas()
|
||||
{
|
||||
yield return DualShockController(1);
|
||||
yield return ConsoleButtons();
|
||||
yield return ConsoleButtons();
|
||||
}
|
||||
|
||||
public static PadSchema DualShockController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(420, 260),
|
||||
Buttons = new[]
|
||||
public static PadSchema DualShockController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(420, 260),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
|
@ -151,7 +151,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,
|
||||
|
@ -160,9 +160,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
Type = PadSchema.PadInputType.AnalogStick
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
private static PadSchema ConsoleButtons()
|
||||
};
|
||||
}
|
||||
private static PadSchema ConsoleButtons()
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
|
@ -185,13 +185,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
Location = new Point(60, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "Disc Switch",
|
||||
MaxValue = 50,
|
||||
DisplayName = "",
|
||||
Name = "Disc Select",
|
||||
MinValue = 1,
|
||||
MaxValue = 5,
|
||||
DisplayName = "Disc Select",
|
||||
Location = new Point(10, 40),
|
||||
Type = PadSchema.PadInputType.AnalogStick
|
||||
TargetSize = new Size(300,100),
|
||||
Type = PadSchema.PadInputType.FloatSingle
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Size TargetSize { get; set; } // Specifically for TargetedPair, specifies the screen size
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
"P1 LStick X", "P1 LStick Y", "P1 RStick X", "P1 RStick Y",
|
||||
//"P2 LStick X", "P2 LStick Y", "P2 RStick X", "P2 RStick Y",
|
||||
//TODO: Fix "Disc Switch",
|
||||
"Disc Select",
|
||||
},
|
||||
FloatRanges =
|
||||
{
|
||||
|
@ -50,6 +51,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
new[] {255.0f, 128.0f, 0.0f},
|
||||
new[] {0.0f, 128.0f, 255.0f},
|
||||
new[] {255.0f, 128.0f, 0.0f},
|
||||
new[] {1.0f,1.0f,5.0f},
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
};
|
||||
|
||||
|
||||
public enum ePeripheralType
|
||||
public enum ePeripheralType : int
|
||||
{
|
||||
None = 0, //can be used to signify disconnection
|
||||
|
||||
|
@ -143,63 +143,62 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate int ShockDisc_ReadLBA(IntPtr opaque, int lba, void* dst);
|
||||
|
||||
[DllImport(dd)]
|
||||
[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)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_DestroyDisc(IntPtr disc);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_AnalyzeDisc(IntPtr disc, out ShockDiscInfo info);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_Create(out IntPtr psx, eRegion region, void* firmware512k);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_Destroy(IntPtr psx);
|
||||
|
||||
[DllImport(dd)]
|
||||
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_Peripheral_Connect(
|
||||
IntPtr psx,
|
||||
int address,
|
||||
[MarshalAs(UnmanagedType.I4)] ePeripheralType type
|
||||
);
|
||||
|
||||
[DllImport(dd)]
|
||||
[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)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_Peripheral_MemcardTransact(IntPtr psx, int address, ref ShockMemcardTransaction transaction);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_MountEXE(IntPtr psx, void* exebuf, int size);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_PowerOn(IntPtr psx);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_PowerOff(IntPtr psx);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_OpenTray(IntPtr psx);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_SetDisc(IntPtr psx, IntPtr disc);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_CloseTray(IntPtr psx);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_Step(IntPtr psx, eShockStep step);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_GetFramebuffer(IntPtr psx, ref ShockFramebufferInfo fb);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_GetSamples(IntPtr psx, void* buffer);
|
||||
|
||||
[DllImport(dd)]
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern int shock_GetMemData(
|
||||
IntPtr psx,
|
||||
out IntPtr ptr,
|
||||
|
|
Loading…
Reference in New Issue