Added support for il2cpp
This commit is contained in:
parent
c5d8354a32
commit
b03f87ed3b
4
.gitignore
vendored
4
.gitignore
vendored
@ -398,4 +398,6 @@ FodyWeavers.xsd
|
||||
*.sln.iml
|
||||
.idea
|
||||
|
||||
TakoTako/Executables/TJAConvert.exe
|
||||
TakoTako/Executables/TJAConvert.exe
|
||||
TakoTako/lib
|
||||
TaikoUnityAssets
|
@ -1,5 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx6' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx5' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx5' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx6' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
@ -7,6 +30,8 @@
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
<Configurations>Release-BepInEx6;Release-BepInEx5;Debug-BepInEx6;Debug-BepInEx5</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,16 +1,50 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx6' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx5' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx5' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx6' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<RootNamespace>TakoTako.Common</RootNamespace>
|
||||
<AssemblyName>TakoTako.Common</AssemblyName>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Configurations>Release-BepInEx6;Release-BepInEx5;Debug-BepInEx6;Debug-BepInEx5</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
<TargetFrameworks>net48;netstandard2.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx5' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx5' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\TakoTako\References\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\TakoTako\References\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
42
TakoTako.sln
42
TakoTako.sln
@ -11,21 +11,35 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TakoTako", "TakoTako\TakoTa
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release-BepInEx6|Any CPU = Release-BepInEx6|Any CPU
|
||||
Release-BepInEx5|Any CPU = Release-BepInEx5|Any CPU
|
||||
Debug-BepInEx6|Any CPU = Debug-BepInEx6|Any CPU
|
||||
Debug-BepInEx5|Any CPU = Debug-BepInEx5|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release-BepInEx6|Any CPU.ActiveCfg = Release-BepInEx6|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release-BepInEx6|Any CPU.Build.0 = Release-BepInEx6|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release-BepInEx5|Any CPU.ActiveCfg = Release-BepInEx5|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Release-BepInEx5|Any CPU.Build.0 = Release-BepInEx5|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug-BepInEx6|Any CPU.ActiveCfg = Debug-BepInEx6|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug-BepInEx6|Any CPU.Build.0 = Debug-BepInEx6|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug-BepInEx5|Any CPU.ActiveCfg = Debug-BepInEx5|Any CPU
|
||||
{DDD2BC9B-15CB-47AE-A104-F45A3C65C7B1}.Debug-BepInEx5|Any CPU.Build.0 = Debug-BepInEx5|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release-BepInEx6|Any CPU.ActiveCfg = Release-BepInEx6|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release-BepInEx6|Any CPU.Build.0 = Release-BepInEx6|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release-BepInEx5|Any CPU.ActiveCfg = Release-BepInEx5|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Release-BepInEx5|Any CPU.Build.0 = Release-BepInEx5|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug-BepInEx6|Any CPU.ActiveCfg = Debug-BepInEx6|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug-BepInEx6|Any CPU.Build.0 = Debug-BepInEx6|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug-BepInEx5|Any CPU.ActiveCfg = Debug-BepInEx5|Any CPU
|
||||
{9ED2476B-FB39-4BE9-8661-21311AD9A3E8}.Debug-BepInEx5|Any CPU.Build.0 = Debug-BepInEx5|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release-BepInEx6|Any CPU.ActiveCfg = Release-BepInEx6|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release-BepInEx6|Any CPU.Build.0 = Release-BepInEx6|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release-BepInEx5|Any CPU.ActiveCfg = Release-BepInEx5|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Release-BepInEx5|Any CPU.Build.0 = Release-BepInEx5|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug-BepInEx6|Any CPU.ActiveCfg = Debug-BepInEx6|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug-BepInEx6|Any CPU.Build.0 = Debug-BepInEx6|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug-BepInEx5|Any CPU.ActiveCfg = Debug-BepInEx5|Any CPU
|
||||
{3B286FDB-8AB8-49B0-852E-5180AFBC20D5}.Debug-BepInEx5|Any CPU.Build.0 = Debug-BepInEx5|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,4 +1,5 @@
|
||||
<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:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DLC/@EntryIndexedValue">DLC</s:String>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=shinuti/@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>
|
||||
|
20
TakoTako/IL2CPPHelper.cs
Normal file
20
TakoTako/IL2CPPHelper.cs
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
#if TAIKO_IL2CPP
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
// using Il2CppSystem.Runtime.InteropServices;
|
||||
using UnhollowerBaseLib;
|
||||
|
||||
namespace TakoTako;
|
||||
|
||||
public class ReferenceObject<T> : Il2CppObjectBase
|
||||
{
|
||||
public T Value { get; private set; }
|
||||
public ReferenceObject(IntPtr pointer) : base(pointer)
|
||||
{
|
||||
Value = Marshal.PtrToStructure<T>(pointer);
|
||||
}
|
||||
|
||||
public static implicit operator T (ReferenceObject<T> value) => value.Value;
|
||||
}
|
||||
#endif
|
98
TakoTako/Il2cppRedirection.cs
Normal file
98
TakoTako/Il2cppRedirection.cs
Normal file
@ -0,0 +1,98 @@
|
||||
#if TAIKO_IL2CPP
|
||||
using HarmonyLib;
|
||||
using Il2CppSystem;
|
||||
using UnhollowerBaseLib;
|
||||
using UnhollowerBaseLib.Attributes;
|
||||
using UnhollowerBaseLib.Runtime;
|
||||
using Il2CppException = UnhollowerBaseLib.Il2CppException;
|
||||
|
||||
namespace TakoTako;
|
||||
|
||||
public static class Il2cppRedirection
|
||||
{
|
||||
[CallerCount(4)]
|
||||
[CachedScanResults(MetadataInitFlagRva = 0, MetadataInitTokenRva = 0, RefRangeEnd = 504456, RefRangeStart = 504452, XrefRangeEnd = 504452, XrefRangeStart = 504452)]
|
||||
public static unsafe void GetMusicInfoExAllIl2cpp(this PlayDataManager instance, int playerId, out Il2CppStructArray<MusicInfoEx> dst)
|
||||
{
|
||||
IL2CPP.Il2CppObjectBaseToPtrNotNull(instance);
|
||||
System.IntPtr* numPtr = stackalloc System.IntPtr[2];
|
||||
numPtr[0] = (System.IntPtr) (&playerId);
|
||||
var outPtr = IntPtr.Zero;
|
||||
numPtr[1] = (System.IntPtr) (&outPtr);
|
||||
System.IntPtr exc = System.IntPtr.Zero;
|
||||
var field = (System.IntPtr) AccessTools.Field(typeof(PlayDataManager), "NativeMethodInfoPtr_GetMusicInfoExAll_Public_Void_Int32_byref_ArrayOf_MusicInfoEx_0").GetValue(null);
|
||||
IL2CPP.il2cpp_runtime_invoke(field, IL2CPP.Il2CppObjectBaseToPtrNotNull(instance), (void**) numPtr, ref exc);
|
||||
dst = new Il2CppStructArray<MusicInfoEx>(outPtr);
|
||||
Il2CppException.RaiseExceptionIfNecessary(exc);
|
||||
}
|
||||
|
||||
public static void GetPlayerInfoRemake(this PlayDataManager instance, int playerId, out PlayerInfo dst) => dst = instance.saveData[playerId].dataBody.playerInfo;
|
||||
|
||||
public static bool SetPlayerInfoRemake(this PlayDataManager instance, int playerId, ref PlayerInfo src, bool immediate = false)
|
||||
{
|
||||
return SetPlayerInfoRemake(instance, playerId, ref src, true, !immediate);
|
||||
}
|
||||
|
||||
public static bool SetPlayerInfoRemake(this PlayDataManager instance, int playerId, ref PlayerInfo src, bool savemode, bool async = true)
|
||||
{
|
||||
src.checkNull();
|
||||
if (!src.IsValid())
|
||||
return false;
|
||||
instance.saveData[playerId].dataBody.playerInfo = src;
|
||||
if (savemode && playerId == 0)
|
||||
{
|
||||
if (async)
|
||||
instance.SaveObjectAsync();
|
||||
else
|
||||
instance.SaveObject();
|
||||
}
|
||||
instance.isSaveDataChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void GetRankMatchSeasonRecordInfoRemake(
|
||||
this PlayDataManager instance,
|
||||
int playerId,
|
||||
int seasonId,
|
||||
out RankMatchSeasonRecordInfo dst)
|
||||
{
|
||||
if (instance.saveData[playerId].dataBody.rankMatchSeasonRecordInfo == null)
|
||||
instance.saveData[playerId].ResetRankMatchSeasonRecordInfo();
|
||||
dst = instance.saveData[playerId].dataBody.rankMatchSeasonRecordInfo[seasonId];
|
||||
}
|
||||
|
||||
public static void CopySettingsRemake(this EnsoDataManager ensoDataManager, out EnsoData.Settings dst) => ensoDataManager.ensoSettings.CopyRemake(out dst);
|
||||
|
||||
public static void GetSystemOptionRemake(this PlayDataManager instance, out SystemOption dst, bool forceReload = false)
|
||||
{
|
||||
dst = instance.systemOption;
|
||||
}
|
||||
|
||||
public static void SetSettingsRemake(this EnsoDataManager instance, ref EnsoData.Settings src)
|
||||
{
|
||||
src.CopyRemake(out var value);
|
||||
instance.ensoSettings = value;
|
||||
}
|
||||
|
||||
public static void CopyRemake(this EnsoData.Settings settings, out EnsoData.Settings dst)
|
||||
{
|
||||
dst = settings;
|
||||
for (int i = 0; i < settings.ensoPlayerSettings.Length; i++)
|
||||
dst.ensoPlayerSettings = settings.ensoPlayerSettings;
|
||||
|
||||
for (int i = 0; i < settings.partsSettings.Length; i++)
|
||||
dst.partsSettings = settings.partsSettings;
|
||||
|
||||
|
||||
DebugCopyRemake(settings.debugSettings, out var value);
|
||||
settings.debugSettings = value;
|
||||
}
|
||||
public static void DebugCopyRemake(this EnsoData.DebugSettings settings, out EnsoData.DebugSettings dst)
|
||||
{
|
||||
dst = settings;
|
||||
|
||||
for (int i = 0; i < settings.debugPlayerSettings.Length; i++)
|
||||
dst.debugPlayerSettings = settings.debugPlayerSettings;
|
||||
}
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -4,13 +4,20 @@ using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using UnityEngine;
|
||||
#if TAIKO_IL2CPP
|
||||
using BepInEx.IL2CPP.Utils;
|
||||
using BepInEx.IL2CPP;
|
||||
#endif
|
||||
|
||||
namespace TakoTako
|
||||
{
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
#if TAIKO_MONO
|
||||
public class Plugin : BaseUnityPlugin
|
||||
#elif TAIKO_IL2CPP
|
||||
public class Plugin : BasePlugin
|
||||
#endif
|
||||
{
|
||||
public ConfigEntry<bool> ConfigSkipSplashScreen;
|
||||
public ConfigEntry<bool> ConfigDisableScreenChangeOnFocus;
|
||||
@ -18,6 +25,7 @@ namespace TakoTako
|
||||
public ConfigEntry<bool> ConfigEnableCustomSongs;
|
||||
public ConfigEntry<bool> ConfigEnableTaikoDrumSupport;
|
||||
public ConfigEntry<bool> ConfigTaikoDrumUseNintendoLayout;
|
||||
public ConfigEntry<bool> ConfigSkipDLCCheck;
|
||||
|
||||
public ConfigEntry<string> ConfigSongDirectory;
|
||||
public ConfigEntry<bool> ConfigSaveEnabled;
|
||||
@ -27,17 +35,27 @@ namespace TakoTako
|
||||
|
||||
public static Plugin Instance;
|
||||
private Harmony _harmony;
|
||||
public static ManualLogSource Log;
|
||||
public new static ManualLogSource Log;
|
||||
|
||||
// private ModMonoBehaviourHelper _modMonoBehaviourHelper;
|
||||
|
||||
#if TAIKO_MONO
|
||||
private void Awake()
|
||||
#elif TAIKO_IL2CPP
|
||||
public override void Load()
|
||||
#endif
|
||||
{
|
||||
Instance = this;
|
||||
Log = Logger;
|
||||
|
||||
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
|
||||
#if TAIKO_MONO
|
||||
Log = Logger;
|
||||
#elif TAIKO_IL2CPP
|
||||
Log = base.Log;
|
||||
#endif
|
||||
|
||||
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
|
||||
|
||||
SetupConfig();
|
||||
|
||||
SetupHarmony();
|
||||
}
|
||||
|
||||
@ -79,13 +97,18 @@ namespace TakoTako
|
||||
|
||||
ConfigFixSignInScreen = Config.Bind("General",
|
||||
"FixSignInScreen",
|
||||
true,
|
||||
false,
|
||||
"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");
|
||||
|
||||
ConfigSkipDLCCheck = Config.Bind("General",
|
||||
"SkipDLCCheck",
|
||||
true,
|
||||
"When true this will skip slow DLC checks");
|
||||
|
||||
ConfigDisableScreenChangeOnFocus = Config.Bind("General",
|
||||
"DisableScreenChangeOnFocus",
|
||||
@ -120,6 +143,11 @@ namespace TakoTako
|
||||
if (ConfigEnableTaikoDrumSupport.Value)
|
||||
_harmony.PatchAll(typeof(TaikoDrumSupport));
|
||||
|
||||
#if TAIKO_IL2CPP
|
||||
if (ConfigSkipDLCCheck.Value)
|
||||
_harmony.PatchAll(typeof(SkipDLCCheck));
|
||||
#endif
|
||||
|
||||
if (ConfigEnableCustomSongs.Value)
|
||||
{
|
||||
_harmony.PatchAll(typeof(MusicPatch));
|
||||
@ -127,9 +155,15 @@ namespace TakoTako
|
||||
}
|
||||
}
|
||||
|
||||
public static MonoBehaviour GetMonoBehaviour() => TaikoSingletonMonoBehaviour<CommonObjects>.Instance;
|
||||
|
||||
public void StartCustomCoroutine(IEnumerator enumerator)
|
||||
{
|
||||
StartCoroutine(enumerator);
|
||||
#if TAIKO_MONO
|
||||
GetMonoBehaviour().StartCoroutine(enumerator);
|
||||
#elif TAIKO_IL2CPP
|
||||
GetMonoBehaviour().StartCoroutine(enumerator);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,25 @@
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
#if TAIKO_MONO
|
||||
using Microsoft.Xbox;
|
||||
|
||||
#endif
|
||||
#if TAIKO_IL2CPP
|
||||
using Il2CppMicrosoft.Xbox;
|
||||
#endif
|
||||
namespace TakoTako;
|
||||
|
||||
/// <summary>
|
||||
/// This patch will address the issue where signing with GDK is done correctly
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(GdkHelpers))]
|
||||
[HarmonyPatch("SignIn")]
|
||||
public static class SignInPatch
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(GdkHelpers))]
|
||||
[HarmonyPatch("SignIn")]
|
||||
[HarmonyPrefix]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
private static bool Prefix(GdkHelpers __instance)
|
||||
private static bool SignIn_Prefix(GdkHelpers __instance)
|
||||
{
|
||||
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);
|
||||
if (methodInfo == null)
|
||||
{
|
||||
Plugin.Log.LogError("Failed to patch");
|
||||
return true;
|
||||
}
|
||||
|
||||
methodInfo.Invoke(__instance, new object[] {true});
|
||||
__instance.SignInImpl(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
28
TakoTako/SkipDLCCheck.cs
Normal file
28
TakoTako/SkipDLCCheck.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace TakoTako;
|
||||
|
||||
#if TAIKO_IL2CPP
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class SkipDLCCheck
|
||||
{
|
||||
private static SongSelectManager songSelectManager;
|
||||
|
||||
[HarmonyPatch(typeof(SongSelectManager), "Start")]
|
||||
[HarmonyPostfix]
|
||||
public static void Start_Postfix(SongSelectManager __instance)
|
||||
{
|
||||
songSelectManager = __instance;
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(DLCLicenseCheckWindow), nameof(DLCLicenseCheckWindow.OpenWindow))]
|
||||
[HarmonyPostfix]
|
||||
private static void OpenWindow_Postfix(DLCLicenseCheckWindow __instance)
|
||||
{
|
||||
songSelectManager.isDLCLicenseChecking = false;
|
||||
songSelectManager.isDLCPackInfoUpdateChecked = true;
|
||||
__instance.CloseWindowImmediately();
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
#if TAIKO_IL2CPP
|
||||
using Array = Il2CppSystem.Array;
|
||||
using UnhollowerBaseLib;
|
||||
#endif
|
||||
|
||||
namespace TakoTako;
|
||||
|
||||
@ -64,6 +69,26 @@ public class TaikoDrumSupport
|
||||
}
|
||||
}
|
||||
|
||||
private static unsafe
|
||||
#if TAIKO_IL2CPP
|
||||
bool[]
|
||||
#elif TAIKO_MONO
|
||||
bool[,]
|
||||
#endif
|
||||
GetPreviousButtons(ControllerManager instance)
|
||||
{
|
||||
#if TAIKO_IL2CPP
|
||||
var fieldPtr = (IntPtr)AccessTools.Field(typeof(ControllerManager), "NativeFieldInfoPtr_prevButtons").GetValue(null);
|
||||
System.IntPtr nativeObject = *(System.IntPtr*) (IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase) instance) + (int) IL2CPP.il2cpp_field_get_offset(fieldPtr));
|
||||
var array = nativeObject == System.IntPtr.Zero ? (Il2CppStructArray<bool>) null : new Il2CppStructArray<bool>(nativeObject);
|
||||
return array;
|
||||
// return instance.prevButtons.Cast<ReferenceObject<bool[,]>>();
|
||||
#elif TAIKO_MONO
|
||||
return instance.prevButtons;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(ControllerManager), "GetButtonDown")]
|
||||
[HarmonyPostfix]
|
||||
private static void GetButtonDown_Postfix(ControllerManager __instance, ref bool __result, ControllerManager.ControllerPlayerNo controllerPlayerNo, ControllerManager.Buttons btn)
|
||||
@ -73,7 +98,14 @@ public class TaikoDrumSupport
|
||||
return;
|
||||
|
||||
var prefix = $"J{controllerIndex}";
|
||||
var previous = __instance.prevButtons[(int) (controllerPlayerNo - 1), (int) btn];
|
||||
#if TAIKO_IL2CPP
|
||||
var previousButtons = GetPreviousButtons(__instance);
|
||||
int playerIndex = (int) (controllerPlayerNo - 1);
|
||||
int btnIndex = (int) btn;
|
||||
var previous = previousButtons[playerIndex * 31 + btnIndex];
|
||||
#elif TAIKO_MONO
|
||||
var previous = GetPreviousButtons(__instance)[(int) (controllerPlayerNo - 1), (int) btn];
|
||||
#endif
|
||||
|
||||
__result = btn switch
|
||||
{
|
||||
@ -114,7 +146,15 @@ public class TaikoDrumSupport
|
||||
return;
|
||||
|
||||
var prefix = $"J{controllerIndex}";
|
||||
var previous = __instance.prevButtons[(int) (controllerPlayerNo - 1), (int) btn];
|
||||
|
||||
#if TAIKO_IL2CPP
|
||||
var previousButtons = GetPreviousButtons(__instance);
|
||||
int playerIndex = (int) (controllerPlayerNo - 1);
|
||||
int btnIndex = (int) btn;
|
||||
var previous = previousButtons[playerIndex * 31 + btnIndex];
|
||||
#elif TAIKO_MONO
|
||||
var previous = GetPreviousButtons(__instance)[(int) (controllerPlayerNo - 1), (int) btn];
|
||||
#endif
|
||||
|
||||
__result = btn switch
|
||||
{
|
||||
|
@ -1,66 +1,104 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx6' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<GameDir>C:\XboxGames\T Tablet\Content</GameDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<AssemblyName>com.fluto.takotako</AssemblyName>
|
||||
<Description>Fixes Taiko issues and allows custom songs</Description>
|
||||
<Version>2.2.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RootNamespace>TakoTako</RootNamespace>
|
||||
<PackageId>com.fluto.takotako</PackageId>
|
||||
<PackageVersion>2.2.0</PackageVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx6' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_IL2CPP;</DefineConstants>
|
||||
<GameDir>C:\XboxGames\T Tablet\Content</GameDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="Costura.Fody" Version="5.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Fody" Version="6.6.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Taiko.GameLibs" Version="1.2.2-r.0" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2020.3.19" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release-BepInEx5' ">
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
<GameDir>D:\XboxGames\T Tablet\Content</GameDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>References\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug-BepInEx5' ">
|
||||
<DebugSymbols Condition=" '$(DebugSymbols)' == '' ">true</DebugSymbols>
|
||||
<Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
|
||||
<DefineConstants>TRACE;TAIKO_MONO;</DefineConstants>
|
||||
<GameDir>D:\XboxGames\T Tablet\Content</GameDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))">netstandard2.1</TargetFramework>
|
||||
<TargetFramework Condition="$(DefineConstants.Contains('TAIKO_MONO'))">net48</TargetFramework>
|
||||
<AssemblyName>com.fluto.takotako</AssemblyName>
|
||||
<Description>A suite of mods that allow for Custom Songs and Taiko Drum support</Description>
|
||||
<Version>3.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RootNamespace>TakoTako</RootNamespace>
|
||||
<PackageId>com.fluto.takotako</PackageId>
|
||||
<PackageVersion>3.0.0</PackageVersion>
|
||||
<Configurations>Release-BepInEx6;Release-BepInEx5;Debug-BepInEx6;Debug-BepInEx5</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="References" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))">
|
||||
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.574" IncludeAssets="compile" />
|
||||
<Reference Include="$(GameDir)\BepInEx\unhollowed\*.dll" Private="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Executables\tja2bin.exe" />
|
||||
<None Remove="Executables\**" />
|
||||
<None Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(DefineConstants.Contains('TAIKO_MONO'))">
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<!-- Empty methods -->
|
||||
<PackageReference Include="Taiko.GameLibs" Version="1.2.2-r.1" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2020.3.34" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Executables\**" />
|
||||
<Compile Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Analyzers" Version="1.0.8" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.1.0" />
|
||||
<PackageReference Include="Costura.Fody" Version="5.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Fody" Version="6.6.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive; compile</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Executables\**" />
|
||||
<EmbeddedResource Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>References\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TakoTako.Common\TakoTako.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="References" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuildCopy" AfterTargets="PostBuildEvent">
|
||||
<Copy SourceFiles="$(TargetDir)$(AssemblyName).dll" DestinationFolder="D:\XboxGames\T Tablet\Content\BepInEx\plugins\$(AssemblyName)" />
|
||||
<Copy SourceFiles="$(ProjectDir)\Executables\tja2bin.exe" DestinationFolder="D:\XboxGames\T Tablet\Content\BepInEx\plugins\$(AssemblyName)" />
|
||||
<Copy SourceFiles="$(ProjectDir)\Executables\TJAConvert.exe" DestinationFolder="D:\XboxGames\T Tablet\Content\BepInEx\plugins\$(AssemblyName)" />
|
||||
</Target>
|
||||
<ItemGroup>
|
||||
<None Remove="Executables\tja2bin.exe" />
|
||||
<None Remove="Executables\**" />
|
||||
<None Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Executables\**" />
|
||||
<Compile Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Executables\**" />
|
||||
<EmbeddedResource Remove="Exes\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TakoTako.Common\TakoTako.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuildCopy" AfterTargets="PostBuildEvent">
|
||||
<Copy SourceFiles="$(TargetDir)$(AssemblyName).dll" DestinationFolder="$(GameDir)\BepInEx\plugins\$(AssemblyName)" />
|
||||
<Copy SourceFiles="$(ProjectDir)\Executables\tja2bin.exe" DestinationFolder="$(GameDir)\BepInEx\plugins\$(AssemblyName)" />
|
||||
<Copy SourceFiles="$(ProjectDir)\Executables\TJAConvert.exe" DestinationFolder="$(GameDir)\BepInEx\plugins\$(AssemblyName)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
17
test/MyFirstPlugin/MyFirstPlugin.csproj
Normal file
17
test/MyFirstPlugin/MyFirstPlugin.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<AssemblyName>MyFirstPlugin</AssemblyName>
|
||||
<Description>My first plugin</Description>
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-*" IncludeAssets="compile" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="Taiko.GameLibs" Version="1.3.1-r.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
6
test/MyFirstPlugin/NuGet.Config
Normal file
6
test/MyFirstPlugin/NuGet.Config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
15
test/MyFirstPlugin/Plugin.cs
Normal file
15
test/MyFirstPlugin/Plugin.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using BepInEx;
|
||||
using BepInEx.IL2CPP;
|
||||
|
||||
namespace MyFirstPlugin
|
||||
{
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class Plugin : BasePlugin
|
||||
{
|
||||
public override void Load()
|
||||
{
|
||||
// Plugin startup logic
|
||||
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user