From a1f987937f2c200021b841b2a59e5fa28c7cc9f1 Mon Sep 17 00:00:00 2001 From: OnlyRealNubs <91900600+OnlyRealNubs@users.noreply.github.com> Date: Sun, 19 Feb 2023 21:32:31 -0500 Subject: [PATCH 1/3] Define options --- ChaosMod/Util/OptionDefaults.h | 3 +- ConfigApp/App.xaml | 1 + ConfigApp/ConfigApp.csproj | 34 ++++----- ConfigApp/FodyWeavers.xsd | 15 ++-- ConfigApp/MainWindow.xaml | 122 ++++++++++++++++++--------------- ConfigApp/MainWindow.xaml.cs | 2 + ConfigApp/packages.config | 8 +-- 7 files changed, 102 insertions(+), 83 deletions(-) diff --git a/ChaosMod/Util/OptionDefaults.h b/ChaosMod/Util/OptionDefaults.h index be0b9dd12..2945c0026 100644 --- a/ChaosMod/Util/OptionDefaults.h +++ b/ChaosMod/Util/OptionDefaults.h @@ -35,4 +35,5 @@ #define OPTION_DEFAULT_DISABLE_STARTUP false #define OPTION_DEFAULT_GROUP_WEIGHTING true -#define OPTION_DEFAULT_FAILSAFE true \ No newline at end of file +#define OPTION_DEFAULT_FAILSAFE true +#define OPTION_DEFAULT_GAMEPAD_RUMBLE true \ No newline at end of file diff --git a/ConfigApp/App.xaml b/ConfigApp/App.xaml index c8094f3a3..501e549ce 100644 --- a/ConfigApp/App.xaml +++ b/ConfigApp/App.xaml @@ -1,6 +1,7 @@  diff --git a/ConfigApp/ConfigApp.csproj b/ConfigApp/ConfigApp.csproj index e579a32fc..3b9ced72c 100644 --- a/ConfigApp/ConfigApp.csproj +++ b/ConfigApp/ConfigApp.csproj @@ -1,6 +1,6 @@  - + Debug @@ -64,8 +64,8 @@ favicon.ico - - ..\packages\Costura.Fody.5.0.2\lib\netstandard1.0\Costura.dll + + ..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll @@ -209,20 +209,20 @@ - - ..\packages\Extended.Wpf.Toolkit.4.0.2\lib\net40\Xceed.Wpf.AvalonDock.dll + + ..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.dll - - ..\packages\Extended.Wpf.Toolkit.4.0.2\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll + + ..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll - - ..\packages\Extended.Wpf.Toolkit.4.0.2\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll + + ..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll - - ..\packages\Extended.Wpf.Toolkit.4.0.2\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll + + ..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll - - ..\packages\Extended.Wpf.Toolkit.4.0.2\lib\net40\Xceed.Wpf.Toolkit.dll + + ..\packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.Toolkit.dll @@ -298,14 +298,16 @@ - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + + + + \ No newline at end of file diff --git a/ConfigApp/FodyWeavers.xsd b/ConfigApp/FodyWeavers.xsd index e82ada356..05e92c114 100644 --- a/ConfigApp/FodyWeavers.xsd +++ b/ConfigApp/FodyWeavers.xsd @@ -19,12 +19,12 @@ - A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. @@ -55,7 +55,12 @@ - Controls if (.NET Core) runtime assemblies are also embedded. + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. @@ -90,12 +95,12 @@ - A list of (.NET Core) runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - A list of (.NET Core) runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. diff --git a/ConfigApp/MainWindow.xaml b/ConfigApp/MainWindow.xaml index 7d832fba0..5ccd3e054 100644 --- a/ConfigApp/MainWindow.xaml +++ b/ConfigApp/MainWindow.xaml @@ -111,118 +111,126 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + + + diff --git a/ConfigApp/MainWindow.xaml.cs b/ConfigApp/MainWindow.xaml.cs index bbfe30f39..6a08d84d8 100644 --- a/ConfigApp/MainWindow.xaml.cs +++ b/ConfigApp/MainWindow.xaml.cs @@ -147,6 +147,7 @@ private void ParseConfigFile() misc_user_effects_enable_group_weighting.IsChecked = m_configFile.ReadValueBool("EnableGroupWeightingAdjustments", true); misc_user_effects_enable_failsafe.IsChecked = m_configFile.ReadValueBool("EnableFailsafe", true); misc_user_anti_softlock_shortcut.IsChecked = m_configFile.ReadValueBool("EnableAntiSoftlockShortcut", true); + misc_user_effects_disable_gamepad_rumble.IsChecked = m_configFile.ReadValueBool("DisableGamepadRumble", true); // Meta Effects meta_effects_spawn_dur.Text = m_configFile.ReadValue("NewMetaEffectSpawnTime", "600"); @@ -178,6 +179,7 @@ private void WriteConfigFile() m_configFile.WriteValue("MaxParallelRunningEffects", misc_user_effects_max_running_effects.Text); } m_configFile.WriteValue("EnableAntiSoftlockShortcut", misc_user_anti_softlock_shortcut.IsChecked.Value); + m_configFile.WriteValue("DisableGamepadRumble", misc_user_effects_disable_gamepad_rumble.IsChecked.Value); // Meta Effects m_configFile.WriteValue("NewMetaEffectSpawnTime", meta_effects_spawn_dur.Text); diff --git a/ConfigApp/packages.config b/ConfigApp/packages.config index c8e40b458..4913ecc53 100644 --- a/ConfigApp/packages.config +++ b/ConfigApp/packages.config @@ -1,10 +1,10 @@  - - - + + + - + From 3bdbbed192d55f5d2cacaa3135510706779dedff Mon Sep 17 00:00:00 2001 From: OnlyRealNubs <91900600+OnlyRealNubs@users.noreply.github.com> Date: Sun, 19 Feb 2023 21:48:00 -0500 Subject: [PATCH 2/3] Init XInput --- ChaosMod/Main.cpp | 4 ++++ ChaosMod/Util/XInput.h | 29 ++++++++++++++++++++++++++++- ConfigApp/MainWindow.xaml | 2 +- ConfigApp/MainWindow.xaml.cs | 4 ++-- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChaosMod/Main.cpp b/ChaosMod/Main.cpp index 01f4740e2..cb6749df3 100644 --- a/ChaosMod/Main.cpp +++ b/ChaosMod/Main.cpp @@ -21,6 +21,7 @@ #include "Util/File.h" #include "Util/OptionsManager.h" #include "Util/PoolSpawner.h" +#include "Util/XInput.h" static bool ms_bClearAllEffects = false; static bool ms_bClearEffectsShortcutEnabled = false; @@ -173,6 +174,9 @@ static void Init() LOG("Initializing Failsafe"); InitComponent(); + LOG("Initializing XInput"); + XInput::Init(); + #ifdef WITH_DEBUG_PANEL_SUPPORT if (DoesFileExist("chaosmod\\.enabledebugsocket")) { diff --git a/ChaosMod/Util/XInput.h b/ChaosMod/Util/XInput.h index 075e15c71..a7a601a20 100644 --- a/ChaosMod/Util/XInput.h +++ b/ChaosMod/Util/XInput.h @@ -1,14 +1,26 @@ #pragma once #include - +#include "OptionsManager.h" #include namespace XInput { + inline bool ms_bIsEnabled = true; + + inline void Init() + { + ms_bIsEnabled = g_OptionsManager.GetConfigValue("EnableGamepadRumble", OPTION_DEFAULT_GAMEPAD_RUMBLE); + } + //Doesn't include the new Xbox Series X|S rumbles inline void SetControllerRumble(DWORD controllerId, int leftMotorSpeed, int rightMotorSpeed) { + if (!ms_bIsEnabled) + { + return; + } + XINPUT_VIBRATION vibration; ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION)); @@ -21,6 +33,11 @@ namespace XInput //Make sure you call stop, or it will rumble until the application closes. inline void SetAllControllersRumble(int leftMotorSpeed, int rightMotorSpeed) { + if (!ms_bIsEnabled) + { + return; + } + for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) { SetControllerRumble(i, leftMotorSpeed, rightMotorSpeed); @@ -29,6 +46,11 @@ namespace XInput inline void StopControllerRumble(DWORD controllerId) { + if (!ms_bIsEnabled) + { + return; + } + XINPUT_VIBRATION vibration; ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION)); @@ -40,6 +62,11 @@ namespace XInput inline void StopAllControllersRumble() { + if (!ms_bIsEnabled) + { + return; + } + for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) { StopControllerRumble(i); diff --git a/ConfigApp/MainWindow.xaml b/ConfigApp/MainWindow.xaml index 5ccd3e054..3349fe606 100644 --- a/ConfigApp/MainWindow.xaml +++ b/ConfigApp/MainWindow.xaml @@ -226,7 +226,7 @@ HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="0,12" />