[MuteSFX] Initial CVRMG release

This commit is contained in:
NotAKidoS 2023-07-06 21:54:28 -05:00
parent aac93fbed7
commit d9c8a31667
9 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,49 @@
using ABI_RC.Core.AudioEffects;
using System.Reflection;
using UnityEngine;
namespace NAK.MuteSFX;
public static class AudioModuleManager
{
public const string sfx_mute = "MuteSFX_sfx_mute";
public const string sfx_unmute = "MuteSFX_sfx_unmute";
public static void SetupDefaultAudioClips()
{
string path = Application.streamingAssetsPath + "/Cohtml/UIResources/GameUI/mods/MuteSFX/audio/";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
MuteSFX.Logger.Msg("Created MuteSFX/audio directory!");
}
string[] clipNames = { "sfx_mute.wav", "sfx_unmute.wav" };
foreach (string clipName in clipNames)
{
string clipPath = Path.Combine(path, clipName);
if (!File.Exists(clipPath))
{
byte[] clipData = null;
string resourceName = "MuteSFX.SFX." + clipName;
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
{
clipData = new byte[stream.Length];
stream.Read(clipData, 0, clipData.Length);
}
using (FileStream fileStream = new FileStream(clipPath, FileMode.CreateNew))
{
fileStream.Write(clipData, 0, clipData.Length);
}
MuteSFX.Logger.Msg("Placed missing sfx in audio folder: " + clipName);
}
}
}
public static void PlayAudioModule(string module)
{
InterfaceAudio.PlayModule(module);
}
}

35
MuteSFX/Main.cs Normal file
View file

@ -0,0 +1,35 @@
using ABI_RC.Core.Base;
using MelonLoader;
using System.Reflection;
namespace NAK.MuteSFX;
public class MuteSFX : MelonMod
{
internal static MelonLogger.Instance Logger;
internal const string SettingsCategory = nameof(MuteSFX);
public static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
Category.CreateEntry("Enabled", true, description: "Toggle MuteSFX entirely.");
public override void OnInitializeMelon()
{
Logger = LoggerInstance;
HarmonyInstance.Patch(
typeof(Audio).GetMethod(nameof(Audio.SetMicrophoneActive)),
postfix: new HarmonyLib.HarmonyMethod(typeof(MuteSFX).GetMethod(nameof(OnSetMicrophoneActive_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
);
AudioModuleManager.SetupDefaultAudioClips();
}
private static void OnSetMicrophoneActive_Postfix(bool muted)
{
if (EntryEnabled.Value)
AudioModuleManager.PlayAudioModule(muted ? AudioModuleManager.sfx_mute : AudioModuleManager.sfx_unmute);
}
}

11
MuteSFX/MuteSFX.csproj Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<None Remove="SFX\sfx_mute.wav" />
<None Remove="SFX\sfx_unmute.wav" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SFX\sfx_mute.wav" />
<EmbeddedResource Include="SFX\sfx_unmute.wav" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,29 @@
using MelonLoader;
using NAK.MuteSFX.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.MuteSFX))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.MuteSFX))]
[assembly: MelonInfo(
typeof(NAK.MuteSFX.MuteSFX),
nameof(NAK.MuteSFX),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/MuteSFX"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
namespace NAK.MuteSFX.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

18
MuteSFX/README.md Normal file
View file

@ -0,0 +1,18 @@
# MuteSFX
A simple mod that makes the CVR_DesktopCameraController defaultFov adjustable.
The custom FOV setting is ignored if a world author specified a FOV other than 60f.
It is limited between 60f and 120f to match the limitations world creators have with setting custom FOV.
---
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.

BIN
MuteSFX/SFX/sfx_mute.wav Normal file

Binary file not shown.

BIN
MuteSFX/SFX/sfx_unmute.wav Normal file

Binary file not shown.

23
MuteSFX/format.json Normal file
View file

@ -0,0 +1,23 @@
{
"_id": -1,
"name": "MuteSFX",
"modversion": "1.0.0",
"gameversion": "2022r170p1",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "Exterrata & NotAKidoS",
"description": "A simple mod to add an audio queue for muting and unmuting.\n\nYou can replace the sfx in 'ChilloutVR\\ChilloutVR_Data\\StreamingAssets\\Cohtml\\UIResources\\GameUI\\mods\\MuteSFX\\audio'.",
"searchtags": [
"mute",
"unmute",
"audio",
"sound"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r13/MuteSFX.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/MuteSFX/",
"changelog": "- Initial CVRMG release",
"embedcolor": "92e492"
}

View file

@ -71,6 +71,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlaySpaceScaleFix", "PlaySp
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FOVAdjustment", "FOVAdjustment\FOVAdjustment.csproj", "{EE552804-30B1-49CF-BBDE-3B312895AFF7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FOVAdjustment", "FOVAdjustment\FOVAdjustment.csproj", "{EE552804-30B1-49CF-BBDE-3B312895AFF7}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MuteSFX", "MuteSFX\MuteSFX.csproj", "{77D222FC-4AEC-4672-A87A-B860B4C39E17}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -213,6 +215,10 @@ Global
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE552804-30B1-49CF-BBDE-3B312895AFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.Build.0 = Release|Any CPU {EE552804-30B1-49CF-BBDE-3B312895AFF7}.Release|Any CPU.Build.0 = Release|Any CPU
{77D222FC-4AEC-4672-A87A-B860B4C39E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77D222FC-4AEC-4672-A87A-B860B4C39E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77D222FC-4AEC-4672-A87A-B860B4C39E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77D222FC-4AEC-4672-A87A-B860B4C39E17}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE