Compare commits

...

7 Commits

Author SHA1 Message Date
ncblakely ac6235d845
Merge pull request #23 from ncblakely/users/tos/modefix
Use value instead of index of mode selection.
2022-11-09 19:46:55 -08:00
Nick Blakely 6208ad77e9 Use value instead of index of mode selection. 2022-11-09 19:46:28 -08:00
ncblakely c9232cc308
Merge pull request #22 from ncblakely/users/tos/modeselection
Remove borderless option (windowed is now borderless)
2022-11-09 18:58:57 -08:00
Nick Blakely 6881cd1327 Remove borderless option (windowed is now borderless); let renderer specify whether it supports fullscreen. 2022-11-09 18:58:08 -08:00
ncblakely 8d918dcaf1
Merge pull request #21 from ncblakely/features/d3d11
Merge D3D11 feature branch.
2022-11-09 18:54:34 -08:00
Nick Blakely 62dbc7f3da Remove borderless option (windowed is now borderless); let renderer specify whether it supports fullscreen. 2022-11-09 18:53:06 -08:00
Nick Blakely 709fe37557 Remove DX7 renderer and support anisotropic filtering selection. 2022-10-29 17:45:12 -07:00
10 changed files with 200 additions and 98 deletions

View File

@ -31,7 +31,9 @@
this.cmbRenderer = new System.Windows.Forms.ComboBox();
this.cmbResolution = new System.Windows.Forms.ComboBox();
this.cmbAntialiasing = new System.Windows.Forms.ComboBox();
this.cmbAnisotropy = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
@ -43,13 +45,12 @@
this.btnCancel = new System.Windows.Forms.Button();
this.btnResetDefaults = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.chkUpdates = new System.Windows.Forms.CheckBox();
this.label5 = new System.Windows.Forms.Label();
this.cmbBranch = new System.Windows.Forms.ComboBox();
this.BranchGroupBox = new System.Windows.Forms.GroupBox();
this.chkUpdates = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.BranchGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cmbRenderer
@ -83,11 +84,22 @@
this.cmbAntialiasing.Size = new System.Drawing.Size(335, 24);
this.cmbAntialiasing.TabIndex = 2;
//
// cmbAnisotropy
//
this.cmbAnisotropy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbAnisotropy.FormattingEnabled = true;
this.cmbAnisotropy.Location = new System.Drawing.Point(165, 133);
this.cmbAnisotropy.Name = "cmbAnisotropy";
this.cmbAnisotropy.Size = new System.Drawing.Size(335, 24);
this.cmbAnisotropy.TabIndex = 3;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.cmbAnisotropy);
this.groupBox1.Controls.Add(this.cmbRenderer);
this.groupBox1.Controls.Add(this.cmbResolution);
this.groupBox1.Controls.Add(this.cmbAntialiasing);
@ -95,11 +107,20 @@
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(509, 143);
this.groupBox1.Size = new System.Drawing.Size(509, 176);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Graphics Settings";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(26, 138);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(127, 16);
this.label4.TabIndex = 7;
this.label4.Text = "Anisotropic Filtering:";
//
// label3
//
this.label3.AutoSize = true;
@ -135,7 +156,7 @@
this.groupBox2.Controls.Add(this.cmbMode);
this.groupBox2.Controls.Add(this.chkTripleBuffering);
this.groupBox2.Controls.Add(this.chkVSync);
this.groupBox2.Location = new System.Drawing.Point(16, 170);
this.groupBox2.Location = new System.Drawing.Point(16, 199);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
@ -148,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";
@ -160,29 +177,29 @@
//
// chkTripleBuffering
//
this.chkTripleBuffering.AutoSize = true;
this.chkTripleBuffering.Location = new System.Drawing.Point(16, 79);
this.chkTripleBuffering.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
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;
//
// chkVSync
//
this.chkVSync.AutoSize = true;
this.chkVSync.Location = new System.Drawing.Point(16, 53);
this.chkVSync.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
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(107, 20);
this.chkVSync.Size = new System.Drawing.Size(136, 20);
this.chkVSync.TabIndex = 1;
this.chkVSync.Text = "Vertical Sync";
this.chkVSync.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(317, 272);
this.btnOK.Location = new System.Drawing.Point(317, 304);
this.btnOK.Margin = new System.Windows.Forms.Padding(4);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(100, 28);
@ -194,7 +211,7 @@
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(425, 272);
this.btnCancel.Location = new System.Drawing.Point(425, 304);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 28);
@ -205,10 +222,10 @@
//
// btnResetDefaults
//
this.btnResetDefaults.Location = new System.Drawing.Point(400, 170);
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;
@ -216,46 +233,46 @@
//
// groupBox3
//
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, 167);
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(169, 54);
this.groupBox3.Size = new System.Drawing.Size(221, 97);
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Other";
this.groupBox3.Text = "Updates";
//
// chkUpdates
// label5
//
this.chkUpdates.AutoSize = true;
this.chkUpdates.Location = new System.Drawing.Point(11, 24);
this.chkUpdates.Margin = new System.Windows.Forms.Padding(4);
this.chkUpdates.Name = "chkUpdates";
this.chkUpdates.Size = new System.Drawing.Size(140, 20);
this.chkUpdates.TabIndex = 1;
this.chkUpdates.Text = "Check for Updates";
this.chkUpdates.UseVisualStyleBackColor = true;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(8, 54);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(52, 16);
this.label5.TabIndex = 10;
this.label5.Text = "Branch:";
//
// cmbBranch
//
this.cmbBranch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbBranch.FormattingEnabled = true;
this.cmbBranch.Location = new System.Drawing.Point(27, 17);
this.cmbBranch.Location = new System.Drawing.Point(66, 49);
this.cmbBranch.Name = "cmbBranch";
this.cmbBranch.Size = new System.Drawing.Size(124, 24);
this.cmbBranch.TabIndex = 9;
//
// BranchGroupBox
// chkUpdates
//
this.BranchGroupBox.Controls.Add(this.cmbBranch);
this.BranchGroupBox.Location = new System.Drawing.Point(181, 222);
this.BranchGroupBox.Name = "BranchGroupBox";
this.BranchGroupBox.Size = new System.Drawing.Size(169, 49);
this.BranchGroupBox.TabIndex = 10;
this.BranchGroupBox.TabStop = false;
this.BranchGroupBox.Text = "Branch";
this.BranchGroupBox.Visible = false;
this.chkUpdates.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.chkUpdates.Location = new System.Drawing.Point(8, 25);
this.chkUpdates.Margin = new System.Windows.Forms.Padding(4);
this.chkUpdates.Name = "chkUpdates";
this.chkUpdates.Size = new System.Drawing.Size(182, 20);
this.chkUpdates.TabIndex = 1;
this.chkUpdates.Text = "Check for Updates";
this.chkUpdates.UseVisualStyleBackColor = true;
//
// OptionsForm
//
@ -264,9 +281,8 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(541, 316);
this.ClientSize = new System.Drawing.Size(541, 346);
this.ControlBox = false;
this.Controls.Add(this.BranchGroupBox);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.btnResetDefaults);
this.Controls.Add(this.btnCancel);
@ -286,10 +302,8 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.BranchGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -299,7 +313,9 @@
private System.Windows.Forms.ComboBox cmbRenderer;
private System.Windows.Forms.ComboBox cmbResolution;
private System.Windows.Forms.ComboBox cmbAntialiasing;
private System.Windows.Forms.ComboBox cmbAnisotropy;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
@ -313,6 +329,6 @@
private System.Windows.Forms.CheckBox chkUpdates;
private System.Windows.Forms.ComboBox cmbMode;
private System.Windows.Forms.ComboBox cmbBranch;
private System.Windows.Forms.GroupBox BranchGroupBox;
private System.Windows.Forms.Label label5;
}
}

View File

@ -38,22 +38,23 @@ namespace Giants.Launcher
this.config.TryGetBool(ConfigSections.Update, ConfigKeys.EnableBranchSelection, defaultValue: false, out bool enableBranchSelection);
this.enableBranchSelection = enableBranchSelection;
// Must come first as other options depend on it
this.PopulateRenderers();
this.SetRenderer();
this.PopulateResolution();
this.PopulateAnisotropy();
this.PopulateAntialiasing();
this.PopulateMode();
this.SetOptions();
}
private async void OptionsForm_Load(object sender, EventArgs e)
{
// Must come first as other options depend on it
this.PopulateRenderers();
this.SetRenderer();
this.PopulateResolution();
this.PopulateAnisotropy();
this.PopulateAntialiasing();
await this.PopulateBranches();
this.SetOptions();
}
}
private async Task PopulateBranches()
{
@ -66,8 +67,6 @@ namespace Giants.Launcher
cmbBranch.Items.AddRange(branches.ToArray());
cmbBranch.SelectedItem = this.currentBranchName;
BranchGroupBox.Visible = true;
cmbBranch.Visible = true;
}
catch (Exception e)
@ -100,13 +99,15 @@ namespace Giants.Launcher
}
else
{
renderer = GameSettings.CompatibleRenderers.Find(r => r.FileName == "gg_dx7r.dll");
renderer = GameSettings.CompatibleRenderers.Find(r => r.FileName == "gg_dx9r.dll");
this.cmbRenderer.SelectedItem = renderer;
}
}
private void SetOptions()
{
SetRenderer();
var resolutions = (List<ScreenResolution>)this.cmbResolution.DataSource;
this.cmbResolution.SelectedItem = resolutions.Find(r => r.Width == GameSettings.Get<int>(RegistryKeys.VideoWidth) && r.Height == GameSettings.Get<int>(RegistryKeys.VideoHeight));
if (this.cmbResolution.SelectedItem == null)
@ -117,6 +118,11 @@ namespace Giants.Launcher
if (this.cmbAntialiasing.SelectedItem == null)
this.cmbAntialiasing.SelectedIndex = 0;
var anisotropyOptions = (List<KeyValuePair<string, int>>)this.cmbAnisotropy.DataSource;
this.cmbAnisotropy.SelectedItem = anisotropyOptions.Find(o => o.Value == GameSettings.Get<int>(RegistryKeys.AnisotropicFiltering));
if (this.cmbAnisotropy.SelectedItem == null)
this.cmbAnisotropy.SelectedIndex = 0;
this.chkUpdates.Checked = GameSettings.Get<int>(RegistryKeys.NoAutoUpdate) != 1;
if (this.enableBranchSelection)
@ -171,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);
}
@ -191,6 +225,23 @@ namespace Giants.Launcher
anisotropyOptions.Add(new KeyValuePair<string,int>(string.Format(Resources.OptionSamples, i), i));
}
}
// Try to keep current selection when repopulating
int? currentValue = null;
if (this.cmbAnisotropy.SelectedValue != null)
{
currentValue = (int)this.cmbAnisotropy.SelectedValue;
}
this.cmbAnisotropy.DataSource = anisotropyOptions;
this.cmbAnisotropy.DisplayMember = "Key";
this.cmbAnisotropy.ValueMember = "Value";
if (currentValue != null)
this.cmbAnisotropy.SelectedValue = currentValue;
if (this.cmbAnisotropy.SelectedValue == null)
this.cmbAnisotropy.SelectedIndex = 0;
}
private void PopulateResolution()
@ -215,18 +266,6 @@ namespace Giants.Launcher
private void cmbRenderer_SelectedIndexChanged(object sender, EventArgs e)
{
bool windowed = GameSettings.Get<int>(RegistryKeys.Windowed) == 1;
if (windowed)
{
bool borderless = GameSettings.Get<int>(RegistryKeys.BorderlessWindow) == 1;
if (borderless)
this.cmbMode.SelectedIndex = 2;
else
this.cmbMode.SelectedIndex = 1;
}
else
this.cmbMode.SelectedIndex = 0;
var renderer = (RendererInfo)this.cmbRenderer.SelectedItem;
if ((renderer.Flags & RendererInfo.RendererFlag.VSync) != RendererInfo.RendererFlag.VSync)
@ -252,6 +291,7 @@ namespace Giants.Launcher
}
this.PopulateAntialiasing();
this.PopulateMode();
this.PopulateAnisotropy();
}
@ -271,10 +311,9 @@ namespace Giants.Launcher
}
GameSettings.Modify(RegistryKeys.Antialiasing, this.cmbAntialiasing.SelectedValue);
bool windowed = (WindowType)this.cmbMode.SelectedIndex == WindowType.Windowed || (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless;
GameSettings.Modify(RegistryKeys.Windowed, windowed == true ? 1 : 0);
bool borderless = (WindowType)this.cmbMode.SelectedIndex == WindowType.Borderless;
GameSettings.Modify(RegistryKeys.BorderlessWindow, borderless == true ? 1 : 0);
GameSettings.Modify(RegistryKeys.AnisotropicFiltering, this.cmbAnisotropy.SelectedValue);
bool windowed = (WindowType)this.cmbMode.SelectedValue == WindowType.Windowed;
GameSettings.Modify(RegistryKeys.Windowed, windowed == true ? 1 : 0);
GameSettings.Modify(RegistryKeys.VerticalSync, this.chkVSync.Checked == true ? 1 : 0);
GameSettings.Modify(RegistryKeys.TripleBuffering, this.chkTripleBuffering.Checked == true ? 1 : 0);
GameSettings.Modify(RegistryKeys.NoAutoUpdate, this.chkUpdates.Checked == false ? 1 : 0);

View File

@ -43,16 +43,18 @@ namespace Giants.Launcher
public static void SetDefaults(string gamePath)
{
// Set default settings:
Settings[RegistryKeys.Renderer] = "gg_dx7r.dll";
Settings[RegistryKeys.Renderer] = "gg_dx9r.dll";
Settings[RegistryKeys.Antialiasing] = 0;
Settings[RegistryKeys.AnisotropicFiltering] = 0;
Settings[RegistryKeys.VideoDepth] = 32;
Settings[RegistryKeys.Windowed] = 0;
Settings[RegistryKeys.BorderlessWindow] = 0;
Settings[RegistryKeys.Windowed] = 1;
Settings[RegistryKeys.VerticalSync] = 1;
Settings[RegistryKeys.TripleBuffering] = 1;
Settings[RegistryKeys.NoAutoUpdate] = 0;
// Set the current desktop resolution
Settings[RegistryKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width;
Settings[RegistryKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height;
// Get a list of renderers compatible with the user's system
if (!CompatibleRenderers.Any())
{
@ -64,18 +66,16 @@ namespace Giants.Launcher
caption: Resources.Error,
buttons: MessageBoxButtons.OK,
icon: MessageBoxIcon.Error);
return;
}
}
// Select the highest priority renderer
if (CompatibleRenderers.Any())
{
Settings[RegistryKeys.Renderer] = Path.GetFileName(CompatibleRenderers.Max().FilePath);
}
// Set the current desktop resolution, leaving bit depth at the default 32:
Settings[RegistryKeys.VideoWidth] = Screen.PrimaryScreen.Bounds.Width;
Settings[RegistryKeys.VideoHeight] = Screen.PrimaryScreen.Bounds.Height;
var bestRenderer = CompatibleRenderers.Max();
Settings[RegistryKeys.Renderer] = Path.GetFileName(bestRenderer.FilePath);
Settings[RegistryKeys.AnisotropicFiltering] = bestRenderer.MaxAnisotropy;
Settings[RegistryKeys.Antialiasing] = bestRenderer.MaxAntialiasing;
}
public static void Load(string gamePath)
@ -91,9 +91,7 @@ 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.BorderlessWindow] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.BorderlessWindow, Settings[RegistryKeys.BorderlessWindow], 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));
Settings[RegistryKeys.NoAutoUpdate] = RegistryExtensions.GetValue(RegistryKey, RegistryKeys.NoAutoUpdate, Settings[RegistryKeys.NoAutoUpdate], typeof(int));
@ -119,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

@ -118,6 +118,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Forms\OptionsForm.resx">
<DependentUpon>OptionsForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

View File

@ -29,6 +29,10 @@ namespace Giants.Launcher
/// <returns>True if the given renderer is supported by the system.</returns>
public static bool GetRendererCapabilities(string dllPath, ref GFXCapabilityInfo capabilities)
{
string currentDirectory = Directory.GetCurrentDirectory();
Directory.SetCurrentDirectory(Path.GetDirectoryName(dllPath));
bool rendererSupported = false;
IntPtr pDll = NativeMethods.LoadLibrary(dllPath);
if (pDll == IntPtr.Zero)
@ -43,6 +47,8 @@ namespace Giants.Launcher
NativeMethods.FreeLibrary(pDll);
Directory.SetCurrentDirectory(currentDirectory);
return rendererSupported;
}

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

@ -4,7 +4,6 @@
{
public const string Antialiasing = "Antialiasing";
public const string AnisotropicFiltering = "AnisotropicFiltering";
public const string BorderlessWindow = "BorderlessWindow";
public const string GameOptionsVersion = "GameOptionsVersion";
public const string NoAutoUpdate = "NoAutoUpdate";
public const string Renderer = "Renderer";
@ -12,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)
@ -30,6 +33,23 @@ namespace Giants.Launcher
this.Flags = (RendererFlag)gfxCaps.flags;
this.Priority = gfxCaps.priority;
this.Name = gfxCaps.rendererName;
if (this.Flags.HasFlag(RendererFlag.MSAA16x))
{
this.MaxAntialiasing = 16;
}
else if (this.Flags.HasFlag(RendererFlag.MSAA8x))
{
this.MaxAntialiasing = 8;
}
else if (this.Flags.HasFlag(RendererFlag.MSAA4x))
{
this.MaxAntialiasing = 4;
}
else if (this.Flags.HasFlag(RendererFlag.MSAA2x))
{
this.MaxAntialiasing = 2;
}
}
public override string ToString()
@ -54,6 +74,7 @@ namespace Giants.Launcher
this.FilePath == info.FilePath &&
this.FileName == info.FileName &&
this.MaxAnisotropy == info.MaxAnisotropy &&
this.MaxAntialiasing == info.MaxAntialiasing &&
this.Flags == info.Flags &&
this.Priority == info.Priority &&
this.Name == info.Name;
@ -65,6 +86,7 @@ namespace Giants.Launcher
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(this.FilePath);
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(this.FileName);
hashCode = hashCode * -1521134295 + this.MaxAnisotropy.GetHashCode();
hashCode = hashCode * -1521134295 + this.MaxAntialiasing.GetHashCode();
hashCode = hashCode * -1521134295 + this.Flags.GetHashCode();
hashCode = hashCode * -1521134295 + this.Priority.GetHashCode();
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(this.Name);
@ -74,6 +96,7 @@ namespace Giants.Launcher
public string FilePath { get; private set; }
public string FileName { get; private set; }
public int MaxAnisotropy { get; private set; }
public int MaxAntialiasing { get; private set; }
public RendererFlag Flags { get; private set; }
public int Priority { get; private set; }
public string Name { get; set; }

View File

@ -4,6 +4,5 @@
{
Fullscreen = 0,
Windowed = 1,
Borderless = 2,
}
}