|
|
|
@ -54,8 +54,88 @@ std::vector<std::string>InputGroup::menuInputGroups; |
|
|
|
|
std::vector<std::string>InputGroup::gameplayInputGroups; |
|
|
|
|
std::array<InputHandle_t,16>Input::steamControllers; |
|
|
|
|
uint8_t Input::activeSteamControllerIndex; |
|
|
|
|
uint8_t Input::controllerCount{0}; |
|
|
|
|
|
|
|
|
|
std::array<std::unordered_map<Steam::SteamInput,std::pair<std::string,HWButton>>,16>Input::enumToActionName; |
|
|
|
|
std::unordered_map<EInputActionOrigin,std::string>Input::steamIconToGameIcon{ |
|
|
|
|
{k_EInputActionOrigin_SteamController_A,"themes/button_d_xb.png"},
|
|
|
|
|
{k_EInputActionOrigin_XBoxOne_A,"themes/button_d_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_A,"themes/button_d_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_A,"themes/button_d_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_JoyConButton_S,"themes/button_d_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_A,"themes/button_d_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_B,"themes/button_r_xb.png"},
|
|
|
|
|
{k_EInputActionOrigin_XBoxOne_B,"themes/button_r_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_B,"themes/button_r_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_B,"themes/button_r_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_JoyConButton_W,"themes/button_r_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_B,"themes/button_r_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_X,"themes/button_l_xb.png"},
|
|
|
|
|
{k_EInputActionOrigin_XBoxOne_X,"themes/button_l_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_X,"themes/button_l_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_X,"themes/button_l_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_JoyConButton_E,"themes/button_l_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_X,"themes/button_l_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_Y,"themes/button_u_xb.png"},
|
|
|
|
|
{k_EInputActionOrigin_XBoxOne_Y,"themes/button_u_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_Y,"themes/button_u_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_Y,"themes/button_u_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_JoyConButton_N,"themes/button_u_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_Y,"themes/button_u_xb.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_LeftBumper,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_LeftBumper,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_LeftBumper,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_LeftBumper,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_LeftBumper,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_L1,"themes/button_l1.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_RightBumper,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_RightBumper,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_RightBumper,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_RightBumper,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_RightBumper,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_R1,"themes/button_r1.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_RightTrigger_Pull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_RightTrigger_Pull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_RightTrigger_Pull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_RightTrigger_Pull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_RightTrigger_Pull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_R2_SoftPull,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_RightTrigger_Click,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_RightTrigger_Click,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_RightTrigger_Click,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_RightTrigger_Click,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_RightTrigger_Click,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_R2,"themes/button_r2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_LeftTrigger_Pull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_LeftTrigger_Pull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Pull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_LeftTrigger_Pull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_LeftTrigger_Pull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_L2_SoftPull,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_LeftTrigger_Click,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_LeftTrigger_Click,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Click,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_LeftTrigger_Click,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_LeftTrigger_Click,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_L2,"themes/button_l2.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_X,"themes/button_d_ps.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_Circle,"themes/button_r_ps.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_Triangle,"themes/button_u_ps.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_Square,"themes/button_l_ps.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamController_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS4_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBoxOne_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_XBox360_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_Switch_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS5_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_PS5_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_LeftStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
{k_EInputActionOrigin_SteamDeck_RightStick_Move,"themes/button_analogstick.png"}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Input::Input(InputType type,int key) |
|
|
|
|
:type(type),key(key){} |
|
|
|
@ -90,9 +170,25 @@ void Input::Initialize(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Input::LoadSteamButtonIcons(){ |
|
|
|
|
GFX.Unlock(); |
|
|
|
|
std::cout<<std::format("Steam Icons may be required... Loading in {} icons",int(k_EInputActionOrigin_Count))<<std::endl; |
|
|
|
|
for(int i=1;i<k_EInputActionOrigin_Count;i++){ |
|
|
|
|
const char*imageName{SteamInput()->GetGlyphPNGForActionOrigin(EInputActionOrigin(i),k_ESteamInputGlyphSize_Small,0U)}; |
|
|
|
|
if(imageName!=nullptr){ |
|
|
|
|
std::string loadImage{imageName}; |
|
|
|
|
if(loadImage.length()>0&&!GFX.count(loadImage)){ |
|
|
|
|
std::cout<<std::format("Loading steam image {}",loadImage)<<std::endl; |
|
|
|
|
GFX[loadImage].Load(loadImage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
GFX.SetInitialized(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Input::UpdateSteamInput(){ |
|
|
|
|
if(SteamInput()){ |
|
|
|
|
int controllerCount=SteamInput()->GetConnectedControllers(steamControllers.data()); |
|
|
|
|
controllerCount=SteamInput()->GetConnectedControllers(steamControllers.data()); |
|
|
|
|
for(int i=0;i<controllerCount;i++){ |
|
|
|
|
for(auto&[input,data]:enumToActionName[i]){ |
|
|
|
|
HWButton prevState=data.second; |
|
|
|
@ -232,7 +328,34 @@ float Input::Analog(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
for(int i=0;i<controllerCount;i++){ |
|
|
|
|
switch(static_cast<GPAxes>(key)){ |
|
|
|
|
case GPAxes::LX:{ |
|
|
|
|
InputDigitalActionHandle_t inputHnd=SteamInput()->GetDigitalActionHandle(""); |
|
|
|
|
}break; |
|
|
|
|
case GPAxes::LY:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::RX:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::RY:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::TL:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::TR:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::DX:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
case GPAxes::DY:{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case KEY: |
|
|
|
|