From 17d5487ecd1ebe890e99845e4f43f95e622df5a2 Mon Sep 17 00:00:00 2001 From: deram Date: Sun, 25 Mar 2018 14:26:05 +0300 Subject: [PATCH 1/3] started developing osx support --- ksp-advanced-flybywire-osx.csproj | 134 ++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 ksp-advanced-flybywire-osx.csproj diff --git a/ksp-advanced-flybywire-osx.csproj b/ksp-advanced-flybywire-osx.csproj new file mode 100644 index 0000000..bef7e1e --- /dev/null +++ b/ksp-advanced-flybywire-osx.csproj @@ -0,0 +1,134 @@ + + + + + Debug + AnyCPU + {C4BAF0C4-E0D3-4246-9CC0-2DE5B6E962FD} + Library + Properties + KSPAdvancedFlyByWire + ksp-advanced-flybywire + v3.5 + 512 + + + + + + 3.5 + + + true + full + false + bin\Debug\ + TRACE;DEBUG + prompt + 4 + true + + + none + true + bin\Release\ + LINUX + prompt + 4 + x86 + true + false + + + OnOutputUpdated + + + true + bin\x64\Debug\ + TRACE;DEBUG + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + LINUX + true + true + x64 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll + + + ..\.steam\steam\steamapps\common\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\KSPUtil.dll + + + + + + + + False + builds\linux\GameData\000_Toolbar\Toolbar.dll + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\linux\GameData\ksp-advanced-flybywire\ +xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\alpha\linux\ +rmdir /S /q ..\..\obj\ +xcopy /Y ksp-advanced-flybywire.dll "$(KSP_PATH)GameData\ksp-advanced-flybywire\" + + + + + + + \ No newline at end of file From e5a3e0138e799e7e94b7674aac18b5d8f595e32e Mon Sep 17 00:00:00 2001 From: deram Date: Sun, 25 Mar 2018 14:30:16 +0300 Subject: [PATCH 2/3] osx build support for module --- Configuration.cs | 4 +- DefaultControllerPresets.cs | 4 +- IController.cs | 2 +- SDL2.cs | 2 + Utility.cs | 4 +- ksp-advanced-flybywire-osx.csproj | 81 +++++++++++++++++++------------ 6 files changed, 60 insertions(+), 37 deletions(-) diff --git a/Configuration.cs b/Configuration.cs index c3d8a2f..d5fe340 100644 --- a/Configuration.cs +++ b/Configuration.cs @@ -101,7 +101,7 @@ public void ActivateController(InputWrapper wrapper, int controllerIndex, IContr if (Utility.CheckXInputSupport() && wrapper == InputWrapper.XInput) { -#if !LINUX +#if !LINUX && !OSX controller.iface = new XInputController(controller.controllerIndex); #endif } @@ -184,7 +184,7 @@ public void OnPostDeserialize() { if (Utility.CheckXInputSupport() && config.wrapper == InputWrapper.XInput) { -#if !LINUX +#if !LINUX && !OSX config.iface = new XInputController(config.controllerIndex); #endif } diff --git a/DefaultControllerPresets.cs b/DefaultControllerPresets.cs index 168ee9f..c3305ab 100644 --- a/DefaultControllerPresets.cs +++ b/DefaultControllerPresets.cs @@ -11,7 +11,7 @@ public static List GetDefaultPresets(IController controller) { List presets = new List(); -#if !LINUX +#if !LINUX && !OSX if (Utility.CheckXInputSupport() && controller is XInputController) { presets.Add(GetXInputDefaultRocketPreset(controller)); @@ -26,7 +26,7 @@ public static ControllerPreset GetXInputDefaultRocketPreset(IController controll ControllerPreset preset = new ControllerPreset(); preset.name = "XInput Default"; -#if !LINUX +#if !LINUX && !OSX int buttonsCount = controller.GetButtonsCount(); preset.SetDiscreteBinding(new Bitset(buttonsCount, (int)XInput.Button.DPadLeft), DiscreteAction.SAS); diff --git a/IController.cs b/IController.cs index 2b41f8e..a0f756d 100644 --- a/IController.cs +++ b/IController.cs @@ -24,7 +24,7 @@ public static List>> Enumer if (Utility.CheckXInputSupport()) { -#if !LINUX +#if !LINUX && !OSX foreach (var controllerName in XInputController.EnumerateControllers()) { controllers.Add(new KeyValuePair>(InputWrapper.XInput, controllerName)); diff --git a/SDL2.cs b/SDL2.cs index 7e3a75d..d5ada04 100644 --- a/SDL2.cs +++ b/SDL2.cs @@ -47,6 +47,8 @@ public static class SDL #if LINUX private const string nativeLibName = "libSDL2-2.0.so.0"; +#elif OSX + private const string nativeLibName = "libSDL2-2.0.0.dylib"; #else private const string nativeLibName = "SDL2.dll"; #endif diff --git a/Utility.cs b/Utility.cs index 55e481c..3b1f9b5 100644 --- a/Utility.cs +++ b/Utility.cs @@ -59,7 +59,7 @@ public static Rect ClampRect(Rect rect, Rect container) public static bool CheckXInputSupport() { -#if LINUX +#if LINUX || OSX return false; #else return true; @@ -73,7 +73,7 @@ public static bool CheckSDLSupport() public static bool CheckSharpDXSupport() { -#if LINUX +#if LINUX || OSX return false; #else return true; diff --git a/ksp-advanced-flybywire-osx.csproj b/ksp-advanced-flybywire-osx.csproj index bef7e1e..422d3f0 100644 --- a/ksp-advanced-flybywire-osx.csproj +++ b/ksp-advanced-flybywire-osx.csproj @@ -23,7 +23,7 @@ full false bin\Debug\ - TRACE;DEBUG + TRACE;DEBUG;OSX prompt 4 true @@ -61,32 +61,6 @@ prompt MinimumRecommendedRules.ruleset - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll - - - ..\.steam\steam\steamapps\common\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp-firstpass.dll - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\KSPUtil.dll - - - - - - - - False - builds\linux\GameData\000_Toolbar\Toolbar.dll - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll - - - ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll - - @@ -113,10 +87,57 @@ + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\Assembly-CSharp.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\Assembly-UnityScript.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\Assembly-UnityScript-firstpass.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.UI.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\System.Core.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\System.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\System.Xml.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\GameData\000_Toolbar\Plugins\aaa_Toolbar.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\mscorlib.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.CoreModule.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.PhysicsModule.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.UIElementsModule.dll + + + ..\..\..\Library\Application Support\Steam\steamapps\common\Kerbal Space Program\KSP.app\Contents\Resources\Data\Managed\UnityEngine.IMGUIModule.dll + + - xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\linux\GameData\ksp-advanced-flybywire\ -xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\alpha\linux\ + xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\osx\GameData\ksp-advanced-flybywire\ +xcopy /Y ksp-advanced-flybywire.dll ..\..\builds\alpha\osx\ rmdir /S /q ..\..\obj\ xcopy /Y ksp-advanced-flybywire.dll "$(KSP_PATH)GameData\ksp-advanced-flybywire\" @@ -131,4 +152,4 @@ xcopy /Y ksp-advanced-flybywire.dll "$(KSP_PATH)GameData\ksp-advanced-flybywire\ --> - \ No newline at end of file + From 0a5fbd028136b318a57aa75c7ebb3538203cfd7c Mon Sep 17 00:00:00 2001 From: deram Date: Sun, 25 Mar 2018 18:00:42 +0300 Subject: [PATCH 3/3] Fixed indentation. --- SDL2.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDL2.cs b/SDL2.cs index d5ada04..9b53ddf 100644 --- a/SDL2.cs +++ b/SDL2.cs @@ -48,7 +48,7 @@ public static class SDL #if LINUX private const string nativeLibName = "libSDL2-2.0.so.0"; #elif OSX - private const string nativeLibName = "libSDL2-2.0.0.dylib"; + private const string nativeLibName = "libSDL2-2.0.0.dylib"; #else private const string nativeLibName = "SDL2.dll"; #endif @@ -5641,4 +5641,4 @@ string app #endregion } -} \ No newline at end of file +}