diff --git a/LuaTTS/LuaTTS.csproj b/LuaTTS/LuaTTS.csproj new file mode 100644 index 0000000..2bdd4b3 --- /dev/null +++ b/LuaTTS/LuaTTS.csproj @@ -0,0 +1,6 @@ + + + + Sprays + + diff --git a/LuaTTS/Main.cs b/LuaTTS/Main.cs new file mode 100644 index 0000000..2035bb9 --- /dev/null +++ b/LuaTTS/Main.cs @@ -0,0 +1,25 @@ +using MelonLoader; +using NAK.LuaTTS.Patches; + +namespace NAK.LuaTTS; + +public class LuaTTSMod : MelonMod +{ + public override void OnInitializeMelon() + { + ApplyPatches(typeof(LuaScriptFactoryPatches)); + } + + private void ApplyPatches(Type type) + { + try + { + HarmonyInstance.PatchAll(type); + } + catch (Exception e) + { + LoggerInstance.Msg($"Failed while patching {type.Name}!"); + LoggerInstance.Error(e); + } + } +} \ No newline at end of file diff --git a/LuaTTS/Patches.cs b/LuaTTS/Patches.cs new file mode 100644 index 0000000..c81a0d6 --- /dev/null +++ b/LuaTTS/Patches.cs @@ -0,0 +1,20 @@ + +using ABI.Scripting.CVRSTL.Client; +using ABI.Scripting.CVRSTL.Common; +using HarmonyLib; +using MoonSharp.Interpreter; +using NAK.LuaTTS.Modules; + +namespace NAK.LuaTTS.Patches; + +internal static class LuaScriptFactoryPatches +{ + [HarmonyPostfix] + [HarmonyPatch(typeof(LuaScriptFactory.CVRRequireModule), nameof(LuaScriptFactory.CVRRequireModule.require))] + private static void Postfix_CVRRequireModule_require(string modid, + ref object __result, ref Script ___script, CVRLuaContext ___context) + { + if (modid == "TextToSpeech") + __result = TTSLuaModule.RegisterUserData(___script, ___context); + } +} \ No newline at end of file diff --git a/LuaTTS/Properties/AssemblyInfo.cs b/LuaTTS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ea81378 --- /dev/null +++ b/LuaTTS/Properties/AssemblyInfo.cs @@ -0,0 +1,32 @@ +using NAK.LuaTTS.Properties; +using MelonLoader; +using System.Reflection; + +[assembly: AssemblyVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyTitle(nameof(NAK.LuaTTS))] +[assembly: AssemblyCompany(AssemblyInfoParams.Author)] +[assembly: AssemblyProduct(nameof(NAK.LuaTTS))] + +[assembly: MelonInfo( + typeof(NAK.LuaTTS.LuaTTSMod), + nameof(NAK.LuaTTS), + AssemblyInfoParams.Version, + AssemblyInfoParams.Author, + downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/LuaTTS" +)] + +[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] +[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] +[assembly: MelonColor(255, 125, 126, 129)] +[assembly: MelonAuthorColor(255, 158, 21, 32)] +[assembly: HarmonyDontPatchAll] + +namespace NAK.LuaTTS.Properties; +internal static class AssemblyInfoParams +{ + public const string Version = "1.0.0"; + public const string Author = "NotAKidoS"; +} \ No newline at end of file diff --git a/LuaTTS/README.md b/LuaTTS/README.md new file mode 100644 index 0000000..3d32c50 --- /dev/null +++ b/LuaTTS/README.md @@ -0,0 +1,14 @@ +# LuaTTS + +Provides access to the built-in text-to-speech (TTS) functionality to lua scripts. Allows you to make the local player speak. + +--- + +Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI. +https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games + +> This mod is an independent creation 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. diff --git a/LuaTTS/TTSLuaModule.cs b/LuaTTS/TTSLuaModule.cs new file mode 100644 index 0000000..bf58c16 --- /dev/null +++ b/LuaTTS/TTSLuaModule.cs @@ -0,0 +1,67 @@ +using ABI_RC.Systems.Communications.Audio.TTS; +using ABI.Scripting.CVRSTL.Common; +using JetBrains.Annotations; +using MoonSharp.Interpreter; + +namespace NAK.LuaTTS.Modules; + +[PublicAPI] // fak off its used +public class TTSLuaModule +{ + private CVRLuaContext context; + + internal TTSLuaModule(CVRLuaContext context) + { + this.context = context; // we don't really need the context for this shit module + } + + internal static object RegisterUserData(Script script, CVRLuaContext context) + { + UserData.RegisterType(InteropAccessMode.Default, "TextToSpeech"); + return new TTSLuaModule(context); + } + + // Check if TTS is playing + public static bool IsPlaying() + => Comms_TTSHandler.Instance.IsPlaying; + + // Check if TTS is processing a message + public static bool IsProcessing() + => Comms_TTSHandler.Instance.IsProcessing; + + // Check if TTS has no modules (only true for proton?) + public static bool HasAnyModules() + => Comms_TTSHandler._modules.Count > 0; + + // Get all available TTS modules + public static string[] GetAvailableModules() + => Comms_TTSHandler._modules.Keys.ToArray(); + + // Get the current TTS module + public static string GetCurrentModule() + => Comms_TTSHandler.Instance.CurrentModuleId; + + // Set the current TTS module + public static void SetCurrentModule(string moduleId) + => Comms_TTSHandler.Instance.ChangeModule(moduleId); + + // Process a message for TTS playback + public static void ProcessMessage(string message) + => Comms_TTSHandler.Instance.ProcessMessage(message); + + // Cancel any currently playing TTS message + public static void CancelMessage() + => Comms_TTSHandler.Instance.ProcessMessage(string.Empty); // empty message cancels the current message + + // Get all available voices for the current module + public static string[] GetAvailableVoices() + => Comms_TTSHandler.Instance.CurrentModule.Voices.Keys.ToArray(); + + // Get the current voice for the module + public static string GetCurrentVoice() + => Comms_TTSHandler.Instance.CurrentModule.CurrentVoice; + + // Set the current voice for the module + public static void SetCurrentVoice(string voiceName) + => Comms_TTSHandler.Instance.ChangeVoice(voiceName); +} \ No newline at end of file diff --git a/LuaTTS/format.json b/LuaTTS/format.json new file mode 100644 index 0000000..191b138 --- /dev/null +++ b/LuaTTS/format.json @@ -0,0 +1,23 @@ +{ + "_id": 211, + "name": "RelativeSync", + "modversion": "1.0.2", + "gameversion": "2024r175", + "loaderversion": "0.6.1", + "modtype": "Mod", + "author": "NotAKidoS", + "description": "Relative sync for Movement Parent & Chairs. Requires both users to have the mod installed. Synced over Mod Network.\n\nProvides some Experimental settings to also fix local jitter on movement parents.", + "searchtags": [ + "relative", + "sync", + "movement", + "chair" + ], + "requirements": [ + "None" + ], + "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r28/RelativeSync.dll", + "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/RelativeSync/", + "changelog": "- Fixed RelativeSyncMarker not generating correct path hash for local player\n - This fixes relative sync on local avatar movement parents\n- Fixed initial calculated interpolation interval when assigning a new RelativeSyncMarker for a remote user\n - Would calculate from time was last on a movement parent, which could lead to seconds long interpolation\n- Added Network Debug settings\n- Added experimental settings to fix **local** jitter on movement parents\n - These options are disabled by default as they have not been heavily tested", + "embedcolor": "#507e64" +} \ No newline at end of file diff --git a/NAK_CVR_Mods.sln b/NAK_CVR_Mods.sln index 5615c82..24b7d75 100644 --- a/NAK_CVR_Mods.sln +++ b/NAK_CVR_Mods.sln @@ -51,6 +51,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelativeSync", "RelativeSyn EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptingSpoofer", "ScriptingSpoofer\ScriptingSpoofer.csproj", "{6B4396C7-B451-4FFD-87B6-3ED8377AC308}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaTTS", "LuaTTS\LuaTTS.csproj", "{24A069F4-4D69-4ABD-AA16-77765469245B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -153,6 +155,10 @@ Global {6B4396C7-B451-4FFD-87B6-3ED8377AC308}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B4396C7-B451-4FFD-87B6-3ED8377AC308}.Release|Any CPU.ActiveCfg = Release|Any CPU {6B4396C7-B451-4FFD-87B6-3ED8377AC308}.Release|Any CPU.Build.0 = Release|Any CPU + {24A069F4-4D69-4ABD-AA16-77765469245B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24A069F4-4D69-4ABD-AA16-77765469245B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24A069F4-4D69-4ABD-AA16-77765469245B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24A069F4-4D69-4ABD-AA16-77765469245B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/copy_and_nstrip_dll.ps1 b/copy_and_nstrip_dll.ps1 index e5e6f36..b81a8c6 100644 --- a/copy_and_nstrip_dll.ps1 +++ b/copy_and_nstrip_dll.ps1 @@ -163,7 +163,7 @@ else { # Loop through each DLL file to strip and call NStrip.exe foreach($dllFile in $dllsToStrip) { $dllPath = Join-Path -Path $managedLibsFolder -ChildPath $dllFile - & $nStripPath -p -n $dllPath $dllPath + & $nStripPath -p -cg -n $dllPath $dllPath } Write-Host ""