using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using MelonLoader;
using MimesisReversedSpeech;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(ReversedSpeechMod), "Mimesis Reversed Speech", "1.0.1", "Kris Jordan", null)]
[assembly: MelonGame("ReLUGames", "MIMESIS")]
[assembly: AssemblyTitle("MimicReversedSpeech")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MimicReversedSpeech")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ddedf60-c482-47a9-8ba2-5b02f5344e48")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MimesisReversedSpeech;
public class ReversedSpeechMod : MelonMod
{
private Harmony harmony;
public override void OnApplicationStart()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
MelonLogger.Msg("Mimesis Reversed Speech loading...");
harmony = new Harmony("com.kj.mimesis.reversedspeech");
try
{
PatchDecoderPipeline();
}
catch (Exception ex)
{
MelonLogger.Error(ex.ToString());
}
}
public override void OnApplicationQuit()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
private void PatchDecoderPipeline()
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
Assembly assembly = null;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly2 in assemblies)
{
if (assembly2.GetName().Name == "DissonanceVoip")
{
assembly = assembly2;
break;
}
}
if (assembly == null)
{
MelonLogger.Error("DissonanceVoip assembly not loaded");
return;
}
Type type = assembly.GetType("Dissonance.Audio.Playback.DecoderPipeline", throwOnError: false);
if (type == null)
{
MelonLogger.Error("DecoderPipeline type not found");
return;
}
MethodInfo method = type.GetMethod("Read", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(ArraySegment<float>) }, null);
if (method == null)
{
MelonLogger.Error("DecoderPipeline.Read not found");
return;
}
harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(typeof(ReversedSpeechMod).GetMethod("ReadPostfix", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MelonLogger.Msg("DecoderPipeline.Read patched successfully");
}
private static void ReadPostfix(ref bool __result, ArraySegment<float> samples)
{
if (!__result)
{
return;
}
float[] array = samples.Array;
if (array != null && samples.Count >= 2)
{
int num = samples.Offset;
int num2 = num + samples.Count - 1;
while (num < num2)
{
float num3 = array[num];
array[num] = array[num2];
array[num2] = num3;
num++;
num2--;
}
}
}
}