1
0
mirror of synced 2024-11-23 22:10:57 +01:00

chore: Add BepInEx 5 project

This commit is contained in:
Repflez 2022-05-24 03:09:00 -06:00
parent b21cabb6dd
commit d3fb19aef8
4 changed files with 127 additions and 74 deletions

View File

@ -1,7 +1,7 @@
using HarmonyLib;
namespace TaikoModStuff
{
using HarmonyLib;
namespace TaikoModStuff
{
[HarmonyPatch]
public class OfflineSaveLoad
{

154
Plugin.cs
View File

@ -1,60 +1,70 @@
using BepInEx;
using BepInEx.IL2CPP;
using BepInEx.Configuration;
using HarmonyLib;
namespace TaikoModStuff
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
public static ConfigEntry<bool> configForceFontChange;
public static ConfigEntry<int> configCustomWindowedWidth;
public static ConfigEntry<int> configCustomWindowedHeight;
public static ConfigEntry<int> configCustomFramerate;
public static ConfigEntry<bool> configToggleVSync;
using BepInEx;
#if !BEPIN_5
using BepInEx.IL2CPP;
#endif
using BepInEx.Configuration;
using HarmonyLib;
namespace TaikoModStuff
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
#if !BEPIN_5
public class Plugin : BasePlugin
#else
public class Plugin : BaseUnityPlugin
#endif
{
public static ConfigEntry<bool> configForceFontChange;
public static ConfigEntry<int> configCustomWindowedWidth;
public static ConfigEntry<int> configCustomWindowedHeight;
public static ConfigEntry<int> configCustomFramerate;
public static ConfigEntry<bool> configToggleVSync;
public static ConfigEntry<bool> configEnableRecording;
public static ConfigEntry<bool> configOfflineSaveLoad;
public static ConfigEntry<bool> configQuickRestart;
public static ConfigEntry<bool> configQuickQuitSong;
public override void Load()
{
// Add configurations
configForceFontChange = Config.Bind("General.Toggles",
"ForceFontChange",
false,
"Force the game font to the JP font");
configCustomWindowedWidth = Config.Bind("General.Resolution",
"CustomWidth",
1920,
"Custom width to use. Set to 0 to disable setting the custom resolution");
configCustomWindowedHeight = Config.Bind("General.Resolution",
"CustomHeight",
1080,
"Custom height to use");
configCustomFramerate = Config.Bind("General.Framerate",
"CustomFramerate",
60,
"Custom framerate.");
configToggleVSync = Config.Bind("General.Graphics",
"EnableVSync",
true,
"Enable VSync.");
configEnableRecording = Config.Bind("General.Toggles",
"EnableGameBarRecording",
true,
"Enables Game Recording from the Xbox Game Bar where it was previously disabled.");
public static ConfigEntry<bool> configOfflineSaveLoad;
public static ConfigEntry<bool> configQuickRestart;
public static ConfigEntry<bool> configQuickQuitSong;
#if !BEPIN_5
public override void Load()
#else
private void Awake()
#endif
{
// Add configurations
configForceFontChange = Config.Bind("General.Toggles",
"ForceFontChange",
false,
"Force the game font to the JP font");
configCustomWindowedWidth = Config.Bind("General.Resolution",
"CustomWidth",
1920,
"Custom width to use. Set to 0 to disable setting the custom resolution");
configCustomWindowedHeight = Config.Bind("General.Resolution",
"CustomHeight",
1080,
"Custom height to use");
configCustomFramerate = Config.Bind("General.Framerate",
"CustomFramerate",
60,
"Custom framerate.");
configToggleVSync = Config.Bind("General.Graphics",
"EnableVSync",
true,
"Enable VSync.");
configEnableRecording = Config.Bind("General.Toggles",
"EnableGameBarRecording",
true,
"Enables Game Recording from the Xbox Game Bar where it was previously disabled.");
configOfflineSaveLoad = Config.Bind("General.Toggles",
"OfflineSaveLoad",
false,
@ -63,17 +73,17 @@ namespace TaikoModStuff
configQuickRestart = Config.Bind("General.Toggles",
"QuickRestart",
false,
"Hit \"Backspace\" on your keyboard to quickly restart a song.");
"Hit \"Backspace\" on your keyboard to quickly restart a song.");
configQuickQuitSong = Config.Bind("General.Toggles",
"QuickQuitSong",
false,
"Hit \"Escape\" on your keyboard to quickly quit a song and return to Song Select.");
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
instance.PatchAll(typeof(FontChanger));
instance.PatchAll(typeof(CustomResolution));
"Hit \"Escape\" on your keyboard to quickly quit a song and return to Song Select.");
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
instance.PatchAll(typeof(FontChanger));
instance.PatchAll(typeof(CustomResolution));
instance.PatchAll(typeof(ForceFramerate));
instance.PatchAll(typeof(RecordingEnable));
@ -84,10 +94,14 @@ namespace TaikoModStuff
instance.PatchAll(typeof(QuickRestart));
if (Plugin.configQuickQuitSong.Value)
instance.PatchAll(typeof(QuickQuitSong));
// Plugin startup logic
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
}
}
}
instance.PatchAll(typeof(QuickQuitSong));
// Plugin startup logic
#if !BEPIN_5
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
#else
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
#endif
}
}
}

View File

@ -1,5 +1,9 @@
using HarmonyLib;
#if !BEPIN_5
using Il2CppMicrosoft.Xbox;
#else
using Microsoft.Xbox;
#endif
namespace TaikoModStuff
{

View File

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<AssemblyName>TaikoModStuff</AssemblyName>
<Description>My first plugin</Description>
<Version>1.3.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>TaikoModStuff</PackageId>
<Authors>TaikoModStuff</Authors>
<Product>TaikoModStuff</Product>
<RootNamespace>TaikoModStuff</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants)TRACE;BEPIN_5</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>$(DefineConstants)TRACE;BEPIN_5</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2020.3.19" IncludeAssets="compile" />
<PackageReference Include="Taiko.GameLibs" Version="1.2.2-r.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>
</Project>