Skip to content

Commit

Permalink
* 1.3.7
Browse files Browse the repository at this point in the history
- Add verbose logging
- Update local hashes
- Fix ladder issues
  • Loading branch information
DaXcess committed Dec 21, 2024
1 parent e14ee36 commit a2b7d9c
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 30 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 1.3.7

**Changes**:
- Updated the compatible game version list to the latest LC
- Increased logging verbosity for OpenXR initialization failures

**Bug fixes**:
- Fixed ladder animations and sounds

# 1.3.6

**Additions**:
Expand Down
5 changes: 3 additions & 2 deletions Docs/Thunderstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor

| LCVR | Lethal Company |
|-------------------|-------------------|
| v1.3.6 *(LATEST)* | V64 - V67 |
| v1.3.7 *(LATEST)* | V64 - V69* |
| v1.3.6 | V64 - V67 |
| v1.3.5 | V64 - V66 |
| v1.3.4 | V64 and V64.1 |
| v1.3.3 | V64 and V64.1 |
Expand All @@ -83,7 +84,7 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor
| v1.0.1 | V45 and V49 |
| v1.0.0 | V45 and V49 |

> LCVR versions from 1.3.6 and above also check hashes remotely, meaning newer Lethal Company versions might be supported even though they aren't listed here.
> \* LCVR versions from 1.3.6 and above also check hashes remotely, meaning newer Lethal Company versions might be supported even though they aren't listed here.
# Compatibility

Expand Down
2 changes: 1 addition & 1 deletion LCVR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>LCVR</AssemblyName>
<Description>Collecting Scrap in VR</Description>
<Version>1.3.6</Version>
<Version>1.3.7</Version>
<Authors>DaXcess</Authors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12.0</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion Preloader/LCVR.Preload.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<Description>LCVR Preloader</Description>
<Authors>DaXcess</Authors>
<Version>1.3.2</Version>
<Version>1.3.7</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>12.0</LangVersion>
<Title>LCVR.Preload</Title>
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ For more documentation on using the mod, check out the [LethalCompanyVR Thunders

# Versions

> [!NOTE]
> Versions annotated with **(BETA)** are not available on Thunderstore, and must be downloaded or compiled manually
Here is a list of LCVR versions and which version(s) of Lethal Company it supports

| LCVR | Lethal Company |
|-------------------|-------------------|
| v1.3.6 *(LATEST)* | V64 - V67 |
| v1.3.7 *(LATEST)* | V64 - V69* |
| v1.3.6 | V64 - V67 |
| v1.3.5 | V64 - V66 |
| v1.3.4 | V64 and V64.1 |
| v1.3.3 | V64 and V64.1 |
Expand All @@ -67,7 +65,7 @@ Here is a list of LCVR versions and which version(s) of Lethal Company it suppor
| v1.0.1 | V45 and V49 |
| v1.0.0 | V45 and V49 |

> LCVR versions from 1.3.6 and above also check hashes remotely, meaning newer Lethal Company versions might be supported even though they aren't listed here.
> \* LCVR versions from 1.3.6 and above also check hashes remotely, meaning newer Lethal Company versions might be supported even though they aren't listed here.
# For developers

Expand All @@ -87,7 +85,7 @@ Next up you'll need to grab a copy of some **Runtime Dependencies** and the [**A

> You can skip this part if you have taken the runtime dependencies from the releases page.
First of all start by installing Unity 2022.3.9f1, which is the Unity version that Lethal Company uses. Once you have installed the editor, create a new Unity project. If you are planning on adding prefabs to the mod, use the HDRP template and add the XR modules via the HDRP helper or by manually installing the Unity OpenXR plugins (Google is your friend), otherwise you can just use the VR template.
First of all start by installing Unity 2022.3.9f1, which is the Unity version that Lethal Company uses. Once you have installed the editor, create a new Unity project. If you are planning on adding prefabs to the mod, use the HDRP template and add the XR modules via the HDRP helper or by manually installing the Unity OpenXR plugins (Google is your friend). Otherwise you can just use the VR template.

Make sure you set the scripting backend to Mono, and not to Il2Cpp (Unity will warn you when you try to compile a VR game with Il2Cpp enabled). You can now build your dummy game. Once the game is built you can navigate to it's `<Project Name>_Data/Managed` directory. There you will need to extract the following files:

Expand All @@ -106,7 +104,7 @@ And from the `<Project Name>_Data/Plugins/x86_64` directory:

BepInEx is the modloader that LCVR uses to mod the game. You can download BepInEx from their [GitHub Releases](https://github.com/BepInEx/BepInEx/releases) (LCVR currently targets BepInEx 5.4.22).

To install BepInEx, you can follow their [Installation Guide](https://docs.bepinex.dev/articles/user_guide/installation/index.html#installing-bepinex-1).
To install BepInEx, you can follow their [Installation Gude](https://docs.bepinex.dev/articles/user_guide/installation/index.html#installing-bepinex-1).

## Installing the mod

Expand Down
6 changes: 3 additions & 3 deletions Source/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public class Config(string assemblyPath, ConfigFile file)
// General configuration

public ConfigEntry<bool> DisableVR { get; } = file.Bind("General", "DisableVR", false, "Disables the main functionality of this mod, can be used if you want to play without VR while keeping the mod installed.");

public ConfigEntry<bool> AskOnStartup { get; } = file.Bind("General", "AskOnStartup", false, "When enabled, shows a popup on game launch where you are asked whether or not you want to play in VR. If DisableVR is set to true, this popup will not show.");
public ConfigEntry<bool> EnableHelmetVisor { get; } = file.Bind("General", "EnableHelmetVisor", false, "Enables the first person helmet visor and helmet. This will restrict your field of view, but looks more immersive.");

public ConfigEntry<bool> EnableVerboseLogging { get; } = file.Bind("General", "EnableVerboseLogging", false, "Enables verbose debug logging during OpenXR initialization");

// Performance configuration

public ConfigEntry<bool> EnableOcclusionMesh { get; } = file.Bind("Performance", "EnableOcclusionMesh", true, "The occlusion mesh will cause the game to stop rendering pixels outside of the lens views, which increases performance.");
Expand All @@ -27,7 +27,7 @@ public class Config(string assemblyPath, ConfigFile file)

// Input configuration

public ConfigEntry<TurnProviderOption> TurnProvider = file.Bind("Input", "TurnProvider", TurnProviderOption.Snap, new ConfigDescription($"Specify which turning provider your player uses, if any.", new AcceptableValueEnum<TurnProviderOption>()));
public ConfigEntry<TurnProviderOption> TurnProvider { get; } = file.Bind("Input", "TurnProvider", TurnProviderOption.Snap, new ConfigDescription($"Specify which turning provider your player uses, if any.", new AcceptableValueEnum<TurnProviderOption>()));
public ConfigEntry<float> SmoothTurnSpeedModifier { get; } = file.Bind("Input", "SmoothTurnSpeedModifier", 1f, new ConfigDescription("A multiplier that is added to the smooth turning speed. Requires turn provider to be set to smooth.", new AcceptableValueRange<float>(0.25f, 5)));
public ConfigEntry<float> SnapTurnSize { get; } = file.Bind("Input", "SnapTurnSize", 45f, new ConfigDescription("The amount of rotation that is applied when performing a snap turn. Requires turn provider to be set to snap.", new AcceptableValueRange<float>(10, 180)));
public ConfigEntry<bool> ToggleSprint { get; } = file.Bind("Input", "ToggleSprint", false, "Whether the sprint button should toggle sprint instead of having to hold it down.");
Expand Down
33 changes: 33 additions & 0 deletions Source/OpenXR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,33 @@ namespace LCVR;

internal static class OpenXR
{
[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_GenerateReport")]
private static extern IntPtr Internal_GenerateReport();

[DllImport("UnityOpenXR", EntryPoint = "DiagnosticReport_ReleaseReport")]
private static extern void Internal_ReleaseReport(IntPtr report);

[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetRuntimeName")]
private static extern bool Internal_GetRuntimeName(out IntPtr runtimeNamePtr);

[DllImport("UnityOpenXR", EntryPoint = "NativeConfig_GetRuntimeVersion")]
private static extern bool Internal_GetRuntimeVersion(out ushort major, out ushort minor, out ushort patch);

/// <summary>
/// Generate an OpenXR diagnostics report
/// </summary>
private static string GenerateReport()
{
var handle = Internal_GenerateReport();
if (handle == IntPtr.Zero)
return "";

var result = Marshal.PtrToStringAnsi(handle);
Internal_ReleaseReport(handle);

return result;
}

/// <summary>
/// Attempt to enumerate installed OpenXR runtimes as described by the <a href="https://registry.khronos.org/OpenXR/specs/1.1/loader.html#runtime-discovery">OpenXR standard</a>.
/// </summary>
Expand Down Expand Up @@ -293,6 +314,18 @@ private static bool InitializeXR(Runtime? runtime)
var displays = new List<XRDisplaySubsystem>();
SubsystemManager.GetInstances(displays);

if (Plugin.Config.EnableVerboseLogging.Value)
{
Logger.LogWarning("OpenXR Diagnostics Report:");

foreach (var line in GenerateReport().Split("\n"))
Logger.LogWarning(line);

Logger.LogWarning("");
Logger.LogWarning(
"To prevent diagnostics report from being printed, disable the 'EnableVerboseLogging' option in the settings.");
}

return displays.Count > 0;
}

Expand Down
14 changes: 0 additions & 14 deletions Source/Patches/PlayerControllerPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,6 @@ private static IEnumerable<CodeInstruction> AllowActivateDuringMenu(IEnumerable<
[HarmonyPatch]
internal static class UniversalPlayerControllerPatches
{
/// <summary>
/// Disable the EnterLadder animation to fix some clunkyness with holding items
/// </summary>
[HarmonyPatch(typeof(InteractTrigger), nameof(InteractTrigger.ladderClimbAnimation), MethodType.Enumerator)]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> DisableLadderAnimation(IEnumerable<CodeInstruction> instructions)
{
return new CodeMatcher(instructions)
.MatchForward(false, new CodeMatch(OpCodes.Ldstr, "EnterLadder"))
.Advance(-3)
.RemoveInstructions(5)
.InstructionEnumeration();
}

/// <summary>
/// Detect when a VR player switches to a VR special item and apply scripts to that item
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Source/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "io.daxcess.lcvr";
public const string PLUGIN_NAME = "LCVR";
public const string PLUGIN_VERSION = "1.3.6";
public const string PLUGIN_VERSION = "1.3.7";

#if DEBUG
private const string SKIP_CHECKSUM_VAR = $"--lcvr-skip-checksum={PLUGIN_VERSION}-dev";
Expand Down Expand Up @@ -242,7 +242,7 @@ private bool InitializeVR()
if (!OpenXR.Loader.InitializeXR())
{
Logger.LogError("Failed to start in VR Mode! Only Non-VR features are available!");
Logger.LogWarning("If you are not intending to play in VR, you can ignore the previous error.");
Logger.LogWarning("You may ignore the previous error if you are intending to play without VR");

Native.ShowNotification("Lethal Company VR",
"Failed to start VR, please check the console logs for more information");
Expand Down

0 comments on commit a2b7d9c

Please sign in to comment.