diff --git a/BepInEx.EnableFullScreenToggle/BepInEx.EnableFullScreenToggle.csproj b/BepInEx.EnableFullScreenToggle/BepInEx.EnableFullScreenToggle.csproj new file mode 100644 index 0000000..3fb9664 --- /dev/null +++ b/BepInEx.EnableFullScreenToggle/BepInEx.EnableFullScreenToggle.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29} + Library + Properties + BepInEx.EnableFullScreenToggle + BepInEx.EnableFullScreenToggle + v3.5 + 512 + true + + + false + none + false + ..\bin\ + DEBUG;TRACE + prompt + 4 + + + none + true + ..\bin\ + TRACE + prompt + 4 + + + + ..\lib\BepInEx.dll + False + + + + + + + + + ..\lib\UnityEngine.dll + False + + + + + + + + \ No newline at end of file diff --git a/BepInEx.EnableFullScreenToggle/EnableFullScreenToggle.cs b/BepInEx.EnableFullScreenToggle/EnableFullScreenToggle.cs new file mode 100644 index 0000000..41451c7 --- /dev/null +++ b/BepInEx.EnableFullScreenToggle/EnableFullScreenToggle.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace BepInEx +{ + /// + /// Allow toggling full screen with alt+enter in games where that has been disabled + /// + [BepInPlugin(GUID, PluginName, Version)] + public class EnableFullScreenToggle : BaseUnityPlugin + { + public const string GUID = "BepInEx.EnableFullScreenToggle"; + public const string PluginName = "Enable Full Screen Toggle"; + public const string Version = "1.0"; + + internal void Update() + { + if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))) + //This section of code is never reached on Unity builds where full screen can be toggled, it seems + //We can safely toggle full screen without risk of it being toggled twice + Screen.fullScreen = !Screen.fullScreen; + } + } +} diff --git a/BepInEx.EnableFullScreenToggle/Properties/AssemblyInfo.cs b/BepInEx.EnableFullScreenToggle/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a03b61c --- /dev/null +++ b/BepInEx.EnableFullScreenToggle/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.InteropServices; +using static BepInEx.EnableFullScreenToggle; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BepInEx.EnableFullScreenToggle")] +[assembly: AssemblyDescription(PluginName)] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("https://github.com/BepInEx/BepInEx.Utility")] +[assembly: AssemblyProduct("BepInEx.EnableFullScreenToggle")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d7b4a73a-1c1a-4c52-8fa6-3b52c2240c29")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion(Version)] +[assembly: AssemblyFileVersion(Version)] \ No newline at end of file diff --git a/BepInEx.Utility.sln b/BepInEx.Utility.sln index 6f4d24f..e675e21 100644 --- a/BepInEx.Utility.sln +++ b/BepInEx.Utility.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.MuteInBackground", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.EnableResize", "BepInEx.EnableResize\BepInEx.EnableResize.csproj", "{B8CFC3BF-4724-4C80-86AC-6AA22AF2FE3B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BepInEx.EnableFullScreenToggle", "BepInEx.EnableFullScreenToggle\BepInEx.EnableFullScreenToggle.csproj", "{D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {B8CFC3BF-4724-4C80-86AC-6AA22AF2FE3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8CFC3BF-4724-4C80-86AC-6AA22AF2FE3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8CFC3BF-4724-4C80-86AC-6AA22AF2FE3B}.Release|Any CPU.Build.0 = Release|Any CPU + {D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7B4A73A-1C1A-4C52-8FA6-3B52C2240C29}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE