diff --git a/FDK/src/02.Input/CInputGamepad.cs b/FDK/src/02.Input/CInputGamepad.cs index 2918c3d8..6e0cb140 100644 --- a/FDK/src/02.Input/CInputGamepad.cs +++ b/FDK/src/02.Input/CInputGamepad.cs @@ -4,14 +4,18 @@ namespace FDK; public class CInputGamepad : CInputButtonsBase, IInputDevice, IDisposable { - public CInputGamepad(IGamepad gamepad) : base(15) { + public CInputGamepad(IGamepad gamepad, float deadzone = 0.5f) : base(gamepad.Buttons.Count + gamepad.Triggers.Count + (gamepad.Thumbsticks.Count * 4)) { this.Device = gamepad; this.CurrentType = InputDeviceType.Gamepad; this.GUID = gamepad.Index.ToString(); this.ID = gamepad.Index; this.Name = gamepad.Name; - gamepad.Deadzone = new Deadzone(0.5f, DeadzoneMethod.Traditional); + ButtonCount = gamepad.Buttons.Count; + TriggerCount = gamepad.Triggers.Count; + ThumbstickCount = gamepad.Thumbsticks.Count; + + gamepad.Deadzone = new Deadzone(deadzone, DeadzoneMethod.Traditional); gamepad.ButtonDown += Gamepad_ButtonDown; gamepad.ButtonUp += Gamepad_ButtonUp; gamepad.ThumbstickMoved += Gamepad_ThumbstickMoved; @@ -19,13 +23,33 @@ public CInputGamepad(IGamepad gamepad) : base(15) { } private void Gamepad_TriggerMoved(IGamepad gamepad, Trigger trigger) { - if (trigger.Position == 1) { + int trigger_index = ButtonCount + trigger.Index; + if (trigger.Position == 1) { + if (!KeyPressing(trigger_index)) { base.ButtonDown(trigger_index); } + } else { + if (!KeyReleased(trigger_index)) { base.ButtonUp(trigger_index); } } } private void Gamepad_ThumbstickMoved(IGamepad gamepad, Thumbstick thumbstick) { + ThumbstickDirection direction = GetDirectionFromThumbstick(thumbstick.Direction); + if (direction == ThumbstickDirection.Unknown) return; + + int thumbstick_index = ButtonCount + TriggerCount + + (thumbstick.Index * 4); + if (gamepad.Deadzone.Apply(thumbstick.Position) > 0) { - ThumbstickDirection direction = GetDirectionFromThumbstick(thumbstick.Direction); + if (!KeyPressing(thumbstick_index)) { + for (int i = 0; i < 4; i++) { + if (i != (int)direction) + base.ButtonUp(thumbstick_index + i); + } + base.ButtonDown(thumbstick_index + (int)direction); + } + } else { + for (int i = 0; i < 4; i++) { + base.ButtonUp(thumbstick_index + i); + } } } @@ -51,10 +75,27 @@ private ThumbstickDirection GetDirectionFromThumbstick(float raw) { } private enum ThumbstickDirection { - Right, - Down, - Left, - Up, - Unknown, + Up = 0, + Right = 1, + Down = 2, + Left = 3, + Unknown = -1, + } + + private int ButtonCount; + private int TriggerCount; + private int ThumbstickCount; + + public string GetButtonName(int index) { + var gamepad = (IGamepad)Device; + if (index >= ButtonCount + TriggerCount) { + int thumbstick_index = index - (ButtonCount + TriggerCount); + return $"Thumbstick{thumbstick_index / 4} - {(ThumbstickDirection)(thumbstick_index % 4)}"; + } + if (index >= ButtonCount) { + int trigger_index = index - ButtonCount; + return $"Trigger{trigger_index}"; + } + return gamepad.Buttons[index].Name.ToString(); } } diff --git a/FDK/src/02.Input/CInputJoystick.cs b/FDK/src/02.Input/CInputJoystick.cs index 1e111e24..a71f50c8 100644 --- a/FDK/src/02.Input/CInputJoystick.cs +++ b/FDK/src/02.Input/CInputJoystick.cs @@ -4,7 +4,12 @@ namespace FDK; public class CInputJoystick : CInputButtonsBase, IInputDevice, IDisposable { - public CInputJoystick(IJoystick joystick) : base(18) { + public CInputJoystick(IJoystick joystick) : base(32) { + // While the Gamepad's button count can be read from the start, + // the Joystick's button count can only be read after pressing + // any button. To be safe, we'll just leave some room for a lot + // of buttons. + this.Device = joystick; this.CurrentType = InputDeviceType.Joystick; this.GUID = joystick.Index.ToString(); @@ -26,4 +31,8 @@ private void Joystick_ButtonUp(IJoystick joystick, Button button) { base.ButtonUp(button.Index); } } + + public string GetButtonName(int index) { + return $"Button{index}"; + } } diff --git a/FDK/src/02.Input/CInputManager.cs b/FDK/src/02.Input/CInputManager.cs index b30a4a69..13961656 100644 --- a/FDK/src/02.Input/CInputManager.cs +++ b/FDK/src/02.Input/CInputManager.cs @@ -44,16 +44,18 @@ public IInputDevice Mouse { return null; } } + public float Deadzone = 0.5f; // Constructor - public CInputManager(IWindow window, bool useBufferedInput, bool bUseMidiIn = true) { - Initialize(window, useBufferedInput, bUseMidiIn); + public CInputManager(IWindow window, bool useBufferedInput, bool bUseMidiIn = true, float gamepad_deadzone = 0.5f) { + Initialize(window, useBufferedInput, bUseMidiIn, gamepad_deadzone); } - public void Initialize(IWindow window, bool useBufferedInput, bool bUseMidiIn) { + public void Initialize(IWindow window, bool useBufferedInput, bool bUseMidiIn, float controller_deadzone) { Context = window.CreateInput(); Context.ConnectionChanged += this.ConnectionChanged; + Deadzone = controller_deadzone; this.InputDevices = new List(10); #region [ Enumerate keyboard/mouse: exception is masked if keyboard/mouse is not connected ] @@ -76,7 +78,7 @@ public void Initialize(IWindow window, bool useBufferedInput, bool bUseMidiIn) { this.InputDevices.Add(new CInputJoystick(joysticks)); } foreach (var gamepad in Context.Gamepads) { - this.InputDevices.Add(new CInputGamepad(gamepad)); + this.InputDevices.Add(new CInputGamepad(gamepad, Deadzone)); } #endregion Trace.TraceInformation("Found {0} Input Device{1}", InputDevices.Count, InputDevices.Count != 1 ? "s:" : ":"); @@ -109,7 +111,7 @@ private void ConnectionChanged(Silk.NET.Input.IInputDevice device, bool connecte } } else if (device is IGamepad) { - this.InputDevices.Add(new CInputGamepad((IGamepad)device)); + this.InputDevices.Add(new CInputGamepad((IGamepad)device, Deadzone)); Trace.TraceInformation($"A gamepad was connected. Device name: {device.Name} / Index: {device.Index}"); } else if (device is IJoystick) { diff --git a/FDK/src/02.Input/IInputDevice.cs b/FDK/src/02.Input/IInputDevice.cs index 1d543c6d..c7c67404 100644 --- a/FDK/src/02.Input/IInputDevice.cs +++ b/FDK/src/02.Input/IInputDevice.cs @@ -35,4 +35,5 @@ List InputEvents { bool KeyReleased(List nKey) { return nKey.Any(key => KeyReleased(key)); } bool KeyReleasing(int nKey); bool KeyReleasing(List nKey) { return nKey.Any(key => KeyReleasing(key)); } + string GetButtonName(int nKey) { return $"Button{nKey}"; } } diff --git a/OpenTaiko/Lang/de/lang.json b/OpenTaiko/Lang/de/lang.json index 4f3985dd..aca9543e 100644 --- a/OpenTaiko/Lang/de/lang.json +++ b/OpenTaiko/Lang/de/lang.json @@ -161,6 +161,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Kalibriert deinen Offset.\nDer globale Offset wird überschrieben, wenn gespeichert.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Kanpeki-Modus", "SETTINGS_GAME_BADCOUNT_DESC": "Bestimmt, wie viele ÜBEL erlaubt sind,\nbevor ein Lied automatisch scheitert.\nSetze dies auf 0, um den Modus zu deaktivieren.", "SETTINGS_GAME_NOTELOCK": "Notelock-Modus", diff --git a/OpenTaiko/Lang/en/lang.json b/OpenTaiko/Lang/en/lang.json index 9f165389..3f564979 100644 --- a/OpenTaiko/Lang/en/lang.json +++ b/OpenTaiko/Lang/en/lang.json @@ -161,6 +161,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Calibrate your offset.\nGlobal Offset will be overwritten if saved.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Kanpeki Mode", "SETTINGS_GAME_BADCOUNT_DESC": "Choose how many BADs are allowed\nbefore a song is automatically failed.\nSet this to 0 to disable the mode.", "SETTINGS_GAME_NOTELOCK": "Notelock Mode", diff --git a/OpenTaiko/Lang/es/lang.json b/OpenTaiko/Lang/es/lang.json index b74811f6..9d8be073 100644 --- a/OpenTaiko/Lang/es/lang.json +++ b/OpenTaiko/Lang/es/lang.json @@ -164,6 +164,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Calibrate your offset.\nGlobal Offset will be overwritten if saved.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Modo Kanpeki", "SETTINGS_GAME_BADCOUNT_DESC": "Modo Kanpeki:\nElige el número de fallos antes de\n que se considere un intento fallido.\nDejar en 0 para deshabilitar el modo Kanpeki.", "SETTINGS_GAME_NOTELOCK": "Bloqueo de notas", diff --git a/OpenTaiko/Lang/fr/lang.json b/OpenTaiko/Lang/fr/lang.json index 5fcb702a..31b581e5 100644 --- a/OpenTaiko/Lang/fr/lang.json +++ b/OpenTaiko/Lang/fr/lang.json @@ -163,6 +163,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Calibrate your offset.\nGlobal Offset will be overwritten if saved.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Mort subite", "SETTINGS_GAME_BADCOUNT_DESC": "Mode mort subite :\nSi 1 ou plus, spécifiez le nombre de \nnotes ratées maximales autorisées avant \nde perdre la partie.\nSi 0 le mode mort subite est désactivé.", "SETTINGS_GAME_NOTELOCK": "Notes vérouillées", diff --git a/OpenTaiko/Lang/ja/lang.json b/OpenTaiko/Lang/ja/lang.json index fa901a05..2c34204c 100644 --- a/OpenTaiko/Lang/ja/lang.json +++ b/OpenTaiko/Lang/ja/lang.json @@ -163,6 +163,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Calibrate your offset.\nGlobal Offset will be overwritten if saved.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "完璧モード", "SETTINGS_GAME_BADCOUNT_DESC": "Riskyモードの設定:\n1以上の値にすると、その回数分の\n不可で演奏が強制終了します。\n0にすると無効になり、\nノルマゲージのみになります。\n", "SETTINGS_GAME_NOTELOCK": "タイト", diff --git a/OpenTaiko/Lang/ko/lang.json b/OpenTaiko/Lang/ko/lang.json index 92bed0fb..b6ab8d34 100644 --- a/OpenTaiko/Lang/ko/lang.json +++ b/OpenTaiko/Lang/ko/lang.json @@ -163,6 +163,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "오프셋을 보정합니다.\n저장하면 글로벌 오프셋을 덮어씁니다.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "완벽하게 모드", "SETTINGS_GAME_BADCOUNT_DESC": "노래가 자동으로 실패하기 전에 허용되는 BAD 수를 선택합니다.\n모드를 비활성화하려면 이 값을 0으로 설정하세요.", "SETTINGS_GAME_NOTELOCK": "노트잠금 모드", diff --git a/OpenTaiko/Lang/nl/lang.json b/OpenTaiko/Lang/nl/lang.json index 6ca3c99b..604bb230 100644 --- a/OpenTaiko/Lang/nl/lang.json +++ b/OpenTaiko/Lang/nl/lang.json @@ -161,6 +161,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Kalibreert de offset.\nGlobale Offset wordt overschreven waneer dit opslaat.", "SETTINGS_GAME_CALIBRATION_OFFSET": "OFFSET: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Kanpeki Modus", "SETTINGS_GAME_BADCOUNT_DESC": "Kies hoeveel 'BAD's zijn toegestaan\nvoordat een lied automatisch mislukt.\nZet de waarde op 0 om het uit te schakelen.", "SETTINGS_GAME_NOTELOCK": "Notelock Modus", diff --git a/OpenTaiko/Lang/ru/lang.json b/OpenTaiko/Lang/ru/lang.json index 20f4e59a..101435f0 100644 --- a/OpenTaiko/Lang/ru/lang.json +++ b/OpenTaiko/Lang/ru/lang.json @@ -161,6 +161,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "Откалибровает ваш офсет.\nГлобальный офсет будет перезаписан, если он\nбудет сохранен.", "SETTINGS_GAME_CALIBRATION_OFFSET": "ОФСЕТ: {0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "Режим Канпэки", "SETTINGS_GAME_BADCOUNT_DESC": "Выбрает сколько «Плохо» позволяют раньше\nпесни автоматически проиграно.\nУстановите значение 0, чтобы выключить этот\nрежим.", "SETTINGS_GAME_NOTELOCK": "Режим замока ноты", diff --git a/OpenTaiko/Lang/zh/lang.json b/OpenTaiko/Lang/zh/lang.json index 923e59f0..79fc6ad0 100644 --- a/OpenTaiko/Lang/zh/lang.json +++ b/OpenTaiko/Lang/zh/lang.json @@ -161,6 +161,9 @@ "SETTINGS_GAME_CALIBRATION_DESC": "校准您的偏移量。\n如果保存,将覆盖全局偏移量。", "SETTINGS_GAME_CALIBRATION_OFFSET": "偏移量:{0}", + "SETTINGS_GAME_CONTROLLERDEADZONE": "Controller Deadzone", + "SETTINGS_GAME_CONTROLLERDEADZONE_DESC": "Adjust the thumbstick deadzone for all connected\ncontrollers. Can be between 10% to 90%.\n\nAfter saving, reconnect the controller or\nrestart the game to apply changes.", + "SETTINGS_GAME_BADCOUNT": "完美模式", "SETTINGS_GAME_BADCOUNT_DESC": "选择打出多少个“不可”时会导致演奏失败。\n— 0:禁用此选项", "SETTINGS_GAME_NOTELOCK": "锁定音符模式", diff --git a/OpenTaiko/src/Common/CConfigIni.cs b/OpenTaiko/src/Common/CConfigIni.cs index 1b939e3c..fc29d561 100644 --- a/OpenTaiko/src/Common/CConfigIni.cs +++ b/OpenTaiko/src/Common/CConfigIni.cs @@ -1117,6 +1117,7 @@ public int nPlayerCount { public int nDefaultAILevel = 4; public int nAILevel = 4; public bool bAIBattleMode = false; + public int nControllerDeadzone = 50; public CAIPerformances[] apAIPerformances = { new CAIPerformances(500, 400, 100, 7, 200), @@ -2124,6 +2125,10 @@ public void t書き出し(string iniファイル名) { sw.WriteLine("; Using Buffered input (0:OFF, 1:ON)"); sw.WriteLine("BufferedInput={0}", this.bBufferedInputs ? 1 : 0); sw.WriteLine(); + sw.WriteLine("; Set the deadzone for all connected controllers' thumbsticks."); + sw.WriteLine("; Can be between 10% and 90%."); + sw.WriteLine("ControllerDeadzone={0}", this.nControllerDeadzone); + sw.WriteLine(); sw.WriteLine("; リザルト画像自動保存機能(0:OFF, 1:ON)"); // #25399 2011.6.9 yyagi sw.WriteLine("; Set \"1\" if you'd like to save result screen image automatically"); // sw.WriteLine("; when you get hiscore/hiskill."); // @@ -2898,6 +2903,9 @@ private void ProcessSystemSection(string key, string value) { case "BufferedInput": this.bBufferedInputs = CConversion.bONorOFF(value[0]); break; + case "ControllerDeadzone": + this.nControllerDeadzone = CConversion.ParseIntInRange(value, 10, 90, this.nControllerDeadzone); + break; case "PolyphonicSounds": this.nPoliphonicSounds = CConversion.ParseIntInRange(value, 1, 8, this.nPoliphonicSounds); break; diff --git a/OpenTaiko/src/Common/ImGuiDebugWindow.cs b/OpenTaiko/src/Common/ImGuiDebugWindow.cs index 1c09453d..1fb86e29 100644 --- a/OpenTaiko/src/Common/ImGuiDebugWindow.cs +++ b/OpenTaiko/src/Common/ImGuiDebugWindow.cs @@ -121,17 +121,17 @@ private static void Inputs() { case InputDeviceType.Gamepad: var gamepad = (CInputGamepad)device; for (int i = 0; i < gamepad.ButtonStates.Length; i++) { - if (gamepad.KeyPressed(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Pressed!"); } - if (gamepad.KeyPressing(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Pressing!"); } - if (gamepad.KeyReleased(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Released!"); } + if (gamepad.KeyPressed(i)) { ImGui.Text(gamepad.GetButtonName(i) + " Pressed!"); } + if (gamepad.KeyPressing(i)) { ImGui.Text(gamepad.GetButtonName(i) + " Pressing!"); } + if (gamepad.KeyReleased(i)) { ImGui.Text(gamepad.GetButtonName(i) + " Released!"); } } break; case InputDeviceType.Joystick: var joystick = (CInputJoystick)device; for (int i = 0; i < joystick.ButtonStates.Length; i++) { - if (joystick.KeyPressed(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Pressed!"); } - if (joystick.KeyPressing(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Pressing!"); } - if (joystick.KeyReleased(i)) { ImGui.Text((Silk.NET.Input.ButtonName)i + " Released!"); } + if (joystick.KeyPressed(i)) { ImGui.Text(joystick.GetButtonName(i) + " Pressed!"); } + if (joystick.KeyPressing(i)) { ImGui.Text(joystick.GetButtonName(i) + " Pressing!"); } + if (joystick.KeyReleased(i)) { ImGui.Text(joystick.GetButtonName(i) + " Released!"); } } break; case InputDeviceType.MidiIn: diff --git a/OpenTaiko/src/Common/OpenTaiko.cs b/OpenTaiko/src/Common/OpenTaiko.cs index cf17f1a9..789cdd37 100755 --- a/OpenTaiko/src/Common/OpenTaiko.cs +++ b/OpenTaiko/src/Common/OpenTaiko.cs @@ -1677,8 +1677,7 @@ private void tStartupProcess() { Trace.TraceInformation("Initializing DirectInput and MIDI input..."); Trace.Indent(); try { - bool bUseMIDIIn = true; - InputManager = new CInputManager(Window_, OpenTaiko.ConfigIni.bBufferedInputs); + InputManager = new CInputManager(Window_, OpenTaiko.ConfigIni.bBufferedInputs, true, OpenTaiko.ConfigIni.nControllerDeadzone / 100.0f); foreach (IInputDevice device in InputManager.InputDevices) { if ((device.CurrentType == InputDeviceType.Joystick) && !ConfigIni.dicJoystick.ContainsValue(device.GUID)) { int key = 0; diff --git a/OpenTaiko/src/Stages/04.Config/CActConfigKeyAssign.cs b/OpenTaiko/src/Stages/04.Config/CActConfigKeyAssign.cs index c0b001cb..2b22da73 100644 --- a/OpenTaiko/src/Stages/04.Config/CActConfigKeyAssign.cs +++ b/OpenTaiko/src/Stages/04.Config/CActConfigKeyAssign.cs @@ -203,66 +203,10 @@ public STKEYLABEL(int nCode, string strLabel) { //private CTexture txカーソル; private void tアサインコードの描画_Joypad(int line, int x, int y, int nID, int nCode, bool b強調) { - string str = ""; - switch (nCode) { - case 0: - str = "Left"; - break; - - case 1: - str = "Right"; - break; - - case 2: - str = "Up"; - break; - - case 3: - str = "Down"; - break; - - case 4: - str = "Forward"; - break; - - case 5: - str = "Back"; - break; - - case 6: - str = "CCW"; - break; - - case 7: - str = "CW"; - break; - - default: - if ((8 <= nCode) && (nCode < 8 + 128)) // other buttons (128 types) - { - str = string.Format("Button{0}", nCode - 7); - } else if ((8 + 128 <= nCode) && (nCode < 8 + 128 + 8)) // POV HAT ( 8 types; 45 degrees per HATs) - { - str = string.Format("POV {0}", (nCode - 8 - 128) * 45); - } else { - str = string.Format("Code{0}", nCode); - } - break; - } - OpenTaiko.stageConfig.actFont.t文字列描画(x, y, string.Format("{0,2}. Joypad #{1} ", line, nID) + str, b強調, 0.75f); + OpenTaiko.stageConfig.actFont.t文字列描画(x, y, $"{String.Format("{0,2}", line)}. Joystick #{nID} - {OpenTaiko.InputManager.Joystick(nID)?.GetButtonName(nCode) ?? "(Missing Device)"}", b強調, 0.75f); } private void tアサインコードの描画_Gamepad(int line, int x, int y, int nID, int nCode, bool b強調) { - string str = ""; - if ((8 <= nCode) && (nCode < 8 + 128)) // other buttons (128 types) - { - str = string.Format("Button{0}", nCode - 7); - } else if ((8 + 128 <= nCode) && (nCode < 8 + 128 + 8)) // POV HAT ( 8 types; 45 degrees per HATs) - { - str = string.Format("POV {0}", (nCode - 8 - 128) * 45); - } else { - str = string.Format("Code{0}", nCode); - } - OpenTaiko.stageConfig.actFont.t文字列描画(x, y, string.Format("{0,2}. Gamepad #{1} ", line, nID) + str, b強調, 0.75f); + OpenTaiko.stageConfig.actFont.t文字列描画(x, y, $"{String.Format("{0,2}", line)}. Gamepad #{nID} - {OpenTaiko.InputManager.Gamepad(nID)?.GetButtonName(nCode) ?? "(Missing Device)"}", b強調, 0.75f); } private void tアサインコードの描画_Keyboard(int line, int x, int y, int nID, int nCode, bool b強調) { string str = null; @@ -285,9 +229,9 @@ private void tアサインコードの描画_Mouse(int line, int x, int y, int n } private bool tキーチェックとアサイン_Gamepad() { - foreach (IInputDevice device in OpenTaiko.InputManager.InputDevices) { + foreach (CInputButtonsBase device in OpenTaiko.InputManager.InputDevices) { if (device.CurrentType == InputDeviceType.Gamepad) { - for (int i = 0; i < 15; i++) // +8 for Axis, +8 for HAT + for (int i = 0; i < device.ButtonStates.Length; i++) { if (device.KeyPressed(i)) { OpenTaiko.Skin.soundDecideSFX.tPlay(); @@ -303,9 +247,9 @@ private bool tキーチェックとアサイン_Gamepad() { return false; } private bool tキーチェックとアサイン_Joypad() { - foreach (IInputDevice device in OpenTaiko.InputManager.InputDevices) { + foreach (CInputButtonsBase device in OpenTaiko.InputManager.InputDevices) { if (device.CurrentType == InputDeviceType.Joystick) { - for (int i = 0; i < 15; i++) // +8 for Axis, +8 for HAT + for (int i = 0; i < device.ButtonStates.Length; i++) { if (device.KeyPressed(i)) { OpenTaiko.Skin.soundDecideSFX.tPlay(); diff --git a/OpenTaiko/src/Stages/04.Config/CActConfigList.cs b/OpenTaiko/src/Stages/04.Config/CActConfigList.cs index e16eab2b..16e303be 100644 --- a/OpenTaiko/src/Stages/04.Config/CActConfigList.cs +++ b/OpenTaiko/src/Stages/04.Config/CActConfigList.cs @@ -417,6 +417,10 @@ public void t項目リストの設定_Drums() { CLangManager.LangInstance.GetString("SETTINGS_GAME_IGNORESONGUNLOCKABLES_DESC")); this.list項目リスト.Add(this.iTaikoIgnoreSongUnlockables); + this.iControllerDeadzone = new CItemInteger(CLangManager.LangInstance.GetString("SETTINGS_GAME_CONTROLLERDEADZONE"), 10, 90, OpenTaiko.ConfigIni.nControllerDeadzone, + CLangManager.LangInstance.GetString("SETTINGS_GAME_CONTROLLERDEADZONE_DESC")); + this.list項目リスト.Add(this.iControllerDeadzone); + this.iDrumsGoToKeyAssign = new CItemBase(CLangManager.LangInstance.GetString("SETTINGS_KEYASSIGN_GAME"), CItemBase.EPanelType.Normal, CLangManager.LangInstance.GetString("SETTINGS_KEYASSIGN_GAME_DESC")); this.list項目リスト.Add(this.iDrumsGoToKeyAssign); @@ -1562,6 +1566,7 @@ private struct stMenuItemRight { private CItemToggle iTaikoAutoPlay2P; private CItemToggle iTaikoAutoRoll; private CItemToggle iTaikoIgnoreSongUnlockables; + private CItemInteger iControllerDeadzone; private CItemInteger iRollsPerSec; private CItemInteger iAILevel; @@ -1712,6 +1717,8 @@ private void tConfigIniへ記録する_Drums() { OpenTaiko.ConfigIni.bTight = this.iDrumsTight.bON; OpenTaiko.ConfigIni.nGlobalOffsetMs = this.iGlobalOffsetMs.n現在の値; + OpenTaiko.ConfigIni.nControllerDeadzone = this.iControllerDeadzone.n現在の値; + OpenTaiko.InputManager.Deadzone = OpenTaiko.ConfigIni.nControllerDeadzone / 100.0f; OpenTaiko.ConfigIni.bIgnoreSongUnlockables = this.iTaikoIgnoreSongUnlockables.bON; OpenTaiko.ConfigIni.nMinDisplayedCombo.Drums = this.iSystemMinComboDrums.n現在の値; diff --git "a/OpenTaiko/src/Stages/05.SongSelect/CActSelect\351\233\243\346\230\223\345\272\246\351\201\270\346\212\236\347\224\273\351\235\242.cs" "b/OpenTaiko/src/Stages/05.SongSelect/CActSelect\351\233\243\346\230\223\345\272\246\351\201\270\346\212\236\347\224\273\351\235\242.cs" index 3bbdff7a..d3b01238 100644 --- "a/OpenTaiko/src/Stages/05.SongSelect/CActSelect\351\233\243\346\230\223\345\272\246\351\201\270\346\212\236\347\224\273\351\235\242.cs" +++ "b/OpenTaiko/src/Stages/05.SongSelect/CActSelect\351\233\243\346\230\223\345\272\246\351\201\270\346\212\236\347\224\273\351\235\242.cs" @@ -182,7 +182,7 @@ public override int Draw() { switch (i) { case 0: right = right || OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.RBlue); - left = left || OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.LeftChange); + left = left || OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.LBlue); decide = decide || (OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.LRed) || OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.RRed)); break; case 1: