---
- feature, saves settings to ZPS filename .ini

SnesPatcher.frmSnesPatcher.btnApply_Click

> using System.Runtime.CompilerServices;

using System.Runtime.InteropServices;

>	public partial class frmSnesPatcher : Form
>	{

		[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);

>			modPatchChain.patchChain.sPath_OutputRom = this.path_destination;

			string configFileName = this.zpsPatch.sPathPatch.Substring(0, this.zpsPatch.sPathPatch.LastIndexOf(".")) + ".ini";
			string configSection = "{unknown}";
			string configKey = "{unknown}";

			foreach (string text in this.zpsPatch.dicOptions.Keys)
			{
				if (this.zpsPatch.dicOptions[text].bAvailable && this.zpsPatch.dicOptions[text].iDevProgress != 0)
				{
					configKey = this.zpsPatch.dicOptions[text].sName.Replace("=", "\\");
					if (configKey.StartsWith("["))
					{
						configSection = configKey.Replace("[", "").Replace("]", "");
						configKey = "{" + configSection + "}";
					}
					WritePrivateProfileString(configSection, configKey, this.zpsPatch.dicOptions[text].bActive ? "1" : "0", configFileName);
				}
			}

			configSection = "Advanced Options";
			foreach (string text2 in this.zpsPatch.dicGlobals.Keys)
			{
				if (this.zpsPatch.dicGlobals[text2].bEditable && this.zpsPatch.dicGlobals[text2].editType != 0) // PatchGlobal.enum_globalType.globalType_none
				{
					configKey = this.zpsPatch.dicGlobals[text2].sName.Replace("=", "\\").Replace("%", "");
					if (!configKey.StartsWith("["))
					{
						WritePrivateProfileString(configSection, configKey, this.zpsPatch.dicGlobals[text2].sEditValue, configFileName);
					}
				}
			}

>			modPatchChain.applyPatchChain(null);

---
- feature, loads settings from ZPS filename .ini

SnesPatcher.frmSnesPatcher.btnSelectPath_Click

> using System.Runtime.CompilerServices;

using System.Runtime.InteropServices;
using System.Text;

>	public partial class frmSnesPatcher : Form
>	{

		[DllImport("kernel32.dll")]
		static extern uint GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName);
		[DllImport("kernel32.dll", CharSet=CharSet.Unicode)]
		static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, uint nSize, string lpFileName);

>			this.lstOptions.Items.Clear();

			string configFileName = this.zpsPatch.sPathPatch.Substring(0, this.zpsPatch.sPathPatch.LastIndexOf(".")) + ".ini";
			string configSection = "{unknown}";
			string configKey = "{unknown}";
			StringBuilder sb = new StringBuilder(6);

			foreach (string text in this.zpsPatch.dicOptions.Keys)
			{
				configKey = this.zpsPatch.dicOptions[text].sName.Replace("=", "\\");
				if (configKey.StartsWith("["))
				{
					configSection = configKey.Replace("[", "").Replace("]", "");
					configKey = "{" + configSection + "}";
				}
				this.zpsPatch.dicOptions[text].bActive = (GetPrivateProfileInt(configSection, configKey, this.zpsPatch.dicOptions[text].bActive ? 1 : 0, configFileName) == 1);
				if (this.zpsPatch.dicOptions[text].bAvailable)
				{
					CheckState check = CheckState.Unchecked;
					if (this.zpsPatch.dicOptions[text].bActive)
					{
						check = CheckState.Checked;
					}
					if (this.zpsPatch.dicOptions[text].iDevProgress == 0)
					{
						check = CheckState.Indeterminate;
					}
					this.lstOptions.Items.Add(text, check);
				}
			}

			configSection = "Advanced Options";
			foreach (string text2 in this.zpsPatch.dicGlobals.Keys)
			{
				if (this.zpsPatch.dicGlobals[text2].bEditable && this.zpsPatch.dicGlobals[text2].editType != 0) // PatchGlobal.enum_globalType.globalType_none
				{
					configKey = this.zpsPatch.dicGlobals[text2].sName.Replace("=", "\\").Replace("%", "");
					if (!configKey.StartsWith("["))
					{
						uint retval = GetPrivateProfileString(configSection, configKey, this.zpsPatch.dicGlobals[text2].sEditValue, sb, (uint)sb.Capacity, configFileName);
						if (retval > 0 && retval <= (uint)sb.Capacity)
						{
							this.zpsPatch.dicGlobals[text2].sEditValue = sb.ToString();
						}
					}
				}
			}

>			this.btnRom.Enabled = true;

---
- change, visible difference to patcher for end user

SnesPatcher.frmSnesPatcher.frmSnesPatcher_Load

	this.Text = "Snes ZPS Patcher V0.18++";

		ldstr		"Snes ZPS Patcher V0.18++"
