fix device disconnect

This commit is contained in:
2022-06-07 22:07:03 +02:00
parent a983c19ec6
commit a687242145

View File

@@ -80,8 +80,21 @@ namespace PJ64Savestater
{ {
var inputCodes = new List<string>(); var inputCodes = new List<string>();
var state = new JoystickState(); var state = new JoystickState();
bool success;
try
{
curPad.Poll(); curPad.Poll();
curPad.GetCurrentState(ref state); curPad.GetCurrentState(ref state);
success = true;
}
catch (SharpDX.SharpDXException)
{
success = false;
}
if (success)
{
for (int i = 0, loopTo = state.Buttons.Length - 1; i <= loopTo; i++) for (int i = 0, loopTo = state.Buttons.Length - 1; i <= loopTo; i++)
{ {
@@ -246,6 +259,7 @@ namespace PJ64Savestater
} }
} }
} }
}
private void CheckForActions(string[] inputCodes) private void CheckForActions(string[] inputCodes)
{ {
@@ -595,7 +609,7 @@ namespace PJ64Savestater
private void radButton3_Click(object sender, EventArgs e) private void radButton3_Click(object sender, EventArgs e)
{ {
var sfd_SaveInputProfile = new SaveFileDialog var sfd_SaveInputProfile = new RadSaveFileDialog
{ {
Filter = FILTER_INPUTPROFILE Filter = FILTER_INPUTPROFILE
}; };
@@ -605,7 +619,7 @@ namespace PJ64Savestater
private void radButton4_Click(object sender, EventArgs e) private void radButton4_Click(object sender, EventArgs e)
{ {
var ofd_SaveInputProfile = new OpenFileDialog var ofd_SaveInputProfile = new RadOpenFileDialog
{ {
Filter = FILTER_INPUTPROFILE Filter = FILTER_INPUTPROFILE
}; };