From f11c76894c8ec2a5525aec3a80804b15810cb69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Uriel=20Navall?= Date: Tue, 25 Nov 2025 09:08:43 -0300 Subject: [PATCH] Fixed runtime warnings and added gamepad controls to the readme. Also made changing the FOV faster. --- README.md | 31 +++++++++++--------- src/Cinematic/IGamepadInputInterceptor.cs | 35 +++++++++++++++++++++-- src/UI/Panels/FreeCamPanel.cs | 8 +++--- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 4581b07..a2b438a 100644 --- a/README.md +++ b/README.md @@ -100,21 +100,21 @@ I wrote a [guide](https://framedsc.com/GeneralGuides/cinematic-unity-explorer.ht The table below describes all of the relevant default hotkeys. You can edit them to your liking by going to the Options panel, changing the hotkeys you want, and saving the settings. -Feature | Key --|- -Freecam | `Insert` -Move the camera forward/left/right/backward | `W`/`A`/`S`/`D` - `UpArrow`/`LeftArrow`/`RightArrow`/`DownArrow` -Move the camera upwards | `Space` -Move the camera downwards | `LeftControl` -Speed up movement | `LeftShift` -Speed down movement | `LeftAlt` -Change freecam orientation | Right mouse click -Tilt left | `Numpad 1` -Tilt right | `Numpad 3` +Feature | Keyboard | Gamepad +-|-|- +Freecam | `Insert` | +Move the camera forward/left/right/backward | `W`/`A`/`S`/`D` - `UpArrow`/`LeftArrow`/`RightArrow`/`DownArrow` | Left stick +Move the camera upwards | `Space` | `LT` +Move the camera downwards | `LeftControl` | `RT` +Speed up movement | `LeftShift` | `Y` +Speed down movement | `LeftAlt` | `X` +Change freecam orientation | Right mouse click | Right stick +Tilt left | `Numpad 1` | Dpad left +Tilt right | `Numpad 3` | Dpad right Reset tilt | `Numpad 2` -Increase FOV | `Numpad +` -Decrease FOV | `Numpad -` -Reset FOV | `Numpad *` +Increase FOV | `Numpad +` | Dpad up +Decrease FOV | `Numpad -` | Dpad down +Reset FOV | `Numpad *` | `B` Pause | `PageUp` Block Freecam movement and rotation | `Home` Block games input | `Numpad .` @@ -122,6 +122,9 @@ Frameskip | `PageDown` HUD Toggle | `Delete` Freeze NPC animations | `Numpad 0` +> [!NOTE] +> Gamepad is only compatible if the game is using [Unity Input System](https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/index.html). + # Features The following are the features I developed for this fork. All focused on making things easier for capture artists to get marketing material for studios. diff --git a/src/Cinematic/IGamepadInputInterceptor.cs b/src/Cinematic/IGamepadInputInterceptor.cs index ccef863..5b5ba0f 100644 --- a/src/Cinematic/IGamepadInputInterceptor.cs +++ b/src/Cinematic/IGamepadInputInterceptor.cs @@ -204,7 +204,22 @@ namespace UniverseLib.Input { if (_vector2ControlType != null) { - MethodInfo vector2ReadValueMethod = _vector2ControlType.GetMethod("ReadValue", Type.EmptyTypes); + MethodInfo vector2ReadValueMethod = _vector2ControlType.GetMethod("ReadValue", + BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, + null, Type.EmptyTypes, null); + + // If not found with DeclaredOnly, try getting from base type + if (vector2ReadValueMethod == null) + { + Type baseType = _vector2ControlType.BaseType; + if (baseType != null && baseType.IsGenericType) + { + vector2ReadValueMethod = baseType.GetMethod("ReadValue", + BindingFlags.Public | BindingFlags.Instance, + null, Type.EmptyTypes, null); + } + } + if (vector2ReadValueMethod != null) { PatchMethod(vector2ReadValueMethod, null, nameof(Postfix_Vector2ReadValue)); @@ -216,8 +231,22 @@ namespace UniverseLib.Input if (_axisControlType != null) { - // Patch AxisControl.ReadValue() method - MethodInfo readValueMethod = _axisControlType.GetMethod("ReadValue", Type.EmptyTypes); + MethodInfo readValueMethod = _axisControlType.GetMethod("ReadValue", + BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, + null, Type.EmptyTypes, null); + + // If not found with DeclaredOnly, try getting from base type + if (readValueMethod == null) + { + Type baseType = _axisControlType.BaseType; + if (baseType != null && baseType.IsGenericType) + { + readValueMethod = baseType.GetMethod("ReadValue", + BindingFlags.Public | BindingFlags.Instance, + null, Type.EmptyTypes, null); + } + } + if (readValueMethod != null) { PatchMethod(readValueMethod, null, nameof(Postfix_AxisReadValue)); diff --git a/src/UI/Panels/FreeCamPanel.cs b/src/UI/Panels/FreeCamPanel.cs index 7b15d64..c452e2c 100644 --- a/src/UI/Panels/FreeCamPanel.cs +++ b/src/UI/Panels/FreeCamPanel.cs @@ -1393,12 +1393,12 @@ namespace UnityExplorer.UI.Panels if (dpadUpPressed) { - FreeCamPanel.GetFreecam().fieldOfView += moveSpeed; + FreeCamPanel.GetFreecam().fieldOfView += moveSpeed * 5; } if (dpadDownPressed) { - FreeCamPanel.GetFreecam().fieldOfView -= moveSpeed; + FreeCamPanel.GetFreecam().fieldOfView -= moveSpeed * 5; } if (dpadLeftPressed) @@ -1477,12 +1477,12 @@ namespace UnityExplorer.UI.Panels if (IInputManager.GetKey(ConfigManager.Decrease_FOV.Value)) { - FreeCamPanel.GetFreecam().fieldOfView -= moveSpeed; + FreeCamPanel.GetFreecam().fieldOfView -= moveSpeed * 5; } if (IInputManager.GetKey(ConfigManager.Increase_FOV.Value)) { - FreeCamPanel.GetFreecam().fieldOfView += moveSpeed; + FreeCamPanel.GetFreecam().fieldOfView += moveSpeed * 5; } if (IInputManager.GetKey(ConfigManager.Reset_FOV.Value)){