1
0
mirror of synced 2024-11-27 15:30:50 +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; using HarmonyLib;
namespace TaikoModStuff namespace TaikoModStuff
{ {
[HarmonyPatch] [HarmonyPatch]
public class OfflineSaveLoad public class OfflineSaveLoad
{ {

154
Plugin.cs
View File

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