Skip to content

Commit

Permalink
1.36.2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
kinsi55 committed May 7, 2024
1 parent 7a183c5 commit 4f61688
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Behaviours/Cam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ internal void UpdateDepthTextureActive() {
UCamera.depthTextureMode = InitOnMainAvailable.useDepthTexture || settings?.PostProcessing.forceDepthTexture == true ? DepthTextureMode.Depth : DepthTextureMode.None;
}

static readonly HashSet<string> CameraBehavioursToDestroy = new HashSet<string>() { "AudioListener", "LIV", "MainCamera", "MeshCollider", "TrackedPoseDriver" };
static readonly HashSet<string> CameraBehavioursToDestroy = new HashSet<string>() {
"AudioListener", "LIV", "MainCamera", "MeshCollider", "TrackedPoseDriver", "DepthTextureController"
};

public void Init(string name, CameraDesktopView presentor = null, bool loadConfig = false, bool rename = false) {
if(this.name != null) {
Expand Down
11 changes: 10 additions & 1 deletion Camera2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,19 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatmapCore.dll</HintPath>

</Reference>
<Reference Include="BeatSaber.GameSettings">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.GameSettings.dll</HintPath>
</Reference>
<Reference Include="BeatSaber.PerformancePresets">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.PerformancePresets.dll</HintPath>
</Reference>
<Reference Include="BGLib.AppFlow">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BGLib.SaveDataCore">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.SaveDataCore.dll</HintPath>
</Reference>
<Reference Include="BGLib.UnityExtension">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.UnityExtension.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -141,7 +150,7 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Main.dll</HintPath>

</Reference>
<Reference Include="HMLib">
<Reference Include="HMLib" Publicize="true">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\HMLib.dll</HintPath>

</Reference>
Expand Down
16 changes: 7 additions & 9 deletions HarmonyPatches/HookRoomAdjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using BeatSaber.GameSettings;

namespace Camera2.HarmonyPatches {
[HarmonyPatch]
Expand All @@ -17,18 +18,15 @@ static class HookRoomAdjust {
[HarmonyPatch(typeof(VRCenterAdjust), nameof(VRCenterAdjust.HandleRoomCenterDidChange))]
[HarmonyPatch(typeof(VRCenterAdjust), nameof(VRCenterAdjust.HandleRoomRotationDidChange))]
[HarmonyPatch(typeof(VRCenterAdjust), nameof(VRCenterAdjust.ResetRoom))]
static void Postfix(Vector3SO ____roomCenter, FloatSO ____roomRotation, MethodBase __originalMethod) {
if(____roomCenter == null) {
position = Vector3.zero;
static void Postfix(MainSettingsHandler ____mainSettingsHandler, MethodBase __originalMethod) {
if(____mainSettingsHandler != null) {
position = ____mainSettingsHandler.instance.roomCenter;
eulerAngles = new Vector3(0, ____mainSettingsHandler.instance.roomRotation, 0);
} else {
position = ____roomCenter;
}

if(____roomRotation == null) {
position = Vector3.zero;
eulerAngles = Vector3.zero;
} else {
eulerAngles = new Vector3(0, ____roomRotation, 0);
}

rotation = Quaternion.Euler(eulerAngles);

#if DEBUG
Expand Down
11 changes: 8 additions & 3 deletions HarmonyPatches/InitOnMainAvailable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
using HarmonyLib;
using UnityEngine;
using System.Linq;
using BeatSaber.GameSettings;
using Camera2.Utils;

namespace Camera2.HarmonyPatches {
[HarmonyPatch(typeof(SmoothCameraController), nameof(SmoothCameraController.ActivateSmoothCameraIfNeeded))]
static class InitOnMainAvailable {
static bool isInited = false;
public static bool useDepthTexture { get; private set; }
static void Postfix(MainSettingsModelSO ____mainSettingsModel) {
useDepthTexture = ____mainSettingsModel.smokeGraphicsSettings;

static void Postfix(SmoothCameraController __instance) {
if(!isInited) {
useDepthTexture = false;

if(SceneUtil.GetMainCameraButReally().GetComponent<DepthTextureController>()._handler.TryGetCurrentPerformancePreset(out var pp))
useDepthTexture = pp.smokeGraphics; // TODO: Change to .depthTexture when they fixed that its true even with smoke off

if(CamManager.baseCullingMask == 0)
CamManager.baseCullingMask = Camera.main.cullingMask;

Expand Down

0 comments on commit 4f61688

Please sign in to comment.