PSX - disable controller config settings because something stupid is causing a stupid crash

This commit is contained in:
adelikat 2015-01-31 21:00:30 +00:00
parent 8222028169
commit 4b6ce6450e
1 changed files with 79 additions and 52 deletions

View File

@ -68,6 +68,11 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
private void SetControllerButtons()
{
// adelikat: ARG, stupid Disc Select hack gets set from something assuming controllers, so I'm disabling this here
_SyncSettings.Controllers[0].IsConnected = true;
_SyncSettings.Controllers[1].IsConnected = true;
return;
ControllerDefinition.BoolButtons.Clear();
ControllerDefinition.FloatControls.Clear();
@ -351,6 +356,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
frameBuffer = new int[BufferWidth * BufferHeight];
}
SetControllerButtons();
if (discInterfaces.Count != 0)
{
//start with first disc inserted and tray closed. it's a sensible default.
@ -371,13 +378,20 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
}
//connect two dualshocks, thats all we're doing right now
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.DualShock);
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, OctoshockDll.ePeripheralType.DualShock);
if (_SyncSettings.Controllers[0].IsConnected)
{
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.DualShock);
}
if (_SyncSettings.Controllers[1].IsConnected)
{
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, OctoshockDll.ePeripheralType.DualShock);
}
//do this after framebuffers and peripherals and whatever crap are setup. kind of lame, but thats how it is for now
StudySaveBufferSize();
SetControllerButtons();
OctoshockDll.shock_PowerOn(psx);
}
@ -414,58 +428,64 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
{
uint buttons = 0;
//dualshock style
if (Controller["P1 Select"]) buttons |= 1;
if (Controller["P1 L3"]) buttons |= 2;
if (Controller["P1 R3"]) buttons |= 4;
if (Controller["P1 Start"]) buttons |= 8;
if (Controller["P1 Up"]) buttons |= 16;
if (Controller["P1 Right"]) buttons |= 32;
if (Controller["P1 Down"]) buttons |= 64;
if (Controller["P1 Left"]) buttons |= 128;
if (Controller["P1 L2"]) buttons |= 256;
if (Controller["P1 R2"]) buttons |= 512;
if (Controller["P1 L1"]) buttons |= 1024;
if (Controller["P1 R1"]) buttons |= 2048;
if (Controller["P1 Triangle"]) buttons |= 4096;
if (Controller["P1 Circle"]) buttons |= 8192;
if (Controller["P1 Cross"]) buttons |= 16384;
if (Controller["P1 Square"]) buttons |= 32768;
if (Controller["P1 MODE"]) buttons |= 65536;
if (_SyncSettings.Controllers[0].IsConnected)
{
//dualshock style
if (Controller["P1 Select"]) buttons |= 1;
if (Controller["P1 L3"]) buttons |= 2;
if (Controller["P1 R3"]) buttons |= 4;
if (Controller["P1 Start"]) buttons |= 8;
if (Controller["P1 Up"]) buttons |= 16;
if (Controller["P1 Right"]) buttons |= 32;
if (Controller["P1 Down"]) buttons |= 64;
if (Controller["P1 Left"]) buttons |= 128;
if (Controller["P1 L2"]) buttons |= 256;
if (Controller["P1 R2"]) buttons |= 512;
if (Controller["P1 L1"]) buttons |= 1024;
if (Controller["P1 R1"]) buttons |= 2048;
if (Controller["P1 Triangle"]) buttons |= 4096;
if (Controller["P1 Circle"]) buttons |= 8192;
if (Controller["P1 Cross"]) buttons |= 16384;
if (Controller["P1 Square"]) buttons |= 32768;
if (Controller["P1 MODE"]) buttons |= 65536;
byte left_x = (byte)Controller.GetFloat("P1 LStick X");
byte left_y = (byte)Controller.GetFloat("P1 LStick Y");
byte right_x = (byte)Controller.GetFloat("P1 RStick X");
byte right_y = (byte)Controller.GetFloat("P1 RStick Y");
byte left_x = (byte)Controller.GetFloat("P1 LStick X");
byte left_y = (byte)Controller.GetFloat("P1 LStick Y");
byte right_x = (byte)Controller.GetFloat("P1 RStick X");
byte right_y = (byte)Controller.GetFloat("P1 RStick Y");
OctoshockDll.shock_Peripheral_SetPadInput(psx, 0x01, buttons, left_x, left_y, right_x, right_y);
OctoshockDll.shock_Peripheral_SetPadInput(psx, 0x01, buttons, left_x, left_y, right_x, right_y);
}
//dualshock style
buttons = 0;
if (Controller["P2 Select"]) buttons |= 1;
if (Controller["P2 L3"]) buttons |= 2;
if (Controller["P2 R3"]) buttons |= 4;
if (Controller["P2 Start"]) buttons |= 8;
if (Controller["P2 Up"]) buttons |= 16;
if (Controller["P2 Right"]) buttons |= 32;
if (Controller["P2 Down"]) buttons |= 64;
if (Controller["P2 Left"]) buttons |= 128;
if (Controller["P2 L2"]) buttons |= 256;
if (Controller["P2 R2"]) buttons |= 512;
if (Controller["P2 L1"]) buttons |= 1024;
if (Controller["P2 R1"]) buttons |= 2048;
if (Controller["P2 Triangle"]) buttons |= 4096;
if (Controller["P2 Circle"]) buttons |= 8192;
if (Controller["P2 Cross"]) buttons |= 16384;
if (Controller["P2 Square"]) buttons |= 32768;
if (Controller["P2 MODE"]) buttons |= 65536;
if (_SyncSettings.Controllers[1].IsConnected)
{
//dualshock style
buttons = 0;
if (Controller["P2 Select"]) buttons |= 1;
if (Controller["P2 L3"]) buttons |= 2;
if (Controller["P2 R3"]) buttons |= 4;
if (Controller["P2 Start"]) buttons |= 8;
if (Controller["P2 Up"]) buttons |= 16;
if (Controller["P2 Right"]) buttons |= 32;
if (Controller["P2 Down"]) buttons |= 64;
if (Controller["P2 Left"]) buttons |= 128;
if (Controller["P2 L2"]) buttons |= 256;
if (Controller["P2 R2"]) buttons |= 512;
if (Controller["P2 L1"]) buttons |= 1024;
if (Controller["P2 R1"]) buttons |= 2048;
if (Controller["P2 Triangle"]) buttons |= 4096;
if (Controller["P2 Circle"]) buttons |= 8192;
if (Controller["P2 Cross"]) buttons |= 16384;
if (Controller["P2 Square"]) buttons |= 32768;
if (Controller["P2 MODE"]) buttons |= 65536;
left_x = (byte)Controller.GetFloat("P2 LStick X");
left_y = (byte)Controller.GetFloat("P2 LStick Y");
right_x = (byte)Controller.GetFloat("P2 RStick X");
right_y = (byte)Controller.GetFloat("P2 RStick Y");
byte left_x = (byte)Controller.GetFloat("P2 LStick X");
byte left_y = (byte)Controller.GetFloat("P2 LStick Y");
byte right_x = (byte)Controller.GetFloat("P2 RStick X");
byte right_y = (byte)Controller.GetFloat("P2 RStick Y");
OctoshockDll.shock_Peripheral_SetPadInput(psx, 0x02, buttons, left_x, left_y, right_x, right_y);
OctoshockDll.shock_Peripheral_SetPadInput(psx, 0x02, buttons, left_x, left_y, right_x, right_y);
}
}
/// <summary>
@ -524,8 +544,15 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
)
{
//dont replace default disc with the leave-default placeholder!
if (requestedDisc == -1) { }
else CurrentDiscIndexMounted = requestedDisc;
if (requestedDisc == -1)
{
}
else
{
CurrentDiscIndexMounted = requestedDisc;
}
if (CurrentDiscIndexMounted == 0)
{
currentDiscInterface = null;