Retrieve Steam icons from steam platform files. Update official controller configs. Release Build 8290.

pull/57/head
sigonasr2 8 months ago
parent bdad7cf186
commit 3be02315a5
  1. 1
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 125
      Adventures in Lestoria/Key.cpp
  3. 7
      Adventures in Lestoria/Key.h
  4. 2
      Adventures in Lestoria/Version.h
  5. 167
      Adventures in Lestoria/controller_config/controller_switch_pro.vdf
  6. 194
      Adventures in Lestoria/controller_config/controller_xbox360.vdf
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -326,6 +326,7 @@ bool AiL::OnUserCreate(){
if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it. if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
if(Steam_Init()){ if(Steam_Init()){
std::cout<<"Steam API Initialized successfully!"<<std::endl; std::cout<<"Steam API Initialized successfully!"<<std::endl;
Input::LoadSteamButtonIcons();
}else{ }else{
std::cout<<"Steam API failed to initialize!"<<std::endl; std::cout<<"Steam API failed to initialize!"<<std::endl;
} }

@ -54,8 +54,88 @@ std::vector<std::string>InputGroup::menuInputGroups;
std::vector<std::string>InputGroup::gameplayInputGroups; std::vector<std::string>InputGroup::gameplayInputGroups;
std::array<InputHandle_t,16>Input::steamControllers; std::array<InputHandle_t,16>Input::steamControllers;
uint8_t Input::activeSteamControllerIndex; 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::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) Input::Input(InputType type,int key)
:type(type),key(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(){ void Input::UpdateSteamInput(){
if(SteamInput()){ if(SteamInput()){
int controllerCount=SteamInput()->GetConnectedControllers(steamControllers.data()); controllerCount=SteamInput()->GetConnectedControllers(steamControllers.data());
for(int i=0;i<controllerCount;i++){ for(int i=0;i<controllerCount;i++){
for(auto&[input,data]:enumToActionName[i]){ for(auto&[input,data]:enumToActionName[i]){
HWButton prevState=data.second; HWButton prevState=data.second;
@ -232,7 +328,34 @@ float Input::Analog(){
} }
} }
}else{ }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; }break;
case KEY: case KEY:

@ -63,7 +63,7 @@ namespace Steam{
enum SteamInput{ enum SteamInput{
//Gameplay Inputs //Gameplay Inputs
MOVE, //This is the left stick analog input. Whenever we use this, we assume left stick is being used. MOVE, //This is the left stick analog input. Whenever we use this, we assume left stick is being used.
MANUAL_AIM, MANUAL_AIM, //This is the right stick analog input. Whenever we use this, we assume right stick is being used.
BASIC_ATTACK, BASIC_ATTACK,
DEFENSIVE, DEFENSIVE,
MENU_PAUSE, MENU_PAUSE,
@ -75,7 +75,7 @@ namespace Steam{
ITEM_2, ITEM_2,
ITEM_3, ITEM_3,
//Menu Inputs //Menu Inputs
NAVIGATE, NAVIGATE, //This is the left stick analog input. Whenever we use this, we assume left stick is being used.
SCROLL, //This is the right stick analog input. Whenever we use this, we assume right stick is being used. SCROLL, //This is the right stick analog input. Whenever we use this, we assume right stick is being used.
CONFIRM, CONFIRM,
BACK, BACK,
@ -103,10 +103,13 @@ class Input{
static bool usingGamepad; static bool usingGamepad;
static void SetUsingGamepad(const bool usingGamepad); static void SetUsingGamepad(const bool usingGamepad);
static std::array<std::unordered_map<Steam::SteamInput,std::pair<std::string,HWButton>>,16>enumToActionName; static std::array<std::unordered_map<Steam::SteamInput,std::pair<std::string,HWButton>>,16>enumToActionName;
static std::unordered_map<EInputActionOrigin,std::string>steamIconToGameIcon;
static void Initialize(); static void Initialize();
static void UpdateSteamInput(); static void UpdateSteamInput();
static std::array<InputHandle_t,16>steamControllers; static std::array<InputHandle_t,16>steamControllers;
static uint8_t activeSteamControllerIndex; static uint8_t activeSteamControllerIndex;
static uint8_t controllerCount;
static void LoadSteamButtonIcons();
public: public:
Input(InputType type,int key); Input(InputType type,int key);
bool Pressed(); bool Pressed();

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 8283 #define VERSION_BUILD 8290
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1,7 +1,7 @@
"controller_mappings" "controller_mappings"
{ {
"version" "3" "version" "3"
"revision" "33" "revision" "44"
"title" "Switch" "title" "Switch"
"description" "Default Switch controller setup." "description" "Default Switch controller setup."
"creator" "76561198025675819" "creator" "76561198025675819"
@ -12,7 +12,7 @@
"controller_caps" "613772287" "controller_caps" "613772287"
"major_revision" "0" "major_revision" "0"
"minor_revision" "0" "minor_revision" "0"
"Timestamp" "1711238146" "Timestamp" "1711284115"
"actions" "actions"
{ {
"InGameControls" "InGameControls"
@ -570,6 +570,163 @@
} }
} }
"group" "group"
{
"id" "18"
"mode" "dpad"
"name" ""
"description" ""
"inputs"
{
"dpad_north"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Up, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_south"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Down, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_east"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Right, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_west"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Left, , "
}
}
}
"disabled_activators"
{
}
}
}
"settings"
{
"requires_click" "0"
"haptic_intensity_override" "0"
}
}
"group"
{
"id" "19"
"mode" "dpad"
"name" ""
"description" ""
"inputs"
{
"dpad_north"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Up, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_south"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Down, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_east"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Right, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_west"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Left, , "
}
}
}
"disabled_activators"
{
}
}
}
"settings"
{
"requires_click" "0"
}
}
"group"
{ {
"id" "0" "id" "0"
"mode" "switches" "mode" "switches"
@ -774,9 +931,11 @@
"5" "button_diamond active" "5" "button_diamond active"
"6" "left_trigger active" "6" "left_trigger active"
"7" "right_trigger active" "7" "right_trigger active"
"12" "joystick active" "12" "joystick inactive"
"19" "joystick active"
"13" "right_joystick active" "13" "right_joystick active"
"11" "dpad active" "11" "dpad inactive"
"18" "dpad active"
} }
} }
"settings" "settings"

@ -1,18 +1,18 @@
"controller_mappings" "controller_mappings"
{ {
"version" "3" "version" "3"
"revision" "26" "revision" "37"
"title" "Xbox/Playstation/Switch" "title" "XBox/Playstation"
"description" "Default Xbox/Playstation/Switch controller setup." "description" "Default Xbox/Playstation controller setup."
"creator" "76561198025675819" "creator" "76561198025675819"
"progenitor" "" "progenitor" ""
"url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_xbox360.vdf" "url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_xbox360.vdf"
"export_type" "personal_cloud" "export_type" "personal_local"
"controller_type" "controller_xbox360" "controller_type" "controller_xbox360"
"controller_caps" "1590271" "controller_caps" "1590271"
"major_revision" "0" "major_revision" "0"
"minor_revision" "0" "minor_revision" "0"
"Timestamp" "1711221628" "Timestamp" "1711284058"
"actions" "actions"
{ {
"InGameControls" "InGameControls"
@ -55,11 +55,6 @@
"legacy_set" "0" "legacy_set" "0"
"StickPadGyro" "StickPadGyro"
{ {
"Navigate"
{
"title" "#Gameplay_Move"
"input_mode" "joystick_move"
}
"Scroll" "Scroll"
{ {
"title" "#Menu_Scroll" "title" "#Menu_Scroll"
@ -117,10 +112,10 @@
"Menu_Function1" "Function 1" "Menu_Function1" "Function 1"
"Menu_Function2" "Function 2" "Menu_Function2" "Function 2"
"Menu_Menu" "Menu/Pause" "Menu_Menu" "Menu/Pause"
"Menu_Up" "Up" "Menu_Up" "Menu Up"
"Menu_Down" "Down" "Menu_Down" "Menu Down"
"Menu_Left" "Left" "Menu_Left" "Menu Left"
"Menu_Right" "Right" "Menu_Right" "Menu Right"
"Menu_Scroll" "Scroll" "Menu_Scroll" "Scroll"
"Menu_ScrollUp" "Fast Scroll Up" "Menu_ScrollUp" "Fast Scroll Up"
"Menu_ScrollDown" "Fast Scroll Down" "Menu_ScrollDown" "Fast Scroll Down"
@ -487,10 +482,6 @@
{ {
"virtual_mode" "1" "virtual_mode" "1"
} }
"gameactions"
{
"MenuControls" "Navigate"
}
} }
"group" "group"
{ {
@ -505,10 +496,6 @@
{ {
"virtual_mode" "1" "virtual_mode" "1"
} }
"gameactions"
{
"MenuControls" "Navigate"
}
} }
"group" "group"
{ {
@ -583,6 +570,163 @@
} }
} }
"group" "group"
{
"id" "17"
"mode" "dpad"
"name" ""
"description" ""
"inputs"
{
"dpad_north"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Up, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_south"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Down, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_east"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Right, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_west"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Left, , "
}
}
}
"disabled_activators"
{
}
}
}
"settings"
{
"requires_click" "0"
"haptic_intensity_override" "0"
}
}
"group"
{
"id" "18"
"mode" "dpad"
"name" ""
"description" ""
"inputs"
{
"dpad_north"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Up, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_south"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Down, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_east"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Right, , "
}
}
}
"disabled_activators"
{
}
}
"dpad_west"
{
"activators"
{
"Full_Press"
{
"bindings"
{
"binding" "game_action MenuControls Left, , "
}
}
}
"disabled_activators"
{
}
}
}
"settings"
{
"requires_click" "0"
}
}
"group"
{ {
"id" "0" "id" "0"
"mode" "switches" "mode" "switches"
@ -755,9 +899,11 @@
"5" "button_diamond active" "5" "button_diamond active"
"6" "left_trigger active" "6" "left_trigger active"
"7" "right_trigger active" "7" "right_trigger active"
"12" "joystick active" "12" "joystick inactive"
"18" "joystick active"
"13" "right_joystick active" "13" "right_joystick active"
"11" "dpad active" "11" "dpad inactive"
"17" "dpad active"
} }
} }
"settings" "settings"

Loading…
Cancel
Save