private bool SavePadConfigurations() { RegistryData registryData = new RegistryData(); string text = registryData.ReadSaveLocationFromRegistry; if (text == "") { return(false); } if (!File.Exists(text)) { Directory.CreateDirectory(text); } text += "\\PlayerInput.cfg"; List <string> list = new List <string>(); GlobalDefs globalDefs = new GlobalDefs(); foreach (OutputConfig outputConfig in GlobalDefs.OutputConfigList) { if (!(outputConfig.mProductGuid == globalDefs.ZERO_GUID)) { list.Add(outputConfig.mProductName.ToString()); string text2 = "$G:"; text2 += outputConfig.mProductGuid.ToString(); string text3 = ""; for (int i = 0; i < outputConfig.mButtonMap.Length; i++) { text3 += outputConfig.mButtonMap[i].ToString(); text3 += " "; } text3 += outputConfig.mMovementType; text2 += "$B:"; text2 += text3; string text4 = ""; for (int j = 0; j < outputConfig.mAxisMap.Length; j++) { text4 += outputConfig.mAxisMap[j].ToString(); text4 += " "; } text2 += "$A:"; text2 += text4; text2 += "$D:"; text2 += outputConfig.mDeadZone.ToString(); text2 += "$"; list.Add(text2); } } File.WriteAllLines(text, list.ToArray()); return(true); }
private void GraphicsConfiguration_Load(object sender, EventArgs e) { int num = DllExterns._GetNumberOfAdapters(); if (num > 0) { this.Adapter_Combo.Enabled = true; this.Resolution_Combo.Enabled = true; this.AA_Combo.Enabled = true; this.Vsync_combo.Enabled = true; this.NoAdapterWarning_label.Visible = false; GlobalDefs.OutputAdapter.ValidAdapter = true; DisplayModes item = default(DisplayModes); item.modeNo = 0; this.mDisplayModesList.Add(item); item.modeNo = 1; this.mDisplayModesList.Add(item); LowHigh item2 = default(LowHigh); item2.bIsHigh = true; this.mShadowList.Add(item2); this.mReflectionList.Add(item2); item2.bIsHigh = false; this.mShadowList.Add(item2); this.mReflectionList.Add(item2); OnOff item3 = default(OnOff); item3.bVsync = true; this.mVsyncList.Add(item3); item3.bVsync = false; this.mVsyncList.Add(item3); for (int i = 0; i < num; i++) { AdapterInfo item4 = default(AdapterInfo); DllExterns._GetAdapterData(i, ref item4); Array.Resize <Resolution>(ref item4.AResArray, item4.NoOfRes); item4.AAList[0] = 0; item4.AAList[1] = 1; Array.Resize <int>(ref item4.AAList, 2); this.mGraphicsAdapterList.Add(item4); } int num2 = 0; int num3 = 0; int num4 = 0; foreach (AdapterInfo adapterInfo in this.mGraphicsAdapterList) { if (adapterInfo.AdapterDescription == GlobalDefs.OutputAdapter.AdapterDescription && adapterInfo.AdapterName == GlobalDefs.OutputAdapter.AdapterName) { num3 = num2; break; } num2++; } int selectedIndex = this.mGraphicsAdapterList[num3].DefaultResIndex; num2 = 0; foreach (Resolution resolution in this.mGraphicsAdapterList[num3].AResArray) { if (resolution.DisplayName == GlobalDefs.OutputAdapter.OutputRes.DisplayName) { selectedIndex = num2; break; } num2++; } num2 = 0; foreach (int num5 in this.mGraphicsAdapterList[num3].AAList) { if (num5 == GlobalDefs.OutputAdapter.AA) { num4 = num2; break; } num2++; } this.Adapter_Combo.DataSource = null; this.Adapter_Combo.Items.Clear(); this.Adapter_Combo.DataSource = this.mGraphicsAdapterList; this.Adapter_Combo.DisplayMember = "DisplayName"; this.Adapter_Combo.SelectedIndex = num3; this.Resolution_Combo.SelectedIndex = selectedIndex; if (this.mAATypesList.Count <AATypes>() > num4) { this.AA_Combo.SelectedIndex = num4; } else { this.AA_Combo.SelectedIndex = 0; } bool flag; bool flag2; bool flag3; bool flag4; if (GlobalDefs.GraphicsConfigFileRead) { this.Windowed_Check.Checked = GlobalDefs.OutputAdapter.bWindowed; flag = GlobalDefs.OutputAdapter.ShadQuality; flag2 = GlobalDefs.OutputAdapter.ReflectQuality; flag3 = GlobalDefs.OutputAdapter.DisplayMode; flag4 = GlobalDefs.OutputAdapter.bVSync; } else { this.Windowed_Check.Checked = true; this.VSync_Check.Checked = true; flag = true; flag2 = true; flag3 = false; flag4 = true; } this.DispMode_combo.DataSource = null; this.DispMode_combo.Items.Clear(); this.DispMode_combo.DataSource = this.mDisplayModesList; this.DispMode_combo.DisplayMember = "DisplayName"; if (flag3) { this.DispMode_combo.SelectedIndex = 1; } else { this.DispMode_combo.SelectedIndex = 0; } this.Shadow_Combo.DataSource = null; this.Shadow_Combo.Items.Clear(); this.Shadow_Combo.DataSource = this.mShadowList; this.Shadow_Combo.DisplayMember = "DisplayName"; if (flag) { this.Shadow_Combo.SelectedIndex = 0; } else { this.Shadow_Combo.SelectedIndex = 1; } this.Reflection_Combo.DataSource = null; this.Reflection_Combo.Items.Clear(); this.Reflection_Combo.DataSource = this.mReflectionList; this.Reflection_Combo.DisplayMember = "DisplayName"; if (flag2) { this.Reflection_Combo.SelectedIndex = 0; } else { this.Reflection_Combo.SelectedIndex = 1; } this.Vsync_combo.DataSource = null; this.Vsync_combo.Items.Clear(); this.Vsync_combo.DataSource = this.mVsyncList; this.Vsync_combo.DisplayMember = "DisplayName"; if (flag4) { this.Vsync_combo.SelectedIndex = 0; } else { this.Vsync_combo.SelectedIndex = 1; } } else { GlobalDefs globalDefs = new GlobalDefs(); this.Adapter_Combo.Enabled = false; this.Resolution_Combo.Enabled = false; this.AA_Combo.Enabled = false; this.VSync_Check.Enabled = false; this.DispMode_combo.Enabled = false; this.Shadow_Combo.Enabled = false; this.Reflection_Combo.Enabled = false; this.Vsync_combo.Enabled = false; this.NoAdapterWarning_label.Visible = true; GlobalDefs.OutputAdapter.AdapterDescription = ""; GlobalDefs.OutputAdapter.AdapterName = ""; GlobalDefs.OutputAdapter.DeviceGUID = globalDefs.ZERO_GUID; GlobalDefs.OutputAdapter.AdapterID = ""; GlobalDefs.OutputAdapter.OutputRes.Height = 0; GlobalDefs.OutputAdapter.OutputRes.Refresh = 0; GlobalDefs.OutputAdapter.OutputRes.Width = 0; GlobalDefs.OutputAdapter.ValidAdapter = false; GlobalDefs.OutputAdapter.DisplayMode = false; GlobalDefs.OutputAdapter.ShadQuality = false; GlobalDefs.OutputAdapter.ReflectQuality = false; } this.DressText(); }