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
This commit is contained in:
2026-03-22 13:59:39 -04:00
parent b589d39ccd
commit 4285ae5258
5 changed files with 52 additions and 100 deletions

View File

@@ -9,7 +9,7 @@ param(
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$ProjectDir = Split-Path -Parent $PSScriptRoot $ProjectDir = $PSScriptRoot
$ProjectFile = Join-Path $ProjectDir "HomuraHimeAudioMod.csproj" $ProjectFile = Join-Path $ProjectDir "HomuraHimeAudioMod.csproj"
$DefaultOutput = Join-Path $ProjectDir "bin\$Configuration\net48" $DefaultOutput = Join-Path $ProjectDir "bin\$Configuration\net48"

View File

@@ -1,14 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using HarmonyLib;
namespace HomuraHimeAudioMod.GUI namespace HomuraHimeAudioMod.GUI
{ {
public class AudioMixerGUI : MonoBehaviour public class AudioMixerGUI : MonoBehaviour
{ {
private static AudioMixerGUI instance;
public static AudioMixerGUI Instance => instance;
private bool isVisible = false; private bool isVisible = false;
private Vector2 scrollPosition; private Vector2 scrollPosition;
private float margin = 10f; private float margin = 10f;
@@ -18,6 +16,7 @@ namespace HomuraHimeAudioMod.GUI
private float lineHeight = 30f; private float lineHeight = 30f;
private float windowWidth = 380f; private float windowWidth = 380f;
private float windowHeight = 520f; private float windowHeight = 520f;
private Rect windowRect = new Rect(10, 10, 380, 520);
private string[] enemyCueNames = new string[] private string[] enemyCueNames = new string[]
{ {
@@ -40,34 +39,20 @@ namespace HomuraHimeAudioMod.GUI
"Player_Critical" "Player_Critical"
}; };
private Rect windowRect private void Start()
{ {
get => new Rect(margin, margin, windowWidth, windowHeight); Plugin.Log.LogInfo("AudioMixerGUI started");
}
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
Plugin.Log.LogInfo("AudioMixerGUI initialized");
}
else
{
Destroy(gameObject);
}
} }
private void Update() private void Update()
{ {
if (Input.GetKeyDown(KeyCode.F1)) if (UnityEngine.Input.GetKeyDown(KeyCode.F1))
{ {
isVisible = !isVisible; isVisible = !isVisible;
Plugin.Log.LogDebug($"Audio Mixer GUI: {(isVisible ? "VISIBLE" : "HIDDEN")}"); Plugin.Log.LogDebug($"Audio Mixer GUI: {(isVisible ? "VISIBLE" : "HIDDEN")}");
} }
if (Input.GetKeyDown(KeyCode.F2)) if (UnityEngine.Input.GetKeyDown(KeyCode.F2))
{ {
isVisible = false; isVisible = false;
} }
@@ -77,44 +62,15 @@ namespace HomuraHimeAudioMod.GUI
{ {
if (!isVisible) return; if (!isVisible) return;
GUI.skin = CreateCustomSkin();
windowRect.x = Mathf.Clamp(windowRect.x, 0, Screen.width - windowWidth - 10); windowRect.x = Mathf.Clamp(windowRect.x, 0, Screen.width - windowWidth - 10);
windowRect.y = Mathf.Clamp(windowRect.y, 0, Screen.height - windowHeight - 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)"); windowRect = UnityEngine.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;
} }
private void DrawMainWindow(int windowID) 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); scrollPosition = GUILayout.BeginScrollView(scrollPosition);

View File

@@ -10,34 +10,53 @@
<Product>HomuraHime Audio Mod</Product> <Product>HomuraHime Audio Mod</Product>
<Description>Audio improvements mod for HomuraHime - fixes glitches and improves enemy indicators</Description> <Description>Audio improvements mod for HomuraHime - fixes glitches and improves enemy indicators</Description>
<Copyright>Copyright 2026</Copyright> <Copyright>Copyright 2026</Copyright>
<GamePath>C:\apps\steam\steamapps\common\Homura Hime\HomuraHime_Data\Managed</GamePath> <GamePath>C:\apps\steam\steamapps\common\Homura Hime</GamePath>
</PropertyGroup> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PropertyGroup Condition="Exists('$(GamePath)')">
<DefineConstants>GAME_PATH_EXISTS</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="0Harmony" Version="2.2.2"> <Reference Include="0Harmony">
<ExcludeAssets>runtime</ExcludeAssets> <HintPath>$(GamePath)\BepInEx\core\0Harmony.dll</HintPath>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="Exists('$(GamePath)')">
<Reference Include="BepInEx">
<HintPath>$(GamePath)\..\BepInEx\core\BepInEx.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
<Reference Include="FMODUnity"> <Reference Include="BepInEx">
<HintPath>$(GamePath)\FMODUnity.dll</HintPath> <HintPath>$(GamePath)\BepInEx\core\BepInEx.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
<Reference Include="UnityEngine.AudioModule"> <Reference Include="UnityEngine.AudioModule">
<HintPath>$(GamePath)\UnityEngine.AudioModule.dll</HintPath> <HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\UnityEngine.UI.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="FMODUnity">
<HintPath>$(GamePath)\HomuraHime_Data\Managed\FMODUnity.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>$(GamePath)\Assembly-CSharp.dll</HintPath> <HintPath>$(GamePath)\HomuraHime_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private> <Private>false</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@@ -5,13 +5,9 @@ using UnityEngine;
namespace HomuraHimeAudioMod 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 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 Plugin instance;
private static ManualLogSource logger; private static ManualLogSource logger;
private Harmony harmony; private Harmony harmony;
@@ -25,13 +21,13 @@ namespace HomuraHimeAudioMod
ModConfig.Initialize(Config); 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($"Voice Limit Fix: {(ModConfig.EnableVoiceLimitFix.Value ? "ENABLED" : "DISABLED")}");
Log.LogInfo($"Ducking Fix: {(ModConfig.EnableDuckingFix.Value ? "ENABLED" : "DISABLED")}"); Log.LogInfo($"Ducking Fix: {(ModConfig.EnableDuckingFix.Value ? "ENABLED" : "DISABLED")}");
Log.LogInfo($"Enemy Audio Boost: {(ModConfig.EnableEnemyAudioBoost.Value ? "ENABLED" : "DISABLED")}"); Log.LogInfo($"Enemy Audio Boost: {(ModConfig.EnableEnemyAudioBoost.Value ? "ENABLED" : "DISABLED")}");
Log.LogInfo($"Max Voices: {ModConfig.MaxVoiceCount.Value}"); Log.LogInfo($"Max Voices: {ModConfig.MaxVoiceCount.Value}");
harmony = new Harmony(PluginInfo.PLUGIN_GUID); harmony = new Harmony("com.homurahime.audiomod");
ApplyPatches(); ApplyPatches();
@@ -46,19 +42,19 @@ namespace HomuraHimeAudioMod
if (ModConfig.EnableVoiceLimitFix.Value || ModConfig.EnableDuckingFix.Value) if (ModConfig.EnableVoiceLimitFix.Value || ModConfig.EnableDuckingFix.Value)
{ {
Log.LogInfo("Applying VoiceManager patches..."); Log.LogInfo("Applying VoiceManager patches...");
VoiceManagerPatch.Apply(ref harmony); Patches.VoiceManagerPatch.Apply(ref harmony);
} }
if (ModConfig.EnableDuckingFix.Value) if (ModConfig.EnableDuckingFix.Value)
{ {
Log.LogInfo("Applying AudioDucking patches..."); Log.LogInfo("Applying AudioDucking patches...");
AudioDuckingPatch.Apply(ref harmony); Patches.AudioDuckingPatch.Apply(ref harmony);
} }
if (ModConfig.EnableEnemyAudioBoost.Value) if (ModConfig.EnableEnemyAudioBoost.Value)
{ {
Log.LogInfo("Applying EnemyAudio patches..."); Log.LogInfo("Applying EnemyAudio patches...");
EnemyAudioPatch.Apply(ref harmony); Patches.EnemyAudioPatch.Apply(ref harmony);
} }
Log.LogInfo("All patches applied successfully"); Log.LogInfo("All patches applied successfully");
@@ -78,7 +74,7 @@ namespace HomuraHimeAudioMod
private void OnDestroy() private void OnDestroy()
{ {
harmony?.UnpatchAll(PluginInfo.PLUGIN_GUID); harmony?.UnpatchSelf();
Log.LogInfo("HomuraHime Audio Mod unloaded"); Log.LogInfo("HomuraHime Audio Mod unloaded");
} }
} }

View File

@@ -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")]