Decompiled source of Polarite v1.0.1
Polarite.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using Discord; using HarmonyLib; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using Polarite; using Polarite.Multiplayer; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("JaketLite")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JaketLite")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1f807cb4-4d22-4300-adf4-c04802f7ab19")] [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")] public class Buffer { private List<int> Data; public Buffer() { Data = new List<int>(); } public int[] Get() { return Data.ToArray(); } public int GetSize() { return Data.Count; } public void Set(int position, int data) { while (position >= Data.Count) { Data.Add(0); } Data[position] = data; } public float[] GetFloats() { float[] array = new float[GetSize()]; for (int i = 0; i < Data.Count; i++) { array[i] = (float)(Data[i] - 127) / 255f; } return array; } } public static class UnitySAM { private static readonly int[] tab36376 = new int[108] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 130, 0, 0, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 192, 168, 176, 172, 192, 160, 184, 160, 192, 188, 160, 172, 168, 172, 192, 160, 160, 172, 180, 164, 192, 168, 168, 176, 192, 188, 0, 0, 0, 2, 0, 32, 32, 155, 32, 192, 185, 32, 205, 163, 76, 138, 142 }; private static readonly int[] rules = new int[4076] { 93, 193, 32, 40, 65, 46, 41, 61, 69, 72, 52, 89, 46, 160, 40, 65, 41, 32, 61, 65, 200, 32, 40, 65, 82, 69, 41, 32, 61, 65, 65, 210, 32, 40, 65, 82, 41, 79, 61, 65, 88, 210, 40, 65, 82, 41, 35, 61, 69, 72, 52, 210, 32, 94, 40, 65, 83, 41, 35, 61, 69, 89, 52, 211, 40, 65, 41, 87, 65, 61, 65, 216, 40, 65, 87, 41, 61, 65, 79, 181, 32, 58, 40, 65, 78, 89, 41, 61, 69, 72, 52, 78, 73, 217, 40, 65, 41, 94, 43, 35, 61, 69, 89, 181, 35, 58, 40, 65, 76, 76, 89, 41, 61, 85, 76, 73, 217, 32, 40, 65, 76, 41, 35, 61, 85, 204, 40, 65, 71, 65, 73, 78, 41, 61, 65, 88, 71, 69, 72, 52, 206, 35, 58, 40, 65, 71, 41, 69, 61, 73, 72, 202, 40, 65, 41, 94, 37, 61, 69, 217, 40, 65, 41, 94, 43, 58, 35, 61, 65, 197, 32, 58, 40, 65, 41, 94, 43, 32, 61, 69, 89, 180, 32, 40, 65, 82, 82, 41, 61, 65, 88, 210, 40, 65, 82, 82, 41, 61, 65, 69, 52, 210, 32, 94, 40, 65, 82, 41, 32, 61, 65, 65, 53, 210, 40, 65, 82, 41, 61, 65, 65, 53, 210, 40, 65, 73, 82, 41, 61, 69, 72, 52, 210, 40, 65, 73, 41, 61, 69, 89, 180, 40, 65, 89, 41, 61, 69, 89, 181, 40, 65, 85, 41, 61, 65, 79, 180, 35, 58, 40, 65, 76, 41, 32, 61, 85, 204, 35, 58, 40, 65, 76, 83, 41, 32, 61, 85, 76, 218, 40, 65, 76, 75, 41, 61, 65, 79, 52, 203, 40, 65, 76, 41, 94, 61, 65, 79, 204, 32, 58, 40, 65, 66, 76, 69, 41, 61, 69, 89, 52, 66, 85, 204, 40, 65, 66, 76, 69, 41, 61, 65, 88, 66, 85, 204, 40, 65, 41, 86, 79, 61, 69, 89, 180, 40, 65, 78, 71, 41, 43, 61, 69, 89, 52, 78, 202, 40, 65, 84, 65, 82, 73, 41, 61, 65, 72, 84, 65, 65, 52, 82, 73, 217, 40, 65, 41, 84, 79, 77, 61, 65, 197, 40, 65, 41, 84, 84, 73, 61, 65, 197, 32, 40, 65, 84, 41, 32, 61, 65, 69, 212, 32, 40, 65, 41, 84, 61, 65, 200, 40, 65, 41, 61, 65, 197, 93, 194, 32, 40, 66, 41, 32, 61, 66, 73, 89, 180, 32, 40, 66, 69, 41, 94, 35, 61, 66, 73, 200, 40, 66, 69, 73, 78, 71, 41, 61, 66, 73, 89, 52, 73, 72, 78, 216, 32, 40, 66, 79, 84, 72, 41, 32, 61, 66, 79, 87, 52, 84, 200, 32, 40, 66, 85, 83, 41, 35, 61, 66, 73, 72, 52, 218, 40, 66, 82, 69, 65, 75, 41, 61, 66, 82, 69, 89, 53, 203, 40, 66, 85, 73, 76, 41, 61, 66, 73, 72, 52, 204, 40, 66, 41, 61, 194, 93, 195, 32, 40, 67, 41, 32, 61, 83, 73, 89, 180, 32, 40, 67, 72, 41, 94, 61, 203, 94, 69, 40, 67, 72, 41, 61, 203, 40, 67, 72, 65, 41, 82, 35, 61, 75, 69, 72, 181, 40, 67, 72, 41, 61, 67, 200, 32, 83, 40, 67, 73, 41, 35, 61, 83, 65, 89, 180, 40, 67, 73, 41, 65, 61, 83, 200, 40, 67, 73, 41, 79, 61, 83, 200, 40, 67, 73, 41, 69, 78, 61, 83, 200, 40, 67, 73, 84, 89, 41, 61, 83, 73, 72, 84, 73, 217, 40, 67, 41, 43, 61, 211, 40, 67, 75, 41, 61, 203, 40, 67, 79, 77, 77, 79, 68, 79, 82, 69, 41, 61, 75, 65, 65, 52, 77, 65, 72, 68, 79, 72, 210, 40, 67, 79, 77, 41, 61, 75, 65, 72, 205, 40, 67, 85, 73, 84, 41, 61, 75, 73, 72, 212, 40, 67, 82, 69, 65, 41, 61, 75, 82, 73, 89, 69, 217, 40, 67, 41, 61, 203, 93, 196, 32, 40, 68, 41, 32, 61, 68, 73, 89, 180, 32, 40, 68, 82, 46, 41, 32, 61, 68, 65, 65, 52, 75, 84, 69, 210, 35, 58, 40, 68, 69, 68, 41, 32, 61, 68, 73, 72, 196, 46, 69, 40, 68, 41, 32, 61, 196, 35, 58, 94, 69, 40, 68, 41, 32, 61, 212, 32, 40, 68, 69, 41, 94, 35, 61, 68, 73, 200, 32, 40, 68, 79, 41, 32, 61, 68, 85, 215, 32, 40, 68, 79, 69, 83, 41, 61, 68, 65, 72, 218, 40, 68, 79, 78, 69, 41, 32, 61, 68, 65, 72, 53, 206, 40, 68, 79, 73, 78, 71, 41, 61, 68, 85, 87, 52, 73, 72, 78, 216, 32, 40, 68, 79, 87, 41, 61, 68, 65, 215, 35, 40, 68, 85, 41, 65, 61, 74, 85, 215, 35, 40, 68, 85, 41, 94, 35, 61, 74, 65, 216, 40, 68, 41, 61, 196, 93, 197, 32, 40, 69, 41, 32, 61, 73, 89, 73, 89, 180, 35, 58, 40, 69, 41, 32, 189, 39, 58, 94, 40, 69, 41, 32, 189, 32, 58, 40, 69, 41, 32, 61, 73, 217, 35, 40, 69, 68, 41, 32, 61, 196, 35, 58, 40, 69, 41, 68, 32, 189, 40, 69, 86, 41, 69, 82, 61, 69, 72, 52, 214, 40, 69, 41, 94, 37, 61, 73, 89, 180, 40, 69, 82, 73, 41, 35, 61, 73, 89, 52, 82, 73, 217, 40, 69, 82, 73, 41, 61, 69, 72, 52, 82, 73, 200, 35, 58, 40, 69, 82, 41, 35, 61, 69, 210, 40, 69, 82, 82, 79, 82, 41, 61, 69, 72, 52, 82, 79, 72, 210, 40, 69, 82, 65, 83, 69, 41, 61, 73, 72, 82, 69, 89, 53, 211, 40, 69, 82, 41, 35, 61, 69, 72, 210, 40, 69, 82, 41, 61, 69, 210, 32, 40, 69, 86, 69, 78, 41, 61, 73, 89, 86, 69, 72, 206, 35, 58, 40, 69, 41, 87, 189, 64, 40, 69, 87, 41, 61, 85, 215, 40, 69, 87, 41, 61, 89, 85, 215, 40, 69, 41, 79, 61, 73, 217, 35, 58, 38, 40, 69, 83, 41, 32, 61, 73, 72, 218, 35, 58, 40, 69, 41, 83, 32, 189, 35, 58, 40, 69, 76, 89, 41, 32, 61, 76, 73, 217, 35, 58, 40, 69, 77, 69, 78, 84, 41, 61, 77, 69, 72, 78, 212, 40, 69, 70, 85, 76, 41, 61, 70, 85, 72, 204, 40, 69, 69, 41, 61, 73, 89, 180, 40, 69, 65, 82, 78, 41, 61, 69, 82, 53, 206, 32, 40, 69, 65, 82, 41, 94, 61, 69, 82, 181, 40, 69, 65, 68, 41, 61, 69, 72, 196, 35, 58, 40, 69, 65, 41, 32, 61, 73, 89, 65, 216, 40, 69, 65, 41, 83, 85, 61, 69, 72, 181, 40, 69, 65, 41, 61, 73, 89, 181, 40, 69, 73, 71, 72, 41, 61, 69, 89, 180, 40, 69, 73, 41, 61, 73, 89, 180, 32, 40, 69, 89, 69, 41, 61, 65, 89, 180, 40, 69, 89, 41, 61, 73, 217, 40, 69, 85, 41, 61, 89, 85, 87, 181, 40, 69, 81, 85, 65, 76, 41, 61, 73, 89, 52, 75, 87, 85, 204, 40, 69, 41, 61, 69, 200, 93, 198, 32, 40, 70, 41, 32, 61, 69, 72, 52, 198, 40, 70, 85, 76, 41, 61, 70, 85, 72, 204, 40, 70, 82, 73, 69, 78, 68, 41, 61, 70, 82, 69, 72, 53, 78, 196, 40, 70, 65, 84, 72, 69, 82, 41, 61, 70, 65, 65, 52, 68, 72, 69, 210, 40, 70, 41, 70, 189, 40, 70, 41, 61, 198, 93, 199, 32, 40, 71, 41, 32, 61, 74, 73, 89, 180, 40, 71, 73, 86, 41, 61, 71, 73, 72, 53, 214, 32, 40, 71, 41, 73, 94, 61, 199, 40, 71, 69, 41, 84, 61, 71, 69, 72, 181, 83, 85, 40, 71, 71, 69, 83, 41, 61, 71, 74, 69, 72, 52, 211, 40, 71, 71, 41, 61, 199, 32, 66, 35, 40, 71, 41, 61, 199, 40, 71, 41, 43, 61, 202, 40, 71, 82, 69, 65, 84, 41, 61, 71, 82, 69, 89, 52, 212, 40, 71, 79, 78, 41, 69, 61, 71, 65, 79, 53, 206, 35, 40, 71, 72, 41, 189, 32, 40, 71, 78, 41, 61, 206, 40, 71, 41, 61, 199, 93, 200, 32, 40, 72, 41, 32, 61, 69, 89, 52, 67, 200, 32, 40, 72, 65, 86, 41, 61, 47, 72, 65, 69, 54, 214, 32, 40, 72, 69, 82, 69, 41, 61, 47, 72, 73, 89, 210, 32, 40, 72, 79, 85, 82, 41, 61, 65, 87, 53, 69, 210, 40, 72, 79, 87, 41, 61, 47, 72, 65, 215, 40, 72, 41, 35, 61, 47, 200, 40, 72, 41, 189, 93, 201, 32, 40, 73, 78, 41, 61, 73, 72, 206, 32, 40, 73, 41, 32, 61, 65, 89, 180, 40, 73, 41, 32, 61, 65, 217, 40, 73, 78, 41, 68, 61, 65, 89, 53, 206, 83, 69, 77, 40, 73, 41, 61, 73, 217, 32, 65, 78, 84, 40, 73, 41, 61, 65, 217, 40, 73, 69, 82, 41, 61, 73, 89, 69, 210, 35, 58, 82, 40, 73, 69, 68, 41, 32, 61, 73, 89, 196, 40, 73, 69, 68, 41, 32, 61, 65, 89, 53, 196, 40, 73, 69, 78, 41, 61, 73, 89, 69, 72, 206, 40, 73, 69, 41, 84, 61, 65, 89, 52, 69, 200, 40, 73, 39, 41, 61, 65, 89, 181, 32, 58, 40, 73, 41, 94, 37, 61, 65, 89, 181, 32, 58, 40, 73, 69, 41, 32, 61, 65, 89, 180, 40, 73, 41, 37, 61, 73, 217, 40, 73, 69, 41, 61, 73, 89, 180, 32, 40, 73, 68, 69, 65, 41, 61, 65, 89, 68, 73, 89, 53, 65, 200, 40, 73, 41, 94, 43, 58, 35, 61, 73, 200, 40, 73, 82, 41, 35, 61, 65, 89, 210, 40, 73, 90, 41, 37, 61, 65, 89, 218, 40, 73, 83, 41, 37, 61, 65, 89, 218, 73, 94, 40, 73, 41, 94, 35, 61, 73, 200, 43, 94, 40, 73, 41, 94, 43, 61, 65, 217, 35, 58, 94, 40, 73, 41, 94, 43, 61, 73, 200, 40, 73, 41, 94, 43, 61, 65, 217, 40, 73, 82, 41, 61, 69, 210, 40, 73, 71, 72, 41, 61, 65, 89, 180, 40, 73, 76, 68, 41, 61, 65, 89, 53, 76, 196, 32, 40, 73, 71, 78, 41, 61, 73, 72, 71, 206, 40, 73, 71, 78, 41, 32, 61, 65, 89, 52, 206, 40, 73, 71, 78, 41, 94, 61, 65, 89, 52, 206, 40, 73, 71, 78, 41, 37, 61, 65, 89, 52, 206, 40, 73, 67, 82, 79, 41, 61, 65, 89, 52, 75, 82, 79, 200, 40, 73, 81, 85, 69, 41, 61, 73, 89, 52, 203, 40, 73, 41, 61, 73, 200, 93, 202, 32, 40, 74, 41, 32, 61, 74, 69, 89, 180, 40, 74, 41, 61, 202, 93, 203, 32, 40, 75, 41, 32, 61, 75, 69, 89, 180, 32, 40, 75, 41, 78, 189, 40, 75, 41, 61, 203, 93, 204, 32, 40, 76, 41, 32, 61, 69, 72, 52, 204, 40, 76, 79, 41, 67, 35, 61, 76, 79, 215, 76, 40, 76, 41, 189, 35, 58, 94, 40, 76, 41, 37, 61, 85, 204, 40, 76, 69, 65, 68, 41, 61, 76, 73, 89, 196, 32, 40, 76, 65, 85, 71, 72, 41, 61, 76, 65, 69, 52, 198, 40, 76, 41, 61, 204, 93, 205, 32, 40, 77, 41, 32, 61, 69, 72, 52, 205, 32, 40, 77, 82, 46, 41, 32, 61, 77, 73, 72, 52, 83, 84, 69, 210, 32, 40, 77, 83, 46, 41, 61, 77, 73, 72, 53, 218, 32, 40, 77, 82, 83, 46, 41, 32, 61, 77, 73, 72, 52, 83, 73, 88, 218, 40, 77, 79, 86, 41, 61, 77, 85, 87, 52, 214, 40, 77, 65, 67, 72, 73, 78, 41, 61, 77, 65, 72, 83, 72, 73, 89, 53, 206, 77, 40, 77, 41, 189, 40, 77, 41, 61, 205, 93, 206, 32, 40, 78, 41, 32, 61, 69, 72, 52, 206, 69, 40, 78, 71, 41, 43, 61, 78, 202, 40, 78, 71, 41, 82, 61, 78, 88, 199, 40, 78, 71, 41, 35, 61, 78, 88, 199, 40, 78, 71, 76, 41, 37, 61, 78, 88, 71, 85, 204, 40, 78, 71, 41, 61, 78, 216, 40, 78, 75, 41, 61, 78, 88, 203, 32, 40, 78, 79, 87, 41, 32, 61, 78, 65, 87, 180, 78, 40, 78, 41, 189, 40, 78, 79, 78, 41, 69, 61, 78, 65, 72, 52, 206, 40, 78, 41, 61, 206, 93, 207, 32, 40, 79, 41, 32, 61, 79, 72, 52, 215, 40, 79, 70, 41, 32, 61, 65, 72, 214, 32, 40, 79, 72, 41, 32, 61, 79, 87, 181, 40, 79, 82, 79, 85, 71, 72, 41, 61, 69, 82, 52, 79, 215, 35, 58, 40, 79, 82, 41, 32, 61, 69, 210, 35, 58, 40, 79, 82, 83, 41, 32, 61, 69, 82, 218, 40, 79, 82, 41, 61, 65, 79, 210, 32, 40, 79, 78, 69, 41, 61, 87, 65, 72, 206, 35, 40, 79, 78, 69, 41, 32, 61, 87, 65, 72, 206, 40, 79, 87, 41, 61, 79, 215, 32, 40, 79, 86, 69, 82, 41, 61, 79, 87, 53, 86, 69, 210, 80, 82, 40, 79, 41, 86, 61, 85, 87, 180, 40, 79, 86, 41, 61, 65, 72, 52, 214, 40, 79, 41, 94, 37, 61, 79, 87, 181, 40, 79, 41, 94, 69, 78, 61, 79, 215, 40, 79, 41, 94, 73, 35, 61, 79, 87, 181, 40, 79, 76, 41, 68, 61, 79, 87, 52, 204, 40, 79, 85, 71, 72, 84, 41, 61, 65, 79, 53, 212, 40, 79, 85, 71, 72, 41, 61, 65, 72, 53, 198, 32, 40, 79, 85, 41, 61, 65, 215, 72, 40, 79, 85, 41, 83, 35, 61, 65, 87, 180, 40, 79, 85, 83, 41, 61, 65, 88, 211, 40, 79, 85, 82, 41, 61, 79, 72, 210, 40, 79, 85, 76, 68, 41, 61, 85, 72, 53, 196, 40, 79, 85, 41, 94, 76, 61, 65, 72, 181, 40, 79, 85, 80, 41, 61, 85, 87, 53, 208, 40, 79, 85, 41, 61, 65, 215, 40, 79, 89, 41, 61, 79, 217, 40, 79, 73, 78, 71, 41, 61, 79, 87, 52, 73, 72, 78, 216, 40, 79, 73, 41, 61, 79, 89, 181, 40, 79, 79, 82, 41, 61, 79, 72, 53, 210, 40, 79, 79, 75, 41, 61, 85, 72, 53, 203, 70, 40, 79, 79, 68, 41, 61, 85, 87, 53, 196, 76, 40, 79, 79, 68, 41, 61, 65, 72, 53, 196, 77, 40, 79, 79, 68, 41, 61, 85, 87, 53, 196, 40, 79, 79, 68, 41, 61, 85, 72, 53, 196, 70, 40, 79, 79, 84, 41, 61, 85, 72, 53, 212, 40, 79, 79, 41, 61, 85, 87, 181, 40, 79, 39, 41, 61, 79, 200, 40, 79, 41, 69, 61, 79, 215, 40, 79, 41, 32, 61, 79, 215, 40, 79, 65, 41, 61, 79, 87, 180, 32, 40, 79, 78, 76, 89, 41, 61, 79, 87, 52, 78, 76, 73, 217, 32, 40, 79, 78, 67, 69, 41, 61, 87, 65, 72, 52, 78, 211, 40, 79, 78, 39, 84, 41, 61, 79, 87, 52, 78, 212, 67, 40, 79, 41, 78, 61, 65, 193, 40, 79, 41, 78, 71, 61, 65, 207, 32, 58, 94, 40, 79, 41, 78, 61, 65, 200, 73, 40, 79, 78, 41, 61, 85, 206, 35, 58, 40, 79, 78, 41, 61, 85, 206, 35, 94, 40, 79, 78, 41, 61, 85, 206, 40, 79, 41, 83, 84, 61, 79, 215, 40, 79, 70, 41, 94, 61, 65, 79, 52, 198, 40, 79, 84, 72, 69, 82, 41, 61, 65, 72, 53, 68, 72, 69, 210, 82, 40, 79, 41, 66, 61, 82, 65, 193, 94, 82, 40, 79, 41, 58, 35, 61, 79, 87, 181, 40, 79, 83, 83, 41, 32, 61, 65, 79, 53, 211, 35, 58, 94, 40, 79, 77, 41, 61, 65, 72, 205, 40, 79, 41, 61, 65, 193, 93, 208, 32, 40, 80, 41, 32, 61, 80, 73, 89, 180, 40, 80, 72, 41, 61, 198, 40, 80, 69, 79, 80, 76, 41, 61, 80, 73, 89, 53, 80, 85, 204, 40, 80, 79, 87, 41, 61, 80, 65, 87, 180, 40, 80, 85, 84, 41, 32, 61, 80, 85, 72, 212, 40, 80, 41, 80, 189, 40, 80, 41, 83, 189, 40, 80, 41, 78, 189, 40, 80, 82, 79, 70, 46, 41, 61, 80, 82, 79, 72, 70, 69, 72, 52, 83, 69, 210, 40, 80, 41, 61, 208, 93, 209, 32, 40, 81, 41, 32, 61, 75, 89, 85, 87, 180, 40, 81, 85, 65, 82, 41, 61, 75, 87, 79, 72, 53, 210, 40, 81, 85, 41, 61, 75, 215, 40, 81, 41, 61, 203, 93, 210, 32, 40, 82, 41, 32, 61, 65, 65, 53, 210, 32, 40, 82, 69, 41, 94, 35, 61, 82, 73, 217, 40, 82, 41, 82, 189, 40, 82, 41, 61, 210, 93, 211, 32, 40, 83, 41, 32, 61, 69, 72, 52, 211, 40, 83, 72, 41, 61, 83, 200, 35, 40, 83, 73, 79, 78, 41, 61, 90, 72, 85, 206, 40, 83, 79, 77, 69, 41, 61, 83, 65, 72, 205, 35, 40, 83, 85, 82, 41, 35, 61, 90, 72, 69, 210, 40, 83, 85, 82, 41, 35, 61, 83, 72, 69, 210, 35, 40, 83, 85, 41, 35, 61, 90, 72, 85, 215, 35, 40, 83, 83, 85, 41, 35, 61, 83, 72, 85, 215, 35, 40, 83, 69, 68, 41, 61, 90, 196, 35, 40, 83, 41, 35, 61, 218, 40, 83, 65, 73, 68, 41, 61, 83, 69, 72, 196, 94, 40, 83, 73, 79, 78, 41, 61, 83, 72, 85, 206, 40, 83, 41, 83, 189, 46, 40, 83, 41, 32, 61, 218, 35, 58, 46, 69, 40, 83, 41, 32, 61, 218, 35, 58, 94, 35, 40, 83, 41, 32, 61, 211, 85, 40, 83, 41, 32, 61, 211, 32, 58, 35, 40, 83, 41, 32, 61, 218, 35, 35, 40, 83, 41, 32, 61, 218, 32, 40, 83, 67, 72, 41, 61, 83, 203, 40, 83, 41, 67, 43, 189, 35, 40, 83, 77, 41, 61, 90, 85, 205, 35, 40, 83, 78, 41, 39, 61, 90, 85, 205, 40, 83, 84, 76, 69, 41, 61, 83, 85, 204, 40, 83, 41, 61, 211, 93, 212, 32, 40, 84, 41, 32, 61, 84, 73, 89, 180, 32, 40, 84, 72, 69, 41, 32, 35, 61, 68, 72, 73, 217, 32, 40, 84, 72, 69, 41, 32, 61, 68, 72, 65, 216, 40, 84, 79, 41, 32, 61, 84, 85, 216, 32, 40, 84, 72, 65, 84, 41, 61, 68, 72, 65, 69, 212, 32, 40, 84, 72, 73, 83, 41, 32, 61, 68, 72, 73, 72, 211, 32, 40, 84, 72, 69, 89, 41, 61, 68, 72, 69, 217, 32, 40, 84, 72, 69, 82, 69, 41, 61, 68, 72, 69, 72, 210, 40, 84, 72, 69, 82, 41, 61, 68, 72, 69, 210, 40, 84, 72, 69, 73, 82, 41, 61, 68, 72, 69, 72, 210, 32, 40, 84, 72, 65, 78, 41, 32, 61, 68, 72, 65, 69, 206, 32, 40, 84, 72, 69, 77, 41, 32, 61, 68, 72, 65, 69, 206, 40, 84, 72, 69, 83, 69, 41, 32, 61, 68, 72, 73, 89, 218, 32, 40, 84, 72, 69, 78, 41, 61, 68, 72, 69, 72, 206, 40, 84, 72, 82, 79, 85, 71, 72, 41, 61, 84, 72, 82, 85, 87, 180, 40, 84, 72, 79, 83, 69, 41, 61, 68, 72, 79, 72, 218, 40, 84, 72, 79, 85, 71, 72, 41, 32, 61, 68, 72, 79, 215, 40, 84, 79, 68, 65, 89, 41, 61, 84, 85, 88, 68, 69, 217, 40, 84, 79, 77, 79, 41, 82, 82, 79, 87, 61, 84, 85, 77, 65, 65, 181, 40, 84, 79, 41, 84, 65, 76, 61, 84, 79, 87, 181, 32, 40, 84, 72, 85, 83, 41, 61, 68, 72, 65, 72, 52, 211, 40, 84, 72, 41, 61, 84, 200, 35, 58, 40, 84, 69, 68, 41, 61, 84, 73, 88, 196, 83, 40, 84, 73, 41, 35, 78, 61, 67, 200, 40, 84, 73, 41, 79, 61, 83, 200, 40, 84, 73, 41, 65, 61, 83, 200, 40, 84, 73, 69, 78, 41, 61, 83, 72, 85, 206, 40, 84, 85, 82, 41, 35, 61, 67, 72, 69, 210, 40, 84, 85, 41, 65, 61, 67, 72, 85, 215, 32, 40, 84, 87, 79, 41, 61, 84, 85, 215, 38, 40, 84, 41, 69, 78, 32, 189, 40, 84, 41, 61, 212, 93, 213, 32, 40, 85, 41, 32, 61, 89, 85, 87, 180, 32, 40, 85, 78, 41, 73, 61, 89, 85, 87, 206, 32, 40, 85, 78, 41, 61, 65, 72, 206, 32, 40, 85, 80, 79, 78, 41, 61, 65, 88, 80, 65, 79, 206, 64, 40, 85, 82, 41, 35, 61, 85, 72, 52, 210, 40, 85, 82, 41, 35, 61, 89, 85, 72, 52, 210, 40, 85, 82, 41, 61, 69, 210, 40, 85, 41, 94, 32, 61, 65, 200, 40, 85, 41, 94, 94, 61, 65, 72, 181, 40, 85, 89, 41, 61, 65, 89, 181, 32, 71, 40, 85, 41, 35, 189, 71, 40, 85, 41, 37, 189, 71, 40, 85, 41, 35, 61, 215, 35, 78, 40, 85, 41, 61, 89, 85, 215, 64, 40, 85, 41, 61, 85, 215, 40, 85, 41, 61, 89, 85, 215, 93, 214, 32, 40, 86, 41, 32, 61, 86, 73, 89, 180, 40, 86, 73, 69, 87, 41, 61, 86, 89, 85, 87, 181, 40, 86, 41, 61, 214, 93, 215, 32, 40, 87, 41, 32, 61, 68, 65, 72, 52, 66, 85, 76, 89, 85, 215, 32, 40, 87, 69, 82, 69, 41, 61, 87, 69, 210, 40, 87, 65, 41, 83, 72, 61, 87, 65, 193, 40, 87, 65, 41, 83, 84, 61, 87, 69, 217, 40, 87, 65, 41, 83, 61, 87, 65, 200, 40, 87, 65, 41, 84, 61, 87, 65, 193, 40, 87, 72, 69, 82, 69, 41, 61, 87, 72, 69, 72, 210, 40, 87, 72, 65, 84, 41, 61, 87, 72, 65, 72, 212, 40, 87, 72, 79, 76, 41, 61, 47, 72, 79, 87, 204, 40, 87, 72, 79, 41, 61, 47, 72, 85, 215, 40, 87, 72, 41, 61, 87, 200, 40, 87, 65, 82, 41, 35, 61, 87, 69, 72, 210, 40, 87, 65, 82, 41, 61, 87, 65, 79, 210, 40, 87, 79, 82, 41, 94, 61, 87, 69, 210, 40, 87, 82, 41, 61, 210, 40, 87, 79, 77, 41, 65, 61, 87, 85, 72, 205, 40, 87, 79, 77, 41, 69, 61, 87, 73, 72, 205, 40, 87, 69, 65, 41, 82, 61, 87, 69, 200, 40, 87, 65, 78, 84, 41, 61, 87, 65, 65, 53, 78, 212, 65, 78, 83, 40, 87, 69, 82, 41, 61, 69, 210, 40, 87, 41, 61, 215, 93, 216, 32, 40, 88, 41, 32, 61, 69, 72, 52, 75, 211, 32, 40, 88, 41, 61, 218, 40, 88, 41, 61, 75, 211, 93, 217, 32, 40, 89, 41, 32, 61, 87, 65, 89, 180, 40, 89, 79, 85, 78, 71, 41, 61, 89, 65, 72, 78, 216, 32, 40, 89, 79, 85, 82, 41, 61, 89, 79, 72, 210, 32, 40, 89, 79, 85, 41, 61, 89, 85, 215, 32, 40, 89, 69, 83, 41, 61, 89, 69, 72, 211, 32, 40, 89, 41, 61, 217, 70, 40, 89, 41, 61, 65, 217, 80, 83, 40, 89, 67, 72, 41, 61, 65, 89, 203, 35, 58, 94, 40, 89, 41, 61, 73, 217, 35, 58, 94, 40, 89, 41, 73, 61, 73, 217, 32, 58, 40, 89, 41, 32, 61, 65, 217, 32, 58, 40, 89, 41, 35, 61, 65, 217, 32, 58, 40, 89, 41, 94, 43, 58, 35, 61, 73, 200, 32, 58, 40, 89, 41, 94, 35, 61, 65, 217, 40, 89, 41, 61, 73, 200, 93, 218, 32, 40, 90, 41, 32, 61, 90, 73, 89, 180, 40, 90, 41, 61, 218, 234 }; private static readonly int[] rules2 = new int[447] { 40, 65, 41, 189, 40, 33, 41, 61, 174, 40, 34, 41, 32, 61, 45, 65, 72, 53, 78, 75, 87, 79, 87, 84, 173, 40, 34, 41, 61, 75, 87, 79, 87, 52, 84, 173, 40, 35, 41, 61, 32, 78, 65, 72, 52, 77, 66, 69, 210, 40, 36, 41, 61, 32, 68, 65, 65, 52, 76, 69, 210, 40, 37, 41, 61, 32, 80, 69, 82, 83, 69, 72, 52, 78, 212, 40, 38, 41, 61, 32, 65, 69, 78, 196, 40, 39, 41, 189, 40, 42, 41, 61, 32, 65, 69, 52, 83, 84, 69, 82, 73, 72, 83, 203, 40, 43, 41, 61, 32, 80, 76, 65, 72, 52, 211, 40, 44, 41, 61, 172, 32, 40, 45, 41, 32, 61, 173, 40, 45, 41, 189, 40, 46, 41, 61, 32, 80, 79, 89, 78, 212, 40, 47, 41, 61, 32, 83, 76, 65, 69, 52, 83, 200, 40, 48, 41, 61, 32, 90, 73, 89, 52, 82, 79, 215, 32, 40, 49, 83, 84, 41, 61, 70, 69, 82, 52, 83, 212, 32, 40, 49, 48, 84, 72, 41, 61, 84, 69, 72, 52, 78, 84, 200, 40, 49, 41, 61, 32, 87, 65, 72, 52, 206, 32, 40, 50, 78, 68, 41, 61, 83, 69, 72, 52, 75, 85, 78, 196, 40, 50, 41, 61, 32, 84, 85, 87, 180, 32, 40, 51, 82, 68, 41, 61, 84, 72, 69, 82, 52, 196, 40, 51, 41, 61, 32, 84, 72, 82, 73, 89, 180, 40, 52, 41, 61, 32, 70, 79, 72, 52, 210, 32, 40, 53, 84, 72, 41, 61, 70, 73, 72, 52, 70, 84, 200, 40, 53, 41, 61, 32, 70, 65, 89, 52, 214, 32, 40, 54, 52, 41, 32, 61, 83, 73, 72, 52, 75, 83, 84, 73, 89, 32, 70, 79, 72, 210, 40, 54, 41, 61, 32, 83, 73, 72, 52, 75, 211, 40, 55, 41, 61, 32, 83, 69, 72, 52, 86, 85, 206, 32, 40, 56, 84, 72, 41, 61, 69, 89, 52, 84, 200, 40, 56, 41, 61, 32, 69, 89, 52, 212, 40, 57, 41, 61, 32, 78, 65, 89, 52, 206, 40, 58, 41, 61, 174, 40, 59, 41, 61, 174, 40, 60, 41, 61, 32, 76, 69, 72, 52, 83, 32, 68, 72, 65, 69, 206, 40, 61, 41, 61, 32, 73, 89, 52, 75, 87, 85, 76, 218, 40, 62, 41, 61, 32, 71, 82, 69, 89, 52, 84, 69, 82, 32, 68, 72, 65, 69, 206, 40, 63, 41, 61, 191, 40, 64, 41, 61, 32, 65, 69, 54, 212, 40, 94, 41, 61, 32, 75, 65, 69, 52, 82, 73, 88, 212, 93, 193 }; private static readonly int[] tab37489 = new int[26] { 0, 149, 247, 162, 57, 197, 6, 126, 199, 38, 55, 78, 145, 241, 85, 161, 254, 36, 69, 45, 167, 54, 83, 46, 71, 218 }; private static readonly int[] tab37515 = new int[26] { 125, 126, 126, 127, 128, 129, 130, 130, 130, 132, 132, 132, 132, 132, 133, 135, 135, 136, 136, 137, 138, 139, 139, 140, 140, 140 }; private static int A; private static int X; private static int Y; private static int[] inputtemp; private static readonly int[] tab48426 = new int[5] { 24, 26, 23, 23, 23 }; private static readonly int[] tab47492 = new int[11] { 0, 0, 224, 230, 236, 243, 249, 0, 6, 12, 6 }; private static readonly int[] amplitudeRescale = new int[17] { 0, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 8, 9, 11, 13, 15, 0 }; private static readonly int[] blendRank = new int[80] { 0, 31, 31, 31, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 2, 10, 2, 8, 5, 5, 11, 10, 9, 8, 8, 160, 8, 8, 23, 31, 18, 18, 18, 18, 30, 30, 20, 20, 20, 20, 23, 23, 26, 26, 29, 29, 2, 2, 2, 2, 2, 2, 26, 29, 27, 26, 29, 27, 26, 29, 27, 26, 29, 27, 23, 29, 23, 23, 29, 23, 23, 29, 23, 23, 29, 23, 23, 23 }; private static readonly int[] outBlendLength = new int[80] { 0, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 4, 4, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 0, 1, 0, 1, 0, 5, 5, 5, 5, 5, 4, 4, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 2, 2, 0, 1, 3, 0, 2, 3, 0, 2, 160, 160 }; private static readonly int[] inBlendLength = new int[80] { 0, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 3, 3, 3, 3, 3, 1, 2, 3, 2, 1, 3, 3, 3, 3, 1, 1, 3, 3, 3, 2, 2, 3, 2, 3, 0, 0, 5, 5, 5, 5, 4, 4, 2, 0, 2, 2, 0, 3, 2, 0, 4, 2, 0, 3, 2, 0, 2, 2, 0, 2, 3, 0, 3, 3, 0, 3, 176, 160 }; private static readonly int[] sampledConsonantFlags = new int[80] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 226, 211, 187, 124, 149, 1, 2, 3, 3, 0, 114, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; private static readonly int[] freq1data = new int[80] { 0, 19, 19, 19, 19, 10, 14, 18, 24, 26, 22, 20, 16, 20, 14, 18, 14, 18, 18, 16, 12, 14, 10, 18, 14, 10, 8, 6, 6, 6, 6, 17, 6, 6, 6, 6, 14, 16, 9, 10, 8, 10, 6, 6, 6, 5, 6, 0, 18, 26, 20, 26, 18, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 6, 6, 6, 44, 19 }; private static readonly int[] freq2data = new int[80] { 0, 67, 67, 67, 67, 84, 72, 66, 62, 40, 44, 30, 36, 44, 72, 48, 36, 30, 50, 36, 28, 68, 24, 50, 30, 24, 82, 46, 54, 86, 54, 67, 73, 79, 26, 66, 73, 37, 51, 66, 40, 47, 79, 79, 66, 79, 110, 0, 72, 38, 30, 42, 30, 34, 26, 26, 26, 66, 66, 66, 110, 110, 110, 84, 84, 84, 26, 26, 26, 66, 66, 66, 109, 86, 109, 84, 84, 84, 127, 127 }; private static readonly int[] freq3data = new int[80] { 0, 91, 91, 91, 91, 110, 93, 91, 88, 89, 87, 88, 82, 89, 93, 62, 82, 88, 62, 110, 80, 93, 90, 60, 110, 90, 110, 81, 121, 101, 121, 91, 99, 106, 81, 121, 93, 82, 93, 103, 76, 93, 101, 101, 121, 101, 121, 0, 90, 88, 88, 88, 88, 82, 81, 81, 81, 121, 121, 121, 112, 110, 110, 94, 94, 94, 81, 81, 81, 121, 121, 121, 101, 101, 112, 94, 94, 94, 8, 1 }; private static readonly int[] ampl1data = new int[80] { 0, 0, 0, 0, 0, 13, 13, 14, 15, 15, 15, 15, 15, 12, 13, 12, 15, 15, 13, 13, 13, 14, 13, 12, 13, 13, 13, 12, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 0, 0, 1, 11, 0, 2, 14, 15, 15, 15, 15, 13, 2, 4, 0, 2, 4, 0, 1, 4, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 15, 15 }; private static readonly int[] ampl2data = new int[80] { 0, 0, 0, 0, 0, 10, 11, 13, 14, 13, 12, 12, 11, 9, 11, 11, 12, 12, 12, 8, 8, 12, 8, 10, 8, 8, 10, 3, 9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 4, 0, 0, 0, 5, 10, 2, 14, 13, 12, 13, 12, 8, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 0, 0, 0 }; private static readonly int[] ampl3data = new int[80] { 0, 0, 0, 0, 0, 8, 7, 8, 8, 1, 1, 0, 1, 0, 7, 5, 1, 0, 6, 1, 0, 7, 0, 5, 1, 0, 8, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 14, 1, 9, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 5, 0, 19, 16 }; private static readonly int[] sinus = new int[256] { 0, 3, 6, 9, 12, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 51, 54, 57, 60, 63, 65, 68, 71, 73, 76, 78, 81, 83, 85, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 107, 109, 111, 112, 113, 115, 116, 117, 118, 120, 121, 122, 122, 123, 124, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 125, 125, 124, 123, 122, 122, 121, 120, 118, 117, 116, 115, 113, 112, 111, 109, 107, 106, 104, 102, 100, 98, 96, 94, 92, 90, 88, 85, 83, 81, 78, 76, 73, 71, 68, 65, 63, 60, 57, 54, 51, 49, 46, 43, 40, 37, 34, 31, 28, 25, 22, 19, 16, 12, 9, 6, 3, 0, -3, -6, -9, -12, -16, -19, -22, -25, -28, -31, -34, -37, -40, -43, -46, -49, -51, -54, -57, -60, -63, -65, -68, -71, -73, -76, -78, -81, -83, -85, -88, -90, -92, -94, -96, -98, -100, -102, -104, -106, -107, -109, -111, -112, -113, -115, -116, -117, -118, -120, -121, -122, -122, -123, -124, -125, -125, -126, -126, -126, -127, -127, -127, -127, -127, -127, -127, -126, -126, -126, -125, -125, -124, -123, -122, -122, -121, -120, -118, -117, -116, -115, -113, -112, -111, -109, -107, -106, -104, -102, -100, -98, -96, -94, -92, -90, -88, -85, -83, -81, -78, -76, -73, -71, -68, -65, -63, -60, -57, -54, -51, -49, -46, -43, -40, -37, -34, -31, -28, -25, -22, -19, -16, -12, -9, -6, -3 }; private static readonly int[] rectangle = new int[256] { 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112 }; private static readonly int[] sampleTable = new int[1280] { 56, 132, 107, 25, 198, 99, 24, 134, 115, 152, 198, 177, 28, 202, 49, 140, 199, 49, 136, 194, 48, 152, 70, 49, 24, 198, 53, 12, 202, 49, 12, 198, 33, 16, 36, 105, 18, 194, 49, 20, 196, 113, 8, 74, 34, 73, 171, 106, 168, 172, 73, 81, 50, 213, 82, 136, 147, 108, 148, 34, 21, 84, 210, 37, 150, 212, 80, 165, 70, 33, 8, 133, 107, 24, 196, 99, 16, 206, 107, 24, 140, 113, 25, 140, 99, 53, 12, 198, 51, 153, 204, 108, 181, 78, 162, 153, 70, 33, 40, 130, 149, 46, 227, 48, 156, 197, 48, 156, 162, 177, 156, 103, 49, 136, 102, 89, 44, 83, 24, 132, 103, 80, 202, 227, 10, 172, 171, 48, 172, 98, 48, 140, 99, 16, 148, 98, 177, 140, 130, 40, 150, 51, 152, 214, 181, 76, 98, 41, 165, 74, 181, 156, 198, 49, 20, 214, 56, 156, 75, 180, 134, 101, 24, 174, 103, 28, 166, 99, 25, 150, 35, 25, 132, 19, 8, 166, 82, 172, 202, 34, 137, 110, 171, 25, 140, 98, 52, 196, 98, 25, 134, 99, 24, 196, 35, 88, 214, 163, 80, 66, 84, 74, 173, 74, 37, 17, 107, 100, 137, 74, 99, 57, 138, 35, 49, 42, 234, 162, 169, 68, 197, 18, 205, 66, 52, 140, 98, 24, 140, 99, 17, 72, 102, 49, 157, 68, 51, 29, 70, 49, 156, 198, 177, 12, 205, 50, 136, 196, 115, 24, 134, 115, 8, 214, 99, 88, 7, 129, 224, 240, 60, 7, 135, 144, 60, 124, 15, 199, 192, 192, 240, 124, 30, 7, 128, 128, 0, 28, 120, 112, 241, 199, 31, 192, 12, 254, 28, 31, 31, 14, 10, 122, 192, 113, 242, 131, 143, 3, 15, 15, 12, 0, 121, 248, 97, 224, 67, 15, 131, 231, 24, 249, 193, 19, 218, 233, 99, 143, 15, 131, 131, 135, 195, 31, 60, 112, 240, 225, 225, 227, 135, 184, 113, 14, 32, 227, 141, 72, 120, 28, 147, 135, 48, 225, 193, 193, 228, 120, 33, 131, 131, 195, 135, 6, 57, 229, 195, 135, 7, 14, 28, 28, 112, 244, 113, 156, 96, 54, 50, 195, 30, 60, 243, 143, 14, 60, 112, 227, 199, 143, 15, 15, 14, 60, 120, 240, 227, 135, 6, 240, 227, 7, 193, 153, 135, 15, 24, 120, 112, 112, 252, 243, 16, 177, 140, 140, 49, 124, 112, 225, 134, 60, 100, 108, 176, 225, 227, 15, 35, 143, 15, 30, 62, 56, 60, 56, 123, 143, 7, 14, 60, 244, 23, 30, 60, 120, 242, 158, 114, 73, 227, 37, 54, 56, 88, 57, 226, 222, 60, 120, 120, 225, 199, 97, 225, 225, 176, 240, 240, 195, 199, 14, 56, 192, 240, 206, 115, 115, 24, 52, 176, 225, 199, 142, 28, 60, 248, 56, 240, 225, 193, 139, 134, 143, 28, 120, 112, 240, 120, 172, 177, 143, 57, 49, 219, 56, 97, 195, 14, 14, 56, 120, 115, 23, 30, 57, 30, 56, 100, 225, 241, 193, 78, 15, 64, 162, 2, 197, 143, 129, 161, 252, 18, 8, 100, 224, 60, 34, 224, 69, 7, 142, 12, 50, 144, 240, 31, 32, 73, 224, 248, 12, 96, 240, 23, 26, 65, 170, 164, 208, 141, 18, 130, 30, 30, 3, 248, 62, 3, 12, 115, 128, 112, 68, 38, 3, 36, 225, 62, 4, 78, 4, 28, 193, 9, 204, 158, 144, 33, 7, 144, 67, 100, 192, 15, 198, 144, 156, 193, 91, 3, 226, 29, 129, 224, 94, 29, 3, 132, 184, 44, 15, 128, 177, 131, 224, 48, 65, 30, 67, 137, 131, 80, 252, 36, 46, 19, 131, 241, 124, 76, 44, 201, 13, 131, 176, 181, 130, 228, 232, 6, 156, 7, 160, 153, 29, 7, 62, 130, 143, 112, 48, 116, 64, 202, 16, 228, 232, 15, 146, 20, 63, 6, 248, 132, 136, 67, 129, 10, 52, 57, 65, 198, 227, 28, 71, 3, 176, 184, 19, 10, 194, 100, 248, 24, 249, 96, 179, 192, 101, 32, 96, 166, 140, 195, 129, 32, 48, 38, 30, 28, 56, 211, 1, 176, 38, 64, 244, 11, 195, 66, 31, 133, 50, 38, 96, 64, 201, 203, 1, 236, 17, 40, 64, 250, 4, 52, 224, 112, 76, 140, 29, 7, 105, 3, 22, 200, 4, 35, 232, 198, 154, 11, 26, 3, 224, 118, 6, 5, 207, 30, 188, 88, 49, 113, 102, 0, 248, 63, 4, 252, 12, 116, 39, 138, 128, 113, 194, 58, 38, 6, 192, 31, 5, 15, 152, 64, 174, 1, 127, 192, 7, 255, 0, 14, 254, 0, 3, 223, 128, 3, 239, 128, 27, 241, 194, 0, 231, 224, 24, 252, 224, 33, 252, 128, 60, 252, 64, 14, 126, 0, 63, 62, 0, 15, 254, 0, 31, 255, 0, 62, 240, 7, 252, 0, 126, 16, 63, 255, 0, 63, 56, 14, 124, 1, 135, 12, 252, 199, 0, 62, 4, 15, 62, 31, 15, 15, 31, 15, 2, 131, 135, 207, 3, 135, 15, 63, 192, 7, 158, 96, 63, 192, 3, 254, 0, 63, 224, 119, 225, 192, 254, 224, 195, 224, 1, 223, 248, 3, 7, 0, 126, 112, 0, 124, 56, 24, 254, 12, 30, 120, 28, 124, 62, 14, 31, 30, 30, 62, 0, 127, 131, 7, 219, 135, 131, 7, 199, 7, 16, 113, 255, 0, 63, 226, 1, 224, 193, 195, 225, 0, 127, 192, 5, 240, 32, 248, 240, 112, 254, 120, 121, 248, 2, 63, 12, 143, 3, 15, 159, 224, 193, 199, 135, 3, 195, 195, 176, 225, 225, 193, 227, 224, 113, 240, 0, 252, 112, 124, 12, 62, 56, 14, 28, 112, 195, 199, 3, 129, 193, 199, 231, 0, 15, 199, 135, 25, 9, 239, 196, 51, 224, 193, 252, 248, 112, 240, 120, 248, 240, 97, 199, 0, 31, 248, 1, 124, 248, 240, 120, 112, 60, 124, 206, 14, 33, 131, 207, 8, 7, 143, 8, 193, 135, 143, 128, 199, 227, 0, 7, 248, 224, 239, 0, 57, 247, 128, 14, 248, 225, 227, 248, 33, 159, 192, 255, 3, 248, 7, 192, 31, 248, 196, 4, 252, 196, 193, 188, 135, 240, 15, 192, 127, 5, 224, 37, 236, 192, 62, 132, 71, 240, 142, 3, 248, 3, 251, 192, 25, 248, 7, 156, 12, 23, 248, 7, 224, 31, 161, 252, 15, 252, 1, 240, 63, 0, 254, 3, 240, 31, 0, 253, 0, 255, 136, 13, 249, 1, 255, 0, 112, 7, 192, 62, 66, 243, 13, 196, 127, 128, 252, 7, 240, 94, 192, 63, 0, 120, 63, 129, 255, 1, 248, 1, 195, 232, 12, 228, 100, 143, 228, 15, 240, 7, 240, 194, 31, 0, 127, 192, 111, 128, 126, 3, 248, 7, 240, 63, 192, 120, 15, 130, 7, 254, 34, 119, 112, 2, 118, 3, 254, 0, 254, 103, 0, 124, 199, 241, 142, 198, 59, 224, 63, 132, 243, 25, 216, 3, 153, 252, 9, 184, 15, 248, 0, 157, 36, 97, 249, 13, 0, 253, 3, 240, 31, 144, 63, 1, 248, 31, 208, 15, 248, 55, 1, 248, 7, 240, 15, 192, 63, 0, 254, 3, 248, 15, 192, 63, 0, 250, 3, 240, 15, 128, 255, 1, 184, 7, 240, 1, 252, 1, 188, 128, 19, 30, 0, 127, 225, 64, 127, 160, 127, 176, 0, 63, 192, 31, 192, 56, 15, 240, 31, 128, 255, 1, 252, 3, 241, 126, 1, 254, 1, 240, 255, 0, 127, 192, 29, 7, 240, 15, 192, 126, 6, 224, 7, 224, 15, 248, 6, 193, 254, 1, 252, 3, 224, 15, 0, 252 }; private static int wait1 = 7; private static int wait2 = 6; private static int[] pitches = new int[256]; private static int[] frequency1 = new int[256]; private static int[] frequency2 = new int[256]; private static int[] frequency3 = new int[256]; private static int[] amplitude1 = new int[256]; private static int[] amplitude2 = new int[256]; private static int[] amplitude3 = new int[256]; private static int[] sampledConsonantFlag = new int[256]; private static readonly int[][] timetable = new int[5][] { new int[5] { 162, 167, 167, 127, 128 }, new int[5] { 226, 60, 60, 0, 0 }, new int[5] { 225, 60, 59, 0, 0 }, new int[5] { 200, 0, 0, 54, 55 }, new int[5] { 199, 0, 0, 54, 54 } }; private static int oldtimetableindex = 0; private static Buffer buf; private static readonly int[] stressInputTable = new int[9] { 42, 49, 50, 51, 52, 53, 54, 55, 56 }; private static readonly int[] signInputTable1 = new int[81] { 32, 46, 63, 44, 45, 73, 73, 69, 65, 65, 65, 65, 85, 65, 73, 69, 85, 79, 82, 76, 87, 89, 87, 82, 76, 87, 89, 77, 78, 78, 68, 81, 83, 83, 70, 84, 47, 47, 90, 90, 86, 68, 67, 42, 74, 42, 42, 42, 69, 65, 79, 65, 79, 85, 66, 42, 42, 68, 42, 42, 71, 42, 42, 71, 42, 42, 80, 42, 42, 84, 42, 42, 75, 42, 42, 75, 42, 42, 85, 85, 85 }; private static readonly int[] signInputTable2 = new int[81] { 42, 42, 42, 42, 42, 89, 72, 72, 69, 65, 72, 79, 72, 88, 88, 82, 88, 72, 88, 88, 88, 88, 72, 42, 42, 42, 42, 42, 42, 88, 88, 42, 42, 72, 42, 72, 72, 88, 42, 72, 42, 72, 72, 42, 42, 42, 42, 42, 89, 89, 89, 87, 87, 87, 42, 42, 42, 42, 42, 42, 42, 42, 42, 88, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 88, 42, 42, 76, 77, 78 }; private static readonly int[] flags = new int[81] { 0, 0, 0, 0, 0, 164, 164, 164, 164, 164, 164, 132, 132, 164, 164, 132, 132, 132, 132, 132, 132, 132, 68, 68, 68, 68, 68, 76, 76, 76, 72, 76, 64, 64, 64, 64, 64, 64, 68, 68, 68, 68, 72, 64, 76, 68, 0, 0, 180, 180, 180, 148, 148, 148, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 128, 193, 193 }; private static readonly int[] flags2 = new int[78] { 128, 193, 193, 193, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 8, 12, 8, 4, 64, 36, 32, 32, 36, 0, 0, 36, 32, 32, 36, 32, 32, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0 }; private static readonly int[] phonemeStressedLengthTable = new int[80] { 0, 18, 18, 18, 8, 11, 9, 11, 14, 15, 11, 16, 12, 6, 6, 14, 12, 14, 12, 11, 8, 8, 11, 10, 9, 8, 8, 8, 8, 8, 3, 5, 2, 2, 2, 2, 2, 2, 6, 6, 8, 6, 6, 2, 9, 4, 2, 1, 14, 15, 15, 15, 14, 14, 8, 2, 2, 7, 2, 1, 7, 2, 2, 7, 2, 2, 8, 2, 2, 6, 2, 2, 7, 2, 4, 7, 1, 4, 5, 5 }; private static readonly int[] phonemeLengthTable = new int[80] { 0, 18, 18, 18, 8, 8, 8, 8, 8, 11, 6, 12, 10, 5, 5, 11, 10, 10, 10, 9, 8, 7, 9, 7, 6, 8, 6, 7, 7, 7, 2, 5, 2, 2, 2, 2, 2, 2, 6, 6, 7, 6, 6, 2, 8, 3, 1, 30, 13, 12, 12, 12, 14, 9, 6, 1, 2, 5, 1, 1, 6, 1, 2, 6, 1, 2, 8, 2, 2, 4, 2, 2, 6, 1, 4, 6, 1, 4, 199, 255 }; private static bool debug; private static int[] input = new int[256]; private static int speed = 72; private static int pitch = 64; private static int mouth = 128; private static int throat = 128; private static bool singmode = false; private static int mem39; private static int mem44; private static int mem47; private static int mem49; private static int mem50; private static int mem51; private static int mem53; private static int mem56; private static int mem59 = 0; private static int[] stress = new int[256]; private static int[] phonemeLength = new int[256]; private static int[] phonemeindex = new int[256]; private static int[] phonemeIndexOutput = new int[256]; private static int[] stressOutput = new int[256]; private static int[] phonemeLengthOutput = new int[256]; private static int bufferpos = 0; public static int[] IntArray(string s) { s = s.ToUpper(); int length = s.Length; byte[] bytes = Encoding.UTF8.GetBytes(s); int[] array = new int[256]; for (int i = 0; i < bytes.Length; i++) { array[i] = bytes[i]; } return array; } public static string TextToPhonemes(string s, out int[] ints) { int[] array = IntArray(s); Debug.Log((object)("success = " + TextToPhonemes(ref array))); int[] array2 = (ints = array); byte[] array3 = new byte[array2.Length]; for (int i = 0; i < array2.Length; i++) { if (array2[i] == 0) { int[] array4 = new int[i]; Array.Copy(array2, array4, i); array2 = array4; break; } array3[i] = (byte)array2[i]; } return Encoding.UTF8.GetString(array3); } private static void Code37055(int mem59) { X = mem59; X--; A = inputtemp[X]; Y = A; A = tab36376[Y]; } private static void Code37066(int mem58) { X = mem58; INC8(ref X); A = inputtemp[X]; Y = A; A = tab36376[Y]; } private static int GetRuleByte(int mem62, int Y) { int num = mem62; if (mem62 >= 37541) { num -= 37541; return rules2[num + Y]; } num -= 32000; return rules[num + Y]; } private static void INC8(ref int xxx) { xxx++; xxx &= 255; } private static void DEC8(ref int xxx) { xxx--; xxx &= 255; } private static bool TextToPhonemes(ref int[] input) { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; int num9 = 0; int num10 = 0; int num11 = 0; inputtemp = new int[256]; inputtemp[0] = 32; X = 1; Y = 0; do { A = input[Y] & 0x7F; if (A >= 112) { A &= 95; } else if (A >= 96) { A &= 79; } inputtemp[X] = A; INC8(ref X); INC8(ref Y); } while (Y != 255); printf(inputtemp); X = 255; inputtemp[X] = 27; num6 = 255; A = 255; num = 255; while (true) { INC8(ref num6); X = num6; if (X < inputtemp.Length) { A = inputtemp[X]; num8 = A; if (A == 91) { INC8(ref num); X = num; A = 155; input[X] = 155; INC8(ref X); int[] array = new int[X]; Array.Copy(input, array, X); input = array; return true; } if (A == 46) { INC8(ref X); Y = inputtemp[X]; A = tab36376[Y] & 1; if (A == 0) { INC8(ref num); X = num; A = 46; input[X] = 46; continue; } } } A = num8; Y = A; A = tab36376[A]; num2 = A; if (((uint)A & 2u) != 0) { num7 = 37541; } else { A = num2; if (A == 0) { A = 32; if (X >= inputtemp.Length) { return true; } inputtemp[X] = 32; INC8(ref num); X = num; if (X <= 120) { input[X] = A; continue; } input[X] = 155; A = num6; num11 = A; return true; } A = num2 & 0x80; if (A == 0) { break; } X = num8 - 65; num7 = tab37489[X] | (tab37515[X] << 8); } while (true) { IL_0363: Y = 0; do { num7++; A = GetRuleByte(num7, Y); } while ((A & 0x80) == 0); INC8(ref Y); while (true) { A = GetRuleByte(num7, Y); if (A == 40) { break; } INC8(ref Y); } num10 = Y; do { INC8(ref Y); A = GetRuleByte(num7, Y); } while (A != 41); num9 = Y; do { INC8(ref Y); A = GetRuleByte(num7, Y); A &= 127; } while (A != 61); num8 = Y; X = num6; num5 = X; Y = num10; INC8(ref Y); while (true) { num2 = inputtemp[X]; A = GetRuleByte(num7, Y); if (A != num2) { break; } INC8(ref Y); if (Y == num9) { goto IL_04e4; } INC8(ref X); num5 = X; } continue; IL_04e4: A = num6; num4 = num6; while (true) { DEC8(ref num10); Y = num10; A = GetRuleByte(num7, Y); num2 = A; if (((uint)A & 0x80u) != 0) { break; } X = A & 0x7F; A = tab36376[X] & 0x80; if (A != 0) { X = num4 - 1; A = inputtemp[X]; if (A != num2) { goto IL_0363; } num4 = X; continue; } A = num2; if (A != 32) { if (A != 35) { if (A != 46) { if (A != 38) { if (A != 64) { if (A != 94) { if (A != 43) { if (A != 58) { return false; } while (true) { Code37055(num4); A &= 32; if (A == 0) { break; } num4 = X; } continue; } X = num4; DEC8(ref X); A = inputtemp[X]; if (A != 69 && A != 73 && A != 89) { goto IL_0363; } } else { Code37055(num4); A &= 32; if (A == 0) { goto IL_0363; } } num4 = X; continue; } Code37055(num4); A &= 4; if (A == 0) { A = inputtemp[X]; if (A != 72 || (A != 84 && A != 67 && A != 83)) { goto IL_0363; } num4 = X; continue; } } else { Code37055(num4); A &= 16; if (A == 0) { A = inputtemp[X]; if (A != 72) { goto IL_0363; } DEC8(ref X); A = inputtemp[X]; if (A != 67 && A != 83) { goto IL_0363; } } } } else { Code37055(num4); A &= 8; if (A == 0) { goto IL_0363; } } num4 = X; continue; } Code37055(num4); A &= 64; if (A == 0) { goto IL_0363; } } else { Code37055(num4); A &= 128; if (A != 0) { goto IL_0363; } } num4 = X; } A = num5; num3 = A; while (true) { Y = num9 + 1; if (Y == num8) { break; } num9 = Y; A = GetRuleByte(num7, Y); num2 = A; X = A; A = tab36376[X] & 0x80; if (A != 0) { X = num3 + 1; A = inputtemp[X]; if (A != num2) { goto IL_0363; } num3 = X; continue; } A = num2; if (A != 32) { if (A != 35) { if (A != 46) { if (A != 38) { if (A != 64) { if (A != 94) { if (A != 43) { if (A != 58) { if (A == 37 || A == 37) { X = num3 + 1; A = inputtemp[X]; if (A == 69) { INC8(ref X); Y = inputtemp[X]; DEC8(ref X); A = tab36376[Y] & 0x80; if (A != 0) { INC8(ref X); A = inputtemp[X]; if (A != 82 && A != 83 && A != 68) { if (A == 76) { INC8(ref X); A = inputtemp[X]; if (A != 89) { goto IL_0363; } } else { if (A != 70) { goto IL_0363; } INC8(ref X); A = inputtemp[X]; if (A != 85) { goto IL_0363; } INC8(ref X); A = inputtemp[X]; if (A != 76) { goto IL_0363; } } } } } else { if (A != 73) { goto IL_0363; } INC8(ref X); A = inputtemp[X]; if (A != 78) { goto IL_0363; } INC8(ref X); A = inputtemp[X]; if (A != 71) { goto IL_0363; } } num3 = X; continue; } return false; } while (true) { Code37066(num3); A &= 32; if (A == 0) { break; } num3 = X; } continue; } X = num3; INC8(ref X); A = inputtemp[X]; if (A != 69 && A != 73 && A != 89) { goto IL_0363; } } else { Code37066(num3); A &= 32; if (A == 0) { goto IL_0363; } } num3 = X; continue; } Code37066(num3); A &= 4; if (A == 0) { A = inputtemp[X]; if (A != 72 || (A != 84 && A != 67 && A != 83)) { goto IL_0363; } num3 = X; continue; } } else { Code37066(num3); A &= 16; if (A == 0) { A = inputtemp[X]; if (A != 72) { goto IL_0363; } INC8(ref X); A = inputtemp[X]; if (A != 67 && A != 83) { goto IL_0363; } } } } else { Code37066(num3); A &= 8; if (A == 0) { goto IL_0363; } } num3 = X; continue; } Code37066(num3); A &= 64; if (A == 0) { goto IL_0363; } } else { Code37066(num3); A &= 128; if (A != 0) { goto IL_0363; } } num3 = X; } break; } Y = num8; num6 = num5; if (debug) { PrintRule(num7); } while (true) { A = GetRuleByte(num7, Y); num2 = A; A &= 127; if (A != 61) { INC8(ref num); X = num; input[X] = A; } if (((uint)num2 & 0x80u) != 0) { break; } INC8(ref Y); } } return false; } private static void Output8BitAry(int index, int[] ary5) { bufferpos += timetable[oldtimetableindex][index]; oldtimetableindex = index; for (int i = 0; i < 5; i++) { buf.Set(bufferpos / 50 + i, ary5[i]); } } private static void Output8Bit(int index, int A) { int[] ary = new int[5] { A, A, A, A, A }; Output8BitAry(index, ary); } private static int Read(int p, int Y) { switch (p) { case 168: return pitches[Y]; case 169: return frequency1[Y]; case 170: return frequency2[Y]; case 171: return frequency3[Y]; case 172: return amplitude1[Y]; case 173: return amplitude2[Y]; case 174: return amplitude3[Y]; default: printf("Error reading from tables: p was" + p); return 0; } } private static void Write(int p, int Y, int value) { switch (p) { case 168: pitches[Y] = value; break; case 169: frequency1[Y] = value; break; case 170: frequency2[Y] = value; break; case 171: frequency3[Y] = value; break; case 172: amplitude1[Y] = value; break; case 173: amplitude2[Y] = value; break; case 174: amplitude3[Y] = value; break; default: printf("Error writing to tables: p was" + p); break; } } private static void RenderSample(ref int mem66) { int num = 0; mem49 = Y; A = mem39 & 7; X = A - 1; mem56 = X; mem53 = tab48426[X]; mem47 = X; A = mem39 & 0xF8; if (A == 0) { Y = mem49; A = pitches[mem49] >> 4; int xxx = A ^ 0xFF; Y = mem66; do { mem56 = 8; A = sampleTable[mem47 * 256 + Y]; do { num = A; A <<= 1; if (((uint)num & 0x80u) != 0) { X = 26; Output8Bit(3, (X & 0xF) * 16); } else { X = 6; Output8Bit(4, (X & 0xF) * 16); } DEC8(ref mem56); } while (mem56 != 0); INC8(ref Y); INC8(ref xxx); } while (xxx != 0); A = 1; mem44 = 1; mem66 = Y; Y = mem49; return; } Y = A ^ 0xFF; do { mem56 = 8; int num2 = mem47 * 256 + Y; A = sampleTable[num2]; do { num = A; A <<= 1; if ((num & 0x80) == 0) { X = mem53; Output8Bit(1, (X & 0xF) * 16); if (X != 0) { goto IL_0118; } } Output8Bit(2, 80); goto IL_0118; IL_0118: X = 0; DEC8(ref mem56); } while (mem56 != 0); INC8(ref Y); } while (Y != 0); mem44 = 1; Y = mem49; } private static int abs(int x) { if (x < 0) { return -x; } return x; } public static void Render() { int num = 0; int num2 = 0; int num3 = 0; int mem = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; if (phonemeIndexOutput[0] == 255) { return; } A = 0; X = 0; mem44 = 0; do { Y = mem44; A = phonemeIndexOutput[mem44]; mem56 = A; if (A == 255) { break; } if (A == 1) { A = 1; num7 = 1; AddInflection(num7, num); } if (A == 2) { num7 = 255; AddInflection(num7, num); } num = tab47492[stressOutput[Y] + 1]; num2 = phonemeLengthOutput[Y]; Y = mem56; do { frequency1[X] = freq1data[Y]; frequency2[X] = freq2data[Y]; frequency3[X] = freq3data[Y]; amplitude1[X] = ampl1data[Y]; amplitude2[X] = ampl2data[Y]; amplitude3[X] = ampl3data[Y]; sampledConsonantFlag[X] = sampledConsonantFlags[Y]; pitches[X] = pitch + num; INC8(ref X); DEC8(ref num2); } while (num2 != 0); INC8(ref mem44); } while (mem44 != 0); A = 0; mem44 = 0; mem49 = 0; X = 0; while (true) { Y = phonemeIndexOutput[X]; A = phonemeIndexOutput[X + 1]; INC8(ref X); if (A == 255) { break; } X = A; mem56 = blendRank[A]; A = blendRank[Y]; if (A == mem56) { num = outBlendLength[Y]; num2 = outBlendLength[X]; } else if (A < mem56) { num = inBlendLength[X]; num2 = outBlendLength[X]; } else { num = outBlendLength[Y]; num2 = inBlendLength[Y]; } Y = mem44; A = mem49 + phonemeLengthOutput[mem44]; mem49 = A; A += num2; num6 = A; mem47 = 168; num3 = mem49 - num; A = num + num2; num4 = A; X = A; X -= 2; if ((X & 0x80) == 0) { do { num5 = num4; if (mem47 == 168) { int num8 = phonemeLengthOutput[mem44] >> 1; int num9 = phonemeLengthOutput[mem44 + 1] >> 1; num5 = num8 + num9; num9 += mem49; num8 = mem49 - num8; A = Read(mem47, num9); Y = num8; mem53 = A - Read(mem47, num8); } else { A = Read(mem47, num6); Y = num3; mem53 = A - Read(mem47, num3); } int num10 = mem53; mem50 = mem53 & 0x80; int num11 = abs(num10); mem51 = num11 % num5; mem53 = num10 / num5; X = num5; Y = num3; mem56 = 0; while (true) { A = Read(mem47, Y) + mem53; num7 = A; INC8(ref Y); DEC8(ref X); if (X == 0) { break; } mem56 += mem51; if (mem56 >= num5) { mem56 -= num5; if ((mem50 & 0x80) == 0) { if (num7 != 0) { INC8(ref num7); } } else { DEC8(ref num7); } } Write(mem47, Y, num7); } INC8(ref mem47); } while (mem47 != 175); } INC8(ref mem44); X = mem44; } num7 = mem49 + phonemeLengthOutput[mem44]; if (!singmode) { for (int i = 0; i < 256; i++) { pitches[i] -= frequency1[i] >> 1; } } num = 0; num2 = 0; num3 = 0; mem49 = 0; num6 = 72; for (int i = 255; i >= 0; i--) { amplitude1[i] = amplitudeRescale[amplitude1[i]]; amplitude2[i] = amplitudeRescale[amplitude2[i]]; amplitude3[i] = amplitudeRescale[amplitude3[i]]; } Y = 0; A = pitches[0]; mem44 = A; X = A; num4 = A - (A >> 2); if (debug) { } bool flag = false; while (true) { A = sampledConsonantFlag[Y]; mem39 = A; A &= 248; if (A != 0) { RenderSample(ref mem); Y += 2; num7 -= 2; } else { int[] array = new int[5]; int num12 = num * 256; int num13 = num2 * 256; int num14 = num3 * 256; for (int j = 0; j < 5; j++) { int num15 = sinus[0xFF & (num12 >> 8)]; int num16 = sinus[0xFF & (num13 >> 8)]; int num17 = rectangle[0xFF & (num14 >> 8)]; int num18 = num15 * (amplitude1[Y] & 0xF); int num19 = num16 * (amplitude2[Y] & 0xF); int num20 = num17 * (amplitude3[Y] & 0xF); int num21 = num18 + num19 + num20; num21 /= 32; num21 += 128; num21 &= 0xFF; array[j] = num21; num12 += frequency1[Y] * 256 / 4; num13 += frequency2[Y] * 256 / 4; num14 += frequency3[Y] * 256 / 4; } Output8BitAry(0, array); DEC8(ref num6); if (num6 != 0) { goto IL_084a; } INC8(ref Y); DEC8(ref num7); } if (num7 == 0) { break; } num6 = speed; goto IL_084a; IL_084a: DEC8(ref mem44); while (true) { if (mem44 == 0 || flag) { flag = false; A = pitches[Y]; mem44 = A; A -= A >> 2; num4 = A; num = 0; num2 = 0; num3 = 0; break; } DEC8(ref num4); if (num4 != 0 || mem39 == 0) { num += frequency1[Y]; num &= 0xFF; num2 += frequency2[Y]; num2 &= 0xFF; num3 += frequency3[Y]; num3 &= 0xFF; break; } RenderSample(ref mem); flag = true; } } } private static void AddInflection(int mem48, int phase1) { mem49 = X; A = X; int a = A; A -= 30; if (a <= 30) { A = 0; } X = A; while ((A = pitches[X]) == 127) { INC8(ref X); } while (true) { A += mem48; A &= 255; phase1 = A; pitches[X] = A; do { INC8(ref X); if (X == mem49) { return; } } while (pitches[X] == 255); A = phase1; } } private static void SetMouthThroat(int mouth, int throat) { int num = 0; int[] array = new int[30] { 0, 0, 0, 0, 0, 10, 14, 19, 24, 27, 23, 21, 16, 20, 14, 18, 14, 18, 18, 16, 13, 15, 11, 18, 14, 11, 9, 6, 6, 6 }; int[] array2 = new int[30] { 255, 255, 255, 255, 255, 84, 73, 67, 63, 40, 44, 31, 37, 45, 73, 49, 36, 30, 51, 37, 29, 69, 24, 50, 30, 24, 83, 46, 54, 86 }; int[] array3 = new int[6] { 19, 27, 21, 27, 18, 13 }; int[] array4 = new int[6] { 72, 39, 31, 43, 30, 34 }; int xxx = 5; while (xxx != 30) { int num2 = array[xxx]; if (num2 != 0) { num = trans(mouth, num2); } freq1data[xxx] = num; num2 = array2[xxx]; if (num2 != 0) { num = trans(throat, num2); } freq2data[xxx] = num; INC8(ref xxx); } xxx = 48; Y = 0; while (xxx != 54) { int num2 = array3[Y]; num = trans(mouth, num2); freq1data[xxx] = num; num2 = array4[Y]; num = trans(throat, num2); freq2data[xxx] = num; INC8(ref Y); INC8(ref xxx); } } private static int trans(int mem39212, int mem39213) { A = 0; int num = 0; int num2 = 0; X = 8; int num4; int num3; do { num3 = mem39212 & 1; mem39212 >>= 1; if (num3 != 0) { num3 = 0; A = num; num4 = A + mem39213; A += mem39213; if (num4 > 255) { num3 = 1; } num = A; } num4 = num & 1; num = (num >> 1) | ((num3 != 0) ? 128 : 0); num3 = num4; DEC8(ref X); } while (X != 0); num4 = num2 & 0x80; num2 = (num2 << 1) | ((num3 != 0) ? 1 : 0); num3 = num4; num4 = num & 0x80; num = (num << 1) | ((num3 != 0) ? 1 : 0); num3 = num4; return num; } private static void printf(string s) { Debug.Log((object)("Print:'" + s + "'")); } private static void printf(int i) { int[] ia = new int[1] { i }; printf(ia); } private static void printf(int[] ia) { byte[] array = new byte[ia.Length]; for (int i = 0; i < ia.Length; i++) { if (ia[i] == 0) { byte[] array2 = new byte[i]; Array.Copy(array, array2, i); array = array2; break; } array[i] = (byte)ia[i]; } string @string = Encoding.UTF8.GetString(array); printf(@string); } private static void PrintRule(int offset) { int num = 1; int num2 = 0; string text = "Applying rule: "; do { num2 = GetRuleByte(offset, num); text = (((num2 & 0x7F) != 61) ? (text + $"{(char)((uint)num2 & 0x7Fu)}") : (text + " -> ")); num++; } while ((num2 & 0x80) == 0); printf(text); } private static void PrintPhonemes(int[] phonemeindex, int[] phonemeLength, int[] stress) { } public static void SetInput(int[] _input) { int num = _input.Length; Debug.Log((object)("SetInput(): " + num)); if (num > 254) { num = 254; } for (int i = 0; i < num; i++) { input[i] = _input[i]; } input[num] = 0; } private static void SetSpeed(int _speed) { speed = _speed; } private static void SetPitch(int _pitch) { pitch = _pitch; } private static void SetMouth(int _mouth) { mouth = _mouth; } private static void SetThroat(int _throat) { throat = _throat; } private static void EnableSingmode() { singmode = true; } private static void Init() { SetMouthThroat(mouth, throat); bufferpos = 0; for (int i = 0; i < 256; i++) { stress[i] = 0; phonemeLength[i] = 0; } for (int j = 0; j < 60; j++) { phonemeIndexOutput[j] = 0; stressOutput[j] = 0; phonemeLengthOutput[j] = 0; } phonemeindex[255] = 255; } public static Buffer SAMMain() { Init(); phonemeindex[255] = 32; if (!Parser1()) { return null; } if (debug) { PrintPhonemes(phonemeindex, phonemeLength, stress); } Parser2(); CopyStress(); SetPhonemeLength(); AdjustLengths(); Code41240(); do { A = phonemeindex[X]; if (A > 80) { phonemeindex[X] = 255; break; } INC8(ref X); } while (X != 0); InsertBreath(); if (debug) { PrintPhonemes(phonemeindex, phonemeLength, stress); } PrepareOutput(); return buf; } private static void PrepareOutput() { A = 0; X = 0; Y = 0; buf = new Buffer(); while (true) { A = phonemeindex[X]; if (A == 255) { break; } if (A == 254) { INC8(ref X); int x = X; phonemeIndexOutput[Y] = 255; Render(); X = x; Y = 0; } else if (A == 0) { INC8(ref X); } else { phonemeIndexOutput[Y] = A; phonemeLengthOutput[Y] = phonemeLength[X]; stressOutput[Y] = stress[X]; INC8(ref X); INC8(ref Y); } } A = 255; phonemeIndexOutput[Y] = 255; Render(); } private static void InsertBreath() { int x = 255; INC8(ref X); int num = 0; int xxx = 0; while (true) { X = xxx; int num2 = phonemeindex[X]; if (num2 == 255) { break; } num += phonemeLength[X]; if (num < 232) { if (num2 != 254) { A = flags2[num2] & 1; if (A != 0) { INC8(ref X); num = 0; Insert(X, 254, mem59, 0); INC8(ref xxx); INC8(ref xxx); continue; } } if (num2 == 0) { x = X; } INC8(ref xxx); } else { X = x; phonemeindex[X] = 31; phonemeLength[X] = 4; stress[X] = 0; INC8(ref X); num = 0; Insert(X, 254, mem59, 0); INC8(ref X); xxx = X; } } } private static void CopyStress() { int xxx = 0; while (true) { Y = phonemeindex[xxx]; if (Y == 255) { break; } if ((flags[Y] & 0x40) == 0) { INC8(ref xxx); continue; } Y = phonemeindex[(xxx + 1) & 0xFF]; if (Y == 255) { INC8(ref xxx); continue; } if ((flags[Y] & 0x80) == 0) { INC8(ref xxx); continue; } Y = stress[xxx + 1]; if (Y == 0) { INC8(ref xxx); continue; } if (((uint)Y & 0x80u) != 0) { INC8(ref xxx); continue; } stress[xxx] = (Y + 1) & 0xFF; INC8(ref xxx); } } private static void Insert(int position, int mem60, int mem59, int mem58) { position &= 0xFF; mem60 &= 0xFF; mem59 &= 0xFF; mem58 &= 0xFF; for (int num = 253; num >= position; num--) { phonemeindex[(num + 1) & 0xFF] = phonemeindex[num]; phonemeLength[(num + 1) & 0xFF] = phonemeLength[num]; stress[(num + 1) & 0xFF] = stress[num]; } phonemeindex[position] = mem60; phonemeLength[position] = mem59; stress[position] = mem58; } private static bool Parser1() { int xxx = 0; X = 0; A = 0; Y = 0; for (int i = 0; i < 256; i++) { stress[i] = 0; } while (true) { int num = input[X]; if (num == 155) { break; } INC8(ref X); int num2 = input[X]; Y = 0; while (true) { A = signInputTable1[Y]; if (A == num) { A = signInputTable2[Y]; if (A != 42 && A == num2) { phonemeindex[xxx] = Y; INC8(ref xxx); INC8(ref X); break; } } INC8(ref Y); if (Y != 81) { continue; } Y = 0; while (true) { if (signInputTable2[Y] == 42 && signInputTable1[Y] == num) { phonemeindex[xxx] = Y; INC8(ref xxx); break; } INC8(ref Y); if (Y != 81) { continue; } Y = 8; while (num != stressInputTable[Y] && Y > 0) { DEC8(ref Y); } if (Y == 0) { return false; } stress[xxx - 1] = Y; break; } break; } } phonemeindex[xxx] = 255; return true; } private static void SetPhonemeLength() { int xxx = 0; while (phonemeindex[xxx] != 255) { int num = stress[xxx]; if (num == 0 || ((uint)num & 0x80u) != 0) { phonemeLength[xxx] = phonemeLengthTable[phonemeindex[xxx]]; } else { phonemeLength[xxx] = phonemeStressedLengthTable[phonemeindex[xxx]]; } INC8(ref xxx); } } private static void Code41240() { int xxx = 0; while (phonemeindex[xxx] != 255) { X = xxx; int num = phonemeindex[xxx]; if ((flags[num] & 2) == 0) { INC8(ref xxx); continue; } if ((flags[num] & 1) == 0) { Insert(xxx + 1, num + 1, phonemeLengthTable[num + 1], stress[xxx]); Insert(xxx + 2, num + 2, phonemeLengthTable[num + 2], stress[xxx]); xxx += 3; continue; } do { INC8(ref X); A = phonemeindex[X]; } while (A == 0); if (A != 255) { if (((uint)flags[A] & 8u) != 0) { INC8(ref xxx); continue; } if (A == 36 || A == 37) { INC8(ref xxx); continue; } } Insert(xxx + 1, num + 1, phonemeLengthTable[num + 1], stress[xxx]); Insert(xxx + 2, num + 2, phonemeLengthTable[num + 2], stress[xxx]); xxx += 3; } } private static void Parser2() { if (debug) { printf("Parser2\n"); } int xxx = 0; int num = 0; while (true) { X = xxx; A = phonemeindex[xxx]; if (A == 0) { INC8(ref xxx); continue; } if (A == 255) { break; } Y = A; if (((uint)flags[A] & 0x10u) != 0) { num = stress[xxx]; A = flags[Y] & 0x20; if (A == 0) { A = 20; } else { A = 21; } if (debug && A == 20) { printf("RULE: insert WX following diphtong NOT ending in IY sound\n"); } if (debug && A == 21) { printf("RULE: insert YX following diphtong ending in IY sound\n"); } Insert(xxx + 1, A, mem59, num); X = xxx; goto IL_06aa; } A = phonemeindex[X]; if (A == 78) { A = 24; if (debug) { printf("RULE: UL -> AX L\n"); } } else if (A == 79) { A = 27; if (debug) { printf("RULE: UM -> AX M\n"); } } else { if (A != 80) { Y = A; A = flags[A] & 0x80; if (A != 0) { A = stress[X]; if (A != 0) { INC8(ref X); A = phonemeindex[X]; if (A == 0) { INC8(ref X); Y = phonemeindex[X]; if (Y == 255) { A = 0; } else { A = flags[Y] & 0x80; } if (A != 0) { A = stress[X]; if (A != 0) { if (debug) { printf("RULE: Insert glottal stop between two stressed vowels with space between them\n"); } Insert(X, 31, mem59, 0); INC8(ref xxx); continue; } } } } } X = xxx; A = phonemeindex[xxx]; if (A == 23) { DEC8(ref X); A = phonemeindex[xxx - 1]; if (A == 69) { if (debug) { printf("RULE: T R -> CH R\n"); } phonemeindex[xxx - 1] = 42; goto IL_073b; } if (A == 57) { phonemeindex[xxx - 1] = 44; if (debug) { printf("RULE: D R -> J R\n"); } goto IL_0793; } A = flags[A] & 0x80; if (debug) { printf("RULE: R -> RX\n"); } if (A != 0) { phonemeindex[xxx] = 18; } INC8(ref xxx); continue; } if (A == 24) { if ((flags[phonemeindex[xxx - 1]] & 0x80) == 0) { INC8(ref xxx); continue; } if (debug) { printf("RULE: <VOWEL> L -> <VOWEL> LX\n"); } phonemeindex[X] = 19; INC8(ref xxx); continue; } if (A == 32) { if (phonemeindex[xxx - 1] != 60) { INC8(ref xxx); continue; } if (debug) { printf("RULE: G S -> G Z\n"); } phonemeindex[xxx] = 38; INC8(ref xxx); continue; } if (A == 72) { Y = phonemeindex[xxx + 1]; if (Y == 255) { phonemeindex[xxx] = 75; } else { A = flags[Y] & 0x20; if (debug && A == 0) { printf("RULE: K <VOWEL OR DIPHTONG NOT ENDING WITH IY> -> KX <VOWEL OR DIPHTONG NOT ENDING WITH IY>\n"); } if (A == 0) { phonemeindex[xxx] = 75; } } } else if (A == 60) { int num2 = phonemeindex[xxx + 1]; if (num2 == 255) { INC8(ref xxx); continue; } if (((uint)flags[num2] & 0x20u) != 0) { INC8(ref xxx); continue; } if (debug) { printf("RULE: G <VOWEL OR DIPHTONG NOT ENDING WITH IY> -> GX <VOWEL OR DIPHTONG NOT ENDING WITH IY>\n"); } phonemeindex[xxx] = 63; INC8(ref xxx); continue; } Y = phonemeindex[xxx]; A = flags[Y] & 1; if (A == 0) { goto IL_06aa; } A = phonemeindex[xxx - 1]; if (A != 32) { A = Y; goto IL_07eb; } phonemeindex[xxx] = Y - 12; INC8(ref xxx); continue; } A = 28; if (debug) { printf("RULE: UN -> AX N\n"); } } num = stress[X]; phonemeindex[X] = 13; Insert(X + 1, A, mem59, num); INC8(ref xxx); continue; IL_06aa: A = phonemeindex[X]; if (A == 53) { Y = phonemeindex[X - 1]; A = flags2[Y] & 4; if (A == 0) { INC8(ref xxx); continue; } if (debug) { printf("RULE: <ALVEOLAR> UW -> <ALVEOLAR> UX\n"); } phonemeindex[X] = 16; INC8(ref xxx); continue; } goto IL_073b; IL_07eb: if (A != 69 && A != 57) { INC8(ref xxx); continue; } if ((flags[phonemeindex[(X - 1) & 0xFF]] & 0x80) == 0) { INC8(ref xxx); continue; } INC8(ref X); A = phonemeindex[X]; if (A != 0) { if ((flags[A] & 0x80) == 0) { INC8(ref xxx); continue; } if (stress[X] != 0) { INC8(ref xxx); continue; } if (debug) { printf("RULE: Soften T or D following vowel or ER and preceding a pause -> DX\n"); } phonemeindex[xxx] = 30; } else { A = phonemeindex[(X + 1) & 0xFF]; if (A == 255) { A = 0; } else { A = flags[A] & 0x80; } if (debug && A != 0) { printf("RULE: Soften T or D following vowel or ER and preceding a pause -> DX\n"); } if (A != 0) { phonemeindex[xxx] = 30; } } INC8(ref xxx); continue; IL_0793: if (A == 44) { if (debug) { printf("J -> J J+1\n"); } Insert(X + 1, A + 1, mem59, stress[X]); INC8(ref xxx); continue; } goto IL_07eb; IL_073b: if (A == 42) { if (debug) { printf("CH -> CH CH+1\n"); } Insert(X + 1, A + 1, mem59, stress[X]); INC8(ref xxx); continue; } goto IL_0793; } } private static void AdjustLengths() { X = 0; int num = 0; while (true) { int num2 = phonemeindex[X]; if (num2 == 255) { break; } if ((flags2[num2] & 1) == 0) { INC8(ref X); continue; } num = X; while (true) { DEC8(ref X); if (X == 0) { break; } num2 = phonemeindex[X]; if (num2 != 255 && (flags[num2] & 0x80) == 0) { continue; } goto IL_00a7; } break; IL_00a7: do { num2 = phonemeindex[X]; if (num2 != 255 && ((flags2[num2] & 0x20) == 0 || ((uint)flags[num2] & 4u) != 0)) { A = phonemeLength[X]; A = (A >> 1) + A + 1; if (debug) { printf("RULE: Lengthen <FRICATIVE> or <VOICED> between <VOWEL> and <PUNCTUATION> by 1.5\n"); } if (debug) { printf("PRE\n"); } phonemeLength[X] = A; if (debug) { printf("POST\n"); } } INC8(ref X); } while (X != num); INC8(ref X); } num = 0; while (true) { X = num; int num2 = phonemeindex[X]; if (num2 == 255) { break; } A = flags[num2] & 0x80; if (A != 0) { INC8(ref X); num2 = phonemeindex[X]; if (num2 == 255) { mem56 = 65; } else { mem56 = flags[num2]; } if ((flags[num2] & 0x40) == 0) { if (num2 == 18 || num2 == 19) { INC8(ref X); num2 = phonemeindex[X]; if (((uint)flags[num2] & 0x40u) != 0) { if (debug) { printf("RULE: <VOWEL> <RX | LX> <CONSONANT> - decrease length by 1\n"); } if (debug) { printf("PRE\n"); } DEC8(ref phonemeLength[num]); if (debug) { printf("POST\n"); } } INC8(ref num); } else { INC8(ref num); } } else if ((mem56 & 4) == 0) { if ((mem56 & 1) == 0) { INC8(ref num); continue; } DEC8(ref X); if (debug) { printf("RULE: <VOWEL> <UNVOICED PLOSIVE> - decrease vowel by 1/8th\n"); } if (debug) { printf("PRE\n"); } mem56 = phonemeLength[X] >> 3; phonemeLength[X] -= mem56; if (debug) { printf("POST\n"); } INC8(ref num); } else { if (debug) { printf("RULE: <VOWEL> <VOICED CONSONANT> - increase vowel by 1/2 + 1\n"); } if (debug) { printf("PRE\n"); } A = phonemeLength[(X - 1) & 0xFF]; phonemeLength[(X - 1) & 0xFF] = ((A >> 2) + A + 1) & 0xFF; if (debug) { printf("POST\n"); } INC8(ref num); } continue; } if (((uint)flags2[num2] & 8u) != 0) { INC8(ref X); num2 = phonemeindex[X]; if (num2 == 255) { A = 0; } else { A = flags[num2] & 2; } if (A != 0) { phonemeLength[X] = 6; phonemeLength[(X - 1) & 0xFF] = 5; } INC8(ref num); continue; } if (((uint)flags[num2] & 2u) != 0) { while (true) { INC8(ref X); num2 = phonemeindex[X]; switch (num2) { case 0: continue; case 255: { bool flag = true; INC8(ref num); break; } default: if ((flags[num2] & 2) == 0) { INC8(ref num); break; } phonemeLength[X] = (phonemeLength[X] >> 1) + 1; X = num; phonemeLength[num] = (phonemeLength[num] >> 1) + 1; INC8(ref num); break; } break; } continue; } if (((uint)flags2[num2] & 0x10u) != 0) { num2 = phonemeindex[(X - 1) & 0xFF]; if (((uint)flags[num2] & 2u) != 0) { phonemeLength[X] -= 2; } } INC8(ref num); } } private static void Code47503(int mem52) { Y = 0; if (((uint)mem53 & 0x80u) != 0) { mem53 = -mem53; Y = 128; } mem50 = Y; A = 0; for (X = 8; X > 0; X--) { int num = mem53; mem53 <<= 1; A <<= 1; if (num >= 128) { INC8(ref A); } if (A >= mem52) { A -= mem52; INC8(ref mem53); } } mem51 = A; if (((uint)mem50 & 0x80u) != 0) { mem53 = -mem53; } } } public class TextReader : MonoBehaviour { public static string TextOutput; public static void Out(string s) { if (s == null) { TextOutput = ""; return; } string textOutput = TextOutput; textOutput += s; textOutput += "\n"; TextOutput = textOutput; } public static void SayString(string s, Transform parent = null) { if ((Object)(object)parent == (Object)null) { parent = ((Component)MonoSingleton<CameraController>.Instance).transform; } if (!string.IsNullOrEmpty(s)) { s = s.Trim().ToUpper(); s = Regex.Replace(s, "[^\\u0000-\\u007F]+", ""); s = s.Replace("'", ""); s = s.Replace("\"", ""); s = s.Replace("\n", " "); if (!s.EndsWith(".") && !s.EndsWith("!") && !s.EndsWith("?")) { s += "."; } PlaySAMChunk(s, parent); } } private static void PlaySAMChunk(string chunk, Transform parent) { if (string.IsNullOrEmpty(chunk)) { return; } int[] ints = null; try { string text = UnitySAM.TextToPhonemes(chunk, out ints); if (ints == null || ints.Length == 0) { text = UnitySAM.TextToPhonemes("AH", out ints); if (ints == null || ints.Length == 0) { return; } } UnitySAM.SetInput(ints); Buffer buffer = UnitySAM.SAMMain(); if (buffer != null && buffer.GetSize() > 0) { AudioClip val = AudioClip.Create("SAMAudio", buffer.GetSize(), 1, 22050, false); val.SetData(buffer.GetFloats(), 0); ItePlugin.SpawnSound(val, 1f, parent, 2f); } } catch (Exception ex) { Debug.LogError((object)("SAM chunk failed: " + ex.Message)); } } } namespace Polarite { public class ForceOff : MonoBehaviour { public void Update() { ((Component)this).gameObject.SetActive(false); } } public class HeadRotate : MonoBehaviour { public Transform head; public Quaternion targetRotation; public void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)head != (Object)null) { Quaternion localRotation = head.localRotation; Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles; Vector3 eulerAngles2 = ((Quaternion)(ref targetRotation)).eulerAngles; float num = Mathf.LerpAngle(eulerAngles.x, eulerAngles2.x, Time.unscaledDeltaTime * 10f); head.localRotation = Quaternion.Euler(num * 1f, 0f, 0f); } } } public enum SkinType { V1, V2 } [BepInPlugin("com.d1g1tal.polarite", "Polarite", "1.0.1")] public class ItePlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static PostEnumValueChangeEvent<SkinType> <>9__20_0; public static UnityAction <>9__25_1; public static UpdateActivityHandler <>9__31_0; public static UpdateActivityHandler <>9__31_1; internal void <Awake>b__20_0(SkinType skin) { if (NetworkManager.InLobby) { NetworkManager instance = NetworkManager.Instance; NetPacket obj = new NetPacket { type = "skin" }; int num = (int)skin; obj.name = num.ToString(); instance.BroadcastPacket(obj); if (NetworkPlayer.LocalPlayer.testPlayer) { NetworkPlayer.LocalPlayer.UpdateSkin((int)skin); } } } internal void <CreatePolariteUI>b__25_1() { Application.OpenURL("https://discord.gg/2jzJ9XWbS4"); } internal void <OnSceneLoaded>b__31_0(Result <p0>) { } internal void <OnSceneLoaded>b__31_1(Result <p0>) { } } [CompilerGenerated] private sealed class <RestartCols>d__35 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RestartCols>d__35(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; case 1: <>1__state = -1; NetworkPlayer.ToggleColsForAll(value: true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpectatePlayersB>d__34 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private List<Transform> <playerTransforms>5__1; private SpectatorCam <cam>5__2; private Dictionary<string, NetworkPlayer>.Enumerator <>s__3; private KeyValuePair<string, NetworkPlayer> <p>5__4; private Door[] <>s__5; private int <>s__6; private Door <door>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpectatePlayersB>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <playerTransforms>5__1 = null; <cam>5__2 = null; <>s__3 = default(Dictionary<string, NetworkPlayer>.Enumerator); <p>5__4 = default(KeyValuePair<string, NetworkPlayer>); <>s__5 = null; <door>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.25f); <>1__state = 1; return true; case 1: <>1__state = -1; <playerTransforms>5__1 = new List<Transform>(); <cam>5__2 = ((Component)MonoSingleton<CameraController>.Instance).GetComponent<SpectatorCam>(); if ((Object)(object)<cam>5__2 == (Object)null) { <cam>5__2 = ((Component)MonoSingleton<CameraController>.Instance).gameObject.AddComponent<SpectatorCam>(); } <>s__3 = NetworkManager.players.GetEnumerator(); try { while (<>s__3.MoveNext()) { <p>5__4 = <>s__3.Current; if ((Object)(object)<p>5__4.Value != (Object)(object)NetworkPlayer.LocalPlayer) { <playerTransforms>5__1.Add(((Component)<p>5__4.Value).transform); } <p>5__4 = default(KeyValuePair<string, NetworkPlayer>); } } finally { ((IDisposable)<>s__3).Dispose(); } <>s__3 = default(Dictionary<string, NetworkPlayer>.Enumerator); ((Behaviour)((Component)<cam>5__2).GetComponent<CameraController>()).enabled = false; MonoSingleton<NewMovement>.Instance.DeactivatePlayer(); <cam>5__2.StartSpectating(<playerTransforms>5__1); <>s__5 = Object.FindObjectsOfType<Door>(); for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++) { <door>5__7 = <>s__5[<>s__6]; <door>5__7.Open(false, true); <door>5__7 = null; } <>s__5 = null; MonoSingleton<MusicManager>.Instance.ForceStartMusic(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static PluginConfigurator config = PluginConfigurator.Create("Polarite Config", "com.d1g1tal.polarite"); public static KeyCodeField buttonToChat = new KeyCodeField(config.rootPanel, "Open chat key", "chat.key", (KeyCode)116); public static EnumField<SkinType> skin = new EnumField<SkinType>(config.rootPanel, "Player skin (only others can see)", "player.skin", SkinType.V1); public static ConfigHeader ttsbad = new ConfigHeader(config.rootPanel, "<color=yellow>TTS can crash the game!</color>", 24); public static BoolField canTTS = new BoolField(config.rootPanel, "Play TTS on chat message", "tts", false); internal readonly Harmony harm = new Harmony("com.d1g1tal.polarite"); internal static ManualLogSource log = new ManualLogSource("Polarite"); public static ItePlugin Instance; public static bool ignoreSpectate = false; public static AssetBundle mainBundle; public static GameObject currentUi; public static GameObject leaveButton; public static GameObject joinButton; public static GameObject hostButton; public static GameObject copyButton; public static GameObject inviteButton; public static GameObject playerListButton; public static Discord discord; public static bool HasDiscord; public static readonly string[] PathsToSoftlocks = new string[11] { "Door (Large) With Controllers (9)/LockedDoorBlocker", "V2 - Arena/V2 Stuff(Clone)/Door", "4 - Heart Chamber/4 Stuff(Clone)/Door", "Main Section/9 - Boss Arena/Boss Stuff(Clone)/IntroObjects/WallCollider", "Main Section/Outside/2-4/2-4 Stuff(Clone)(Clone)/GlassDoor (Skull)", "2 - Organ Hall/2 Stuff(Clone)/Door", "Exteriors/14/Cube", "Exteriors/Armboy/Cube", "3 - Fuckatorium/3 Stuff(Clone)/EntranceCloser", "Main/Exterior/ExteriorStuff(Clone)/SecuritySystemFight/ArenaWalls", "Main/Interior/InteriorStuff(Clone)(Clone)/BrainFight/EntryForceField" }; public void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harm.PatchAll(); NetworkManager component = ((Component)this).gameObject.GetComponent<NetworkManager>(); if ((Object)(object)component == (Object)null) { component = ((Component)this).gameObject.AddComponent<NetworkManager>(); } SceneManager.sceneLoaded += OnSceneLoaded; config.SetIconWithURL("file://" + Path.Combine(Directory.GetParent(((BaseUnityPlugin)this).Info.Location).FullName, "globehaha.png")); skin.postValueChangeEvent += delegate(SkinType skin) { if (NetworkManager.InLobby) { NetworkManager instance = NetworkManager.Instance; NetPacket obj = new NetPacket { type = "skin" }; int num = (int)skin; obj.name = num.ToString(); instance.BroadcastPacket(obj); if (NetworkPlayer.LocalPlayer.testPlayer) { NetworkPlayer.LocalPlayer.UpdateSkin((int)skin); } } }; mainBundle = AssetBundle.LoadFromFile(Path.Combine(Directory.GetParent(((BaseUnityPlugin)this).Info.Location).FullName, "polariteassets.bundle")); TryRunDiscord(); } public void OnApplicationQuit() { discord.Dispose(); } public bool TryRunDiscord() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown try { discord = new Discord(1432308384798867456L, 1uL); HasDiscord = true; return true; } catch { log.LogWarning((object)"User doesn't have discord in the background, Skipping discord!"); return false; } } public void Update() { if (HasDiscord) { discord.RunCallbacks(); } if ((Object)(object)currentUi != (Object)null && SceneHelper.CurrentScene != "Main Menu") { currentUi.SetActive(MonoSingleton<OptionsManager>.Instance.paused); if (currentUi.GetComponentInChildren<PolariteMenuManager>().mainPanel.activeSelf && MonoSingleton<OptionsManager>.Instance.paused && (Object)(object)MonoSingleton<OptionsManager>.Instance.pauseMenu != (Object)null) { TogglePauseMenu(value: false); } if (!currentUi.GetComponentInChildren<PolariteMenuManager>().mainPanel.activeSelf && MonoSingleton<OptionsManager>.Instance.paused && (Object)(object)MonoSingleton<OptionsManager>.Instance.pauseMenu != (Object)null) { TogglePauseMenu(value: true); } if (!MonoSingleton<OptionsManager>.Instance.paused) { currentUi.GetComponentInChildren<PolariteMenuManager>().mainPanel.SetActive(false); } PolariteMenuManager componentInChildren = currentUi.GetComponentInChildren<PolariteMenuManager>(); if ((Object)(object)componentInChildren != (Object)null) { string text = (NetworkManager.InLobby ? "STATUS: <color=green>IN LOBBY" : "STATUS: <color=red>NOT IN LOBBY"); ((TMP_Text)componentInChildren.statusHost).text = text; ((TMP_Text)componentInChildren.statusJoin).text = text; leaveButton.SetActive(NetworkManager.InLobby); playerListButton.SetActive(NetworkManager.InLobby); ((Selectable)joinButton.GetComponent<Button>()).interactable = !NetworkManager.InLobby; ((Selectable)hostButton.GetComponent<Button>()).interactable = !NetworkManager.InLobby; inviteButton.SetActive(NetworkManager.HostAndConnected); copyButton.SetActive(NetworkManager.HostAndConnected); } } if ((Object)(object)currentUi != (Object)null && SceneHelper.CurrentScene == "Main Menu") { currentUi.SetActive(false); } if ((Object)(object)currentUi != (Object)null) { PolariteMenuManager componentInChildren2 = currentUi.GetComponentInChildren<PolariteMenuManager>(); ((Selectable)componentInChildren2.uiOpen).interactable = SceneHelper.CurrentScene != "Endless"; } } public void TogglePauseMenu(bool value) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown foreach (Transform item in MonoSingleton<OptionsManager>.Instance.pauseMenu.transform) { Transform val = item; if (((Object)val).name != "Level Stats") { ((Component)val).gameObject.SetActive(value); } } ((Behaviour)MonoSingleton<OptionsManager>.Instance.pauseMenu.GetComponent<Image>()).enabled = value; } private void CreatePolariteUI() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Expected O, but got Unknown //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(mainBundle.LoadAsset<GameObject>("PolariteCanvas")); if (!((Object)(object)val != (Object)null)) { return; } Object.DontDestroyOnLoad((Object)(object)val); currentUi = val; PolariteMenuManager pMM = ((Component)currentUi.transform.Find("PolariteMenu")).gameObject.AddComponent<PolariteMenuManager>(); if (!((Object)(object)pMM != (Object)null)) { return; } pMM.uiOpen = ((Component)((Component)pMM).transform.Find("Activate")).GetComponent<Button>(); ((UnityEvent)pMM.uiOpen.onClick).AddListener(new UnityAction(pMM.ToggleMainPanel)); Transform val2 = ((Component)pMM).transform.Find("Main").Find("Host"); Transform val3 = ((Component)pMM).transform.Find("Main").Find("Join"); Transform val4 = ((Component)pMM).transform.Find("Main").Find("PublicLobbies"); Transform val5 = ((Component)pMM).transform.Find("Main").Find("PlayerList"); pMM.maxP = ((Component)val2.Find("MaxPlayers")).GetComponent<TMP_InputField>(); pMM.lobbyName = ((Component)val2.Find("UsefulInputField")).GetComponent<TMP_InputField>(); pMM.lobbyType = ((Component)val2.Find("UsefulDropdown")).GetComponent<TMP_Dropdown>(); pMM.mainPanel = ((Component)((Component)pMM).transform.Find("Main")).gameObject; pMM.code = ((Component)val3.Find("UsefulInputField")).GetComponent<TMP_InputField>(); pMM.canCheat = ((Component)val2.Find("CanCheat")).GetComponent<TMP_Dropdown>(); pMM.statusHost = ((Component)val2.Find("Status")).GetComponent<TextMeshProUGUI>(); pMM.statusJoin = ((Component)val3.Find("Status")).GetComponent<TextMeshProUGUI>(); Button component = ((Component)((Component)pMM).transform.Find("Main").Find("Leave")).GetComponent<Button>(); Button component2 = ((Component)val2.Find("UsefulButton (1)")).GetComponent<Button>(); Button component3 = ((Component)val2.Find("UsefulButton")).GetComponent<Button>(); Button component4 = ((Component)val3.Find("UsefulButton")).GetComponent<Button>(); Button component5 = ((Component)val2.Find("CopyCode")).GetComponent<Button>(); Button component6 = ((Component)((Component)pMM).transform.Find("Main").Find("UsefulButton (3)")).GetComponent<Button>(); Button component7 = ((Component)val4.Find("RefreshButton")).GetComponent<Button>(); Button component8 = ((Component)((Component)pMM).transform.Find("Main").Find("PlayerListButton")).GetComponent<Button>(); Button component9 = ((Component)((Component)pMM).transform.Find("Main").Find("JoinDiscord")).GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener(new UnityAction(NetworkManager.Instance.LeaveLobby)); ((UnityEvent)component2.onClick).AddListener(new UnityAction(NetworkManager.Instance.ShowInviteOverlay)); ((UnityEvent)component3.onClick).AddListener(new UnityAction(CreateLobby)); ((UnityEvent)component4.onClick).AddListener(new UnityAction(JoinLobby)); ((UnityEvent)component5.onClick).AddListener((UnityAction)delegate { GUIUtility.systemCopyBuffer = pMM.codeHost; MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=green>Lobby code copied to clipboard!</color>", "", "", 0, false, false, true); }); ButtonClickedEvent onClick = component9.onClick; object obj = <>c.<>9__25_1; if (obj == null) { UnityAction val6 = delegate { Application.OpenURL("https://discord.gg/2jzJ9XWbS4"); }; <>c.<>9__25_1 = val6; obj = (object)val6; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ((UnityEvent)component6.onClick).AddListener(new UnityAction(PublicLobbyManager.RefreshLobbies)); ((UnityEvent)component7.onClick).AddListener(new UnityAction(PublicLobbyManager.RefreshLobbies)); ((UnityEvent)component8.onClick).AddListener(new UnityAction(PlayerList.UpdatePList)); PublicLobbyManager.Content = val4.Find("LobbyList").Find("Content"); PlayerList.ContentB = val5.Find("List").Find("Content"); leaveButton = ((Component)component).gameObject; joinButton = ((Component)component4).gameObject; hostButton = ((Component)component3).gameObject; copyButton = ((Component)component5).gameObject; inviteButton = ((Component)component2).gameObject; playerListButton = ((Component)component8).gameObject; ((Component)component).gameObject.SetActive(false); ((Component)component2).gameObject.SetActive(false); ((Component)val2).gameObject.SetActive(false); ((Component)val3).gameObject.SetActive(false); ((Component)val4).gameObject.SetActive(false); ((Component)component5).gameObject.SetActive(false); ((Component)val5).gameObject.SetActive(false); ((Component)component8).gameObject.SetActive(false); pMM.mainPanel.SetActive(false); pMM.lobbyName.text = NetworkManager.GetNameOfId(SteamId.op_Implicit(SteamClient.SteamId)) + "'s Lobby"; } private async void CreateLobby() { PolariteMenuManager pMM = currentUi.GetComponentInChildren<PolariteMenuManager>(); int max = int.Parse(pMM.maxP.text); string lobbyName = pMM.lobbyName.text; bool allowCheats = false; LobbyType type = pMM.lobbyType.value switch { 0 => LobbyType.Public, 1 => LobbyType.FriendsOnly, 2 => LobbyType.Private, _ => LobbyType.Public, }; switch (pMM.canCheat.value) { case 0: allowCheats = false; break; case 1: allowCheats = true; break; } await NetworkManager.Instance.CreateLobby(max, type, lobbyName, delegate(string c) { pMM.codeHost = c; }, allowCheats); string levelName = ((MapInfoBase)StockMapInfo.Instance).levelName; if (string.IsNullOrEmpty(levelName)) { levelName = SceneHelper.CurrentScene; } ((Lobby)(ref NetworkManager.Instance.CurrentLobby)).SetData("levelName", levelName); } private async void JoinLobby() { PolariteMenuManager pMM = currentUi.GetComponentInChildren<PolariteMenuManager>(); await NetworkManager.Instance.JoinLobbyByCode(pMM.code.text); NetworkManager.Instance.GetAllPlayersInLobby(NetworkManager.Instance.CurrentLobby, out var ids, ignoreSelf: false); SteamId[] array = ids; for (int i = 0; i < array.Length; i++) { SteamId id = array[i]; Dictionary<string, NetworkPlayer> players = NetworkManager.players; ulong value = id.Value; if (!players.ContainsKey(value.ToString())) { NetworkPlayer newPlr = NetworkPlayer.Create(id.Value, NetworkManager.GetNameOfId(SteamId.op_Implicit(id))); Dictionary<string, NetworkPlayer> players2 = NetworkManager.players; value = id.Value; players2.Add(value.ToString(), newPlr); } } } public static void CleanLevelOfSoftlocks() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) string[] pathsToSoftlocks = PathsToSoftlocks; foreach (string text in pathsToSoftlocks) { bool flag = text == "V2 - Arena/V2 Stuff(Clone)/Door"; Scene activeScene = SceneManager.GetActiveScene(); Transform val = FindByPath(((Scene)(ref activeScene)).GetRootGameObjects(), text); if ((Object)(object)val != (Object)null) { if (flag) { ((Component)val).GetComponent<Door>().Open(false, true); Object.Destroy((Object)(object)((Component)val).GetComponent<Door>()); } else if ((Object)(object)((Component)val).GetComponent<ForceOff>() == (Object)null) { ((Component)val).gameObject.AddComponent<ForceOff>(); } } } } private static Transform FindByPath(GameObject[] roots, string path) { string[] parts = path.Split(new char[1] { '/' }); foreach (GameObject val in roots) { Transform val2 = Recurse(val.transform, parts, 0); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } private static Transform Recurse(Transform current, string[] parts, int index) { if (((Object)current).name != parts[index]) { return null; } if (index == parts.Length - 1) { return current; } for (int i = 0; i < current.childCount; i++) { Transform val = Recurse(current.GetChild(i), parts, index + 1); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void OnSceneLoaded(Scene args1, LoadSceneMode args2) { //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown if (SceneHelper.CurrentScene == "Intro" || SceneHelper.CurrentScene == "Bootstrap") { return;