Skip to content

Commit

Permalink
Fixed error induced by previous fix, where the screen was being rese…
Browse files Browse the repository at this point in the history
…t upon reentering after changing screen, due to a variable not being set properly.
  • Loading branch information
linuxgurugamer committed Mar 7, 2024
1 parent f4018c0 commit 7596b64
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion AnyRes.version
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"MAJOR": 2,
"MINOR": 0,
"PATCH": 9,
"BUILD": 0
"BUILD": 1
},
"KSP_VERSION": {
"MAJOR": 1,
Expand Down
3 changes: 3 additions & 0 deletions AnyRes/AnyRes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ void GUIActive(int windowID)
GameSettings.SCREEN_RESOLUTION_WIDTH = x;
GameSettings.FULLSCREEN = fullScreen;
GameSettings.SaveSettings();
Log.Info("GUIActive.SetResolution, x: " + x + ", y: " + y + ", fullScreen: " + fullScreen);
Screen.SetResolution(x, y, fullScreen);

SaveDataConfig(x, y, fullScreen);
Expand Down Expand Up @@ -281,6 +282,7 @@ void GUIActive(int windowID)
if (GUILayout.Button(resConfigs[i].node.GetValue("name")))
{
SetScreenRes(resConfigs[i].node);
SetInitialRes.LastSetRes = resConfigs[i].node;
GameSettings.SaveSettings();

Debug.Log("[AnyRes] Set screen resolution from preset");
Expand Down Expand Up @@ -310,6 +312,7 @@ public static void SetScreenRes(ConfigNode config, bool saveConfig = true)
GameSettings.SCREEN_RESOLUTION_HEIGHT = yVal;
GameSettings.SCREEN_RESOLUTION_WIDTH = xVal;
GameSettings.FULLSCREEN = fullscreen;
Log.Info("SetScreenRes.SetResolution, xVal: " + xVal + ", yVal: " + yVal + ", fullscreen: " + fullscreen);
Screen.SetResolution(xVal, yVal, fullscreen);
if (saveConfig)
{
Expand Down
4 changes: 2 additions & 2 deletions AnyRes/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

using System.Reflection;

[assembly: AssemblyVersion("2.0.8.0")]
[assembly: AssemblyFileVersion("2.0.8.0")]
[assembly: AssemblyVersion("2.0.9.0")]
[assembly: AssemblyFileVersion("2.0.9.0")]
4 changes: 3 additions & 1 deletion AnyRes/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public class SetInitialRes : MonoBehaviour
internal static string dirPath;
static bool initialResSet = false;
internal static ConfigNode LastSetRes = null;

internal void DoStart(bool initial)
{
if (!initialResSet)
{
initialResSet = initial;
Log.Info("SetInitialRes");
dirPath = KSPUtil.ApplicationRootPath.Replace("\\", "/") + "GameData/AnyRes/PluginData/";


Expand All @@ -32,7 +32,9 @@ internal void DoStart(bool initial)
}
}
if (LastSetRes != null)
{
AnyRes.SetScreenRes(LastSetRes, false);
}
LoadWinPos();
}

Expand Down
2 changes: 2 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ChangeLog

2.0.9.1
Fixed error induced by previous fix, where the screen was being reset upon reentering after changing screen, due to a variable not being set properly.

2.0.9
Fixed performance issue when window was left open
Expand Down
2 changes: 1 addition & 1 deletion GameData/AnyRes/AnyRes.version
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"VERSION": {
"MAJOR": 2,
"MINOR": 0,
"PATCH": 8,
"PATCH": 9,
"BUILD": 0
},
"KSP_VERSION": {
Expand Down

0 comments on commit 7596b64

Please sign in to comment.