Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CommunityBugFixCollection/SteamVrFocusResolutionScale.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using HarmonyLib;
using MonkeyLoader.Resonite;
using System.Collections.Generic;

namespace CommunityBugFixCollection
{
[HarmonyPatchCategory(nameof(SteamVrFocusResolutionScale))]
[HarmonyPatch("Valve.VR.SteamVR_Render", "OnInputFocus")]
internal sealed class SteamVrFocusResolutionScale : ResoniteBugFixMonkey<SteamVrFocusResolutionScale>
{
public override IEnumerable<string> Authors => Contributors.Goat;

// SteamVR_Render is treated as a singleton in SteamVR and initialized once from SteamVRDriver through SteamVR.Initialize()
private static bool _lastInputFocus = false;

public static bool Prefix(bool hasFocus)
{
// Work around some broken logic in SteamVR focus handling
// https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2337#issuecomment-3025681468
// https://github.com/ValveSoftware/steamvr_unity_plugin/blob/056c82369d78f253af8cefcae9b289efd69bd960/Assets/SteamVR/Scripts/SteamVR_Render.cs#L237-L262
if (Enabled && !hasFocus && !_lastInputFocus)
{
Logger.Trace(() => "Dropping redundant OnInputFocus call");
return false;
}

_lastInputFocus = hasFocus;
return true;
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ just disable them in the settings in the meantime.
* FlipAtUser component does not respect view position (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1335)
* ColorX From HexCode (ProtoFlux node) defaults to Linear profile (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1404)
* ProtoFlux value casts from byte to other values converting incorrectly (mono / graphical client only) (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2257)
* Resolution scale may get stuck at 0.5 when opening and closing the SteamVR dashboard while the game is hitching (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2337)
* `ValueMod<Decimal>` node crashes the game when B input is set to zero or disconnected. (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2746)
* Grid World grid being off-center (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/2754)
* Animators updating all associated fields every frame while enabled but not playing (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/3480)
Expand Down