using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DspFontPatcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DspFontPatcher")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.1.0.0")] namespace DSPVoiceLingoSwitch; [BepInPlugin("Appun.DSP.plugin.VoiceLingoSwitch", "DSPVoiceLingoSwitch", "0.0.1")] public class Main : BaseUnityPlugin { public void Awake() { LogManager.Logger = ((BaseUnityPlugin)this).Logger; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } public class LogManager { public static ManualLogSource Logger; } [HarmonyPatch] internal class Patches { [HarmonyPrefix] [HarmonyPatch(typeof(Localization), "Translate", new Type[] { typeof(string) })] public static bool Localization_Translate_Prefix(ref string __result, string s) { if (s == null) { __result = ""; return false; } if (s == "AudioResPostfix" || s == "ResPostfix") { __result = "-en"; LogManager.Logger.LogInfo((object)(s + " => " + __result)); return false; } if (s == "CutsceneBGM0") { __result = "Musics/df-cutscene-en"; LogManager.Logger.LogInfo((object)(s + " => " + __result)); return false; } return true; } }