[LuaTTS] Initial Builds

This commit is contained in:
NotAKidoS 2024-05-31 21:31:43 -05:00
parent f8dc4e9521
commit 0a0e6d849b
9 changed files with 194 additions and 1 deletions

6
LuaTTS/LuaTTS.csproj Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>Sprays</RootNamespace>
</PropertyGroup>
</Project>

25
LuaTTS/Main.cs Normal file
View file

@ -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);
}
}
}

20
LuaTTS/Patches.cs Normal file
View file

@ -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);
}
}

View file

@ -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";
}

14
LuaTTS/README.md Normal file
View file

@ -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.

67
LuaTTS/TTSLuaModule.cs Normal file
View file

@ -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<TTSLuaModule>(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);
}

23
LuaTTS/format.json Normal file
View file

@ -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"
}

View file

@ -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

View file

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