1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-28 23:06:41 +00:00

Revert "Ability to unbind controls in settings menu"

This reverts commit 0836680e36.

To prevent crashes on empty input bindings config.
This commit is contained in:
elsid 2024-08-21 00:13:27 +02:00
parent 6a5bc9f992
commit ca2bacd47a
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -79,12 +79,7 @@ namespace MWInput
// Disallow binding escape key // Disallow binding escape key
if (key == SDL_SCANCODE_ESCAPE) if (key == SDL_SCANCODE_ESCAPE)
{ {
// Unbind if esc pressed // Stop binding if esc pressed
if (mDetectingKeyboard)
clearAllKeyBindings(mInputBinder, control);
else
clearAllControllerBindings(mInputBinder, control);
control->setInitialValue(0.0f);
mInputBinder->cancelDetectingBindingState(); mInputBinder->cancelDetectingBindingState();
MWBase::Environment::get().getWindowManager()->notifyInputActionBound(); MWBase::Environment::get().getWindowManager()->notifyInputActionBound();
return; return;
@ -161,13 +156,6 @@ namespace MWInput
return; return;
clearAllControllerBindings(mInputBinder, control); clearAllControllerBindings(mInputBinder, control);
control->setInitialValue(0.0f); control->setInitialValue(0.0f);
if (button == SDL_CONTROLLER_BUTTON_START)
{
// Disallow rebinding SDL_CONTROLLER_BUTTON_START - it is used to open main and without it is not
// even possible to exit the game (or change the binding back).
mInputBinder->cancelDetectingBindingState();
}
else
ICS::DetectingBindingListener::joystickButtonBindingDetected(ICS, deviceID, control, button, direction); ICS::DetectingBindingListener::joystickButtonBindingDetected(ICS, deviceID, control, button, direction);
MWBase::Environment::get().getWindowManager()->notifyInputActionBound(); MWBase::Environment::get().getWindowManager()->notifyInputActionBound();
} }
@ -192,11 +180,8 @@ namespace MWInput
mListener = std::make_unique<BindingsListener>(mInputBinder.get(), this); mListener = std::make_unique<BindingsListener>(mInputBinder.get(), this);
mInputBinder->setDetectingBindingListener(mListener.get()); mInputBinder->setDetectingBindingListener(mListener.get());
if (!userFileExists)
{
loadKeyDefaults(); loadKeyDefaults();
loadControllerDefaults(); loadControllerDefaults();
}
for (int i = 0; i < A_Last; ++i) for (int i = 0; i < A_Last; ++i)
{ {