Add commands for applying gamepad stick and button configurations

This commit is contained in:
Jan 2021-08-22 16:18:43 +02:00
parent 8cd99235c0
commit 0875a87e26
2 changed files with 16 additions and 0 deletions

View File

@ -1265,6 +1265,18 @@ namespace Components
}
}
void Gamepad::Bind_GP_SticksConfigs_f(Command::Params* params)
{
const auto* stickConfigName = gpad_sticksConfig.get<const char*>();
Game::Cbuf_AddText(0, Utils::String::VA("exec %s\n", stickConfigName));
}
void Gamepad::Bind_GP_ButtonsConfigs_f(Command::Params* params)
{
const auto* buttonConfigName = gpad_buttonConfig.get<const char*>();
Game::Cbuf_AddText(0, Utils::String::VA("exec %s\n", buttonConfigName));
}
void Gamepad::InitDvars()
{
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_FLAG_SAVED, "Game pad enabled");
@ -1333,6 +1345,8 @@ namespace Components
Command::Add("bindaxis", Axis_Bind_f);
Command::Add("unbindallaxis", Axis_Unbindall_f);
Command::Add("bindgpsticksconfigs", Bind_GP_SticksConfigs_f);
Command::Add("bindgpbuttonsconfigs", Bind_GP_ButtonsConfigs_f);
if (Dedicated::IsEnabled())
return;

View File

@ -265,6 +265,8 @@ namespace Components
static Game::GamepadMapping StringToGamePadMapping(const char* str);
static void Axis_Bind_f(Command::Params* params);
static void Axis_Unbindall_f(Command::Params* params);
static void Bind_GP_SticksConfigs_f(Command::Params* params);
static void Bind_GP_ButtonsConfigs_f(Command::Params* params);
static void InitDvars();
static void IN_Init_Hk();