Skip to content

Commit 5d76440

Browse files
committed
Misc 1.3.9 bugfixes
1 parent cb370d3 commit 5d76440

File tree

10 files changed

+87
-16
lines changed

10 files changed

+87
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
**Bug fixes**:
1010
- Fixed issue where "VR Settings" button would render on top of the rebinding panel
11+
- Fixed issue where pressing the menu button wouldn't work while in the rebinding menu
12+
- Fixed issue where some unused UI elements were sometimes visible in the pause menu
1113

1214
**Removals**:
1315
- Removed the cave dweller from the main menu

Docs/Thunderstore/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor
5959

6060
| LCVR | Lethal Company |
6161
|-------------------|-------------------|
62-
| v1.3.8 *(LATEST)* | V64 - V69* |
62+
| v1.3.9 *(LATEST)* | V64 - V69.1 |
63+
| v1.3.8 | V64 - V69 |
6364
| v1.3.7 | V64 - V67 |
64-
| v1.3.6 | V64 - V67 |
65+
| v1.3.6* | V64 - V67 |
6566
| v1.3.5 | V64 - V66 |
6667
| v1.3.4 | V64 and V64.1 |
6768
| v1.3.3 | V64 and V64.1 |

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor
4040

4141
| LCVR | Lethal Company |
4242
|-------------------|-------------------|
43-
| v1.3.8 *(LATEST)* | V64 - V69* |
43+
| v1.3.9 *(LATEST)* | V64 - V69.1 |
44+
| v1.3.8 | V64 - V69 |
4445
| v1.3.7 | V64 - V67 |
45-
| v1.3.6 | V64 - V67 |
46+
| v1.3.6* | V64 - V67 |
4647
| v1.3.5 | V64 - V66 |
4748
| v1.3.4 | V64 and V64.1 |
4849
| v1.3.3 | V64 and V64.1 |

Source/Compatibility/MoreCompany/MoreCompanyCompatibility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace LCVR.Compatibility.MoreCompany;
44

55
internal static class MoreCompanyCompatibility
66
{
7+
private static GameObject canvasUi;
78
private static Transform previousParent;
89
private static Vector3 previousPosition;
910
private static Vector3 previousRotation;
@@ -18,7 +19,7 @@ public static void SetupMoreCompanyUIMainMenu()
1819
if (overlay == null)
1920
return;
2021

21-
var canvasUi = overlay.Find("Canvas/GlobalScale");
22+
canvasUi = overlay.Find("Canvas/GlobalScale");
2223

2324
previousParent = canvasUi.transform.parent;
2425
previousPosition = canvasUi.transform.localPosition;
@@ -46,7 +47,6 @@ public static void RevertMoreCompanyUIMainMenu()
4647
if (overlay == null)
4748
return;
4849

49-
var canvasUi = overlay.Find("Canvas/GlobalScale");
5050
canvasUi.transform.parent = previousParent;
5151
canvasUi.transform.localPosition = previousPosition;
5252
canvasUi.transform.localEulerAngles = previousRotation;

Source/Input/KeyRemapManager.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ public class KeyRemapManager : MonoBehaviour
4444

4545
public static KeyRemapManager Instance { get; private set; }
4646

47+
public bool IsRebinding => currentOperation != null || Time.realtimeSinceStartup - lastRebindTime < 0.5f;
48+
4749
private KepRemapPanel panel;
4850
private TextMeshProUGUI sectionText;
4951

5052
private PlayerInput playerInput;
5153
private InputActionRebindingExtensions.RebindingOperation currentOperation;
5254
private SettingsOption currentOption;
5355
private List<(RemappableControl, SettingsOption)> controlsList = [];
54-
private readonly List<GameObject> panelObjects = [];
5556

5657
private float lastRebindTime;
5758

@@ -87,7 +88,6 @@ private void Awake()
8788
var obj = Instantiate(panel.keyRemapSlotPrefab, panel.keyRemapContainer);
8889
var discard = Instantiate(AssetManager.KeybindDiscard, obj.transform);
8990

90-
panelObjects.Add(obj);
9191
panel.keySlots.Add(obj);
9292

9393
obj.GetComponentInChildren<TextMeshProUGUI>().text = remappableKey.controlName;
@@ -249,6 +249,8 @@ private void CompleteRebind(SettingsOption option, int rebindIndex)
249249
var action = currentOperation.action;
250250

251251
currentOperation.Dispose();
252+
currentOperation = null;
253+
252254
playerInput.ActivateInput();
253255

254256
var image = option.transform.Find("ControlImage").GetComponent<Image>();

Source/OpenXR.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,26 @@ private static bool EnumRuntimeFiles(IntPtr hKey, List<string> files)
164164
/// </summary>
165165
private static IEnumerable<Runtime> LocateCommonRuntimes()
166166
{
167-
Runtime rt;
168-
169167
// 1. SteamVR
170-
if (SteamClient.IsValid && SteamApps.IsAppInstalled(250820) && SteamApps.AppInstallDir(250820) is { } path)
168+
var runtime = Utils.ExecuteWithSteamAPI<Runtime?>(() =>
171169
{
172-
if (Runtime.ReadFromJson(Path.Combine(path, "steamxr_win64.json"), out rt))
173-
yield return rt;
170+
if (SteamApps.IsAppInstalled(250820) && SteamApps.AppInstallDir(250820) is { } path &&
171+
Runtime.ReadFromJson(Path.Combine(path, "steamxr_win64.json"), out var runtime))
172+
return runtime;
173+
174+
return null;
175+
});
176+
177+
if (runtime != null)
178+
{
179+
yield return runtime.Value;
174180
}
175181

176182
// 2. Virtual Desktop
177-
path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
183+
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
178184
@"Virtual Desktop Streamer\OpenXR\virtualdesktop-openxr.json");
179185

180-
if (File.Exists(path) && Runtime.ReadFromJson(path, out rt))
186+
if (File.Exists(path) && Runtime.ReadFromJson(path, out var rt))
181187
yield return rt;
182188

183189
// 3. Oculus

Source/Patches/QuickMenuManagerPatches.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using HarmonyLib;
2+
using LCVR.Input;
23
using LCVR.Player;
34

45
namespace LCVR.Patches;
@@ -22,8 +23,22 @@ private static void AfterOpenPauseMenu()
2223
/// </summary>
2324
[HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.CloseQuickMenu))]
2425
[HarmonyPostfix]
25-
private static void AfterClosePauseMenu()
26+
private static void AfterClosePauseMenu(bool __runOriginal)
2627
{
28+
if (!__runOriginal)
29+
return;
30+
2731
VRSession.Instance.OnPauseMenuClosed();
2832
}
33+
34+
/// <summary>
35+
/// Prevent closing the pause menu under certain conditions
36+
/// </summary>
37+
[HarmonyPatch(typeof(QuickMenuManager), nameof(QuickMenuManager.CloseQuickMenu))]
38+
[HarmonyPrefix]
39+
private static bool BeforeClosePauseMenu()
40+
{
41+
// Disallow during rebinding operation
42+
return KeyRemapManager.Instance == null || !KeyRemapManager.Instance.IsRebinding;
43+
}
2944
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using HarmonyLib;
2+
3+
namespace LCVR.Patches;
4+
5+
[LCVRPatch]
6+
[HarmonyPatch]
7+
internal static class SettingsOptionPatches
8+
{
9+
/// <summary>
10+
/// When you close the rebinding menu, this function makes sure the binding text is reset to normal for each binding.
11+
/// In VR, we use icons, so this only causes issues for us.
12+
/// </summary>
13+
[HarmonyPatch(typeof(SettingsOption), nameof(SettingsOption.SetBindingToCurrentSetting))]
14+
[HarmonyPrefix]
15+
private static bool IgnoreBindingTextReload()
16+
{
17+
return false;
18+
}
19+
}

Source/UI/VRHUD.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ private void Awake()
438438
spectatorLight = Instantiate(AssetManager.SpectatorLight, transform);
439439
spectatorLight.SetActive(false);
440440

441+
// Remove leftover UI
442+
ingamePlayerHud.Find("TopRightCorner").transform.GetChildren().Do(child => child.gameObject.SetActive(false));
443+
ingamePlayerHud.Find("BottomLeftCorner").transform.GetChildren().Do(child => child.gameObject.SetActive(false));
444+
441445
// Prevents CullFactory from culling the light
442446
spectatorLight.hideFlags |= HideFlags.DontSave;
443447

Source/Utils.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Collections;
1313
using System.Linq;
1414
using GameNetcodeStuff;
15+
using Steamworks;
1516

1617
namespace LCVR;
1718

@@ -235,4 +236,24 @@ public static IEnumerator NopRoutine()
235236
{
236237
yield break;
237238
}
239+
240+
/// <summary>
241+
/// Execute a function making sure the Steam API is initialized, and immediately shutdown the Steam API if it
242+
/// wasn't already in use. This is required because this variant of Steamworks crashes on multiple Init calls,
243+
/// instead of silently ignoring subsequent init calls.
244+
/// </summary>
245+
public static T ExecuteWithSteamAPI<T>(Func<T> func)
246+
{
247+
var isValid = SteamClient.IsValid;
248+
249+
if (!isValid)
250+
SteamClient.Init(1966720, false);
251+
252+
var result = func();
253+
254+
if (!isValid)
255+
SteamClient.Shutdown();
256+
257+
return result;
258+
}
238259
}

0 commit comments

Comments
 (0)