Skip to content

Commit

Permalink
Fixed issue where buttons to change throttle weren't working unless t…
Browse files Browse the repository at this point in the history
…here was at least one axis defined
  • Loading branch information
linuxgurugamer committed Dec 28, 2022
1 parent 848f38f commit 8584f71
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions AFBW/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

using System.Reflection;

[assembly: AssemblyVersion("1.8.3.7")]
[assembly: AssemblyFileVersion("1.8.3.7")]
[assembly: AssemblyVersion("1.8.4.0")]
[assembly: AssemblyFileVersion("1.8.4.0")]
2 changes: 1 addition & 1 deletion AFBW/ControllerPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void OnPreSerialize()
public void OnPostDeserialize()
{
continuousActionsMap.Clear();
foreach(var entry in serialiazableContinuousActionList)
foreach(ContinuousActionEntry entry in serialiazableContinuousActionList)
{
continuousActionsMap.Add(entry.Action, entry);
}
Expand Down
3 changes: 2 additions & 1 deletion AFBW/DefaultControllerPresets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public static ControllerPreset GetXInputDefaultRocketPreset(IController controll
{
ControllerPreset preset = new ControllerPreset();
preset.name = "XInput Default";

#if !LINUX && !OSX

int buttonsCount = controller.GetButtonsCount();

preset.SetDiscreteBinding(new Bitset(buttonsCount, (int)XInput.Button.DPadLeft), DiscreteAction.SAS);
Expand Down
9 changes: 5 additions & 4 deletions AFBW/FlightManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ public void OnFlyByWire(FlightCtrlState state)
m_Throttle.SetMinMaxValues(-state.mainThrottle, 1.0f - state.mainThrottle);
m_WheelThrottle.SetMinMaxValues(-1.0f, 1.0f);


foreach (ControllerConfiguration config in m_Configuration.controllers)
{
if (config.isEnabled && !AdvancedFlyByWire.rightClickDisabled)
{
config.iface.Update(state);
throttleActive = true;
UpdateAxes(config, state);
config.iface.Update(state);

if (FlightGlobals.ActiveVessel.isEVA)
{
Expand Down Expand Up @@ -116,21 +118,20 @@ private void UpdateAxes(ControllerConfiguration config, FlightCtrlState state)

float axisState = config.iface.GetAxisState(i);

foreach (var action in actions)
foreach (ContinuousAction action in actions)
{
var axisValue = axisState;
if (config.GetCurrentPreset().IsContinuousBindingInverted(action))
{
axisValue *= -1.0f;
}


throttleActive = true;
if (!AdvancedFlyByWire.Instance.settings.m_ThrottleOverride && action == ContinuousAction.Throttle)
{
if (axisValue == last_m_throttle)
{
throttleActive = false;
//throttleActive = false;
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions AFBW/PresetEditorWindowNG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public void DoChooseDiscreteActionWindow(int window)

public void DoChooseContinuousActionWindow(int window)
{
if (!m_ChooseContinuousAction)
{
return;
}
//if (!m_ChooseContinuousAction)
//{
// return;
//}
GUILayout.BeginHorizontal();
var currentPreset = m_Controller.GetCurrentPreset();
GUILayout.FlexibleSpace();
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
ChangeLog

1.8.4.1
Fixed issue where buttons to change throttle weren't working unless there was at least one axis defined

1.8.4
Thanks to github user @AlexanderDzhoganov for this:
Add support for Custom Axis Groups
Expand Down
Binary file modified GameData/ksp-advanced-flybywire/Plugins/AdvancedFlyByWire.dll
Binary file not shown.
Binary file modified GameData/ksp-advanced-flybywire/Plugins/AdvancedFlyByWire.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"VERSION": {
"MAJOR": 1,
"MINOR": 8,
"PATCH": 3,
"BUILD": 7
"PATCH": 4,
"BUILD": 0
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
"PATCH": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
3 changes: 2 additions & 1 deletion deploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rem VERSIONFILE is the name of the version file, usually the same as GAMEDATA,
rem but not always

set H=%KSPDIR%

set GAMEDIR=ksp-advanced-flybywire
set GAMEDATA="GameData"
set SUPPORTFILES=SUPPORTFILES
Expand All @@ -23,4 +24,4 @@ copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%
xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%H%\GameData\%GAMEDIR%"
xcopy /y /s /I %GAMEDATA%\%GAMEDIR% "%DP0%\GameData\%GAMEDIR%"

pause
rem pause
2 changes: 1 addition & 1 deletion ksp-advanced-flybywire.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 1,
"MINOR": 8,
"PATCH": 4,
"BUILD": 0
"BUILD": 1
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down

0 comments on commit 8584f71

Please sign in to comment.