mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[MuteSFX] Initial CVRMG release
This commit is contained in:
parent
aac93fbed7
commit
d9c8a31667
9 changed files with 171 additions and 0 deletions
49
MuteSFX/AudioModuleManager.cs
Normal file
49
MuteSFX/AudioModuleManager.cs
Normal 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
35
MuteSFX/Main.cs
Normal 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
11
MuteSFX/MuteSFX.csproj
Normal 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>
|
29
MuteSFX/Properties/AssemblyInfo.cs
Normal file
29
MuteSFX/Properties/AssemblyInfo.cs
Normal 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
18
MuteSFX/README.md
Normal 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
BIN
MuteSFX/SFX/sfx_mute.wav
Normal file
Binary file not shown.
BIN
MuteSFX/SFX/sfx_unmute.wav
Normal file
BIN
MuteSFX/SFX/sfx_unmute.wav
Normal file
Binary file not shown.
23
MuteSFX/format.json
Normal file
23
MuteSFX/format.json
Normal 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"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue