From c6d679c382c84ca898c1fdbf0c308f92e13d1839 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 15 Jul 2014 00:50:42 +0000 Subject: [PATCH] Profile config - save and load the selected profile --- BizHawk.Client.Common/config/Config.cs | 11 ++++++ .../config/ProfileConfig.cs | 34 ++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index 4859641878..5202027252 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -100,6 +100,17 @@ namespace BizHawk.Client.Common public MovieEndAction MovieEndAction = MovieEndAction.Finish; + public enum ClientProfile + { + Unknown = 0, + Casual = 1, + Longplay = 2, + Tas = 3, + Custom = 99 + } + + public ClientProfile SelectedProfile = ClientProfile.Unknown; + // N64 public bool N64UseCircularAnalogConstraint = true; diff --git a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index 20c720a0d8..71ddaa4b08 100644 --- a/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -20,10 +20,6 @@ namespace BizHawk.Client.EmuHawk { public partial class ProfileConfig : Form { - // TODO: - // Save the profile selected to Global.Config (Casual is the default) - // Default the dropdown to the current profile selected instead of empty - public ProfileConfig() { InitializeComponent(); @@ -35,6 +31,21 @@ namespace BizHawk.Client.EmuHawk { ProfileSelectComboBox.Items.Remove("Custom Profile"); } + + switch (Global.Config.SelectedProfile) + { + default: + case Config.ClientProfile.Custom: // For now + case Config.ClientProfile.Casual: + ProfileSelectComboBox.SelectedItem = "Casual Gaming"; + break; + case Config.ClientProfile.Longplay: + ProfileSelectComboBox.SelectedItem = "Longplays"; + break; + case Config.ClientProfile.Tas: + ProfileSelectComboBox.SelectedItem = "Tool-assisted Speedruns"; + break; + } } private void OkBtn_Click(object sender, EventArgs e) @@ -210,6 +221,21 @@ namespace BizHawk.Client.EmuHawk //DisplayProfileSettingBoxes(true); } + switch(ProfileSelectComboBox.SelectedItem.ToString()) + { + default: + case "Custom Profile": // For now + case "Casual Gaming": + Global.Config.SelectedProfile = Config.ClientProfile.Casual; + break; + case "Longplays": + Global.Config.SelectedProfile = Config.ClientProfile.Longplay; + break; + case "Tool-assisted Speedruns": + Global.Config.SelectedProfile = Config.ClientProfile.Tas; + break; + } + DialogResult = DialogResult.OK; Close(); }