diff --git a/FFXIVZoomHack.7z b/FFXIVZoomHack.7z deleted file mode 100644 index 42c0a53..0000000 Binary files a/FFXIVZoomHack.7z and /dev/null differ diff --git a/FFXIVZoomHack/Program.cs b/FFXIVZoomHack/Program.cs index 4dcf604..84d30b6 100644 --- a/FFXIVZoomHack/Program.cs +++ b/FFXIVZoomHack/Program.cs @@ -1,22 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; namespace FFXIVZoomHack { - static class Program + public static class Program { - /// - /// The main entry point for the application. - /// [STAThread] - static void Main() + private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } -} +} \ No newline at end of file diff --git a/FFXIVZoomHack/Settings.cs b/FFXIVZoomHack/Settings.cs index ec7dfcd..2f2a27b 100644 --- a/FFXIVZoomHack/Settings.cs +++ b/FFXIVZoomHack/Settings.cs @@ -74,30 +74,38 @@ public static Settings Load(string location = null) .Value .Split(',') .Where(x => !string.IsNullOrEmpty(x)) - .Select(x => int.Parse(x, NumberStyles.HexNumber)) + .Select(x => int.Parse(x, NumberStyles.HexNumber, CultureInfo.InvariantCulture)) .ToArray(); - settings.DX9_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber); - settings.DX9_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber); - settings.DX9_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber); - settings.DX9_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber); + settings.DX9_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX9_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX9_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX9_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); break; case "DX11": settings.DX11_StructureAddress = element.Element("StructureAddress") .Value .Split(',') .Where(x => !string.IsNullOrEmpty(x)) - .Select(x => int.Parse(x, NumberStyles.HexNumber)) + .Select(x => int.Parse(x, NumberStyles.HexNumber, CultureInfo.InvariantCulture)) .ToArray(); - settings.DX11_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber); - settings.DX11_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber); - settings.DX11_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber); - settings.DX11_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber); + settings.DX11_ZoomCurrent = int.Parse(element.Element("ZoomCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX11_ZoomMax = int.Parse(element.Element("ZoomMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX11_FovCurrent = int.Parse(element.Element("FovCurrent").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); + settings.DX11_FovMax = int.Parse(element.Element("FovMax").Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture); break; case "DesiredZoom": - settings.DesiredZoom = float.Parse(element.Value); + settings.DesiredZoom = float.Parse(element.Value, CultureInfo.InvariantCulture); + if (settings.DesiredZoom < 1f || settings.DesiredZoom > 1000f) + { + settings.DesiredZoom = 20f; + } break; case "DesiredFov": - settings.DesiredFov = float.Parse(element.Value); + settings.DesiredFov = float.Parse(element.Value, CultureInfo.InvariantCulture); + if (settings.DesiredFov < 0.01f || settings.DesiredFov > 3f) + { + settings.DesiredFov = 0.78f; + } break; case "LastUpdate": settings.LastUpdate = element.Value; @@ -131,18 +139,18 @@ public void Save() private IEnumerable GetSaveElements() { yield return new XElement("DX9", - new XElement("StructureAddress", string.Join(",", DX9_StructureAddress.Select(x => x.ToString("X")))), - new XElement("ZoomCurrent", DX9_ZoomCurrent.ToString("X")), - new XElement("ZoomMax", DX9_ZoomMax.ToString("X")), - new XElement("FovCurrent", DX9_FovCurrent.ToString("X")), - new XElement("FovMax", DX9_FovMax.ToString("X")) + new XElement("StructureAddress", string.Join(",", DX9_StructureAddress.Select(x => x.ToString("X", CultureInfo.InvariantCulture)))), + new XElement("ZoomCurrent", DX9_ZoomCurrent.ToString("X", CultureInfo.InvariantCulture)), + new XElement("ZoomMax", DX9_ZoomMax.ToString("X", CultureInfo.InvariantCulture)), + new XElement("FovCurrent", DX9_FovCurrent.ToString("X", CultureInfo.InvariantCulture)), + new XElement("FovMax", DX9_FovMax.ToString("X", CultureInfo.InvariantCulture)) ); yield return new XElement("DX11", - new XElement("StructureAddress", string.Join(",", DX11_StructureAddress.Select(x => x.ToString("X")))), - new XElement("ZoomCurrent", DX11_ZoomCurrent.ToString("X")), - new XElement("ZoomMax", DX11_ZoomMax.ToString("X")), - new XElement("FovCurrent", DX11_FovCurrent.ToString("X")), - new XElement("FovMax", DX11_FovMax.ToString("X")) + new XElement("StructureAddress", string.Join(",", DX11_StructureAddress.Select(x => x.ToString("X", CultureInfo.InvariantCulture)))), + new XElement("ZoomCurrent", DX11_ZoomCurrent.ToString("X", CultureInfo.InvariantCulture)), + new XElement("ZoomMax", DX11_ZoomMax.ToString("X", CultureInfo.InvariantCulture)), + new XElement("FovCurrent", DX11_FovCurrent.ToString("X", CultureInfo.InvariantCulture)), + new XElement("FovMax", DX11_FovMax.ToString("X", CultureInfo.InvariantCulture)) ); yield return new XElement("LastUpdate", LastUpdate); @@ -150,9 +158,9 @@ private IEnumerable GetSaveElements() { yield break; } - yield return new XElement("AutoApply", AutoApply); - yield return new XElement("DesiredZoom", DesiredZoom); - yield return new XElement("DesiredFov", DesiredFov); + yield return new XElement("AutoApply", AutoApply.ToString(CultureInfo.InvariantCulture)); + yield return new XElement("DesiredZoom", DesiredZoom.ToString(CultureInfo.InvariantCulture)); + yield return new XElement("DesiredFov", DesiredFov.ToString(CultureInfo.InvariantCulture)); yield return new XElement("OffsetUpdateLocation", OffsetUpdateLocation); } }