Skip to content

Commit ba6f8f9

Browse files
committed
Fixed Logging, adjusted config tweaks
1 parent 1353b57 commit ba6f8f9

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

Config.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static Vector2 ShadowResVec()
6262
_ => new Vector2(4096, 4096)
6363
};
6464
}
65-
65+
6666
//private static string path = @"BepInEx\content\svsfix_content";
6767
//public static AssetBundle blackBarControllerBundle = AssetBundle.LoadFromFile(path);
6868

@@ -91,7 +91,6 @@ public static Vector2 ShadowResVec()
9191
public static ConfigEntry<bool> _bDisableSteamInput; // For those that don't want to use SteamInput, absolutely hate it being forced, and would rather use Unity's built-in input system.
9292

9393
// Resolution Config
94-
public static ConfigEntry<bool> _bForceCustomResolution;
9594
public static ConfigEntry<int> _iHorizontalResolution;
9695
public static ConfigEntry<int> _iVerticalResolution;
9796

@@ -109,7 +108,7 @@ private void InitConfig()
109108
_sPostAAType = Config.Bind("Graphics", "Post-Process AA", "SMAA", "Off, FXAA, SMAA");
110109
if (!Enum.TryParse(_sPostAAType.Value, out _confPostAAType)) {
111110
_confPostAAType = EPostAAType.SMAA;
112-
HMFix._log.LogError($"PostAA Value is invalid. Defaulting to SMAA.");
111+
Log.LogError($"PostAA Value is invalid. Defaulting to SMAA.");
113112
}
114113

115114
_resolutionScale = Config.Bind("Graphics", "Resolution Scale", 100,
@@ -119,7 +118,7 @@ private void InitConfig()
119118
"Low (512), Medium (1024), High (2048), Original (4096), Ultra (8192), Extreme (16384)");
120119
if (!Enum.TryParse(_sShadowQuality.Value, out _confShadowQuality)) {
121120
_confShadowQuality = EShadowQuality.Original;
122-
HMFix._log.LogError($"ShadowQuality Value is invalid. Defaulting to Original.");
121+
Log.LogError($"ShadowQuality Value is invalid. Defaulting to Original.");
123122
}
124123

125124
_shadowCascades = Config.Bind("Graphics", "Shadow Cascades", 4,
@@ -155,21 +154,19 @@ private void InitConfig()
155154
_sInputType = Config.Bind("Input", "Input Type", "Automatic", "Automatic, KBM, Controller");
156155
if (!Enum.TryParse(_sInputType.Value, out _confInputType)) {
157156
_confInputType = EInputType.Automatic;
158-
HMFix._log.LogError($"Input Type Value is invalid. Defaulting to Automatic.");
157+
Log.LogError($"Input Type Value is invalid. Defaulting to Automatic.");
159158
}
160159

161160
_sControllerType = Config.Bind("Input", "Controller Prompts Type", "Automatic", "Automatic, Xbox, PS3, PS4, PS5, Switch (If SteamInput is enabled, 'Automatic' will be used regardless of settings)");
162161
if (!Enum.TryParse(_sControllerType.Value, out _confControllerType)) {
163162
_confControllerType = EControllerType.Automatic;
164-
HMFix._log.LogError($"Controller Type Value is invalid. Defaulting to Automatic.");
163+
Log.LogError($"Controller Type Value is invalid. Defaulting to Automatic.");
165164
}
166165

167166
_bDisableSteamInput = Config.Bind("Input", "Force Disable SteamInput", false,
168167
"Self Explanatory. Prevents SteamInput from ever running, forcefully, for those using DS4Windows/DualSenseX or wanting native controller support. Make sure to disable SteamInput in the controller section of the game's properties on Steam alongside this option.");
169168

170169
// Resolution Config
171-
_bForceCustomResolution = Config.Bind("Resolution", "Force Custom Resolution", false,
172-
"Self Explanatory. A temporary toggle for custom resolutions until I can figure out how to go about removing the resolution count restrictions.");
173170
_iHorizontalResolution = Config.Bind("Resolution", "Horizontal Resolution", 1280);
174171
_iVerticalResolution = Config.Bind("Resolution", "Vertical Resolution", 720);
175172
}

HMFix.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ namespace HMFix
1212
[BepInProcess("Harvest Moon The Winds of Anthos.exe")]
1313
public partial class HMFix : BaseUnityPlugin
1414
{
15-
private static ManualLogSource _log;
15+
private static ManualLogSource Log;
1616

1717
private void Awake()
1818
{
19-
HMFix._log = Logger;
19+
Log = base.Logger;
2020
// Plugin startup logic
21-
HMFix._log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
21+
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
2222
// Reads or creates our config file.
2323
InitConfig();
2424
LoadGraphicsSettings(); // Initializes our graphics options
2525
var createdFramelimiter = InitializeFramelimiter();
2626
if (createdFramelimiter) {
27-
_log.LogInfo("Created Framelimiter.");
27+
Log.LogInfo("Created Framelimiter.");
2828
}
29-
else { _log.LogError("Couldn't create Framelimiter Actor."); }
29+
else { Log.LogError("Couldn't create Framelimiter Actor."); }
3030
Harmony.CreateAndPatchAll(typeof(ResolutionPatches));
3131
}
3232

@@ -49,6 +49,7 @@ private static bool InitializeFramelimiter()
4949
public class ResolutionPatches
5050
{
5151
private const float OriginalAspectRatio = 1.7777778f;
52+
5253
// Set screen match mode when object has canvas scaler enabled
5354
[HarmonyPatch(typeof(CanvasScaler), "OnEnable")]
5455
[HarmonyPostfix]
@@ -66,10 +67,10 @@ public static void SetScreenMatchMode(CanvasScaler __instance)
6667
public static bool CustomResolutionPatch()
6768
{
6869
if (Screen.fullScreen) {
69-
Screen.SetResolution(_iHorizontalResolution.Value, _iVerticalResolution.Value, FullScreenMode.Windowed);
70+
Screen.SetResolution(HMFix._iHorizontalResolution.Value, HMFix._iVerticalResolution.Value, FullScreenMode.Windowed);
7071
return false;
7172
}
72-
Screen.SetResolution(_iHorizontalResolution.Value, _iVerticalResolution.Value, FullScreenMode.FullScreenWindow);
73+
Screen.SetResolution(HMFix._iHorizontalResolution.Value, HMFix._iVerticalResolution.Value, FullScreenMode.FullScreenWindow);
7374
Application.targetFrameRate = 0; // Disables any external framelimit from Unity. We will be using our own framerate limiting logic anyways.
7475
QualitySettings.vSyncCount = HMFix._bvSync.Value ? 1 : 0;
7576
return false;

0 commit comments

Comments
 (0)