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
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,6 +428,8 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
{
uint buttons = 0;
if (_SyncSettings.Controllers[0].IsConnected)
{
//dualshock style
if (Controller["P1 Select"]) buttons |= 1;
if (Controller["P1 L3"]) buttons |= 2;
@ -439,7 +455,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
byte right_y = (byte)Controller.GetFloat("P1 RStick Y");
OctoshockDll.shock_Peripheral_SetPadInput(psx, 0x01, buttons, left_x, left_y, right_x, right_y);
}
if (_SyncSettings.Controllers[1].IsConnected)
{
//dualshock style
buttons = 0;
if (Controller["P2 Select"]) buttons |= 1;
@ -460,13 +479,14 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
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);
}
}
/// <summary>
/// Calculates what the output resolution would be for the given input resolution and settings
@ -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;