mirror of
https://github.com/ncblakely/GiantsTools
synced 2024-11-21 21:55:38 +01:00
Compare commits
No commits in common. "ac6235d845d513d03808d4e924a857e0f132a760" and "31625f7466042c8705c392d75fcf3a973eca0e68" have entirely different histories.
ac6235d845
...
31625f7466
108
Giants.Launcher/Forms/OptionsForm.Designer.cs
generated
108
Giants.Launcher/Forms/OptionsForm.Designer.cs
generated
@ -31,9 +31,7 @@
|
||||
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();
|
||||
@ -45,12 +43,13 @@
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnResetDefaults = new System.Windows.Forms.Button();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.cmbBranch = new System.Windows.Forms.ComboBox();
|
||||
this.chkUpdates = new System.Windows.Forms.CheckBox();
|
||||
this.cmbBranch = new System.Windows.Forms.ComboBox();
|
||||
this.BranchGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.BranchGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cmbRenderer
|
||||
@ -84,22 +83,11 @@
|
||||
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);
|
||||
@ -107,20 +95,11 @@
|
||||
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, 176);
|
||||
this.groupBox1.Size = new System.Drawing.Size(509, 143);
|
||||
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;
|
||||
@ -156,7 +135,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, 199);
|
||||
this.groupBox2.Location = new System.Drawing.Point(16, 170);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Padding = new System.Windows.Forms.Padding(4);
|
||||
@ -169,6 +148,10 @@
|
||||
//
|
||||
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";
|
||||
@ -177,29 +160,29 @@
|
||||
//
|
||||
// chkTripleBuffering
|
||||
//
|
||||
this.chkTripleBuffering.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.chkTripleBuffering.Location = new System.Drawing.Point(13, 79);
|
||||
this.chkTripleBuffering.AutoSize = true;
|
||||
this.chkTripleBuffering.Location = new System.Drawing.Point(16, 79);
|
||||
this.chkTripleBuffering.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.chkTripleBuffering.Name = "chkTripleBuffering";
|
||||
this.chkTripleBuffering.Size = new System.Drawing.Size(136, 27);
|
||||
this.chkTripleBuffering.Size = new System.Drawing.Size(119, 20);
|
||||
this.chkTripleBuffering.TabIndex = 2;
|
||||
this.chkTripleBuffering.Text = "Triple Buffering";
|
||||
this.chkTripleBuffering.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkVSync
|
||||
//
|
||||
this.chkVSync.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.chkVSync.Location = new System.Drawing.Point(13, 53);
|
||||
this.chkVSync.AutoSize = true;
|
||||
this.chkVSync.Location = new System.Drawing.Point(16, 53);
|
||||
this.chkVSync.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.chkVSync.Name = "chkVSync";
|
||||
this.chkVSync.Size = new System.Drawing.Size(136, 20);
|
||||
this.chkVSync.Size = new System.Drawing.Size(107, 20);
|
||||
this.chkVSync.TabIndex = 1;
|
||||
this.chkVSync.Text = "Vertical Sync";
|
||||
this.chkVSync.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(317, 304);
|
||||
this.btnOK.Location = new System.Drawing.Point(317, 272);
|
||||
this.btnOK.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(100, 28);
|
||||
@ -211,7 +194,7 @@
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(425, 304);
|
||||
this.btnCancel.Location = new System.Drawing.Point(425, 272);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(100, 28);
|
||||
@ -222,10 +205,10 @@
|
||||
//
|
||||
// btnResetDefaults
|
||||
//
|
||||
this.btnResetDefaults.Location = new System.Drawing.Point(410, 205);
|
||||
this.btnResetDefaults.Location = new System.Drawing.Point(400, 170);
|
||||
this.btnResetDefaults.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.btnResetDefaults.Name = "btnResetDefaults";
|
||||
this.btnResetDefaults.Size = new System.Drawing.Size(115, 28);
|
||||
this.btnResetDefaults.Size = new System.Drawing.Size(125, 28);
|
||||
this.btnResetDefaults.TabIndex = 8;
|
||||
this.btnResetDefaults.Text = "Reset Defaults";
|
||||
this.btnResetDefaults.UseVisualStyleBackColor = true;
|
||||
@ -233,46 +216,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(185, 199);
|
||||
this.groupBox3.Location = new System.Drawing.Point(181, 167);
|
||||
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(221, 97);
|
||||
this.groupBox3.Size = new System.Drawing.Size(169, 54);
|
||||
this.groupBox3.TabIndex = 6;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Updates";
|
||||
this.groupBox3.Text = "Other";
|
||||
//
|
||||
// label5
|
||||
// chkUpdates
|
||||
//
|
||||
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:";
|
||||
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;
|
||||
//
|
||||
// cmbBranch
|
||||
//
|
||||
this.cmbBranch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbBranch.FormattingEnabled = true;
|
||||
this.cmbBranch.Location = new System.Drawing.Point(66, 49);
|
||||
this.cmbBranch.Location = new System.Drawing.Point(27, 17);
|
||||
this.cmbBranch.Name = "cmbBranch";
|
||||
this.cmbBranch.Size = new System.Drawing.Size(124, 24);
|
||||
this.cmbBranch.TabIndex = 9;
|
||||
//
|
||||
// chkUpdates
|
||||
// BranchGroupBox
|
||||
//
|
||||
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;
|
||||
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;
|
||||
//
|
||||
// OptionsForm
|
||||
//
|
||||
@ -281,8 +264,9 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size(541, 346);
|
||||
this.ClientSize = new System.Drawing.Size(541, 316);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.BranchGroupBox);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.btnResetDefaults);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
@ -302,8 +286,10 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@ -313,9 +299,7 @@
|
||||
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;
|
||||
@ -329,6 +313,6 @@
|
||||
private System.Windows.Forms.CheckBox chkUpdates;
|
||||
private System.Windows.Forms.ComboBox cmbMode;
|
||||
private System.Windows.Forms.ComboBox cmbBranch;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.GroupBox BranchGroupBox;
|
||||
}
|
||||
}
|
@ -38,23 +38,22 @@ 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()
|
||||
{
|
||||
@ -67,6 +66,8 @@ namespace Giants.Launcher
|
||||
cmbBranch.Items.AddRange(branches.ToArray());
|
||||
|
||||
cmbBranch.SelectedItem = this.currentBranchName;
|
||||
|
||||
BranchGroupBox.Visible = true;
|
||||
cmbBranch.Visible = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -99,15 +100,13 @@ namespace Giants.Launcher
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer = GameSettings.CompatibleRenderers.Find(r => r.FileName == "gg_dx9r.dll");
|
||||
renderer = GameSettings.CompatibleRenderers.Find(r => r.FileName == "gg_dx7r.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)
|
||||
@ -118,11 +117,6 @@ 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)
|
||||
@ -177,35 +171,7 @@ namespace Giants.Launcher
|
||||
this.cmbAntialiasing.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
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)
|
||||
private bool IsPowerOfTwo(int x)
|
||||
{
|
||||
return (x != 0) && ((x & (x - 1)) == 0);
|
||||
}
|
||||
@ -225,23 +191,6 @@ 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()
|
||||
@ -266,6 +215,18 @@ 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)
|
||||
@ -291,7 +252,6 @@ namespace Giants.Launcher
|
||||
}
|
||||
|
||||
this.PopulateAntialiasing();
|
||||
this.PopulateMode();
|
||||
this.PopulateAnisotropy();
|
||||
}
|
||||
|
||||
@ -311,9 +271,10 @@ namespace Giants.Launcher
|
||||
}
|
||||
|
||||
GameSettings.Modify(RegistryKeys.Antialiasing, this.cmbAntialiasing.SelectedValue);
|
||||
GameSettings.Modify(RegistryKeys.AnisotropicFiltering, this.cmbAnisotropy.SelectedValue);
|
||||
bool windowed = (WindowType)this.cmbMode.SelectedValue == WindowType.Windowed;
|
||||
GameSettings.Modify(RegistryKeys.Windowed, windowed == true ? 1 : 0);
|
||||
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.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);
|
||||
|
@ -43,18 +43,16 @@ namespace Giants.Launcher
|
||||
public static void SetDefaults(string gamePath)
|
||||
{
|
||||
// Set default settings:
|
||||
Settings[RegistryKeys.Renderer] = "gg_dx9r.dll";
|
||||
Settings[RegistryKeys.Renderer] = "gg_dx7r.dll";
|
||||
Settings[RegistryKeys.Antialiasing] = 0;
|
||||
Settings[RegistryKeys.AnisotropicFiltering] = 0;
|
||||
Settings[RegistryKeys.Windowed] = 1;
|
||||
Settings[RegistryKeys.VideoDepth] = 32;
|
||||
Settings[RegistryKeys.Windowed] = 0;
|
||||
Settings[RegistryKeys.BorderlessWindow] = 0;
|
||||
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())
|
||||
{
|
||||
@ -66,16 +64,18 @@ namespace Giants.Launcher
|
||||
caption: Resources.Error,
|
||||
buttons: MessageBoxButtons.OK,
|
||||
icon: MessageBoxIcon.Error);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Select the highest priority renderer
|
||||
var bestRenderer = CompatibleRenderers.Max();
|
||||
Settings[RegistryKeys.Renderer] = Path.GetFileName(bestRenderer.FilePath);
|
||||
Settings[RegistryKeys.AnisotropicFiltering] = bestRenderer.MaxAnisotropy;
|
||||
Settings[RegistryKeys.Antialiasing] = bestRenderer.MaxAntialiasing;
|
||||
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;
|
||||
}
|
||||
|
||||
public static void Load(string gamePath)
|
||||
@ -91,7 +91,9 @@ 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));
|
||||
@ -117,7 +119,9 @@ 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);
|
||||
|
@ -118,7 +118,6 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\OptionsForm.resx">
|
||||
<DependentUpon>OptionsForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
|
@ -29,10 +29,6 @@ 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)
|
||||
@ -47,8 +43,6 @@ namespace Giants.Launcher
|
||||
|
||||
NativeMethods.FreeLibrary(pDll);
|
||||
|
||||
Directory.SetCurrentDirectory(currentDirectory);
|
||||
|
||||
return rendererSupported;
|
||||
}
|
||||
|
||||
|
20
Giants.Launcher/Properties/Resources.Designer.cs
generated
20
Giants.Launcher/Properties/Resources.Designer.cs
generated
@ -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", "17.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
@ -181,15 +181,6 @@ 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>
|
||||
@ -348,14 +339,5 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,10 +208,4 @@
|
||||
<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>
|
@ -4,6 +4,7 @@
|
||||
{
|
||||
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";
|
||||
@ -11,6 +12,7 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,7 @@ namespace Giants.Launcher
|
||||
[Flags]
|
||||
public enum RendererFlag
|
||||
{
|
||||
None = 0x0,
|
||||
|
||||
Unused = 0x1,
|
||||
LowBitDepthAllowed = 0x1,
|
||||
|
||||
// Multisampling support flags:
|
||||
MSAA2x = 0x2,
|
||||
@ -22,7 +20,6 @@ namespace Giants.Launcher
|
||||
// Other options:
|
||||
VSync = 0x20,
|
||||
TripleBuffer = 0x40,
|
||||
Fullscreen = 0x80,
|
||||
};
|
||||
|
||||
public RendererInfo(string filePath, ref RendererInterop.GFXCapabilityInfo gfxCaps)
|
||||
@ -33,23 +30,6 @@ 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()
|
||||
@ -74,7 +54,6 @@ 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;
|
||||
@ -86,7 +65,6 @@ 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);
|
||||
@ -96,7 +74,6 @@ 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; }
|
||||
|
@ -4,5 +4,6 @@
|
||||
{
|
||||
Fullscreen = 0,
|
||||
Windowed = 1,
|
||||
Borderless = 2,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user