diff --git a/Giants.Launcher/Forms/OptionsForm.Designer.cs b/Giants.Launcher/Forms/OptionsForm.Designer.cs index 9de06ed..da1781b 100644 --- a/Giants.Launcher/Forms/OptionsForm.Designer.cs +++ b/Giants.Launcher/Forms/OptionsForm.Designer.cs @@ -169,10 +169,6 @@ // this.cmbMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbMode.FormattingEnabled = true; - this.cmbMode.Items.AddRange(new object[] { - "Fullscreen", - "Windowed", - "Borderless"}); this.cmbMode.Location = new System.Drawing.Point(16, 23); this.cmbMode.Margin = new System.Windows.Forms.Padding(4); this.cmbMode.Name = "cmbMode"; @@ -185,7 +181,7 @@ this.chkTripleBuffering.Location = new System.Drawing.Point(13, 79); this.chkTripleBuffering.Margin = new System.Windows.Forms.Padding(4); this.chkTripleBuffering.Name = "chkTripleBuffering"; - this.chkTripleBuffering.Size = new System.Drawing.Size(119, 20); + this.chkTripleBuffering.Size = new System.Drawing.Size(136, 27); this.chkTripleBuffering.TabIndex = 2; this.chkTripleBuffering.Text = "Triple Buffering"; this.chkTripleBuffering.UseVisualStyleBackColor = true; @@ -196,7 +192,7 @@ this.chkVSync.Location = new System.Drawing.Point(13, 53); this.chkVSync.Margin = new System.Windows.Forms.Padding(4); this.chkVSync.Name = "chkVSync"; - this.chkVSync.Size = new System.Drawing.Size(119, 20); + this.chkVSync.Size = new System.Drawing.Size(136, 20); this.chkVSync.TabIndex = 1; this.chkVSync.Text = "Vertical Sync"; this.chkVSync.UseVisualStyleBackColor = true; @@ -226,10 +222,10 @@ // // btnResetDefaults // - this.btnResetDefaults.Location = new System.Drawing.Point(400, 205); + this.btnResetDefaults.Location = new System.Drawing.Point(410, 205); this.btnResetDefaults.Margin = new System.Windows.Forms.Padding(4); this.btnResetDefaults.Name = "btnResetDefaults"; - this.btnResetDefaults.Size = new System.Drawing.Size(125, 28); + this.btnResetDefaults.Size = new System.Drawing.Size(115, 28); this.btnResetDefaults.TabIndex = 8; this.btnResetDefaults.Text = "Reset Defaults"; this.btnResetDefaults.UseVisualStyleBackColor = true; @@ -240,11 +236,11 @@ this.groupBox3.Controls.Add(this.label5); this.groupBox3.Controls.Add(this.cmbBranch); this.groupBox3.Controls.Add(this.chkUpdates); - this.groupBox3.Location = new System.Drawing.Point(181, 199); + this.groupBox3.Location = new System.Drawing.Point(185, 199); this.groupBox3.Margin = new System.Windows.Forms.Padding(4); this.groupBox3.Name = "groupBox3"; this.groupBox3.Padding = new System.Windows.Forms.Padding(4); - this.groupBox3.Size = new System.Drawing.Size(211, 97); + this.groupBox3.Size = new System.Drawing.Size(221, 97); this.groupBox3.TabIndex = 6; this.groupBox3.TabStop = false; this.groupBox3.Text = "Updates"; diff --git a/Giants.Launcher/Forms/OptionsForm.cs b/Giants.Launcher/Forms/OptionsForm.cs index ccad733..59df262 100644 --- a/Giants.Launcher/Forms/OptionsForm.cs +++ b/Giants.Launcher/Forms/OptionsForm.cs @@ -46,6 +46,7 @@ namespace Giants.Launcher this.PopulateResolution(); this.PopulateAnisotropy(); this.PopulateAntialiasing(); + this.PopulateMode(); this.SetOptions(); } @@ -176,7 +177,35 @@ namespace Giants.Launcher this.cmbAntialiasing.SelectedIndex = 0; } - private bool IsPowerOfTwo(int x) + private void PopulateMode() + { + var modeOptions = new List>(); + + var renderer = (RendererInfo)this.cmbRenderer.SelectedItem; + if (renderer != null && renderer.Flags.HasFlag(RendererInfo.RendererFlag.Fullscreen)) + modeOptions.Add(new KeyValuePair(Resources.Fullscreen, 0)); + + modeOptions.Add(new KeyValuePair(Resources.Windowed, 1)); + + // Try to keep current selection when repopulating + int? currentValue = null; + if (this.cmbMode.SelectedValue != null) + { + currentValue = (int)this.cmbMode.SelectedValue; + } + + this.cmbMode.DataSource = modeOptions; + this.cmbMode.DisplayMember = "Key"; + this.cmbMode.ValueMember = "Value"; + + if (currentValue != null) + this.cmbMode.SelectedValue = currentValue; + + if (this.cmbMode.SelectedValue == null) + this.cmbMode.SelectedIndex = 0; + } + + private bool IsPowerOfTwo(int x) { return (x != 0) && ((x & (x - 1)) == 0); } @@ -237,8 +266,6 @@ namespace Giants.Launcher private void cmbRenderer_SelectedIndexChanged(object sender, EventArgs e) { - this.cmbMode.SelectedIndex = GameSettings.Get(RegistryKeys.Windowed) == 1 ? 1 : 0; - var renderer = (RendererInfo)this.cmbRenderer.SelectedItem; if ((renderer.Flags & RendererInfo.RendererFlag.VSync) != RendererInfo.RendererFlag.VSync) @@ -264,6 +291,7 @@ namespace Giants.Launcher } this.PopulateAntialiasing(); + this.PopulateMode(); this.PopulateAnisotropy(); } diff --git a/Giants.Launcher/GameSettings.cs b/Giants.Launcher/GameSettings.cs index ade2bcf..f1158fb 100644 --- a/Giants.Launcher/GameSettings.cs +++ b/Giants.Launcher/GameSettings.cs @@ -46,14 +46,12 @@ namespace Giants.Launcher Settings[RegistryKeys.Renderer] = "gg_dx9r.dll"; Settings[RegistryKeys.Antialiasing] = 0; Settings[RegistryKeys.AnisotropicFiltering] = 0; - Settings[RegistryKeys.VideoDepth] = 32; Settings[RegistryKeys.Windowed] = 1; - Settings[RegistryKeys.BorderlessWindow] = 1; Settings[RegistryKeys.VerticalSync] = 1; Settings[RegistryKeys.TripleBuffering] = 1; Settings[RegistryKeys.NoAutoUpdate] = 0; - // Set the current desktop resolution, leaving bit depth at the default 32: + // Set the current desktop resolution Settings[RegistryKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width; Settings[RegistryKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height; @@ -93,7 +91,6 @@ namespace Giants.Launcher Settings[RegistryKeys.AnisotropicFiltering] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.AnisotropicFiltering, Settings[RegistryKeys.AnisotropicFiltering], typeof(int)); Settings[RegistryKeys.VideoWidth] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoWidth, Settings[RegistryKeys.VideoWidth], typeof(int)); Settings[RegistryKeys.VideoHeight] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoHeight, Settings[RegistryKeys.VideoHeight], typeof(int)); - Settings[RegistryKeys.VideoDepth] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VideoDepth, Settings[RegistryKeys.VideoDepth], typeof(int)); Settings[RegistryKeys.Windowed] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.Windowed, Settings[RegistryKeys.Windowed], typeof(int)); Settings[RegistryKeys.VerticalSync] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.VerticalSync, Settings[RegistryKeys.VerticalSync], typeof(int)); Settings[RegistryKeys.TripleBuffering] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.TripleBuffering, Settings[RegistryKeys.TripleBuffering], typeof(int)); @@ -120,9 +117,7 @@ namespace Giants.Launcher Registry.SetValue(RegistryKey, RegistryKeys.AnisotropicFiltering, Settings[RegistryKeys.AnisotropicFiltering], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.VideoWidth, Settings[RegistryKeys.VideoWidth], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.VideoHeight, Settings[RegistryKeys.VideoHeight], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, RegistryKeys.VideoDepth, Settings[RegistryKeys.VideoDepth], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.Windowed, Settings[RegistryKeys.Windowed], RegistryValueKind.DWord); - Registry.SetValue(RegistryKey, RegistryKeys.BorderlessWindow, Settings[RegistryKeys.BorderlessWindow], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.VerticalSync, Settings[RegistryKeys.VerticalSync], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.TripleBuffering, Settings[RegistryKeys.TripleBuffering], RegistryValueKind.DWord); Registry.SetValue(RegistryKey, RegistryKeys.NoAutoUpdate, Settings[RegistryKeys.NoAutoUpdate], RegistryValueKind.DWord); diff --git a/Giants.Launcher/Properties/Resources.Designer.cs b/Giants.Launcher/Properties/Resources.Designer.cs index 07075c4..02c6121 100644 --- a/Giants.Launcher/Properties/Resources.Designer.cs +++ b/Giants.Launcher/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Giants.Launcher { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -181,6 +181,15 @@ namespace Giants.Launcher { } } + /// + /// Looks up a localized string similar to Fullscreen. + /// + internal static string Fullscreen { + get { + return ResourceManager.GetString("Fullscreen", resourceCulture); + } + } + /// /// Looks up a localized string similar to Download complete. The launcher will now close to apply the update.. /// @@ -339,5 +348,14 @@ namespace Giants.Launcher { return ResourceManager.GetString("UpdateDownloadFailedTitle", resourceCulture); } } + + /// + /// Looks up a localized string similar to Windowed. + /// + internal static string Windowed { + get { + return ResourceManager.GetString("Windowed", resourceCulture); + } + } } } diff --git a/Giants.Launcher/Properties/Resources.resx b/Giants.Launcher/Properties/Resources.resx index 1a3bb72..af08d86 100644 --- a/Giants.Launcher/Properties/Resources.resx +++ b/Giants.Launcher/Properties/Resources.resx @@ -208,4 +208,10 @@ Giants: Citizen Kabuto + + Fullscreen + + + Windowed + \ No newline at end of file diff --git a/Giants.Launcher/RegistryKeys.cs b/Giants.Launcher/RegistryKeys.cs index f1ed4fb..2583191 100644 --- a/Giants.Launcher/RegistryKeys.cs +++ b/Giants.Launcher/RegistryKeys.cs @@ -11,7 +11,6 @@ public const string VerticalSync = "VerticalSync"; public const string VideoWidth = "VideoWidth"; public const string VideoHeight = "VideoHeight"; - public const string VideoDepth = "VideoDepth"; public const string Windowed = "Windowed"; } } diff --git a/Giants.Launcher/Renderer/RendererInfo.cs b/Giants.Launcher/Renderer/RendererInfo.cs index 8095c8f..b17d805 100644 --- a/Giants.Launcher/Renderer/RendererInfo.cs +++ b/Giants.Launcher/Renderer/RendererInfo.cs @@ -9,7 +9,9 @@ namespace Giants.Launcher [Flags] public enum RendererFlag { - LowBitDepthAllowed = 0x1, + None = 0x0, + + Unused = 0x1, // Multisampling support flags: MSAA2x = 0x2, @@ -20,6 +22,7 @@ namespace Giants.Launcher // Other options: VSync = 0x20, TripleBuffer = 0x40, + Fullscreen = 0x80, }; public RendererInfo(string filePath, ref RendererInterop.GFXCapabilityInfo gfxCaps)