Hot swapping/plugging controllers now working. Refresh action sets of all active controllers. Release Build 8298.

This commit is contained in:
sigonasr2 2024-03-24 17:11:38 -05:00
parent 8f17c3b0fc
commit 3d621fa95b
6 changed files with 14 additions and 4 deletions

View File

@ -353,7 +353,7 @@ bool AiL::OnUserUpdate(float fElapsedTime){
Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls"); Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls");
Input::menuControlsHandle=SteamInput()->GetActionSetHandle("MenuControls"); Input::menuControlsHandle=SteamInput()->GetActionSetHandle("MenuControls");
} }
SteamInput()->ActivateActionSet(STEAM_INPUT_HANDLE_ALL_CONTROLLERS,Input::menuControlsHandle); ActivateActionSetForAllControllers(Input::menuControlsHandle);
Input::UpdateSteamInput(); Input::UpdateSteamInput();
} }
@ -434,7 +434,7 @@ bool AiL::DownPressed(){
void AiL::HandleUserInput(float fElapsedTime){ void AiL::HandleUserInput(float fElapsedTime){
if(!Menu::stack.empty())return; //A window being opened means there's no user input allowed. if(!Menu::stack.empty())return; //A window being opened means there's no user input allowed.
if(SteamInput())SteamInput()->ActivateActionSet(STEAM_INPUT_HANDLE_ALL_CONTROLLERS,Input::ingameControlsHandle); if(SteamInput())ActivateActionSetForAllControllers(Input::ingameControlsHandle);
if(GetKey(SCROLL).bPressed)displayHud=!displayHud; if(GetKey(SCROLL).bPressed)displayHud=!displayHud;
@ -3796,4 +3796,10 @@ bool AiL::Steam_Init(){
return true; return true;
} }
return false; return false;
}
void AiL::ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle){
for(int i=0;i<Input::controllerCount;i++){
SteamInput()->ActivateActionSet(Input::steamControllers[i],Input::menuControlsHandle);
}
} }

View File

@ -304,6 +304,7 @@ public:
rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true); rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true);
void UpdateMonsters(); void UpdateMonsters();
bool Steam_Init(); bool Steam_Init();
void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle);
struct TileGroupData{ struct TileGroupData{
vi2d tilePos; vi2d tilePos;

View File

@ -197,6 +197,7 @@ void Input::UpdateSteamInput(){
InputDigitalActionHandle_t inputHnd=SteamInput()->GetDigitalActionHandle(data.first.c_str()); InputDigitalActionHandle_t inputHnd=SteamInput()->GetDigitalActionHandle(data.first.c_str());
InputDigitalActionData_t buttonData=SteamInput()->GetDigitalActionData(steamControllers[i],inputHnd); InputDigitalActionData_t buttonData=SteamInput()->GetDigitalActionData(steamControllers[i],inputHnd);
if(!buttonData.bActive)continue; //Ignore inputs that are not active. if(!buttonData.bActive)continue; //Ignore inputs that are not active.
if(buttonData.bActive){std::cout<<input<<" is active"<<std::endl;}
data.second.bPressed=data.second.bReleased=false; data.second.bPressed=data.second.bReleased=false;
if(!data.second.bHeld&&buttonData.bState){ if(!data.second.bHeld&&buttonData.bState){

View File

@ -46,4 +46,6 @@ Make another actions config file for the main build
Sword attack should linger Sword attack should linger
Add game file debug logging Add game file debug logging
Automatically pause if controller is disconnected (while using a controller) Automatically pause if controller is disconnected (while using a controller)
PS5 LED color support

View File

@ -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 8293 #define VERSION_BUILD 8298
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a