diff --git a/Assembly-CSharp/Global/Booster/BoosterSlider.cs b/Assembly-CSharp/Global/Booster/BoosterSlider.cs index 67ea659e1..674d4edff 100644 --- a/Assembly-CSharp/Global/Booster/BoosterSlider.cs +++ b/Assembly-CSharp/Global/Booster/BoosterSlider.cs @@ -281,7 +281,7 @@ public void SetBoosterState(Int32 currentCharacterStateIndex) } } - public void ShowWaringDialog(BoosterType type, Action callback = null) + public void ShowWarningDialog(BoosterType type, Action callback = null) { if (this.needComfirmType == BoosterType.None && (PersistenSingleton.Instance.IsPlayerControlEnable || PersistenSingleton.Instance.State == UIManager.UIState.Config) diff --git a/Assembly-CSharp/Global/Config/ConfigUI.cs b/Assembly-CSharp/Global/Config/ConfigUI.cs index d188cc503..8b6bda08f 100644 --- a/Assembly-CSharp/Global/Config/ConfigUI.cs +++ b/Assembly-CSharp/Global/Config/ConfigUI.cs @@ -813,7 +813,7 @@ private void OnBoosterPanelKeyConfirm(GameObject go) if (Configuration.Cheats.MasterSkill) { FF9Sfx.FF9SFX_Play(103); - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.MasterSkill, AfterBoosterFinish); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.MasterSkill, AfterBoosterFinish); hitpointScreenButton.KeyCommand = Control.None; WarningDialogHitPoint.SetActive(true); } @@ -836,7 +836,7 @@ private void OnBoosterPanelKeyConfirm(GameObject go) if (Configuration.Cheats.LvMax) { FF9Sfx.FF9SFX_Play(103); - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.LvMax, AfterBoosterFinish); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.LvMax, AfterBoosterFinish); hitpointScreenButton.KeyCommand = Control.None; WarningDialogHitPoint.SetActive(true); } @@ -851,7 +851,7 @@ private void OnBoosterPanelKeyConfirm(GameObject go) if (Configuration.Cheats.GilMax) { FF9Sfx.FF9SFX_Play(103); - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.GilMax, AfterBoosterFinish); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.GilMax, AfterBoosterFinish); hitpointScreenButton.KeyCommand = Control.None; WarningDialogHitPoint.SetActive(true); } diff --git a/Assembly-CSharp/Global/Hono/HonoInputManager.cs b/Assembly-CSharp/Global/Hono/HonoInputManager.cs index 30c186060..19fb9a1dc 100644 --- a/Assembly-CSharp/Global/Hono/HonoInputManager.cs +++ b/Assembly-CSharp/Global/Hono/HonoInputManager.cs @@ -915,6 +915,22 @@ public Boolean IsInputUp(Control index) return this.isInputUp[indexInt]; } + /// + /// [DV] L3 and R3 are working with XInputDotNetPure if Steam Input is activated ! (need to simulate a XBOX controller) + /// + + public Boolean IsL3Pressed() + { + return UnityXInput.XInputManager.Instance.CurrentState.Buttons.LeftStick == ButtonState.Pressed + && UnityXInput.XInputManager.Instance.PreviousState.Buttons.LeftStick == ButtonState.Released; + } + + public Boolean IsR3Pressed() + { + return UnityXInput.XInputManager.Instance.CurrentState.Buttons.RightStick == ButtonState.Pressed + && UnityXInput.XInputManager.Instance.PreviousState.Buttons.RightStick == ButtonState.Released; + } + public Vector2 GetAxis() { return this.AxisValue(); diff --git a/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs b/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs index 1d7b0968f..5e0568e6f 100644 --- a/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs +++ b/Assembly-CSharp/Global/UI/UIKey/UIKeyTrigger.cs @@ -197,7 +197,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) return; if (PersistenSingleton.Instance.State == UIManager.UIState.Title || PersistenSingleton.Instance.State == UIManager.UIState.PreEnding || (PersistenSingleton.Instance.State == UIManager.UIState.Ending || !MBG.IsNull && !MBG.Instance.IsFinishedForDisableBooster())) return; - if (UnityXInput.Input.GetKeyDown(KeyCode.F1) || triggerType == BoosterType.HighSpeedMode) + if (UnityXInput.Input.GetKeyDown(KeyCode.F1) || triggerType == BoosterType.HighSpeedMode || IsStickCheatTriggered("HighSpeedMode")) { if (!Configuration.Cheats.SpeedMode) { @@ -211,7 +211,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) PersistenSingleton.Instance.Booster.SetBoosterHudIcon(BoosterType.HighSpeedMode, flag); PersistenSingleton.Instance.Booster.SetBoosterButton(BoosterType.HighSpeedMode, flag); } - if (UnityXInput.Input.GetKeyDown(KeyCode.F2) || triggerType == BoosterType.BattleAssistance) + if (UnityXInput.Input.GetKeyDown(KeyCode.F2) || triggerType == BoosterType.BattleAssistance || IsStickCheatTriggered("BattleAssistance")) { if (!Configuration.Cheats.BattleAssistance) { @@ -227,7 +227,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) PersistenSingleton.Instance.Booster.SetBoosterHudIcon(BoosterType.BattleAssistance, flag); PersistenSingleton.Instance.Booster.SetBoosterButton(BoosterType.BattleAssistance, flag); } - if (UnityXInput.Input.GetKeyDown(KeyCode.F3) || triggerType == BoosterType.Attack9999) + if (UnityXInput.Input.GetKeyDown(KeyCode.F3) || triggerType == BoosterType.Attack9999 || IsStickCheatTriggered("Attack9999")) { if (!Configuration.Cheats.Attack9999) { @@ -241,7 +241,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) PersistenSingleton.Instance.Booster.SetBoosterHudIcon(BoosterType.Attack9999, flag); PersistenSingleton.Instance.Booster.SetBoosterButton(BoosterType.Attack9999, flag); } - if (UnityXInput.Input.GetKeyDown(KeyCode.F4) || triggerType == BoosterType.NoRandomEncounter) + if (UnityXInput.Input.GetKeyDown(KeyCode.F4) || triggerType == BoosterType.NoRandomEncounter || IsStickCheatTriggered("NoRandomEncounter")) { if (!Configuration.Cheats.NoRandomEncounter) { @@ -268,7 +268,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) if (!FF9StateSystem.Settings.IsMasterSkill) { - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.MasterSkill); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.MasterSkill); } else { @@ -285,7 +285,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) return; } - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.LvMax); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.LvMax); } if (UnityXInput.Input.GetKeyDown(KeyCode.F7) && (PersistenSingleton.Instance.State == UIManager.UIState.FieldHUD || PersistenSingleton.Instance.State == UIManager.UIState.WorldHUD || PersistenSingleton.Instance.State == UIManager.UIState.Pause)) { @@ -296,7 +296,7 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) return; } - PersistenSingleton.Instance.Booster.ShowWaringDialog(BoosterType.GilMax); + PersistenSingleton.Instance.Booster.ShowWarningDialog(BoosterType.GilMax); } if (Configuration.Control.SoftReset && ((UnityXInput.Input.GetKeyDown(KeyCode.F8) && PersistenSingleton.Instance.IsPause) || SoftResetKeyPSXDown)) { // Soft Reset @@ -352,13 +352,9 @@ public void HandleBoosterButton(BoosterType triggerType = BoosterType.None) SceneDirector.Replace("Title", SceneTransition.FadeOutToBlack_FadeIn, true); return; } - if (UnityXInput.Input.GetKeyDown(KeyCode.F9) && Configuration.Control.TurboDialog) - { - if (TurboKey) - TurboKey = false; - else - TurboKey = true; - } + + if ((UnityXInput.Input.GetKeyDown(KeyCode.F9) || IsStickCheatTriggered("TurboDialog")) && Configuration.Control.TurboDialog) + TurboKey = !TurboKey; } [DllImport("user32.dll")] @@ -938,6 +934,21 @@ private Boolean ShouldTurboDialog(List confirmKeys) return false; } + private Boolean IsStickCheatTriggered(String cheatName) + { + if (HonoInputManager.Instance.IsL3Pressed()) + { + if (String.Equals(Configuration.Control.L3BindCheat, cheatName, StringComparison.OrdinalIgnoreCase)) + return true; + } + if (HonoInputManager.Instance.IsR3Pressed()) + { + if (String.Equals(Configuration.Control.R3BindCheat, cheatName, StringComparison.OrdinalIgnoreCase)) + return true; + } + return false; + } + private void Start() { UICamera.onNavigate = (UICamera.KeyCodeDelegate)Delegate.Combine(UICamera.onNavigate, (UICamera.KeyCodeDelegate)OnKeyNavigate); diff --git a/Assembly-CSharp/Memoria/Configuration/Access/Control.cs b/Assembly-CSharp/Memoria/Configuration/Access/Control.cs index d7a77f1c2..1b47569c1 100644 --- a/Assembly-CSharp/Memoria/Configuration/Access/Control.cs +++ b/Assembly-CSharp/Memoria/Configuration/Access/Control.cs @@ -39,6 +39,8 @@ The PSX movement algorithm is different than the remaster's movement algorithm public static Boolean PSXMovementMethod => Instance._control.PSXMovementMethod; public static Boolean AlwaysCaptureGamepad => Instance._control.AlwaysCaptureGamepad; public static Boolean SwapConfirmCancel => Instance._control.SwapConfirmCancel; + public static String L3BindCheat => Instance._control.L3BindCheat; + public static String R3BindCheat => Instance._control.R3BindCheat; } } } diff --git a/Assembly-CSharp/Memoria/Configuration/Memoria.ini b/Assembly-CSharp/Memoria/Configuration/Memoria.ini index c4c4b5fba..82d5c1ff5 100644 --- a/Assembly-CSharp/Memoria/Configuration/Memoria.ini +++ b/Assembly-CSharp/Memoria/Configuration/Memoria.ini @@ -106,11 +106,13 @@ AlternateControls = 0 ; WrapSomeMenus (default 1) 0 = Don't wrap selection in menu that don't natively wrap it / 1 = Wrap selection for easing menu navigation ; BattleAutoConfirm (default 1) 0 = Confirm needs to be pressed repeatedly / 1 = Holding Confirm will automatically validate commands during battle and progress the battle result screen ; TurboDialog (default 1) F9 - Toggles the automatic skipping of basic dialogs. Alternatively Holding Shift + Confirm or Right Bumper + Confirm also skips dialogs automatically. - ; SoftReset (default 1) [Pause + F8] / [L1+R1 + L2+R2 + start + select (PSX)] - Back to Main Menu instantly # [DV]: I've used this feature hundreds of times and never had a problem... but be careful, bugs can happen! + ; SoftReset (default 1) [Pause + F8] / [L1+R1 + L2+R2 + start + select (PSX)] - Back to Main Menu instantly ; PSXScrollingMethod (default 1) 0 = Use the native Steam scrolling pattern / 1 = Scroll lists with the same behaviour as the PSX version ; PSXMovementMethod (default 1) 0 = Use the native Steam move pathing method, which makes movements faster on sloping paths / 1 = Use the PSX move pathing method ; AlwaysCaptureGamepad (default 1) 0 = Gamepad inputs are ignored when the game windows doesn't have focus / 1 = Gamepad inputs are always in effect ; SwapConfirmCancel (default 0) 0 = Confirm and Cancel inputs are the PSX buttons X and O respectively (western norm) / 1 = Confirm and Cancel inputs are the PSX buttons O and X respectively (Japanese norm) + ; L3BindCheat (default "HighSpeedMode") Binds a cheat to the L3 button / Values available => HighSpeedMode, BattleAssistance, Attack9999, NoRandomEncounter, TurboDialog or you can left it empty. + ; R3BindCheat (default "TurboDialog") Binds a cheat to the R3 button / Values available => HighSpeedMode, BattleAssistance, Attack9999, NoRandomEncounter, TurboDialog or you can left it empty. Enabled = 1 KeyBindings = "W","A","S","D","Backspace","Alpha1" DisableMouse = 0 @@ -123,6 +125,8 @@ PSXScrollingMethod = 1 PSXMovementMethod = 1 AlwaysCaptureGamepad = 1 SwapConfirmCancel = 0 +L3BindCheat = HighSpeedMode +R3BindCheat = TurboDialog [AnalogControl] ; StickThreshold (default 10) 0->100, threshold under which there is no movement diff --git a/Assembly-CSharp/Memoria/Configuration/Structure/ControlSection.cs b/Assembly-CSharp/Memoria/Configuration/Structure/ControlSection.cs index 7d5d5c8d2..9282ccfa2 100644 --- a/Assembly-CSharp/Memoria/Configuration/Structure/ControlSection.cs +++ b/Assembly-CSharp/Memoria/Configuration/Structure/ControlSection.cs @@ -38,6 +38,8 @@ private sealed class ControlSection : IniSection public readonly IniValue PSXMovementMethod; public readonly IniValue AlwaysCaptureGamepad; public readonly IniValue SwapConfirmCancel; + public readonly IniValue L3BindCheat; + public readonly IniValue R3BindCheat; public ControlSection() : base(nameof(ControlSection), true) { @@ -52,6 +54,8 @@ public ControlSection() : base(nameof(ControlSection), true) PSXMovementMethod = BindBoolean(nameof(PSXMovementMethod), false); AlwaysCaptureGamepad = BindBoolean(nameof(AlwaysCaptureGamepad), true); SwapConfirmCancel = BindBoolean(nameof(SwapConfirmCancel), false); + L3BindCheat = BindString(nameof(L3BindCheat), "HighSpeedMode"); + R3BindCheat = BindString(nameof(R3BindCheat), "TurboDialog"); } } } diff --git a/Memoria.Launcher/Ini/Memoria.ini b/Memoria.Launcher/Ini/Memoria.ini index c4c4b5fba..82d5c1ff5 100644 --- a/Memoria.Launcher/Ini/Memoria.ini +++ b/Memoria.Launcher/Ini/Memoria.ini @@ -106,11 +106,13 @@ AlternateControls = 0 ; WrapSomeMenus (default 1) 0 = Don't wrap selection in menu that don't natively wrap it / 1 = Wrap selection for easing menu navigation ; BattleAutoConfirm (default 1) 0 = Confirm needs to be pressed repeatedly / 1 = Holding Confirm will automatically validate commands during battle and progress the battle result screen ; TurboDialog (default 1) F9 - Toggles the automatic skipping of basic dialogs. Alternatively Holding Shift + Confirm or Right Bumper + Confirm also skips dialogs automatically. - ; SoftReset (default 1) [Pause + F8] / [L1+R1 + L2+R2 + start + select (PSX)] - Back to Main Menu instantly # [DV]: I've used this feature hundreds of times and never had a problem... but be careful, bugs can happen! + ; SoftReset (default 1) [Pause + F8] / [L1+R1 + L2+R2 + start + select (PSX)] - Back to Main Menu instantly ; PSXScrollingMethod (default 1) 0 = Use the native Steam scrolling pattern / 1 = Scroll lists with the same behaviour as the PSX version ; PSXMovementMethod (default 1) 0 = Use the native Steam move pathing method, which makes movements faster on sloping paths / 1 = Use the PSX move pathing method ; AlwaysCaptureGamepad (default 1) 0 = Gamepad inputs are ignored when the game windows doesn't have focus / 1 = Gamepad inputs are always in effect ; SwapConfirmCancel (default 0) 0 = Confirm and Cancel inputs are the PSX buttons X and O respectively (western norm) / 1 = Confirm and Cancel inputs are the PSX buttons O and X respectively (Japanese norm) + ; L3BindCheat (default "HighSpeedMode") Binds a cheat to the L3 button / Values available => HighSpeedMode, BattleAssistance, Attack9999, NoRandomEncounter, TurboDialog or you can left it empty. + ; R3BindCheat (default "TurboDialog") Binds a cheat to the R3 button / Values available => HighSpeedMode, BattleAssistance, Attack9999, NoRandomEncounter, TurboDialog or you can left it empty. Enabled = 1 KeyBindings = "W","A","S","D","Backspace","Alpha1" DisableMouse = 0 @@ -123,6 +125,8 @@ PSXScrollingMethod = 1 PSXMovementMethod = 1 AlwaysCaptureGamepad = 1 SwapConfirmCancel = 0 +L3BindCheat = HighSpeedMode +R3BindCheat = TurboDialog [AnalogControl] ; StickThreshold (default 10) 0->100, threshold under which there is no movement diff --git a/Memoria.XInputDotNetPure/GamePad.cs b/Memoria.XInputDotNetPure/GamePad.cs index 146b627be..46b7a2fb8 100644 --- a/Memoria.XInputDotNetPure/GamePad.cs +++ b/Memoria.XInputDotNetPure/GamePad.cs @@ -366,10 +366,10 @@ public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone dea if ((jslState.buttons & (int)JSL.Button.Options) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.Start; if ((jslState.buttons & (int)JSL.Button.TouchpadClick) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.Back; if ((jslState.buttons & (int)JSL.Button.Minus) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.Back; - if ((jslState.buttons & (int)JSL.Button.ZL) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.LeftThumb; - if ((jslState.buttons & (int)JSL.Button.ZR) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.RightThumb; - if ((jslState.buttons & (int)JSL.Button.L) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.LeftShoulder; - if ((jslState.buttons & (int)JSL.Button.R) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.RightShoulder; + if ((jslState.buttons & (int)JSL.Button.L) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.LeftShoulder; // L1 + if ((jslState.buttons & (int)JSL.Button.R) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.RightShoulder; // R1 + if ((jslState.buttons & (int)JSL.Button.LClick) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.LeftThumb; // L3 + if ((jslState.buttons & (int)JSL.Button.RClick) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.RightThumb; // R3 if ((jslState.buttons & (int)JSL.Button.PS) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.Guide; if ((jslState.buttons & (int)JSL.Button.S) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.A; if ((jslState.buttons & (int)JSL.Button.E) != 0) rawState.Gamepad.wButtons |= (ushort)ButtonsConstants.B; @@ -387,8 +387,8 @@ public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone dea rawState.Gamepad.sThumbRX = (short)Utils.Clamp((int)(jslState.stickRX * short.MaxValue + rawState.Gamepad.sThumbRX), short.MinValue, short.MaxValue); rawState.Gamepad.sThumbRY = (short)Utils.Clamp((int)(jslState.stickRY * short.MaxValue + rawState.Gamepad.sThumbRY), short.MinValue, short.MaxValue); - rawState.Gamepad.bLeftTrigger = (byte)Utils.Clamp((int)(jslState.lTrigger * byte.MaxValue + rawState.Gamepad.bLeftTrigger), byte.MinValue, byte.MaxValue); - rawState.Gamepad.bRightTrigger = (byte)Utils.Clamp((int)(jslState.rTrigger * byte.MaxValue + rawState.Gamepad.bRightTrigger), byte.MinValue, byte.MaxValue); + rawState.Gamepad.bLeftTrigger = (byte)Utils.Clamp((int)(jslState.lTrigger * byte.MaxValue + rawState.Gamepad.bLeftTrigger), byte.MinValue, byte.MaxValue); // L2 + rawState.Gamepad.bRightTrigger = (byte)Utils.Clamp((int)(jslState.rTrigger * byte.MaxValue + rawState.Gamepad.bRightTrigger), byte.MinValue, byte.MaxValue); // R2 } result = Utils.Success; }