1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-16 11:45:38 +01:00

Remove borderless option (windowed is now borderless); let renderer specify whether it supports fullscreen.

This commit is contained in:
Nick Blakely 2022-11-09 18:58:08 -08:00
parent 8d918dcaf1
commit 6881cd1327
7 changed files with 67 additions and 22 deletions

View File

@ -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";

View File

@ -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<KeyValuePair<string, int>>();
var renderer = (RendererInfo)this.cmbRenderer.SelectedItem;
if (renderer != null && renderer.Flags.HasFlag(RendererInfo.RendererFlag.Fullscreen))
modeOptions.Add(new KeyValuePair<string, int>(Resources.Fullscreen, 0));
modeOptions.Add(new KeyValuePair<string, int>(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<int>(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();
}

View File

@ -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);

View File

@ -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 {
}
}
/// <summary>
/// Looks up a localized string similar to Fullscreen.
/// </summary>
internal static string Fullscreen {
get {
return ResourceManager.GetString("Fullscreen", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Download complete. The launcher will now close to apply the update..
/// </summary>
@ -339,5 +348,14 @@ namespace Giants.Launcher {
return ResourceManager.GetString("UpdateDownloadFailedTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Windowed.
/// </summary>
internal static string Windowed {
get {
return ResourceManager.GetString("Windowed", resourceCulture);
}
}
}
}

View File

@ -208,4 +208,10 @@
<data name="AppName" xml:space="preserve">
<value>Giants: Citizen Kabuto</value>
</data>
<data name="Fullscreen" xml:space="preserve">
<value>Fullscreen</value>
</data>
<data name="Windowed" xml:space="preserve">
<value>Windowed</value>
</data>
</root>

View File

@ -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";
}
}

View File

@ -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)