From d7b4104433f1c84f359d0539c5a98109e00e3ec5 Mon Sep 17 00:00:00 2001 From: Alex Strout Date: Thu, 24 Jun 2021 17:36:46 -0400 Subject: [PATCH] Add in-game InputClass error handling (should hopefully ease some install issues) --- Classes/foxPlayerInput.uc | 39 +++++++++++++++++++++++++++++++++++++++ readme.md | 15 +++++++++++---- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Classes/foxPlayerInput.uc b/Classes/foxPlayerInput.uc index 0738792..da35332 100644 --- a/Classes/foxPlayerInput.uc +++ b/Classes/foxPlayerInput.uc @@ -4,6 +4,7 @@ class foxPlayerInput extends PlayerInput within PlayerController transient; var bool bDoInit; +var bool bDoErrorInit; var float CachedResScaleX; var float CachedDefaultFOV; @@ -21,6 +22,7 @@ struct WeaponInfo }; var WeaponInfo CachedWeaponInfo; +var globalconfig bool bInputClassErrorCheck; var globalconfig float Desired43FOV; var globalconfig bool bCorrectZoomFOV; var globalconfig bool bCorrectMouseSensitivity; @@ -46,6 +48,23 @@ exec function SetFOV(float F) CachedResScaleX = default.CachedResScaleX; } +//fox: Check various PlayerController classes for correct InputClass (and possibly just add it if missing) +function CheckControllerInputClass(class ControllerClass, string FriendlyName) +{ + if (ControllerClass.default.InputClass != class'foxPlayerInput') { + ClientMessage("foxWSFix: " $ FriendlyName $ " InputClass is: " $ ControllerClass.default.InputClass); + + //Just add InputClass if missing + if (ControllerClass.default.InputClass == None) { + ClientMessage("foxWSFix: Attempting to add missing InputClass line..."); + ControllerClass.default.InputClass = class'foxPlayerInput'; + ControllerClass.static.StaticSaveConfig(); + ClientMessage("foxWSFix: " $ FriendlyName $ " InputClass is now: " $ ControllerClass.default.InputClass); + } + ClientMessage("foxWSFix: Please verify User.ini settings!"); + } +} + //fox: Hijack this to force FOV per current aspect ratio - done every frame as a lazy catch-all since we're only hooking clientside PlayerInput event PlayerInput(float DeltaTime) { @@ -55,6 +74,24 @@ event PlayerInput(float DeltaTime) if (bDoInit) { bDoInit = false; + //Check for errors if requested + if (bInputClassErrorCheck + && (class'PlayerController'.default.InputClass != class'foxPlayerInput' || class'xPlayer'.default.InputClass != class'foxPlayerInput')) { + if (bDoErrorInit && Level.TimeSeconds > 3f) { + bDoErrorInit = false; + ClientMessage("foxWSFix Warning: One or more errors occurred. To skip this error check, set bInputClassErrorCheck=false in User.ini"); + CheckControllerInputClass(class'PlayerController', "[Engine.PlayerController]"); + CheckControllerInputClass(class'xPlayer', "[XGame.xPlayer]"); + + //Write settings to ini once if stuck on errors + SaveConfig(); + } + + //Just bail here, resetting bDoInit so we don't do our normal hooks + bDoInit = true; + return; + } + //Write settings to ini if first run SaveConfig(); @@ -260,6 +297,8 @@ function InvertMouse(optional string Invert) defaultproperties { bDoInit=true + bDoErrorInit=true + bInputClassErrorCheck=true Desired43FOV=90f bCorrectZoomFOV=true bCorrectMouseSensitivity=true diff --git a/readme.md b/readme.md index 1ae445c..a4402ec 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -foxWSFix v2.1.0 +foxWSFix v2.1.1 =============== Improved widescreen support for Unreal Tournament 2004 @@ -7,7 +7,7 @@ Features * Aspect-correct "Hor+" FOV adjustment, including vehicle and weapon zoom values * Aspect-correct rendering for first-person weapons * Aspect-correct HUD support (mostly), based on Azarael's HUD Scaling Fix mutator -* Aspect-correct mouse sensitivity (auto-adjusts on resolution change) +* Aspect-correct mouse sensitivity (scale off wider FOV instead of hard-coded 90) * Entirely client-side - no mutators required Install / Uninstall @@ -23,7 +23,8 @@ Replace every instance of it with the following: ;InputClass=Class'Engine.PlayerInput' InputClass=Class'foxWSFix.foxPlayerInput' -(Note: This line may appear multiple times - be sure to change each one if so!) +**Note:** This line should appear *at least twice* - once under `[Engine.PlayerController]`, and +once under `[XGame.xPlayer]`. Be sure to change each one! (or add it if missing) You're done! To uninstall, simply reverse your changes. @@ -60,9 +61,10 @@ However, widescreen HUDs are provided for vanilla HUDs only. foxWSFix stores its settings in System\User.ini as such: [foxWSFix.foxPlayerInput] + bInputClassErrorCheck=True ;Check User.ini InputClass settings for possible errors? Desired43FOV=90.000000 ;Desired 4:3 FOV per SetFOV command / menu setting bCorrectZoomFOV=True ;Correct FOV values for weapon zoom? - bCorrectMouseSensitivity=True ;Correct MouseSensitivity for aspect ratio changes? + bCorrectMouseSensitivity=True ;Correct MouseSensitivity for aspect ratio changes? (due to wider FOV) Desired43MouseSensitivity=2.200000 ;Desired 4:3 MouseSensitivity per SetSensitivity command / menu setting WideHUDMap=(HudClass=Class'UT2k4Assault.HUD_Assault',WideHUD="foxWSFix.foxWideHUD_Assault") WideHUDMap=(HudClass=Class'XInterface.HudCBombingRun',WideHUD="foxWSFix.foxWideHudCBombingRun") @@ -118,6 +120,11 @@ And of course, thanks for trying the mod! Changes ------- +v2.1.1 (2020-06-24): +* Added in-game InputClass error handling to hopefully ease some install issues +* Updated installation instructions to reflect the above +* Clarified bCorrectMouseSensitivity (Unreal normally scales sensitivity against a hard-coded 90 FOV for zoom) + v2.1.0 (2020-02-27): * Resolved AntiTCC issue with GUIController hook (see "v2.0 Upgrade Note" above) * (Note: All functionality is still in place, just handled in foxPlayerInput now)