Add gamepad reset option to menu
This commit is contained in:
parent
1bcae623b0
commit
90ff9b5b15
5 changed files with 58 additions and 4 deletions
|
|
@ -410,10 +410,7 @@ CCMD (gamepad)
|
|||
if (command == "reset")
|
||||
{
|
||||
if (set) return usage();
|
||||
sticks[pad]->SetDefaultConfig();
|
||||
sticks[pad]->SetEnabled(true);
|
||||
sticks[pad]->SetEnabledInBackground(sticks[pad]->AllowsEnabledInBackground());
|
||||
sticks[pad]->SetSensitivity(1);
|
||||
sticks[pad]->Reset();
|
||||
return;
|
||||
}
|
||||
if (command == "enabled")
|
||||
|
|
|
|||
|
|
@ -78,6 +78,14 @@ struct IJoystickConfig
|
|||
|
||||
virtual void SetDefaultConfig() = 0;
|
||||
virtual FString GetIdentifier() = 0;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
SetDefaultConfig();
|
||||
SetEnabled(true);
|
||||
SetEnabledInBackground(AllowsEnabledInBackground());
|
||||
SetSensitivity(1);
|
||||
}
|
||||
};
|
||||
|
||||
EXTERN_CVAR(Bool, use_joystick);
|
||||
|
|
|
|||
|
|
@ -188,6 +188,14 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, SetEnabledInBackground)
|
|||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(IJoystickConfig, Reset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(IJoystickConfig);
|
||||
self->Reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void UpdateJoystickMenu(IJoystickConfig *selected)
|
||||
{
|
||||
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_JoystickOptions);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue