From bbf852fa4bffa4a26afd4a6bf9578e7f4d34d866 Mon Sep 17 00:00:00 2001 From: Ibodan Date: Wed, 25 Dec 2019 03:36:59 +0900 Subject: [PATCH] BSIPA and BS1.6.0 compatibility --- RumbleEnhancerOculus/Plugin.cs | 60 +++++++++++++------ RumbleEnhancerOculus/PluginConfig.cs | 29 +++++++++ .../Properties/AssemblyInfo.cs | 4 +- .../RumbleEnhancerOculus.csproj | 42 ++++++++----- RumbleEnhancerOculus/manifest.json | 13 ++++ 5 files changed, 113 insertions(+), 35 deletions(-) create mode 100644 RumbleEnhancerOculus/PluginConfig.cs create mode 100644 RumbleEnhancerOculus/manifest.json diff --git a/RumbleEnhancerOculus/Plugin.cs b/RumbleEnhancerOculus/Plugin.cs index 43aa1bd..6779dd6 100644 --- a/RumbleEnhancerOculus/Plugin.cs +++ b/RumbleEnhancerOculus/Plugin.cs @@ -1,13 +1,16 @@ using System; using System.Linq; -using IllusionPlugin; +using IPA; +using IPA.Config; using Harmony; using UnityEngine; using System.Collections; +using UnityEngine.SceneManagement; +using IPALogger = IPA.Logging.Logger; namespace RumbleEnhancerOculus { - public class Plugin : IPlugin + public class Plugin : IBeatSaberPlugin { public static OVRHapticsClip CutClip; public static OVRHapticsClip MissCutClip; @@ -16,8 +19,31 @@ public class Plugin : IPlugin public static OVRHapticsClip ClashClip; public static OVRHapticsClip ObstacleClip; - public string Name => "RumbleEnhancerOculus"; - public string Version => "1.0.6"; + internal static IPALogger logger; + + public void Init(IPALogger logger, [Config.Prefer("json")] IConfigProvider configProvider) + { + IPA.Logging.StandardLogger.PrintFilter = IPA.Logging.Logger.LogLevel.All; + Plugin.logger = logger; + var config = configProvider.MakeLink((p, v) => + { + if (v.Value._fresh) + { + Plugin.logger.Debug("Generating settings file."); + v.Value._fresh = false; + p.Store(v.Value); + } + }); + Plugin.logger.Debug("RumbleEnhancerOculus Initialized, using settings:"); + config.Value.LogValues(); + + CutClip = createHapticsClip(config.Value.CutClip); + MissCutClip = createHapticsClip(config.Value.MissCutClip); + BombClip = createHapticsClip(config.Value.BombClip); + UIClip = createHapticsClip(config.Value.UIClip); + ClashClip = createHapticsClip(config.Value.SaberClashClip); + ObstacleClip = createHapticsClip(config.Value.ObstacleClip); + } private OVRHapticsClip createHapticsClip(string strPattern) { @@ -33,21 +59,9 @@ private OVRHapticsClip createHapticsClip(string strPattern) return clip; } - public static void Log(string s) - { - Console.WriteLine("[RumbleEnhancerOculus] " + s); - } - public void OnApplicationStart() { SharedCoroutineStarter.instance.StartCoroutine(Patch()); - - CutClip = createHapticsClip(ModPrefs.GetString(Name, "CutClip", "0,0,0,0,255,255,255,0,255,255,255,0,255,255,0,255,255,0,200,200,0,200,200,0,120,120,0,90,90,0,90,90", true)); - MissCutClip = createHapticsClip(ModPrefs.GetString(Name, "MissCutClip", "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255", true)); - BombClip = createHapticsClip(ModPrefs.GetString(Name, "BombClip", "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255", true)); - UIClip = createHapticsClip(ModPrefs.GetString(Name, "UIClip", "80,100,0,0,0,0", true)); - ClashClip = createHapticsClip(ModPrefs.GetString(Name, "SaberClashClip", "45,90,135,180,0,0,0,0,0,0", true)); - ObstacleClip = createHapticsClip(ModPrefs.GetString(Name, "ObstacleClip", "255,255,255,0,255,255,255,0", true)); } private IEnumerator Patch() @@ -55,7 +69,7 @@ private IEnumerator Patch() yield return new WaitForSecondsRealtime(0.2f); var harmony = HarmonyInstance.Create("HapticTest"); harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly()); - Console.WriteLine("[RumbleEnhancerOculus] patch applied now."); + logger.Debug("Harmony patches applied now."); } public void OnApplicationQuit() @@ -77,5 +91,17 @@ public void OnUpdate() public void OnFixedUpdate() { } + + public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) + { + } + + public void OnSceneUnloaded(Scene scene) + { + } + + public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) + { + } } } diff --git a/RumbleEnhancerOculus/PluginConfig.cs b/RumbleEnhancerOculus/PluginConfig.cs new file mode 100644 index 0000000..e99f8b6 --- /dev/null +++ b/RumbleEnhancerOculus/PluginConfig.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RumbleEnhancerOculus +{ + internal class PluginConfig + { + public string CutClip = "0,0,0,0,255,255,255,0,255,255,255,0,255,255,0,255,255,0,200,200,0,200,200,0,120,120,0,90,90,0,90,90"; + public string MissCutClip = "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255"; + public string BombClip = "0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255,0,0,0,0,255,255,255,0,255,255,255"; + public string UIClip = "80,100,0,0,0,0"; + public string SaberClashClip = "45,90,135,180,0,0,0,0,0,0"; + public string ObstacleClip = "255,255,255,0,255,255,255,0"; + public bool _fresh = true; + + public void LogValues() + { + Plugin.logger?.Debug($" CutClip: {CutClip}"); + Plugin.logger?.Debug($" MissCutClip: {MissCutClip}"); + Plugin.logger?.Debug($" BombClip: {BombClip}"); + Plugin.logger?.Debug($" UIClip: {UIClip}"); + Plugin.logger?.Debug($" SaberClashClip: {SaberClashClip}"); + Plugin.logger?.Debug($" ObstacleClip: {ObstacleClip}"); + } + } +} \ No newline at end of file diff --git a/RumbleEnhancerOculus/Properties/AssemblyInfo.cs b/RumbleEnhancerOculus/Properties/AssemblyInfo.cs index 4c9b7a6..0a9ab70 100644 --- a/RumbleEnhancerOculus/Properties/AssemblyInfo.cs +++ b/RumbleEnhancerOculus/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.6.0")] -[assembly: AssemblyFileVersion("1.0.6.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/RumbleEnhancerOculus/RumbleEnhancerOculus.csproj b/RumbleEnhancerOculus/RumbleEnhancerOculus.csproj index eb5fc20..66130cc 100644 --- a/RumbleEnhancerOculus/RumbleEnhancerOculus.csproj +++ b/RumbleEnhancerOculus/RumbleEnhancerOculus.csproj @@ -9,7 +9,7 @@ Properties RumbleEnhancerOculus RumbleEnhancerOculus - v4.6 + v4.7.2 512 @@ -33,19 +33,21 @@ false - - False - E:\Steam7\steamapps\common\Beat Saber\Beat Saber_Data\Managed\0Harmony.dll + + D:\SteamAnnex\steamapps\common\Beat Saber\Libs\0Harmony.1.2.0.1.dll + + + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\HMLib.dll - - J:\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll + + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll - - J:\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IllusionPlugin.dll + + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\MainAssembly.dll False - E:\Steam7\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Oculus.VR.dll + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Oculus.VR.dll @@ -54,28 +56,36 @@ - J:\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll + + + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AudioModule.dll + + + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll - - False - E:\Steam7\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.VRModule.dll + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.VRModule.dll False - E:\Steam7\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.XRModule.dll + D:\SteamAnnex\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.XRModule.dll + + + + - "C:\Users\kataho\Desktop\beat saber workspace\PluginVersionSetter.exe" $(ProjectDir)Properties\AssemblyInfo.cs $(ProjectDir)Plugin.cs - + + \ No newline at end of file diff --git a/RumbleEnhancerOculus/manifest.json b/RumbleEnhancerOculus/manifest.json new file mode 100644 index 0000000..6c10abf --- /dev/null +++ b/RumbleEnhancerOculus/manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/nike4613/ModSaber-MetadataFileSchema/master/Schema.json", + "author": "Ibodan", + "description": "BeatSaber haptic feedback rebuilding for Oculus Touch.", + "gameVersion": "1.6.0", + "id": "RumbleEnhancerOculus", + "name": "RumbleEnhancerOculus", + "version": "1.1.0", + "dependsOn": { + "BSIPA": "^3.13.4" + }, + "features": [] +}