gpgx: support activator and xepp1ppxepxep1ppxep1pxepe1p1p1apexep`1p
This commit is contained in:
parent
75d4ff5117
commit
f0d846a0ba
|
@ -38,7 +38,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||
|
||||
// still working out what all the possibilities are here
|
||||
public enum ControlType
|
||||
{
|
||||
None,
|
||||
|
|
|
@ -65,10 +65,44 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
new CName("Lightgun Start", LibGPGX.INPUT_KEYS.INPUT_MENACER_START),
|
||||
};
|
||||
|
||||
static CName[] Activator =
|
||||
{
|
||||
new CName("1L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_1L),
|
||||
new CName("1U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_1U),
|
||||
new CName("2L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_2L),
|
||||
new CName("2U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_2U),
|
||||
new CName("3L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_3L),
|
||||
new CName("3U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_3U),
|
||||
new CName("4L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_4L),
|
||||
new CName("4U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_4U),
|
||||
new CName("5L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_5L),
|
||||
new CName("5U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_5U),
|
||||
new CName("6L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_6L),
|
||||
new CName("6U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_6U),
|
||||
new CName("7L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_7L),
|
||||
new CName("7U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_7U),
|
||||
new CName("8L", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_8L),
|
||||
new CName("8U", LibGPGX.INPUT_KEYS.INPUT_ACTIVATOR_8U),
|
||||
};
|
||||
|
||||
static CName[] XEA1P =
|
||||
{
|
||||
new CName("XE A", LibGPGX.INPUT_KEYS.INPUT_XE_A),
|
||||
new CName("XE B", LibGPGX.INPUT_KEYS.INPUT_XE_B),
|
||||
new CName("XE C", LibGPGX.INPUT_KEYS.INPUT_XE_C),
|
||||
new CName("XE D", LibGPGX.INPUT_KEYS.INPUT_XE_D),
|
||||
new CName("XE Start", LibGPGX.INPUT_KEYS.INPUT_XE_START),
|
||||
new CName("XE Select", LibGPGX.INPUT_KEYS.INPUT_XE_SELECT),
|
||||
new CName("XE E1", LibGPGX.INPUT_KEYS.INPUT_XE_E1),
|
||||
new CName("XE E2", LibGPGX.INPUT_KEYS.INPUT_XE_E2),
|
||||
};
|
||||
|
||||
static ControllerDefinition.FloatRange MouseRange = new ControllerDefinition.FloatRange(-512, 0, 511);
|
||||
// lightgun needs to be transformed to match the current screen resolution
|
||||
static ControllerDefinition.FloatRange LightgunRange = new ControllerDefinition.FloatRange(0, 5000, 10000);
|
||||
|
||||
static ControllerDefinition.FloatRange XEA1PRange = new ControllerDefinition.FloatRange(-128, 0, 127);
|
||||
|
||||
LibGPGX.InputData target = null;
|
||||
IController source = null;
|
||||
|
||||
|
@ -121,6 +155,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
});
|
||||
}
|
||||
|
||||
void DoXEA1PAnalog(int idx, int player)
|
||||
{
|
||||
string NX = string.Format("P{0} Stick X", player);
|
||||
string NY = string.Format("P{0} Stick Y", player);
|
||||
string NZ = string.Format("P{0} Stick Z", player);
|
||||
ControllerDef.FloatControls.Add(NX);
|
||||
ControllerDef.FloatControls.Add(NY);
|
||||
ControllerDef.FloatControls.Add(NZ);
|
||||
ControllerDef.FloatRanges.Add(XEA1PRange);
|
||||
ControllerDef.FloatRanges.Add(XEA1PRange);
|
||||
ControllerDef.FloatRanges.Add(XEA1PRange);
|
||||
Converts.Add(delegate()
|
||||
{
|
||||
target.analog[(2 * idx) + 0] = (short)(source.GetFloat(NX));
|
||||
target.analog[(2 * idx) + 1] = (short)(source.GetFloat(NY));
|
||||
// +2 is correct in how gpgx internally does this
|
||||
target.analog[(2 * idx) + 2] = (short)(source.GetFloat(NZ));
|
||||
});
|
||||
}
|
||||
|
||||
public GPGXControlConverter(LibGPGX.InputData input)
|
||||
{
|
||||
Console.WriteLine("Genesis Controller report:");
|
||||
|
@ -156,13 +210,30 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
case LibGPGX.INPUT_DEVICE.DEVICE_NONE:
|
||||
break;
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_LIGHTGUN:
|
||||
// is this always a menacer??????
|
||||
// supports menacers and justifiers
|
||||
AddToController(i, player, Lightgun);
|
||||
DoLightgunAnalog(i, player);
|
||||
player++;
|
||||
break;
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_PAD2B:
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_PADDLE:
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_SPORTSPAD:
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_TEREBI:
|
||||
throw new Exception("Master System only device? Something went wrong.");
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_ACTIVATOR:
|
||||
AddToController(i, player, Activator);
|
||||
player++;
|
||||
break;
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_XE_A1P:
|
||||
AddToController(i, player, XEA1P);
|
||||
DoXEA1PAnalog(i, player);
|
||||
player++;
|
||||
break;
|
||||
case LibGPGX.INPUT_DEVICE.DEVICE_PICO:
|
||||
// PICO isn't finished on the unmanaged side either
|
||||
throw new Exception("Sega PICO not implemented yet!");
|
||||
default:
|
||||
throw new Exception("Unhandled control device! Something needs to be implemented first.");
|
||||
throw new Exception("Unknown Genesis control device! Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue