From 4285ae5258ea3c85e14f020e131ca484d0094c55 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 22 Mar 2026 13:59:39 -0400 Subject: [PATCH] Fix build issues: csproj references, Unity modules, Harmony calls - Fixed csproj to reference all Unity modules (Core, Audio, IMG, Input, TextRendering, UI) - Fixed AudioMixerGUI namespace conflicts (GUI.Window vs UnityEngine.GUI.Window) - Fixed Harmony UnpatchAll -> UnpatchSelf - Removed duplicate AssemblyInfo.cs - Build now succeeds and DLL deployed to BepInEx/plugins --- src/HomuraHimeAudioMod/Build.ps1 | 2 +- src/HomuraHimeAudioMod/GUI/AudioMixerGUI.cs | 60 +++---------------- .../HomuraHimeAudioMod.csproj | 53 ++++++++++------ src/HomuraHimeAudioMod/Plugin.cs | 18 +++--- .../Properties/AssemblyInfo.cs | 19 ------ 5 files changed, 52 insertions(+), 100 deletions(-) delete mode 100644 src/HomuraHimeAudioMod/Properties/AssemblyInfo.cs diff --git a/src/HomuraHimeAudioMod/Build.ps1 b/src/HomuraHimeAudioMod/Build.ps1 index 9f38471..28fc9cd 100644 --- a/src/HomuraHimeAudioMod/Build.ps1 +++ b/src/HomuraHimeAudioMod/Build.ps1 @@ -9,7 +9,7 @@ param( $ErrorActionPreference = "Stop" -$ProjectDir = Split-Path -Parent $PSScriptRoot +$ProjectDir = $PSScriptRoot $ProjectFile = Join-Path $ProjectDir "HomuraHimeAudioMod.csproj" $DefaultOutput = Join-Path $ProjectDir "bin\$Configuration\net48" diff --git a/src/HomuraHimeAudioMod/GUI/AudioMixerGUI.cs b/src/HomuraHimeAudioMod/GUI/AudioMixerGUI.cs index 814a856..21f4b2c 100644 --- a/src/HomuraHimeAudioMod/GUI/AudioMixerGUI.cs +++ b/src/HomuraHimeAudioMod/GUI/AudioMixerGUI.cs @@ -1,14 +1,12 @@ using System; using System.Collections.Generic; using UnityEngine; +using HarmonyLib; namespace HomuraHimeAudioMod.GUI { public class AudioMixerGUI : MonoBehaviour { - private static AudioMixerGUI instance; - public static AudioMixerGUI Instance => instance; - private bool isVisible = false; private Vector2 scrollPosition; private float margin = 10f; @@ -18,6 +16,7 @@ namespace HomuraHimeAudioMod.GUI private float lineHeight = 30f; private float windowWidth = 380f; private float windowHeight = 520f; + private Rect windowRect = new Rect(10, 10, 380, 520); private string[] enemyCueNames = new string[] { @@ -40,34 +39,20 @@ namespace HomuraHimeAudioMod.GUI "Player_Critical" }; - private Rect windowRect + private void Start() { - get => new Rect(margin, margin, windowWidth, windowHeight); - } - - private void Awake() - { - if (instance == null) - { - instance = this; - DontDestroyOnLoad(gameObject); - Plugin.Log.LogInfo("AudioMixerGUI initialized"); - } - else - { - Destroy(gameObject); - } + Plugin.Log.LogInfo("AudioMixerGUI started"); } private void Update() { - if (Input.GetKeyDown(KeyCode.F1)) + if (UnityEngine.Input.GetKeyDown(KeyCode.F1)) { isVisible = !isVisible; Plugin.Log.LogDebug($"Audio Mixer GUI: {(isVisible ? "VISIBLE" : "HIDDEN")}"); } - if (Input.GetKeyDown(KeyCode.F2)) + if (UnityEngine.Input.GetKeyDown(KeyCode.F2)) { isVisible = false; } @@ -77,44 +62,15 @@ namespace HomuraHimeAudioMod.GUI { if (!isVisible) return; - GUI.skin = CreateCustomSkin(); - windowRect.x = Mathf.Clamp(windowRect.x, 0, Screen.width - windowWidth - 10); windowRect.y = Mathf.Clamp(windowRect.y, 0, Screen.height - windowHeight - 10); - windowRect = GUI.Window(0, windowRect, DrawMainWindow, "HomuraHime Audio Mixer (F1: Toggle | F2: Close)"); - } - - private GUISkin CreateCustomSkin() - { - GUISkin skin = GUI.skin; - - GUIStyle headerStyle = new GUIStyle(GUI.skin.label) - { - fontSize = 14, - fontStyle = FontStyle.Bold, - alignment = TextAnchor.MiddleCenter - }; - - GUIStyle sectionStyle = new GUIStyle(GUI.skin.label) - { - fontSize = 12, - fontStyle = FontStyle.Bold, - normal = { textColor = new Color(0.9f, 0.7f, 0.3f) } - }; - - GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) - { - fontSize = 11, - fontStyle = FontStyle.Normal - }; - - return skin; + windowRect = UnityEngine.GUI.Window(0, windowRect, DrawMainWindow, "HomuraHime Audio Mixer (F1: Toggle | F2: Close)"); } private void DrawMainWindow(int windowID) { - GUI.DragWindow(new Rect(0, 0, windowWidth - 20, 25)); + UnityEngine.GUI.DragWindow(new Rect(0, 0, windowWidth - 20, 25)); scrollPosition = GUILayout.BeginScrollView(scrollPosition); diff --git a/src/HomuraHimeAudioMod/HomuraHimeAudioMod.csproj b/src/HomuraHimeAudioMod/HomuraHimeAudioMod.csproj index c2a06fe..c3a6047 100644 --- a/src/HomuraHimeAudioMod/HomuraHimeAudioMod.csproj +++ b/src/HomuraHimeAudioMod/HomuraHimeAudioMod.csproj @@ -10,34 +10,53 @@ HomuraHime Audio Mod Audio improvements mod for HomuraHime - fixes glitches and improves enemy indicators Copyright 2026 - C:\apps\steam\steamapps\common\Homura Hime\HomuraHime_Data\Managed - - - - GAME_PATH_EXISTS + C:\apps\steam\steamapps\common\Homura Hime + false - - runtime - - - - - - $(GamePath)\..\BepInEx\core\BepInEx.dll + + $(GamePath)\BepInEx\core\0Harmony.dll false - - $(GamePath)\FMODUnity.dll + + $(GamePath)\BepInEx\core\BepInEx.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.CoreModule.dll false - $(GamePath)\UnityEngine.AudioModule.dll + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.AudioModule.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.IMGUIModule.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.InputLegacyModule.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.TextRenderingModule.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\UnityEngine.UI.dll + false + + + $(GamePath)\HomuraHime_Data\Managed\FMODUnity.dll false - $(GamePath)\Assembly-CSharp.dll + $(GamePath)\HomuraHime_Data\Managed\Assembly-CSharp.dll false diff --git a/src/HomuraHimeAudioMod/Plugin.cs b/src/HomuraHimeAudioMod/Plugin.cs index 521b914..7857759 100644 --- a/src/HomuraHimeAudioMod/Plugin.cs +++ b/src/HomuraHimeAudioMod/Plugin.cs @@ -5,13 +5,9 @@ using UnityEngine; namespace HomuraHimeAudioMod { - [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] + [BepInPlugin("com.homurahime.audiomod", "HomuraHime Audio Mod", "1.0.0")] public class Plugin : BaseUnityPlugin { - public const string PLUGIN_GUID = "com.homurahime.audiomod"; - public const string PLUGIN_NAME = "HomuraHime Audio Mod"; - public const string PLUGIN_VERSION = "1.0.0"; - private static Plugin instance; private static ManualLogSource logger; private Harmony harmony; @@ -25,13 +21,13 @@ namespace HomuraHimeAudioMod ModConfig.Initialize(Config); - Log.LogInfo($"HomuraHime Audio Mod v{PluginInfo.PLUGIN_VERSION} initializing..."); + Log.LogInfo("HomuraHime Audio Mod v1.0.0 initializing..."); Log.LogInfo($"Voice Limit Fix: {(ModConfig.EnableVoiceLimitFix.Value ? "ENABLED" : "DISABLED")}"); Log.LogInfo($"Ducking Fix: {(ModConfig.EnableDuckingFix.Value ? "ENABLED" : "DISABLED")}"); Log.LogInfo($"Enemy Audio Boost: {(ModConfig.EnableEnemyAudioBoost.Value ? "ENABLED" : "DISABLED")}"); Log.LogInfo($"Max Voices: {ModConfig.MaxVoiceCount.Value}"); - harmony = new Harmony(PluginInfo.PLUGIN_GUID); + harmony = new Harmony("com.homurahime.audiomod"); ApplyPatches(); @@ -46,19 +42,19 @@ namespace HomuraHimeAudioMod if (ModConfig.EnableVoiceLimitFix.Value || ModConfig.EnableDuckingFix.Value) { Log.LogInfo("Applying VoiceManager patches..."); - VoiceManagerPatch.Apply(ref harmony); + Patches.VoiceManagerPatch.Apply(ref harmony); } if (ModConfig.EnableDuckingFix.Value) { Log.LogInfo("Applying AudioDucking patches..."); - AudioDuckingPatch.Apply(ref harmony); + Patches.AudioDuckingPatch.Apply(ref harmony); } if (ModConfig.EnableEnemyAudioBoost.Value) { Log.LogInfo("Applying EnemyAudio patches..."); - EnemyAudioPatch.Apply(ref harmony); + Patches.EnemyAudioPatch.Apply(ref harmony); } Log.LogInfo("All patches applied successfully"); @@ -78,7 +74,7 @@ namespace HomuraHimeAudioMod private void OnDestroy() { - harmony?.UnpatchAll(PluginInfo.PLUGIN_GUID); + harmony?.UnpatchSelf(); Log.LogInfo("HomuraHime Audio Mod unloaded"); } } diff --git a/src/HomuraHimeAudioMod/Properties/AssemblyInfo.cs b/src/HomuraHimeAudioMod/Properties/AssemblyInfo.cs deleted file mode 100644 index ed5d2c3..0000000 --- a/src/HomuraHimeAudioMod/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("HomuraHimeAudioMod")] -[assembly: AssemblyDescription("Audio improvements mod for HomuraHime")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("HomuraHimeAudioMod")] -[assembly: AssemblyCopyright("Copyright © 2026")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")]