Skip to content

Commit

Permalink
Merge pull request #150 from BeatLeader/1.37.3
Browse files Browse the repository at this point in the history
BS 1.37.3 Support
  • Loading branch information
Reezonate authored Aug 20, 2024
2 parents 8e4e7fe + 7aa8cad commit 7120384
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 32 deletions.
5 changes: 0 additions & 5 deletions Source/0_Harmony/InstallersPatches/LevelDataEnhancerPatch.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using BeatLeader.Core.Managers.ReplayEnhancer;
using BeatLeader.Installers;
using BeatSaber.PerformancePresets;
using HarmonyLib;
using IPA.Utilities;
using JetBrains.Annotations;
using System;
using System.Linq;
using System.Reflection;

Expand Down
2 changes: 1 addition & 1 deletion Source/0_Harmony/InstallersPatches/MainSystemInitPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class MainSystemInitPatch {
// ReSharper disable once InconsistentNaming
private static void Postfix(MainSystemInit __instance) {
try {
BLLocalization.Initialize(__instance._mainSettingsHandler);
BLLocalization.Initialize(__instance._settingsManager);
} catch (Exception ex) {
Plugin.Log.Critical($"---\nMainSystemInit patch exception: {ex.Message}\n{ex.StackTrace}\n---");
}
Expand Down
6 changes: 3 additions & 3 deletions Source/2_Core/Localization/BLLocalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
using BGLib.Polyglot;
using TMPro;
using UnityEngine;
using BeatSaber.GameSettings;
using System.Linq;

namespace BeatLeader {
public static class BLLocalization {
#region Initialize

private static Language _baseGameLanguage = Language.English;

internal static void Initialize(MainSettingsHandler mainSettingsModel) {
_baseGameLanguage = mainSettingsModel.instance.language;
internal static void Initialize(SettingsManager settingsmanager) {
_baseGameLanguage = Localization.Instance.SupportedLanguages.FirstOrDefault(l => l.ToSerializedName() == settingsmanager.settings.misc.language);
OnBaseGameLanguageDidChange();
}

Expand Down
3 changes: 1 addition & 2 deletions Source/2_Core/Managers/DataManager/LeaderboardManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using BeatLeader.API.Methods;
using BeatLeader.Manager;
using BeatLeader.Models;
using BeatSaber.GameSettings;
using JetBrains.Annotations;
using LeaderboardCore.Interfaces;
using UnityEngine;
Expand Down Expand Up @@ -78,7 +77,7 @@ private static void SetFakeBloomProperty() {

try {
var mainSystemInit = Resources.FindObjectsOfTypeAll<MainSystemInit>()[0];
enableFakeBloom = (mainSystemInit._graphicSettingsHandler.instance.customPreset?.mainEffectGraphics ?? 0) == 0;
enableFakeBloom = mainSystemInit._settingsManager.settings.quality.mainEffect == BeatSaber.Settings.QualitySettings.MainEffectOption.Off;
} catch (Exception) {
enableFakeBloom = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BeatLeader.Utils;
using BeatSaber.GameSettings;
using IPA.Utilities;
using UnityEngine;
using VRUIControls;
Expand All @@ -11,7 +10,7 @@ public class MenuControllersManager : MonoBehaviour {
[Inject] private readonly PauseMenuManager _pauseMenuManager = null!;
[Inject] private readonly DiContainer _diContainer = null!;
[Inject] private readonly VRInputModule _vrInputModule = null!;
[Inject] private readonly MainSettingsHandler _mainSettingsHandler = null!;
[Inject] private readonly SettingsManager _settingsManager = null!;

public Transform HandsContainer { get; private set; } = null!;
public VRController LeftHand { get; private set; } = null!;
Expand All @@ -30,8 +29,8 @@ private void Awake() {
menuHandsTransform.gameObject.GetComponent<DeactivateOnInputFocusCapture>().TryDestroy();
LeftHand = Instantiate(menuHandsTransform.Find("ControllerLeft")).GetComponent<VRController>();
RightHand = Instantiate(menuHandsTransform.Find("ControllerRight")).GetComponent<VRController>();
((VRControllersValueSettingsOffsets)LeftHand._transformOffset)._mainSettingsHandler = _mainSettingsHandler;
((VRControllersValueSettingsOffsets)RightHand._transformOffset)._mainSettingsHandler = _mainSettingsHandler;
((VRControllersValueSettingsOffsets)LeftHand._transformOffset).SetField("_settingsManager", _settingsManager);
((VRControllersValueSettingsOffsets)RightHand._transformOffset).SetField("_settingsManager", _settingsManager);

_diContainer.InjectComponentsInChildren(LeftHand.gameObject);
_diContainer.InjectComponentsInChildren(RightHand.gameObject);
Expand Down
7 changes: 3 additions & 4 deletions Source/2_Core/Replayer/ReplayerExtraObjectsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BeatLeader.Utils;
using BeatSaber.GameSettings;
using UnityEngine;

namespace BeatLeader.Replayer {
Expand All @@ -25,9 +24,9 @@ private void Awake() {
ReplayerCenterAdjust = new GameObject("CenterAdjust").transform;
ReplayerCenterAdjust.SetParent(ReplayerCore, false);

var settingsModel = _mainSystemInit._mainSettingsHandler.instance;
_posOffset = settingsModel.roomCenter;
_rotOffset = Quaternion.Euler(0, settingsModel.roomRotation, 0);
var settingsModel = _mainSystemInit._settingsManager.settings;
_posOffset = settingsModel.room.center;
_rotOffset = Quaternion.Euler(0, settingsModel.room.rotation, 0);
}

private void Start() {
Expand Down
12 changes: 5 additions & 7 deletions Source/2_Core/Replayer/ReplayerLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using JetBrains.Annotations;
using UnityEngine;
using Zenject;
using BeatSaber.PerformancePresets;
using BeatSaber.GameSettings;

namespace BeatLeader.Replayer {
[PublicAPI]
Expand Down Expand Up @@ -66,7 +64,7 @@ public bool StartReplay(ReplayLaunchData data, Action? afterTransitionCallback =

private static readonly EnvironmentType normalEnvironmentType = EnvironmentType.Normal;
private static StandardLevelScenesTransitionSetupDataSO? _standardLevelScenesTransitionSetupDataSo;
private static GraphicSettingsHandler? _graphicSettingsHandler;
private static SettingsManager? _settingsManager;

private void Awake() {
if (!_standardLevelScenesTransitionSetupDataSo) {
Expand All @@ -75,10 +73,10 @@ private void Awake() {
.First();
}

if (_graphicSettingsHandler == null) {
_graphicSettingsHandler = Resources
if (_settingsManager == null) {
_settingsManager = Resources
.FindObjectsOfTypeAll<MainSystemInit>()
.First()._graphicSettingsHandler;
.First()._settingsManager;
}
}

Expand Down Expand Up @@ -114,7 +112,7 @@ private void Awake() {
_environmentsListModel,
_audioClipAsyncLoader,
_beatmapDataLoader,
_graphicSettingsHandler.instance.customPreset,
_settingsManager,
"Menu",
_beatmapLevelsModel,
_beatmapLevelsEntitlementModel,
Expand Down
7 changes: 3 additions & 4 deletions Source/2_Core/Replayer/Tweaking/Tweaks/RoomOffsetsTweak.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BeatLeader.Utils;
using BeatSaber.GameSettings;
using UnityEngine;
using Zenject;

Expand All @@ -16,9 +15,9 @@ public override void Initialize() {
}
public override void Dispose() {
if (_centerAdjust == null) return;
var settingsModel = _mainSystemInit._mainSettingsHandler.instance;
_centerAdjust.transform.localPosition = settingsModel.roomCenter;
_centerAdjust.transform.localEulerAngles = new Vector3(0, settingsModel.roomRotation, 0);
var settingsManager = _mainSystemInit._settingsManager;
_centerAdjust.transform.localPosition = settingsManager.settings.room.center;
_centerAdjust.transform.localEulerAngles = new Vector3(0, settingsManager.settings.room.rotation, 0);
_centerAdjust.enabled = true;
}
}
Expand Down
10 changes: 10 additions & 0 deletions Source/BeatLeader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BeatSaber.Settings">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Settings.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="BGLib.AppFlow">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -123,6 +128,11 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Unity.Mathematics">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Unity.Mathematics.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Unity.TextMeshPro">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<Private>False</Private>
Expand Down
4 changes: 2 additions & 2 deletions Source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"id": "BeatLeader",
"name": "BeatLeader",
"author": "",
"version": "0.9.19",
"version": "0.9.21",
"description": "beatleader.xyz | In-game leaderboards for custom and OST maps | Score replays | Clans, events, playlists and much more",
"gameVersion": "1.37.1",
"gameVersion": "1.37.3",
"dependsOn": {
"SongCore": "^3.14.11",
"LeaderboardCore": "^1.6.0",
Expand Down

0 comments on commit 7120384

Please sign in to comment.