diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 89bb9153..03d6b173 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -326,17 +326,6 @@ bool AiL::OnUserCreate(){ if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it. if(Steam_Init()){ std::cout<<"Steam API Initialized successfully!"<SetWarningMessageHook([](int severity,const char*message){ - std::cout<Init(false); - SteamInput()->RunFrame(); - Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls"); - Input::menuControlsHandle=SteamInput()->GetActionSetHandle("MenuControls"); - } }else{ std::cout<<"Steam API failed to initialize!"<GetActionSetHandle("InGameControls"); + Input::menuControlsHandle=SteamInput()->GetActionSetHandle("MenuControls"); + } SteamInput()->ActivateActionSet(STEAM_INPUT_HANDLE_ALL_CONTROLLERS,Input::menuControlsHandle); - SteamInput()->RunFrame(); Input::UpdateSteamInput(); } @@ -3789,5 +3783,18 @@ int AiL::GetLoadoutSize()const{ } bool AiL::Steam_Init(){ - return SteamAPI_Init(); + if(SteamAPI_Init()){ + if(SteamUtils()!=nullptr){ + SteamUtils()->SetWarningMessageHook([](int severity,const char*message){ + std::cout<Init(false); + Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls"); + Input::menuControlsHandle=SteamInput()->GetActionSetHandle("MenuControls"); + } + return true; + } + return false; } \ No newline at end of file diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index ceeb85f1..f9d8e523 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -98,24 +98,25 @@ void Input::UpdateSteamInput(){ HWButton prevState=data.second; InputDigitalActionHandle_t inputHnd=SteamInput()->GetDigitalActionHandle(data.first.c_str()); InputDigitalActionData_t buttonData=SteamInput()->GetDigitalActionData(steamControllers[i],inputHnd); + if(!buttonData.bActive)continue; //Ignore inputs that are not active. data.second.bPressed=data.second.bReleased=false; if(!data.second.bHeld&&buttonData.bState){ data.second.bPressed=true; activeSteamControllerIndex=i; } - data.second.bHeld=buttonData.bState; if(data.second.bHeld&&!buttonData.bState){ data.second.bReleased=true; activeSteamControllerIndex=i; } + data.second.bHeld=buttonData.bState; } } } } bool Input::Pressed(){ - if(!game->IsFocused())return false; + //if(!game->IsFocused())return false; bool inputPressed=false; switch(type){ case KEY:{ @@ -132,7 +133,7 @@ bool Input::Pressed(){ } }break; case STEAM:{ - return enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bPressed; + if(enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bPressed)inputPressed=true; }break; case ANALOG:{ //An analog input can never be "pressed". No-op. @@ -142,7 +143,7 @@ bool Input::Pressed(){ } } if(inputPressed){ - usingGamepad=type==CONTROLLER; + usingGamepad=type==CONTROLLER||type==STEAM; return true; } return false; @@ -153,20 +154,20 @@ bool Input::Held(){ bool inputHeld=false; switch(type){ case KEY:{ - inputHeld=game->GetKey(Key(key)).bHeld; + inputHeld|=game->GetKey(Key(key)).bHeld; }break; case MOUSE:{ - inputHeld=game->GetMouse(key).bHeld; + inputHeld|=game->GetMouse(key).bHeld; }break; case CONTROLLER:{ if(!SteamInput()){ for(GamePad*gamepad:GamePad::getGamepads()){ - if(gamepad->stillConnected&&gamepad->getButton(static_cast(key)).bHeld)inputHeld=true; + if(gamepad->stillConnected)inputHeld|=gamepad->getButton(static_cast(key)).bHeld; } } }break; case STEAM:{ - return enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bHeld; + inputHeld|=enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bHeld; }break; case ANALOG:{ //An analog input can never be "held". No-op. @@ -176,31 +177,31 @@ bool Input::Held(){ } } if(inputHeld){ - usingGamepad=type==CONTROLLER; + usingGamepad=type==CONTROLLER||type==STEAM; return true; } return false; } bool Input::Released(){ - if(!game->IsFocused())return false; + //if(!game->IsFocused())return false; bool inputReleased=false; switch(type){ case KEY:{ - inputReleased=game->GetKey(Key(key)).bReleased; + inputReleased|=game->GetKey(Key(key)).bReleased; }break; case MOUSE:{ - inputReleased=game->GetMouse(key).bReleased; + inputReleased|=game->GetMouse(key).bReleased; }break; case CONTROLLER:{ if(!SteamInput()){ for(GamePad*gamepad:GamePad::getGamepads()){ - if(gamepad->stillConnected&&gamepad->getButton(static_cast(key)).bReleased)inputReleased=true; + if(gamepad->stillConnected)inputReleased|=gamepad->getButton(static_cast(key)).bReleased; } } }break; case STEAM:{ - return enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bReleased; + inputReleased|=enumToActionName[activeSteamControllerIndex][Steam::SteamInput(key)].second.bReleased; }break; case ANALOG:{ //An analog input can never be "released". No-op. @@ -210,7 +211,7 @@ bool Input::Released(){ } } if(inputReleased){ - usingGamepad=type==CONTROLLER; + usingGamepad=type==CONTROLLER||type==STEAM; return true; } return false; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index fa5093d9..eb8117a5 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 5 #define VERSION_PATCH 1 -#define VERSION_BUILD 8264 +#define VERSION_BUILD 8281 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 49037246..9ff02053 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ