1
0
mirror of synced 2024-11-24 06:10:11 +01:00

Added more mods including a song loader

This commit is contained in:
Fluto 2022-01-30 16:28:02 +11:00
parent 9b6593afbe
commit 843d7aba8a
7 changed files with 1291 additions and 9 deletions

View File

@ -0,0 +1,21 @@
using HarmonyLib;
namespace TaikoMods;
[HarmonyPatch]
public class DisableScreenChangeOnFocus
{
[HarmonyPatch(typeof(FocusManager), "OnApplicationFocus")]
[HarmonyPrefix]
private static bool OnApplicationFocus_Prefix(bool focusStatus)
{
return false;
}
[HarmonyPatch(typeof(FocusManager), "UpdateFocusManager")]
[HarmonyPrefix]
private static bool UpdateFocusManager_Prefix()
{
return false;
}
}

View File

@ -1,3 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fluto/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Fluto/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fumen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Taiko/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=Taiko/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

1151
MusicPatch.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,99 @@
using BepInEx; using System;
using System.Collections;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FlutoTaikoMods;
using HarmonyLib; using HarmonyLib;
using HarmonyLib.Tools;
namespace TaikoMods namespace TaikoMods
{ {
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin public class Plugin : BaseUnityPlugin
{ {
public ConfigEntry<bool> ConfigSkipSplashScreen;
public ConfigEntry<bool> ConfigDisableScreenChangeOnFocus;
public ConfigEntry<bool> ConfigFixSignInScreen;
public ConfigEntry<bool> ConfigEnableCustomSongs;
public ConfigEntry<string> ConfigSongDirectory;
public ConfigEntry<string> ConfigSaveDirectory;
public static Plugin Instance;
private Harmony _harmony; private Harmony _harmony;
public static ManualLogSource Log;
private void Awake() private void Awake()
{ {
Instance = this;
Log = Logger;
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!"); Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
SetupConfig();
SetupHarmony();
}
private void SetupConfig()
{
var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
ConfigFixSignInScreen = Config.Bind("General",
"FixSignInScreen",
true,
"When true this will apply the patch to fix signing into Xbox Live");
ConfigSkipSplashScreen = Config.Bind("General",
"SkipSplashScreen",
true,
"When true this will skip the intro");
ConfigDisableScreenChangeOnFocus = Config.Bind("General",
"DisableScreenChangeOnFocus",
false,
"When focusing this wont do anything jank, I thnk");
ConfigEnableCustomSongs = Config.Bind("CustomSongs",
"EnableCustomSongs",
true,
"When true this will load custom mods");
ConfigSongDirectory = Config.Bind("CustomSongs",
"SongDirectory",
$"{userFolder}/Documents/TaikoTheDrumMasterMods/customSongs",
"The directory where custom tracks are stored");
ConfigSaveDirectory = Config.Bind("CustomSongs",
"SaveDirectory",
$"{userFolder}/Documents/TaikoTheDrumMasterMods/saves",
"The directory where saves are stored");
}
private void SetupHarmony()
{
// Patch methods // Patch methods
_harmony = new Harmony(PluginInfo.PLUGIN_GUID); _harmony = new Harmony(PluginInfo.PLUGIN_GUID);
_harmony.PatchAll();
if (ConfigSkipSplashScreen.Value)
_harmony.PatchAll(typeof(SkipSplashScreen));
if (ConfigFixSignInScreen.Value)
_harmony.PatchAll(typeof(SignInPatch));
if (ConfigDisableScreenChangeOnFocus.Value)
_harmony.PatchAll(typeof(DisableScreenChangeOnFocus));
if (ConfigEnableCustomSongs.Value)
{
_harmony.PatchAll(typeof(MusicPatch));
MusicPatch.Setup(_harmony);
}
}
public void StartCustomCoroutine(IEnumerator enumerator)
{
StartCoroutine(enumerator);
} }
} }
} }

View File

@ -1,6 +1,7 @@
using System.Reflection; using System.Reflection;
using HarmonyLib; using HarmonyLib;
using Microsoft.Xbox; using Microsoft.Xbox;
using TaikoMods;
using UnityEngine; using UnityEngine;
namespace FlutoTaikoMods; namespace FlutoTaikoMods;
@ -12,19 +13,23 @@ namespace FlutoTaikoMods;
[HarmonyPatch("SignIn")] [HarmonyPatch("SignIn")]
public static class SignInPatch public static class SignInPatch
{ {
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
private static bool Prefix(GdkHelpers __instance) private static bool Prefix(GdkHelpers __instance)
{ {
// Only apply this patch if we're on version 1.0.0 // Only apply this patch if we're on version 1.0.0
if (Application.version != "1.0.0") if (Application.version != "1.0.0")
return false; return false;
UnityEngine.Debug.Log("Patching sign in to force the user to be prompted to sign in"); Plugin.Log.LogInfo("Patching sign in to force the user to be prompted to sign in");
var methodInfo = typeof(GdkHelpers).GetMethod("SignInImpl", BindingFlags.NonPublic | BindingFlags.Instance); var methodInfo = typeof(GdkHelpers).GetMethod("SignInImpl", BindingFlags.NonPublic | BindingFlags.Instance);
if (methodInfo == null) if (methodInfo == null)
return false; {
Plugin.Log.LogError("Failed to patch");
methodInfo.Invoke(__instance, new object[] { false}); return true;
return true; }
methodInfo.Invoke(__instance, new object[] {true});
return false;
} }
} }

20
SkipSplashScreen.cs Normal file
View File

@ -0,0 +1,20 @@
using System.Diagnostics.CodeAnalysis;
using HarmonyLib;
namespace TaikoMods;
[HarmonyPatch]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class SkipSplashScreen
{
/// <summary>
/// Simply load the next scene, I don't think this scene does anything specific?
/// </summary>
[HarmonyPatch(typeof(BootManager), "Start")]
[HarmonyPostfix]
private static void BootManager_Postfix(BootManager __instance)
{
TaikoSingletonMonoBehaviour<CommonObjects>.Instance.MySceneManager.ChangeScene("Title", false);
__instance.gameObject.SetActive(false);
}
}

View File

@ -3,12 +3,13 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net48</TargetFramework> <TargetFramework>net48</TargetFramework>
<AssemblyName>com.fluto.taikomods</AssemblyName> <AssemblyName>com.fluto.taikomods</AssemblyName>
<Description>Cool Taiko mods</Description> <Description>Fixes Taiko issues and allows custom songs</Description>
<Version>0.0.1</Version> <Version>0.0.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<RootNamespace>TaikoMods</RootNamespace> <RootNamespace>TaikoMods</RootNamespace>
<PackageId>com.fluto.taikomods</PackageId> <PackageId>com.fluto.taikomods</PackageId>
<PackageVersion>1.0.0</PackageVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -26,6 +27,9 @@
<Reference Include="Assembly-CSharp, Version=1.0.2.22379, Culture=neutral, PublicKeyToken=null"> <Reference Include="Assembly-CSharp, Version=1.0.2.22379, Culture=neutral, PublicKeyToken=null">
<HintPath>D:\XboxGames\T Tablet\Content\Taiko no Tatsujin_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>D:\XboxGames\T Tablet\Content\Taiko no Tatsujin_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>D:\XboxGames\T Tablet\Content\Taiko no Tatsujin_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<Target Name="PostBuildCopy" AfterTargets="PostBuildEvent"> <Target Name="PostBuildCopy" AfterTargets="PostBuildEvent">