-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,4 +363,4 @@ MigrationBackup/ | |
FodyWeavers.xsd | ||
|
||
# Ignore game data | ||
lib/Assembly-CSharp.dll | ||
lib/*.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using HarmonyLib; | ||
using UnityEngine; | ||
|
||
namespace TaikoModStuff | ||
{ | ||
internal class CustomResolution | ||
{ | ||
// Skip the original method, we're doing magic here | ||
[HarmonyPatch(typeof(FocusManager), "SetScreenType")] | ||
[HarmonyPrefix] | ||
static bool Prefix() | ||
{ | ||
return false; | ||
} | ||
|
||
[HarmonyPatch(typeof(FocusManager), "SetScreenType")] | ||
[HarmonyPrefix] | ||
static void setCustomResolution(int type) | ||
{ | ||
int width = 1920; | ||
int height = 1080; | ||
int framerate = Plugin.configCustomFramerate.Value; | ||
|
||
if (Plugin.configCustomWindowedWidth.Value > 0) { | ||
width = Plugin.configCustomWindowedWidth.Value; | ||
|
||
// Set custom height if the width is set first | ||
if (Plugin.configCustomWindowedHeight.Value > 0) { | ||
height = Plugin.configCustomWindowedHeight.Value; | ||
} | ||
} | ||
|
||
switch (type) { | ||
case 1: // Borderless | ||
Screen.fullScreen = true; | ||
Screen.SetResolution(width, height, FullScreenMode.FullScreenWindow, framerate); | ||
break; | ||
case 2: // Windowed | ||
Screen.fullScreen = false; | ||
Screen.SetResolution(width, height, FullScreenMode.Windowed, framerate); | ||
break; | ||
default: // Fullscreen | ||
Screen.fullScreen = true; | ||
Screen.SetResolution(width, height, FullScreenMode.FullScreenWindow, framerate); | ||
break; | ||
} | ||
|
||
// TODO: Fix this | ||
Traverse.CreateWithType("FocusManager").Field("m_typeScreenMode").SetValue((DataConst.ScreenModeType)type); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters