diff --git a/BizHawk.Client.Common/movie/bk2/StringLogs.cs b/BizHawk.Client.Common/movie/bk2/StringLogs.cs index 83351c2fe9..bfbfa560c8 100644 --- a/BizHawk.Client.Common/movie/bk2/StringLogs.cs +++ b/BizHawk.Client.Common/movie/bk2/StringLogs.cs @@ -12,9 +12,6 @@ namespace BizHawk.Client.Common { public static bool DefaultToDisk { get; set; } - public static bool DefaultToAwe { get; set; } - - /// is but not running on Windows host public static IStringLog MakeStringLog() { if (DefaultToDisk) @@ -22,13 +19,6 @@ namespace BizHawk.Client.Common return new StreamStringLog(true); } - if (DefaultToAwe) - { - return OSTailoredCode.IsUnixHost - ? throw new InvalidOperationException("logging to AWE is only available on Windows for now") - : new StreamStringLog(false); - } - return new ListStringLog(); } @@ -114,7 +104,8 @@ namespace BizHawk.Client.Common } else { - _stream = new AWEMemoryStream(); + //but leave this in case we want to retain the option for more efficient management than the list of strings + throw new InvalidOperationException("Not supported anymore"); } _bw = new BinaryWriter(_stream); diff --git a/BizHawk.Client.EmuHawk/Program.cs b/BizHawk.Client.EmuHawk/Program.cs index d221394bec..614ed8d605 100644 --- a/BizHawk.Client.EmuHawk/Program.cs +++ b/BizHawk.Client.EmuHawk/Program.cs @@ -121,7 +121,6 @@ namespace BizHawk.Client.EmuHawk Global.Config.ResolveDefaults(); StringLogUtil.DefaultToDisk = Global.Config.MoviesOnDisk; - StringLogUtil.DefaultToAwe = Global.Config.MoviesInAwe; // super hacky! this needs to be done first. still not worth the trouble to make this system fully proper if (Array.Exists(args, arg => arg.StartsWith("--gdi", StringComparison.InvariantCultureIgnoreCase))) diff --git a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.Designer.cs b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.Designer.cs index 372271d80f..df71c06d07 100644 --- a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.Designer.cs @@ -28,571 +28,569 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.btnDialogOK = new BizHawk.WinForms.Controls.LocSzButtonEx(); - this.btnDialogCancel = new BizHawk.WinForms.Controls.LocSzButtonEx(); - this.tcDialog = new System.Windows.Forms.TabControl(); - this.tpGeneral = new BizHawk.WinForms.Controls.TabPageEx(); - this.flpTpGeneral = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbMenusPauseEmulation = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.cbEnableContextMenu = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.cbSaveWindowPosition = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.cbNeverAskForSave = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.flpNoFocusEmulate = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbNoFocusEmulate = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblNoFocusEmulate = new BizHawk.WinForms.Controls.LocLabelEx(); - this.flpNoFocusInput = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.flpNoFocusInputCheckBoxes = new BizHawk.WinForms.Controls.SingleRowFLP(); - this.cbNoFocusInput = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.cbNoFocusInputGamepadOnly = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblNoFocusInput = new BizHawk.WinForms.Controls.LocLabelEx(); - this.cbNonQWERTY = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.grpStartup = new BizHawk.WinForms.Controls.SzGroupBoxEx(); - this.flpGrpStartup = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); - this.cbStartPaused = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.cbStartInFS = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.flpSingleInstance = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbSingleInstance = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblSingleInstanceDesc = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lblSingleInstanceRestartWarning = new BizHawk.WinForms.Controls.LocLabelEx(); - this.tpAdvanced = new BizHawk.WinForms.Controls.TabPageEx(); - this.flpTpAdvanced = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbBackupSaveRAM = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.flpAutoSaveRAM = new BizHawk.WinForms.Controls.SingleRowFLP(); - this.cbAutoSaveRAM = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.grpAutoSaveRAM = new BizHawk.WinForms.Controls.SzGroupBoxEx(); - this.flpGrpAutoSaveRAM = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); - this.lblAutoSaveRAM = new BizHawk.WinForms.Controls.LabelEx(); - this.flpAutoSaveRAMFreq = new BizHawk.WinForms.Controls.SingleRowFLP(); - this.lblAutoSaveRAMFreqDesc = new BizHawk.WinForms.Controls.LabelEx(); - this.cbAutoSaveRAMFreq5s = new BizHawk.WinForms.Controls.RadioButtonEx(grpAutoSaveRAM.Tracker); - this.AutoSaveRAMFreq5min = new BizHawk.WinForms.Controls.RadioButtonEx(grpAutoSaveRAM.Tracker); - this.flpAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.SingleRowFLP(); - this.rbAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.RadioButtonEx(grpAutoSaveRAM.Tracker); - this.nudAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.SzNUDEx(); - this.lblAutoSaveRAMFreqCustomUnits = new BizHawk.WinForms.Controls.LabelEx(); - this.flpFrameAdvPastLag = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbFrameAdvPastLag = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblFrameAdvPastLag1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.lblFrameAdvPastLag2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.cbRunLuaDuringTurbo = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.flpMoviesOnDisk = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbMoviesOnDisk = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblMoviesOnDisk = new BizHawk.WinForms.Controls.LocLabelEx(); - this.flpMoviesInAWE = new BizHawk.WinForms.Controls.SingleColumnFLP(); - this.cbMoviesInAWE = new BizHawk.WinForms.Controls.CheckBoxEx(); - this.lblMoviesInAWE = new BizHawk.WinForms.Controls.LocLabelEx(); - this.grpLuaEngine = new BizHawk.WinForms.Controls.SzGroupBoxEx(); - this.flpGrpLuaEngine = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); - this.rbKopiLua = new BizHawk.WinForms.Controls.RadioButtonEx(grpLuaEngine.Tracker); - this.rbLuaInterface = new BizHawk.WinForms.Controls.RadioButtonEx(grpLuaEngine.Tracker); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.flpDialogButtons = new BizHawk.WinForms.Controls.LocSzSingleRowFLP(); - this.grpInputMethod = new BizHawk.WinForms.Controls.SzGroupBoxEx(); - this.flpGrpInputMethod = new BizHawk.WinForms.Controls.LocSingleRowFLP(); - this.rbInputMethodOpenTK = new BizHawk.WinForms.Controls.RadioButtonEx(grpInputMethod.Tracker); - this.rbInputMethodDirectInput = new BizHawk.WinForms.Controls.RadioButtonEx(grpInputMethod.Tracker); - this.tcDialog.SuspendLayout(); - this.tpGeneral.SuspendLayout(); - this.flpTpGeneral.SuspendLayout(); - this.flpNoFocusEmulate.SuspendLayout(); - this.flpNoFocusInput.SuspendLayout(); - this.flpNoFocusInputCheckBoxes.SuspendLayout(); - this.grpStartup.SuspendLayout(); - this.flpGrpStartup.SuspendLayout(); - this.flpSingleInstance.SuspendLayout(); - this.tpAdvanced.SuspendLayout(); - this.flpTpAdvanced.SuspendLayout(); - this.flpAutoSaveRAM.SuspendLayout(); - this.grpAutoSaveRAM.SuspendLayout(); - this.flpGrpAutoSaveRAM.SuspendLayout(); - this.flpAutoSaveRAMFreq.SuspendLayout(); - this.flpAutoSaveRAMFreqCustom.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudAutoSaveRAMFreqCustom)).BeginInit(); - this.flpFrameAdvPastLag.SuspendLayout(); - this.flpMoviesOnDisk.SuspendLayout(); - this.flpMoviesInAWE.SuspendLayout(); - this.grpLuaEngine.SuspendLayout(); - this.flpGrpLuaEngine.SuspendLayout(); - this.flpDialogButtons.SuspendLayout(); - this.grpInputMethod.SuspendLayout(); - this.flpGrpInputMethod.SuspendLayout(); - this.SuspendLayout(); - // - // btnDialogOK - // - this.btnDialogOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnDialogOK.Location = new System.Drawing.Point(3, 3); - this.btnDialogOK.Name = "btnDialogOK"; - this.btnDialogOK.Size = new System.Drawing.Size(60, 23); - this.btnDialogOK.Text = "&OK"; - this.btnDialogOK.Click += new System.EventHandler(this.btnDialogOK_Click); - // - // btnDialogCancel - // - this.btnDialogCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnDialogCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnDialogCancel.Location = new System.Drawing.Point(69, 3); - this.btnDialogCancel.Name = "btnDialogCancel"; - this.btnDialogCancel.Size = new System.Drawing.Size(60, 23); - this.btnDialogCancel.Text = "&Cancel"; - this.btnDialogCancel.Click += new System.EventHandler(this.btnDialogCancel_Click); - // - // tcDialog - // - this.tcDialog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.components = new System.ComponentModel.Container(); + this.btnDialogOK = new BizHawk.WinForms.Controls.LocSzButtonEx(); + this.btnDialogCancel = new BizHawk.WinForms.Controls.LocSzButtonEx(); + this.tcDialog = new System.Windows.Forms.TabControl(); + this.tpGeneral = new BizHawk.WinForms.Controls.TabPageEx(); + this.flpTpGeneral = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbMenusPauseEmulation = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.cbEnableContextMenu = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.cbSaveWindowPosition = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.cbNeverAskForSave = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.flpNoFocusEmulate = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbNoFocusEmulate = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblNoFocusEmulate = new BizHawk.WinForms.Controls.LocLabelEx(); + this.flpNoFocusInput = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.flpNoFocusInputCheckBoxes = new BizHawk.WinForms.Controls.SingleRowFLP(); + this.cbNoFocusInput = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.cbNoFocusInputGamepadOnly = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblNoFocusInput = new BizHawk.WinForms.Controls.LocLabelEx(); + this.grpInputMethod = new BizHawk.WinForms.Controls.SzGroupBoxEx(); + this.flpGrpInputMethod = new BizHawk.WinForms.Controls.LocSingleRowFLP(); + this.rbInputMethodDirectInput = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.rbInputMethodOpenTK = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.cbNonQWERTY = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.grpStartup = new BizHawk.WinForms.Controls.SzGroupBoxEx(); + this.flpGrpStartup = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); + this.cbStartPaused = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.cbStartInFS = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.flpSingleInstance = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbSingleInstance = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblSingleInstanceDesc = new BizHawk.WinForms.Controls.LocLabelEx(); + this.lblSingleInstanceRestartWarning = new BizHawk.WinForms.Controls.LocLabelEx(); + this.tpAdvanced = new BizHawk.WinForms.Controls.TabPageEx(); + this.flpTpAdvanced = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbBackupSaveRAM = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.flpAutoSaveRAM = new BizHawk.WinForms.Controls.SingleRowFLP(); + this.cbAutoSaveRAM = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.grpAutoSaveRAM = new BizHawk.WinForms.Controls.SzGroupBoxEx(); + this.flpGrpAutoSaveRAM = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); + this.lblAutoSaveRAM = new BizHawk.WinForms.Controls.LabelEx(); + this.flpAutoSaveRAMFreq = new BizHawk.WinForms.Controls.SingleRowFLP(); + this.lblAutoSaveRAMFreqDesc = new BizHawk.WinForms.Controls.LabelEx(); + this.cbAutoSaveRAMFreq5s = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.AutoSaveRAMFreq5min = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.flpAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.SingleRowFLP(); + this.rbAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.nudAutoSaveRAMFreqCustom = new BizHawk.WinForms.Controls.SzNUDEx(); + this.lblAutoSaveRAMFreqCustomUnits = new BizHawk.WinForms.Controls.LabelEx(); + this.flpFrameAdvPastLag = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbFrameAdvPastLag = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblFrameAdvPastLag1 = new BizHawk.WinForms.Controls.LocLabelEx(); + this.lblFrameAdvPastLag2 = new BizHawk.WinForms.Controls.LocLabelEx(); + this.cbRunLuaDuringTurbo = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.flpMoviesOnDisk = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbMoviesOnDisk = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblMoviesOnDisk = new BizHawk.WinForms.Controls.LocLabelEx(); + this.flpMoviesInAWE = new BizHawk.WinForms.Controls.SingleColumnFLP(); + this.cbSkipWaterboxIntegrityChecks = new BizHawk.WinForms.Controls.CheckBoxEx(); + this.lblSkipWaterboxIntegrityChecks = new BizHawk.WinForms.Controls.LocLabelEx(); + this.grpLuaEngine = new BizHawk.WinForms.Controls.SzGroupBoxEx(); + this.flpGrpLuaEngine = new BizHawk.WinForms.Controls.LocSingleColumnFLP(); + this.rbLuaInterface = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.rbKopiLua = new BizHawk.WinForms.Controls.RadioButtonEx(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.flpDialogButtons = new BizHawk.WinForms.Controls.LocSzSingleRowFLP(); + this.tcDialog.SuspendLayout(); + this.tpGeneral.SuspendLayout(); + this.flpTpGeneral.SuspendLayout(); + this.flpNoFocusEmulate.SuspendLayout(); + this.flpNoFocusInput.SuspendLayout(); + this.flpNoFocusInputCheckBoxes.SuspendLayout(); + this.grpInputMethod.SuspendLayout(); + this.flpGrpInputMethod.SuspendLayout(); + this.grpStartup.SuspendLayout(); + this.flpGrpStartup.SuspendLayout(); + this.flpSingleInstance.SuspendLayout(); + this.tpAdvanced.SuspendLayout(); + this.flpTpAdvanced.SuspendLayout(); + this.flpAutoSaveRAM.SuspendLayout(); + this.grpAutoSaveRAM.SuspendLayout(); + this.flpGrpAutoSaveRAM.SuspendLayout(); + this.flpAutoSaveRAMFreq.SuspendLayout(); + this.flpAutoSaveRAMFreqCustom.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAutoSaveRAMFreqCustom)).BeginInit(); + this.flpFrameAdvPastLag.SuspendLayout(); + this.flpMoviesOnDisk.SuspendLayout(); + this.flpMoviesInAWE.SuspendLayout(); + this.grpLuaEngine.SuspendLayout(); + this.flpGrpLuaEngine.SuspendLayout(); + this.flpDialogButtons.SuspendLayout(); + this.SuspendLayout(); + // + // btnDialogOK + // + this.btnDialogOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnDialogOK.Location = new System.Drawing.Point(3, 3); + this.btnDialogOK.Name = "btnDialogOK"; + this.btnDialogOK.Size = new System.Drawing.Size(60, 23); + this.btnDialogOK.Text = "&OK"; + this.btnDialogOK.Click += new System.EventHandler(this.btnDialogOK_Click); + // + // btnDialogCancel + // + this.btnDialogCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnDialogCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnDialogCancel.Location = new System.Drawing.Point(69, 3); + this.btnDialogCancel.Name = "btnDialogCancel"; + this.btnDialogCancel.Size = new System.Drawing.Size(60, 23); + this.btnDialogCancel.Text = "&Cancel"; + this.btnDialogCancel.Click += new System.EventHandler(this.btnDialogCancel_Click); + // + // tcDialog + // + this.tcDialog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tcDialog.Controls.Add(this.tpGeneral); - this.tcDialog.Controls.Add(this.tpAdvanced); - this.tcDialog.Location = new System.Drawing.Point(4, 4); - this.tcDialog.Name = "tcDialog"; - this.tcDialog.SelectedIndex = 0; - this.tcDialog.Size = new System.Drawing.Size(379, 389); - this.tcDialog.TabIndex = 0; - // - // tpGeneral - // - this.tpGeneral.Controls.Add(this.flpTpGeneral); - this.tpGeneral.Name = "tpGeneral"; - this.tpGeneral.Padding = new System.Windows.Forms.Padding(3); - this.tpGeneral.Text = "General"; - // - // flpTpGeneral - // - this.flpTpGeneral.Controls.Add(this.cbMenusPauseEmulation); - this.flpTpGeneral.Controls.Add(this.cbEnableContextMenu); - this.flpTpGeneral.Controls.Add(this.cbSaveWindowPosition); - this.flpTpGeneral.Controls.Add(this.cbNeverAskForSave); - this.flpTpGeneral.Controls.Add(this.flpNoFocusEmulate); - this.flpTpGeneral.Controls.Add(this.flpNoFocusInput); - this.flpTpGeneral.Controls.Add(this.grpInputMethod); - this.flpTpGeneral.Controls.Add(this.cbNonQWERTY); - this.flpTpGeneral.Controls.Add(this.grpStartup); - this.flpTpGeneral.Name = "flpTpGeneral"; - // - // cbMenusPauseEmulation - // - this.cbMenusPauseEmulation.Name = "cbMenusPauseEmulation"; - this.cbMenusPauseEmulation.Text = "Pause when menu activated"; - // - // cbEnableContextMenu - // - this.cbEnableContextMenu.Name = "cbEnableContextMenu"; - this.cbEnableContextMenu.Text = "Enable Context Menu"; - // - // cbSaveWindowPosition - // - this.cbSaveWindowPosition.Name = "cbSaveWindowPosition"; - this.cbSaveWindowPosition.Text = "Save Window Position"; - // - // cbNeverAskForSave - // - this.cbNeverAskForSave.Name = "cbNeverAskForSave"; - this.cbNeverAskForSave.Text = "Never be asked to save changes"; - // - // flpNoFocusEmulate - // - this.flpNoFocusEmulate.Controls.Add(this.cbNoFocusEmulate); - this.flpNoFocusEmulate.Controls.Add(this.lblNoFocusEmulate); - this.flpNoFocusEmulate.Name = "flpNoFocusEmulate"; - // - // cbNoFocusEmulate - // - this.cbNoFocusEmulate.Name = "cbNoFocusEmulate"; - this.cbNoFocusEmulate.Text = "Run in background"; - // - // lblNoFocusEmulate - // - this.lblNoFocusEmulate.Location = new System.Drawing.Point(3, 23); - this.lblNoFocusEmulate.Name = "lblNoFocusEmulate"; - this.lblNoFocusEmulate.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblNoFocusEmulate.Text = "When this is set, the client will continue to run when it loses focus"; - // - // flpNoFocusInput - // - this.flpNoFocusInput.Controls.Add(this.flpNoFocusInputCheckBoxes); - this.flpNoFocusInput.Controls.Add(this.lblNoFocusInput); - this.flpNoFocusInput.Name = "flpNoFocusInput"; - // - // flpNoFocusInputCheckBoxes - // - this.flpNoFocusInputCheckBoxes.Controls.Add(this.cbNoFocusInput); - this.flpNoFocusInputCheckBoxes.Controls.Add(this.cbNoFocusInputGamepadOnly); - this.flpNoFocusInputCheckBoxes.Name = "flpNoFocusInputCheckBoxes"; - // - // cbNoFocusInput - // - this.cbNoFocusInput.Name = "cbNoFocusInput"; - this.cbNoFocusInput.Text = "Accept background input"; - this.cbNoFocusInput.CheckedChanged += new System.EventHandler(this.cbNoFocusInput_CheckedChanged); - // - // cbNoFocusInputGamepadOnly - // - this.cbNoFocusInputGamepadOnly.Enabled = false; - this.cbNoFocusInputGamepadOnly.Name = "cbNoFocusInputGamepadOnly"; - this.cbNoFocusInputGamepadOnly.Text = "From controller only"; - // - // lblNoFocusInput - // - this.lblNoFocusInput.Location = new System.Drawing.Point(3, 24); - this.lblNoFocusInput.Name = "lblNoFocusInput"; - this.lblNoFocusInput.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblNoFocusInput.Text = "When this is set, the client will receive user input even when focus is lost"; - // - // cbNonQWERTY - // - this.cbNonQWERTY.Name = "cbNonQWERTY"; - this.cbNonQWERTY.Text = "Handle alternate keyboard layouts (e.g. Dvorak) [experimental]"; - // - // grpStartup - // - this.grpStartup.Controls.Add(this.flpGrpStartup); - this.grpStartup.Name = "grpStartup"; - this.grpStartup.Size = new System.Drawing.Size(334, 118); - this.grpStartup.Text = "Startup Options"; - // - // flpGrpStartup - // - this.flpGrpStartup.Controls.Add(this.cbStartPaused); - this.flpGrpStartup.Controls.Add(this.cbStartInFS); - this.flpGrpStartup.Controls.Add(this.flpSingleInstance); - this.flpGrpStartup.Location = new System.Drawing.Point(3, 16); - this.flpGrpStartup.Name = "flpGrpStartup"; - // - // cbStartPaused - // - this.cbStartPaused.Name = "cbStartPaused"; - this.cbStartPaused.Text = "Start paused"; - // - // cbStartInFS - // - this.cbStartInFS.Name = "cbStartInFS"; - this.cbStartInFS.Text = "Start in Fullscreen"; - // - // flpSingleInstance - // - this.flpSingleInstance.Controls.Add(this.cbSingleInstance); - this.flpSingleInstance.Controls.Add(this.lblSingleInstanceDesc); - this.flpSingleInstance.Controls.Add(this.lblSingleInstanceRestartWarning); - this.flpSingleInstance.Name = "flpSingleInstance"; - // - // cbSingleInstance - // - this.cbSingleInstance.Name = "cbSingleInstance"; - this.cbSingleInstance.Text = "Single instance mode"; - // - // lblSingleInstanceDesc - // - this.lblSingleInstanceDesc.Location = new System.Drawing.Point(3, 23); - this.lblSingleInstanceDesc.Name = "lblSingleInstanceDesc"; - this.lblSingleInstanceDesc.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblSingleInstanceDesc.Text = "Enable to force only one instance of EmuHawk at a time."; - // - // lblSingleInstanceRestartWarning - // - this.lblSingleInstanceRestartWarning.Location = new System.Drawing.Point(3, 36); - this.lblSingleInstanceRestartWarning.Name = "lblSingleInstanceRestartWarning"; - this.lblSingleInstanceRestartWarning.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblSingleInstanceRestartWarning.Text = "Note: Requires closing and reopening EmuHawk to take effect."; - // - // tpAdvanced - // - this.tpAdvanced.Controls.Add(this.flpTpAdvanced); - this.tpAdvanced.Name = "tpAdvanced"; - this.tpAdvanced.Text = "Advanced"; - // - // flpTpAdvanced - // - this.flpTpAdvanced.Controls.Add(this.cbBackupSaveRAM); - this.flpTpAdvanced.Controls.Add(this.flpAutoSaveRAM); - this.flpTpAdvanced.Controls.Add(this.flpFrameAdvPastLag); - this.flpTpAdvanced.Controls.Add(this.cbRunLuaDuringTurbo); - this.flpTpAdvanced.Controls.Add(this.flpMoviesOnDisk); - this.flpTpAdvanced.Controls.Add(this.flpMoviesInAWE); - this.flpTpAdvanced.Controls.Add(this.grpLuaEngine); - this.flpTpAdvanced.Name = "flpTpAdvanced"; - // - // cbBackupSaveRAM - // - this.cbBackupSaveRAM.Name = "cbBackupSaveRAM"; - this.cbBackupSaveRAM.Text = "Backup SaveRAM to .SaveRAM.bak"; - // - // flpAutoSaveRAM - // - this.flpAutoSaveRAM.Controls.Add(this.cbAutoSaveRAM); - this.flpAutoSaveRAM.Controls.Add(this.grpAutoSaveRAM); - this.flpAutoSaveRAM.Name = "flpAutoSaveRAM"; - // - // cbAutoSaveRAM - // - this.cbAutoSaveRAM.Name = "cbAutoSaveRAM"; - this.cbAutoSaveRAM.CheckedChanged += new System.EventHandler(this.cbAutoSaveRAM_CheckedChanged); - // - // grpAutoSaveRAM - // - this.grpAutoSaveRAM.Controls.Add(this.flpGrpAutoSaveRAM); - this.grpAutoSaveRAM.Name = "grpAutoSaveRAM"; - this.grpAutoSaveRAM.Size = new System.Drawing.Size(238, 54); - this.grpAutoSaveRAM.Text = "AutoSaveRAM"; - // - // flpGrpAutoSaveRAM - // - this.flpGrpAutoSaveRAM.Controls.Add(this.lblAutoSaveRAM); - this.flpGrpAutoSaveRAM.Controls.Add(this.flpAutoSaveRAMFreq); - this.flpGrpAutoSaveRAM.Location = new System.Drawing.Point(3, 12); - this.flpGrpAutoSaveRAM.Name = "flpGrpAutoSaveRAM"; - // - // lblAutoSaveRAM - // - this.lblAutoSaveRAM.Name = "lblAutoSaveRAM"; - this.lblAutoSaveRAM.Text = "Save SaveRAM to .AutoSaveRAM.SaveRAM"; - // - // flpAutoSaveRAMFreq - // - this.flpAutoSaveRAMFreq.Controls.Add(this.lblAutoSaveRAMFreqDesc); - this.flpAutoSaveRAMFreq.Controls.Add(this.cbAutoSaveRAMFreq5s); - this.flpAutoSaveRAMFreq.Controls.Add(this.AutoSaveRAMFreq5min); - this.flpAutoSaveRAMFreq.Controls.Add(this.flpAutoSaveRAMFreqCustom); - this.flpAutoSaveRAMFreq.Name = "flpAutoSaveRAMFreq"; - // - // lblAutoSaveRAMFreqDesc - // - this.lblAutoSaveRAMFreqDesc.Name = "lblAutoSaveRAMFreqDesc"; - this.lblAutoSaveRAMFreqDesc.Text = "every"; - // - // cbAutoSaveRAMFreq5s - // - this.cbAutoSaveRAMFreq5s.Name = "cbAutoSaveRAMFreq5s"; - this.cbAutoSaveRAMFreq5s.Text = "5s"; - // - // AutoSaveRAMFreq5min - // - this.AutoSaveRAMFreq5min.Name = "AutoSaveRAMFreq5min"; - this.AutoSaveRAMFreq5min.Text = "5m"; - // - // flpAutoSaveRAMFreqCustom - // - this.flpAutoSaveRAMFreqCustom.Controls.Add(this.rbAutoSaveRAMFreqCustom); - this.flpAutoSaveRAMFreqCustom.Controls.Add(this.nudAutoSaveRAMFreqCustom); - this.flpAutoSaveRAMFreqCustom.Controls.Add(this.lblAutoSaveRAMFreqCustomUnits); - this.flpAutoSaveRAMFreqCustom.Name = "flpAutoSaveRAMFreqCustom"; - // - // rbAutoSaveRAMFreqCustom - // - this.rbAutoSaveRAMFreqCustom.Name = "rbAutoSaveRAMFreqCustom"; - this.rbAutoSaveRAMFreqCustom.CheckedChanged += new System.EventHandler(this.rbAutoSaveRAMFreqCustom_CheckedChanged); - // - // nudAutoSaveRAMFreqCustom - // - this.nudAutoSaveRAMFreqCustom.Maximum = new decimal(new int[] { + this.tcDialog.Controls.Add(this.tpGeneral); + this.tcDialog.Controls.Add(this.tpAdvanced); + this.tcDialog.Location = new System.Drawing.Point(4, 4); + this.tcDialog.Name = "tcDialog"; + this.tcDialog.SelectedIndex = 0; + this.tcDialog.Size = new System.Drawing.Size(379, 389); + this.tcDialog.TabIndex = 0; + // + // tpGeneral + // + this.tpGeneral.Controls.Add(this.flpTpGeneral); + this.tpGeneral.Name = "tpGeneral"; + this.tpGeneral.Padding = new System.Windows.Forms.Padding(3); + this.tpGeneral.Text = "General"; + // + // flpTpGeneral + // + this.flpTpGeneral.Controls.Add(this.cbMenusPauseEmulation); + this.flpTpGeneral.Controls.Add(this.cbEnableContextMenu); + this.flpTpGeneral.Controls.Add(this.cbSaveWindowPosition); + this.flpTpGeneral.Controls.Add(this.cbNeverAskForSave); + this.flpTpGeneral.Controls.Add(this.flpNoFocusEmulate); + this.flpTpGeneral.Controls.Add(this.flpNoFocusInput); + this.flpTpGeneral.Controls.Add(this.grpInputMethod); + this.flpTpGeneral.Controls.Add(this.cbNonQWERTY); + this.flpTpGeneral.Controls.Add(this.grpStartup); + this.flpTpGeneral.Name = "flpTpGeneral"; + // + // cbMenusPauseEmulation + // + this.cbMenusPauseEmulation.Name = "cbMenusPauseEmulation"; + this.cbMenusPauseEmulation.Text = "Pause when menu activated"; + // + // cbEnableContextMenu + // + this.cbEnableContextMenu.Name = "cbEnableContextMenu"; + this.cbEnableContextMenu.Text = "Enable Context Menu"; + // + // cbSaveWindowPosition + // + this.cbSaveWindowPosition.Name = "cbSaveWindowPosition"; + this.cbSaveWindowPosition.Text = "Save Window Position"; + // + // cbNeverAskForSave + // + this.cbNeverAskForSave.Name = "cbNeverAskForSave"; + this.cbNeverAskForSave.Text = "Never be asked to save changes"; + // + // flpNoFocusEmulate + // + this.flpNoFocusEmulate.Controls.Add(this.cbNoFocusEmulate); + this.flpNoFocusEmulate.Controls.Add(this.lblNoFocusEmulate); + this.flpNoFocusEmulate.Name = "flpNoFocusEmulate"; + // + // cbNoFocusEmulate + // + this.cbNoFocusEmulate.Name = "cbNoFocusEmulate"; + this.cbNoFocusEmulate.Text = "Run in background"; + // + // lblNoFocusEmulate + // + this.lblNoFocusEmulate.Location = new System.Drawing.Point(3, 23); + this.lblNoFocusEmulate.Name = "lblNoFocusEmulate"; + this.lblNoFocusEmulate.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblNoFocusEmulate.Text = "When this is set, the client will continue to run when it loses focus"; + // + // flpNoFocusInput + // + this.flpNoFocusInput.Controls.Add(this.flpNoFocusInputCheckBoxes); + this.flpNoFocusInput.Controls.Add(this.lblNoFocusInput); + this.flpNoFocusInput.Name = "flpNoFocusInput"; + // + // flpNoFocusInputCheckBoxes + // + this.flpNoFocusInputCheckBoxes.Controls.Add(this.cbNoFocusInput); + this.flpNoFocusInputCheckBoxes.Controls.Add(this.cbNoFocusInputGamepadOnly); + this.flpNoFocusInputCheckBoxes.Name = "flpNoFocusInputCheckBoxes"; + // + // cbNoFocusInput + // + this.cbNoFocusInput.Name = "cbNoFocusInput"; + this.cbNoFocusInput.Text = "Accept background input"; + this.cbNoFocusInput.CheckedChanged += new System.EventHandler(this.cbNoFocusInput_CheckedChanged); + // + // cbNoFocusInputGamepadOnly + // + this.cbNoFocusInputGamepadOnly.Enabled = false; + this.cbNoFocusInputGamepadOnly.Name = "cbNoFocusInputGamepadOnly"; + this.cbNoFocusInputGamepadOnly.Text = "From controller only"; + // + // lblNoFocusInput + // + this.lblNoFocusInput.Location = new System.Drawing.Point(3, 24); + this.lblNoFocusInput.Name = "lblNoFocusInput"; + this.lblNoFocusInput.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblNoFocusInput.Text = "When this is set, the client will receive user input even when focus is lost"; + // + // grpInputMethod + // + this.grpInputMethod.Controls.Add(this.flpGrpInputMethod); + this.grpInputMethod.Name = "grpInputMethod"; + this.grpInputMethod.Size = new System.Drawing.Size(334, 45); + this.grpInputMethod.Text = "Input Method (requires restart)"; + // + // flpGrpInputMethod + // + this.flpGrpInputMethod.Controls.Add(this.rbInputMethodDirectInput); + this.flpGrpInputMethod.Controls.Add(this.rbInputMethodOpenTK); + this.flpGrpInputMethod.Location = new System.Drawing.Point(4, 12); + this.flpGrpInputMethod.Name = "flpGrpInputMethod"; + // + // rbInputMethodDirectInput + // + this.rbInputMethodDirectInput.Name = "rbInputMethodDirectInput"; + this.rbInputMethodDirectInput.Tag = BizHawk.Client.Common.EHostInputMethod.DirectInput; + this.rbInputMethodDirectInput.Text = "DirectInput"; + // + // rbInputMethodOpenTK + // + this.rbInputMethodOpenTK.Name = "rbInputMethodOpenTK"; + this.rbInputMethodOpenTK.Tag = BizHawk.Client.Common.EHostInputMethod.OpenTK; + this.rbInputMethodOpenTK.Text = "OpenTK"; + // + // cbNonQWERTY + // + this.cbNonQWERTY.Name = "cbNonQWERTY"; + this.cbNonQWERTY.Text = "Handle alternate keyboard layouts (e.g. Dvorak) [experimental]"; + // + // grpStartup + // + this.grpStartup.Controls.Add(this.flpGrpStartup); + this.grpStartup.Name = "grpStartup"; + this.grpStartup.Size = new System.Drawing.Size(334, 118); + this.grpStartup.Text = "Startup Options"; + // + // flpGrpStartup + // + this.flpGrpStartup.Controls.Add(this.cbStartPaused); + this.flpGrpStartup.Controls.Add(this.cbStartInFS); + this.flpGrpStartup.Controls.Add(this.flpSingleInstance); + this.flpGrpStartup.Location = new System.Drawing.Point(3, 16); + this.flpGrpStartup.Name = "flpGrpStartup"; + // + // cbStartPaused + // + this.cbStartPaused.Name = "cbStartPaused"; + this.cbStartPaused.Text = "Start paused"; + // + // cbStartInFS + // + this.cbStartInFS.Name = "cbStartInFS"; + this.cbStartInFS.Text = "Start in Fullscreen"; + // + // flpSingleInstance + // + this.flpSingleInstance.Controls.Add(this.cbSingleInstance); + this.flpSingleInstance.Controls.Add(this.lblSingleInstanceDesc); + this.flpSingleInstance.Controls.Add(this.lblSingleInstanceRestartWarning); + this.flpSingleInstance.Name = "flpSingleInstance"; + // + // cbSingleInstance + // + this.cbSingleInstance.Name = "cbSingleInstance"; + this.cbSingleInstance.Text = "Single instance mode"; + // + // lblSingleInstanceDesc + // + this.lblSingleInstanceDesc.Location = new System.Drawing.Point(3, 23); + this.lblSingleInstanceDesc.Name = "lblSingleInstanceDesc"; + this.lblSingleInstanceDesc.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblSingleInstanceDesc.Text = "Enable to force only one instance of EmuHawk at a time."; + // + // lblSingleInstanceRestartWarning + // + this.lblSingleInstanceRestartWarning.Location = new System.Drawing.Point(3, 36); + this.lblSingleInstanceRestartWarning.Name = "lblSingleInstanceRestartWarning"; + this.lblSingleInstanceRestartWarning.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblSingleInstanceRestartWarning.Text = "Note: Requires closing and reopening EmuHawk to take effect."; + // + // tpAdvanced + // + this.tpAdvanced.Controls.Add(this.flpTpAdvanced); + this.tpAdvanced.Name = "tpAdvanced"; + this.tpAdvanced.Text = "Advanced"; + // + // flpTpAdvanced + // + this.flpTpAdvanced.Controls.Add(this.cbBackupSaveRAM); + this.flpTpAdvanced.Controls.Add(this.flpAutoSaveRAM); + this.flpTpAdvanced.Controls.Add(this.flpFrameAdvPastLag); + this.flpTpAdvanced.Controls.Add(this.cbRunLuaDuringTurbo); + this.flpTpAdvanced.Controls.Add(this.flpMoviesOnDisk); + this.flpTpAdvanced.Controls.Add(this.flpMoviesInAWE); + this.flpTpAdvanced.Controls.Add(this.grpLuaEngine); + this.flpTpAdvanced.Name = "flpTpAdvanced"; + // + // cbBackupSaveRAM + // + this.cbBackupSaveRAM.Name = "cbBackupSaveRAM"; + this.cbBackupSaveRAM.Text = "Backup SaveRAM to .SaveRAM.bak"; + // + // flpAutoSaveRAM + // + this.flpAutoSaveRAM.Controls.Add(this.cbAutoSaveRAM); + this.flpAutoSaveRAM.Controls.Add(this.grpAutoSaveRAM); + this.flpAutoSaveRAM.Name = "flpAutoSaveRAM"; + // + // cbAutoSaveRAM + // + this.cbAutoSaveRAM.Name = "cbAutoSaveRAM"; + this.cbAutoSaveRAM.CheckedChanged += new System.EventHandler(this.cbAutoSaveRAM_CheckedChanged); + // + // grpAutoSaveRAM + // + this.grpAutoSaveRAM.Controls.Add(this.flpGrpAutoSaveRAM); + this.grpAutoSaveRAM.Name = "grpAutoSaveRAM"; + this.grpAutoSaveRAM.Size = new System.Drawing.Size(238, 54); + this.grpAutoSaveRAM.Text = "AutoSaveRAM"; + // + // flpGrpAutoSaveRAM + // + this.flpGrpAutoSaveRAM.Controls.Add(this.lblAutoSaveRAM); + this.flpGrpAutoSaveRAM.Controls.Add(this.flpAutoSaveRAMFreq); + this.flpGrpAutoSaveRAM.Location = new System.Drawing.Point(3, 12); + this.flpGrpAutoSaveRAM.Name = "flpGrpAutoSaveRAM"; + // + // lblAutoSaveRAM + // + this.lblAutoSaveRAM.Name = "lblAutoSaveRAM"; + this.lblAutoSaveRAM.Text = "Save SaveRAM to .AutoSaveRAM.SaveRAM"; + // + // flpAutoSaveRAMFreq + // + this.flpAutoSaveRAMFreq.Controls.Add(this.lblAutoSaveRAMFreqDesc); + this.flpAutoSaveRAMFreq.Controls.Add(this.cbAutoSaveRAMFreq5s); + this.flpAutoSaveRAMFreq.Controls.Add(this.AutoSaveRAMFreq5min); + this.flpAutoSaveRAMFreq.Controls.Add(this.flpAutoSaveRAMFreqCustom); + this.flpAutoSaveRAMFreq.Name = "flpAutoSaveRAMFreq"; + // + // lblAutoSaveRAMFreqDesc + // + this.lblAutoSaveRAMFreqDesc.Name = "lblAutoSaveRAMFreqDesc"; + this.lblAutoSaveRAMFreqDesc.Text = "every"; + // + // cbAutoSaveRAMFreq5s + // + this.cbAutoSaveRAMFreq5s.Name = "cbAutoSaveRAMFreq5s"; + this.cbAutoSaveRAMFreq5s.Text = "5s"; + // + // AutoSaveRAMFreq5min + // + this.AutoSaveRAMFreq5min.Name = "AutoSaveRAMFreq5min"; + this.AutoSaveRAMFreq5min.Text = "5m"; + // + // flpAutoSaveRAMFreqCustom + // + this.flpAutoSaveRAMFreqCustom.Controls.Add(this.rbAutoSaveRAMFreqCustom); + this.flpAutoSaveRAMFreqCustom.Controls.Add(this.nudAutoSaveRAMFreqCustom); + this.flpAutoSaveRAMFreqCustom.Controls.Add(this.lblAutoSaveRAMFreqCustomUnits); + this.flpAutoSaveRAMFreqCustom.Name = "flpAutoSaveRAMFreqCustom"; + // + // rbAutoSaveRAMFreqCustom + // + this.rbAutoSaveRAMFreqCustom.Name = "rbAutoSaveRAMFreqCustom"; + this.rbAutoSaveRAMFreqCustom.CheckedChanged += new System.EventHandler(this.rbAutoSaveRAMFreqCustom_CheckedChanged); + // + // nudAutoSaveRAMFreqCustom + // + this.nudAutoSaveRAMFreqCustom.Maximum = new decimal(new int[] { 100000, 0, 0, 0}); - this.nudAutoSaveRAMFreqCustom.Name = "nudAutoSaveRAMFreqCustom"; - this.nudAutoSaveRAMFreqCustom.Size = new System.Drawing.Size(50, 20); - // - // lblAutoSaveRAMFreqCustomUnits - // - this.lblAutoSaveRAMFreqCustomUnits.Name = "lblAutoSaveRAMFreqCustomUnits"; - this.lblAutoSaveRAMFreqCustomUnits.Text = "s"; - // - // flpFrameAdvPastLag - // - this.flpFrameAdvPastLag.Controls.Add(this.cbFrameAdvPastLag); - this.flpFrameAdvPastLag.Controls.Add(this.lblFrameAdvPastLag1); - this.flpFrameAdvPastLag.Controls.Add(this.lblFrameAdvPastLag2); - this.flpFrameAdvPastLag.Name = "flpFrameAdvPastLag"; - // - // cbFrameAdvPastLag - // - this.cbFrameAdvPastLag.Name = "cbFrameAdvPastLag"; - this.cbFrameAdvPastLag.Text = "Frame advance button skips non-input frames"; - // - // lblFrameAdvPastLag1 - // - this.lblFrameAdvPastLag1.Location = new System.Drawing.Point(3, 23); - this.lblFrameAdvPastLag1.Name = "lblFrameAdvPastLag1"; - this.lblFrameAdvPastLag1.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblFrameAdvPastLag1.Text = "When enabled, the frame advance button will skip over"; - // - // lblFrameAdvPastLag2 - // - this.lblFrameAdvPastLag2.Location = new System.Drawing.Point(3, 36); - this.lblFrameAdvPastLag2.Name = "lblFrameAdvPastLag2"; - this.lblFrameAdvPastLag2.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblFrameAdvPastLag2.Text = "frames in which no input was polled (lag frames)"; - // - // cbRunLuaDuringTurbo - // - this.cbRunLuaDuringTurbo.Name = "cbRunLuaDuringTurbo"; - this.cbRunLuaDuringTurbo.Text = "Run lua scripts when turboing"; - // - // flpMoviesOnDisk - // - this.flpMoviesOnDisk.Controls.Add(this.cbMoviesOnDisk); - this.flpMoviesOnDisk.Controls.Add(this.lblMoviesOnDisk); - this.flpMoviesOnDisk.Name = "flpMoviesOnDisk"; - // - // cbMoviesOnDisk - // - this.cbMoviesOnDisk.Name = "cbMoviesOnDisk"; - this.cbMoviesOnDisk.Text = "Store movie working data on disk instead of RAM"; - // - // lblMoviesOnDisk - // - this.lblMoviesOnDisk.Location = new System.Drawing.Point(3, 23); - this.lblMoviesOnDisk.Name = "lblMoviesOnDisk"; - this.lblMoviesOnDisk.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblMoviesOnDisk.Text = "Will prevent many Out Of Memory crashes during long movies.\r\nYou must restart the" + + this.nudAutoSaveRAMFreqCustom.Name = "nudAutoSaveRAMFreqCustom"; + this.nudAutoSaveRAMFreqCustom.Size = new System.Drawing.Size(50, 20); + // + // lblAutoSaveRAMFreqCustomUnits + // + this.lblAutoSaveRAMFreqCustomUnits.Name = "lblAutoSaveRAMFreqCustomUnits"; + this.lblAutoSaveRAMFreqCustomUnits.Text = "s"; + // + // flpFrameAdvPastLag + // + this.flpFrameAdvPastLag.Controls.Add(this.cbFrameAdvPastLag); + this.flpFrameAdvPastLag.Controls.Add(this.lblFrameAdvPastLag1); + this.flpFrameAdvPastLag.Controls.Add(this.lblFrameAdvPastLag2); + this.flpFrameAdvPastLag.Name = "flpFrameAdvPastLag"; + // + // cbFrameAdvPastLag + // + this.cbFrameAdvPastLag.Name = "cbFrameAdvPastLag"; + this.cbFrameAdvPastLag.Text = "Frame advance button skips non-input frames"; + // + // lblFrameAdvPastLag1 + // + this.lblFrameAdvPastLag1.Location = new System.Drawing.Point(3, 23); + this.lblFrameAdvPastLag1.Name = "lblFrameAdvPastLag1"; + this.lblFrameAdvPastLag1.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblFrameAdvPastLag1.Text = "When enabled, the frame advance button will skip over"; + // + // lblFrameAdvPastLag2 + // + this.lblFrameAdvPastLag2.Location = new System.Drawing.Point(3, 36); + this.lblFrameAdvPastLag2.Name = "lblFrameAdvPastLag2"; + this.lblFrameAdvPastLag2.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblFrameAdvPastLag2.Text = "frames in which no input was polled (lag frames)"; + // + // cbRunLuaDuringTurbo + // + this.cbRunLuaDuringTurbo.Name = "cbRunLuaDuringTurbo"; + this.cbRunLuaDuringTurbo.Text = "Run lua scripts when turboing"; + // + // flpMoviesOnDisk + // + this.flpMoviesOnDisk.Controls.Add(this.cbMoviesOnDisk); + this.flpMoviesOnDisk.Controls.Add(this.lblMoviesOnDisk); + this.flpMoviesOnDisk.Name = "flpMoviesOnDisk"; + // + // cbMoviesOnDisk + // + this.cbMoviesOnDisk.Name = "cbMoviesOnDisk"; + this.cbMoviesOnDisk.Text = "Store movie working data on disk instead of RAM"; + // + // lblMoviesOnDisk + // + this.lblMoviesOnDisk.Location = new System.Drawing.Point(3, 23); + this.lblMoviesOnDisk.Name = "lblMoviesOnDisk"; + this.lblMoviesOnDisk.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblMoviesOnDisk.Text = "Will prevent many Out Of Memory crashes during long movies.\r\nYou must restart the" + " program after changing this."; - // - // flpMoviesInAWE - // - this.flpMoviesInAWE.Controls.Add(this.cbMoviesInAWE); - this.flpMoviesInAWE.Controls.Add(this.lblMoviesInAWE); - this.flpMoviesInAWE.Name = "flpMoviesInAWE"; - // - // cbMoviesInAWE - // - this.cbMoviesInAWE.Name = "cbMoviesInAWE"; - this.cbMoviesInAWE.Text = "Store movie working data in extended > 1GB Ram"; - // - // lblMoviesInAWE - // - this.lblMoviesInAWE.Location = new System.Drawing.Point(3, 23); - this.lblMoviesInAWE.Name = "lblMoviesInAWE"; - this.lblMoviesInAWE.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); - this.lblMoviesInAWE.Text = "Will reduce many Out Of Memory crashes during long movies.\r\nThis is experimental;" + - " it may require admin permissions.\r\nYou must restart the program after changing " + - "this."; - // - // grpLuaEngine - // - this.grpLuaEngine.Controls.Add(this.flpGrpLuaEngine); - this.grpLuaEngine.Name = "grpLuaEngine"; - this.grpLuaEngine.Size = new System.Drawing.Size(355, 67); - this.grpLuaEngine.Text = "Lua Engine"; - // - // flpGrpLuaEngine - // - this.flpGrpLuaEngine.Controls.Add(this.rbLuaInterface); - this.flpGrpLuaEngine.Controls.Add(this.rbKopiLua); - this.flpGrpLuaEngine.Location = new System.Drawing.Point(7, 16); - this.flpGrpLuaEngine.Name = "flpGrpLuaEngine"; - // - // rbKopiLua - // - this.rbKopiLua.Name = "rbKopiLua"; - this.rbKopiLua.Tag = BizHawk.Client.Common.ELuaEngine.NLuaPlusKopiLua; - this.rbKopiLua.Text = "NLua+KopiLua - Slower but reliable"; - // - // rbLuaInterface - // - this.rbLuaInterface.Name = "rbLuaInterface"; - this.rbLuaInterface.Tag = BizHawk.Client.Common.ELuaEngine.LuaPlusLuaInterface; - this.rbLuaInterface.Text = "Lua+LuaInterface"; - // - // flpDialogButtons - // - this.flpDialogButtons.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.flpDialogButtons.Controls.Add(this.btnDialogOK); - this.flpDialogButtons.Controls.Add(this.btnDialogCancel); - this.flpDialogButtons.Location = new System.Drawing.Point(247, 396); - this.flpDialogButtons.MinimumSize = new System.Drawing.Size(24, 24); - this.flpDialogButtons.Name = "flpDialogButtons"; - this.flpDialogButtons.Size = new System.Drawing.Size(132, 29); - // - // grpInputMethod - // - this.grpInputMethod.Controls.Add(this.flpGrpInputMethod); - this.grpInputMethod.Name = "grpInputMethod"; - this.grpInputMethod.Size = new System.Drawing.Size(334, 45); - this.grpInputMethod.Text = "Input Method (requires restart)"; - // - // flpGrpInputMethod - // - this.flpGrpInputMethod.Controls.Add(this.rbInputMethodDirectInput); - this.flpGrpInputMethod.Controls.Add(this.rbInputMethodOpenTK); - this.flpGrpInputMethod.Location = new System.Drawing.Point(4, 12); - this.flpGrpInputMethod.Name = "flpGrpInputMethod"; - // - // rbInputMethodOpenTK - // - this.rbInputMethodOpenTK.Name = "rbInputMethodOpenTK"; - this.rbInputMethodOpenTK.Tag = BizHawk.Client.Common.EHostInputMethod.OpenTK; - this.rbInputMethodOpenTK.Text = "OpenTK"; - // - // rbInputMethodDirectInput - // - this.rbInputMethodDirectInput.Name = "rbInputMethodDirectInput"; - this.rbInputMethodDirectInput.Tag = BizHawk.Client.Common.EHostInputMethod.DirectInput; - this.rbInputMethodDirectInput.Text = "DirectInput"; - // - // EmuHawkOptions - // - this.AcceptButton = this.btnDialogOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.btnDialogCancel; - this.ClientSize = new System.Drawing.Size(385, 431); - this.Controls.Add(this.flpDialogButtons); - this.Controls.Add(this.tcDialog); - this.MinimumSize = new System.Drawing.Size(401, 444); - this.Name = "EmuHawkOptions"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Customization Options"; - this.Load += new System.EventHandler(this.GuiOptions_Load); - this.tcDialog.ResumeLayout(false); - this.tpGeneral.ResumeLayout(false); - this.tpGeneral.PerformLayout(); - this.flpTpGeneral.ResumeLayout(false); - this.flpTpGeneral.PerformLayout(); - this.flpNoFocusEmulate.ResumeLayout(false); - this.flpNoFocusEmulate.PerformLayout(); - this.flpNoFocusInput.ResumeLayout(false); - this.flpNoFocusInput.PerformLayout(); - this.flpNoFocusInputCheckBoxes.ResumeLayout(false); - this.flpNoFocusInputCheckBoxes.PerformLayout(); - this.grpStartup.ResumeLayout(false); - this.grpStartup.PerformLayout(); - this.flpGrpStartup.ResumeLayout(false); - this.flpGrpStartup.PerformLayout(); - this.flpSingleInstance.ResumeLayout(false); - this.flpSingleInstance.PerformLayout(); - this.tpAdvanced.ResumeLayout(false); - this.tpAdvanced.PerformLayout(); - this.flpTpAdvanced.ResumeLayout(false); - this.flpTpAdvanced.PerformLayout(); - this.flpAutoSaveRAM.ResumeLayout(false); - this.flpAutoSaveRAM.PerformLayout(); - this.grpAutoSaveRAM.ResumeLayout(false); - this.grpAutoSaveRAM.PerformLayout(); - this.flpGrpAutoSaveRAM.ResumeLayout(false); - this.flpGrpAutoSaveRAM.PerformLayout(); - this.flpAutoSaveRAMFreq.ResumeLayout(false); - this.flpAutoSaveRAMFreq.PerformLayout(); - this.flpAutoSaveRAMFreqCustom.ResumeLayout(false); - this.flpAutoSaveRAMFreqCustom.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudAutoSaveRAMFreqCustom)).EndInit(); - this.flpFrameAdvPastLag.ResumeLayout(false); - this.flpFrameAdvPastLag.PerformLayout(); - this.flpMoviesOnDisk.ResumeLayout(false); - this.flpMoviesOnDisk.PerformLayout(); - this.flpMoviesInAWE.ResumeLayout(false); - this.flpMoviesInAWE.PerformLayout(); - this.grpLuaEngine.ResumeLayout(false); - this.grpLuaEngine.PerformLayout(); - this.flpGrpLuaEngine.ResumeLayout(false); - this.flpGrpLuaEngine.PerformLayout(); - this.flpDialogButtons.ResumeLayout(false); - this.grpInputMethod.ResumeLayout(false); - this.grpInputMethod.PerformLayout(); - this.flpGrpInputMethod.ResumeLayout(false); - this.flpGrpInputMethod.PerformLayout(); - this.ResumeLayout(false); + // + // flpMoviesInAWE + // + this.flpMoviesInAWE.Controls.Add(this.cbSkipWaterboxIntegrityChecks); + this.flpMoviesInAWE.Controls.Add(this.lblSkipWaterboxIntegrityChecks); + this.flpMoviesInAWE.Name = "flpMoviesInAWE"; + // + // cbSkipWaterboxIntegrityChecks + // + this.cbSkipWaterboxIntegrityChecks.Name = "cbSkipWaterboxIntegrityChecks"; + this.cbSkipWaterboxIntegrityChecks.Text = "Store movie working data in extended > 1GB Ram"; + // + // lblSkipWaterboxIntegrityChecks + // + this.lblSkipWaterboxIntegrityChecks.Location = new System.Drawing.Point(3, 23); + this.lblSkipWaterboxIntegrityChecks.Name = "lblSkipWaterboxIntegrityChecks"; + this.lblSkipWaterboxIntegrityChecks.Padding = new System.Windows.Forms.Padding(16, 0, 0, 0); + this.lblSkipWaterboxIntegrityChecks.Text = "Skips some integrity check exceptions in waterbox cores.\r\nUseful for romhackers."; + // + // grpLuaEngine + // + this.grpLuaEngine.Controls.Add(this.flpGrpLuaEngine); + this.grpLuaEngine.Name = "grpLuaEngine"; + this.grpLuaEngine.Size = new System.Drawing.Size(355, 67); + this.grpLuaEngine.Text = "Lua Engine"; + // + // flpGrpLuaEngine + // + this.flpGrpLuaEngine.Controls.Add(this.rbLuaInterface); + this.flpGrpLuaEngine.Controls.Add(this.rbKopiLua); + this.flpGrpLuaEngine.Location = new System.Drawing.Point(7, 16); + this.flpGrpLuaEngine.Name = "flpGrpLuaEngine"; + // + // rbLuaInterface + // + this.rbLuaInterface.Name = "rbLuaInterface"; + this.rbLuaInterface.Tag = BizHawk.Client.Common.ELuaEngine.LuaPlusLuaInterface; + this.rbLuaInterface.Text = "Lua+LuaInterface"; + // + // rbKopiLua + // + this.rbKopiLua.Name = "rbKopiLua"; + this.rbKopiLua.Tag = BizHawk.Client.Common.ELuaEngine.NLuaPlusKopiLua; + this.rbKopiLua.Text = "NLua+KopiLua - Slower but reliable"; + // + // flpDialogButtons + // + this.flpDialogButtons.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.flpDialogButtons.Controls.Add(this.btnDialogOK); + this.flpDialogButtons.Controls.Add(this.btnDialogCancel); + this.flpDialogButtons.Location = new System.Drawing.Point(247, 396); + this.flpDialogButtons.MinimumSize = new System.Drawing.Size(24, 24); + this.flpDialogButtons.Name = "flpDialogButtons"; + this.flpDialogButtons.Size = new System.Drawing.Size(132, 29); + // + // EmuHawkOptions + // + this.AcceptButton = this.btnDialogOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnDialogCancel; + this.ClientSize = new System.Drawing.Size(393, 431); + this.Controls.Add(this.flpDialogButtons); + this.Controls.Add(this.tcDialog); + this.MinimumSize = new System.Drawing.Size(401, 444); + this.Name = "EmuHawkOptions"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Customization Options"; + this.Load += new System.EventHandler(this.GuiOptions_Load); + this.tcDialog.ResumeLayout(false); + this.tpGeneral.ResumeLayout(false); + this.tpGeneral.PerformLayout(); + this.flpTpGeneral.ResumeLayout(false); + this.flpTpGeneral.PerformLayout(); + this.flpNoFocusEmulate.ResumeLayout(false); + this.flpNoFocusEmulate.PerformLayout(); + this.flpNoFocusInput.ResumeLayout(false); + this.flpNoFocusInput.PerformLayout(); + this.flpNoFocusInputCheckBoxes.ResumeLayout(false); + this.flpNoFocusInputCheckBoxes.PerformLayout(); + this.grpInputMethod.ResumeLayout(false); + this.grpInputMethod.PerformLayout(); + this.flpGrpInputMethod.ResumeLayout(false); + this.flpGrpInputMethod.PerformLayout(); + this.grpStartup.ResumeLayout(false); + this.grpStartup.PerformLayout(); + this.flpGrpStartup.ResumeLayout(false); + this.flpGrpStartup.PerformLayout(); + this.flpSingleInstance.ResumeLayout(false); + this.flpSingleInstance.PerformLayout(); + this.tpAdvanced.ResumeLayout(false); + this.tpAdvanced.PerformLayout(); + this.flpTpAdvanced.ResumeLayout(false); + this.flpTpAdvanced.PerformLayout(); + this.flpAutoSaveRAM.ResumeLayout(false); + this.flpAutoSaveRAM.PerformLayout(); + this.grpAutoSaveRAM.ResumeLayout(false); + this.grpAutoSaveRAM.PerformLayout(); + this.flpGrpAutoSaveRAM.ResumeLayout(false); + this.flpGrpAutoSaveRAM.PerformLayout(); + this.flpAutoSaveRAMFreq.ResumeLayout(false); + this.flpAutoSaveRAMFreq.PerformLayout(); + this.flpAutoSaveRAMFreqCustom.ResumeLayout(false); + this.flpAutoSaveRAMFreqCustom.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudAutoSaveRAMFreqCustom)).EndInit(); + this.flpFrameAdvPastLag.ResumeLayout(false); + this.flpFrameAdvPastLag.PerformLayout(); + this.flpMoviesOnDisk.ResumeLayout(false); + this.flpMoviesOnDisk.PerformLayout(); + this.flpMoviesInAWE.ResumeLayout(false); + this.flpMoviesInAWE.PerformLayout(); + this.grpLuaEngine.ResumeLayout(false); + this.grpLuaEngine.PerformLayout(); + this.flpGrpLuaEngine.ResumeLayout(false); + this.flpGrpLuaEngine.PerformLayout(); + this.flpDialogButtons.ResumeLayout(false); + this.ResumeLayout(false); } @@ -626,8 +624,8 @@ private BizHawk.WinForms.Controls.SzGroupBoxEx grpStartup; private BizHawk.WinForms.Controls.LocLabelEx lblMoviesOnDisk; private BizHawk.WinForms.Controls.CheckBoxEx cbMoviesOnDisk; - private BizHawk.WinForms.Controls.LocLabelEx lblMoviesInAWE; - private BizHawk.WinForms.Controls.CheckBoxEx cbMoviesInAWE; + private BizHawk.WinForms.Controls.LocLabelEx lblSkipWaterboxIntegrityChecks; + private BizHawk.WinForms.Controls.CheckBoxEx cbSkipWaterboxIntegrityChecks; private BizHawk.WinForms.Controls.RadioButtonEx rbLuaInterface; private BizHawk.WinForms.Controls.RadioButtonEx rbKopiLua; private BizHawk.WinForms.Controls.CheckBoxEx cbAutoSaveRAM; diff --git a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs index ec494fe5d4..e055b948e0 100644 --- a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs +++ b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.cs @@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk cbFrameAdvPastLag.Checked = _config.SkipLagFrame; cbRunLuaDuringTurbo.Checked = _config.RunLuaDuringTurbo; cbMoviesOnDisk.Checked = _config.MoviesOnDisk; - cbMoviesInAWE.Checked = _config.MoviesInAwe; + cbSkipWaterboxIntegrityChecks.Checked = _config.SkipWaterboxIntegrityChecks; switch (_config.LuaEngine) { @@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk _config.SkipLagFrame = cbFrameAdvPastLag.Checked; _config.RunLuaDuringTurbo = cbRunLuaDuringTurbo.Checked; _config.MoviesOnDisk = cbMoviesOnDisk.Checked; - _config.MoviesInAwe = cbMoviesInAWE.Checked; + _config.SkipWaterboxIntegrityChecks = cbSkipWaterboxIntegrityChecks.Checked; var prevLuaEngine = _config.LuaEngine; _config.LuaEngine = grpLuaEngine.Tracker.GetSelectionTagAs() ?? throw new InvalidOperationException(); diff --git a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.resx b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.resx index df8339b688..65a871b69c 100644 --- a/BizHawk.Client.EmuHawk/config/EmuHawkOptions.resx +++ b/BizHawk.Client.EmuHawk/config/EmuHawkOptions.resx @@ -1,123 +1,123 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + \ No newline at end of file diff --git a/BizHawk.Common/AWEMemoryStream.cs b/BizHawk.Common/AWEMemoryStream.cs deleted file mode 100644 index 7552e8e522..0000000000 --- a/BizHawk.Common/AWEMemoryStream.cs +++ /dev/null @@ -1,462 +0,0 @@ -#nullable disable - -using System; -using System.IO; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace BizHawk.Common -{ - /// - /// A MemoryStream that uses AWE to achieve a large addressable area, without being subject to 32 bit address space limits. - /// - public class AWEMemoryStream : Stream - { - const int kBlockSizeBits = 20; - const int kBlockSize = 1 << 20; - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool VirtualFree(IntPtr lpAddress, IntPtr dwSize, uint dwFreeType); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr VirtualAlloc(IntPtr lpAddress, IntPtr dwSize, AllocationType flAllocationType, MemoryProtection flProtect); - - [Flags] - enum MemoryProtection : uint - { - EXECUTE = 0x10, - EXECUTE_READ = 0x20, - EXECUTE_READWRITE = 0x40, - EXECUTE_WRITECOPY = 0x80, - NOACCESS = 0x01, - READONLY = 0x02, - READWRITE = 0x04, - WRITECOPY = 0x08, - GUARD_Modifierflag = 0x100, - NOCACHE_Modifierflag = 0x200, - WRITECOMBINE_Modifierflag = 0x400 - } - - [Flags] - enum AllocationType : uint - { - COMMIT = 0x1000, - RESERVE = 0x2000, - RESET = 0x80000, - LARGE_PAGES = 0x20000000, - PHYSICAL = 0x400000, - TOP_DOWN = 0x100000, - WRITE_WATCH = 0x200000 - } - - public AWEMemoryStream() - { - // bootstrap the datastructures - Position = 0; - - // allocate the window (address space that we'll allocate physical pages into) - mWindow = VirtualAlloc(IntPtr.Zero, new IntPtr(kBlockSize), AllocationType.RESERVE | AllocationType.PHYSICAL, MemoryProtection.READWRITE); - } - - protected override void Dispose(bool disposing) - { - if (mWindow != IntPtr.Zero) - { - VirtualFree(mWindow, IntPtr.Zero, 0x8000U); //MEM_RELEASE - mWindow = IntPtr.Zero; - } - - if (disposing) - { - foreach (var block in mBlocks) - block.Dispose(); - } - } - - ~AWEMemoryStream() - { - Dispose(false); - } - - long mLength = 0, mPosition = -1; - long mCurrBlock = -1; - List mBlocks = new List(); - IntPtr mWindow; - - public override bool CanRead => true; - public override bool CanSeek => true; - public override bool CanWrite => true; - public override void Flush() { } - public override long Length => mLength; - - public override long Position - { - get => mPosition; - set - { - if (!Ensure(value + 1)) - throw new OutOfMemoryException($"Couldn't set {nameof(AWEMemoryStream)} to specified Position"); - mPosition = value; - } - } - - - public override long Seek(long offset, SeekOrigin origin) - { - switch (origin) - { - case SeekOrigin.Begin: Position = offset; return Position; - case SeekOrigin.Current: Position += offset; return Position; - case SeekOrigin.End: Position = Length + offset; return Position; - default: throw new InvalidOperationException(); - } - } - - bool Ensure(long len) - { - long blocksNeeded = (len + kBlockSize - 1) >> kBlockSizeBits; - while (mBlocks.Count < blocksNeeded) - { - var block = new AWEMemoryBlock(); - if (!block.Allocate(kBlockSize)) - return false; - mBlocks.Add(block); - } - return true; - } - - public override void SetLength(long value) - { - if (!Ensure(value)) - throw new OutOfMemoryException($"Couldn't set {nameof(AWEMemoryStream)} to specified Length"); - mLength = value; - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (count + mPosition > mLength) - count = (int)(mLength - mPosition); - int ocount = count; - while (count > 0) - { - int todo = count; - long lblock = mPosition >> kBlockSizeBits; - if (lblock > int.MaxValue) throw new ArgumentOutOfRangeException(); - int block = (int)lblock; - int blockOfs = (int)(mPosition - (block << kBlockSizeBits)); - int remainsInBlock = kBlockSize - blockOfs; - if (remainsInBlock < todo) - todo = remainsInBlock; - if (mCurrBlock != block) - { - mCurrBlock = block; - if (!mBlocks[block].Map(mWindow)) - throw new Exception($"Couldn't map required memory for {nameof(AWEMemoryStream)}.{nameof(Write)}"); - } - Marshal.Copy(IntPtr.Add(mWindow, blockOfs), buffer, offset, todo); - count -= todo; - mPosition += todo; - offset += todo; - } - return ocount - count; - } - - public override void Write(byte[] buffer, int offset, int count) - { - long end = mPosition + count; - if (!Ensure(end)) - throw new OutOfMemoryException($"Couldn't reserve required resources for {nameof(AWEMemoryStream)}.{nameof(Write)}"); - SetLength(end); - while (count > 0) - { - int todo = count; - long lblock = mPosition >> kBlockSizeBits; - if (lblock > int.MaxValue) throw new ArgumentOutOfRangeException(); - int block = (int)lblock; - int blockOfs = (int)(mPosition - (block << kBlockSizeBits)); - int remainsInBlock = kBlockSize - blockOfs; - if (remainsInBlock < todo) - todo = remainsInBlock; - if (mCurrBlock != block) - { - mCurrBlock = block; - if (!mBlocks[block].Map(mWindow)) - throw new Exception($"Couldn't map required memory for {nameof(AWEMemoryStream)}.{nameof(Write)}"); - } - Marshal.Copy(buffer, offset, IntPtr.Add(mWindow, blockOfs), todo); - count -= todo; - mPosition += todo; - offset += todo; - } - } - - unsafe class AWEMemoryBlock : IDisposable - { - [DllImport("kernel32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool AllocateUserPhysicalPages(IntPtr hProcess, ref uint NumberOfPages, IntPtr PageArray); - - [DllImport("kernel32.dll")] - static extern bool MapUserPhysicalPages(IntPtr lpAddress, uint NumberOfPages, IntPtr UserPfnArray); - - [DllImport("kernel32.dll")] - static extern bool FreeUserPhysicalPages(IntPtr hProcess, ref uint NumberOfPages, IntPtr UserPfnArray); - - public enum ProcessorArchitecture - { - X86 = 0, - X64 = 9, - Arm = -1, - Itanium = 6, - Unknown = 0xFFFF, - } - - [StructLayout(LayoutKind.Sequential)] - public struct SystemInfo - { - public ProcessorArchitecture ProcessorArchitecture; // WORD - public uint PageSize; // DWORD - public IntPtr MinimumApplicationAddress; // (long)void* - public IntPtr MaximumApplicationAddress; // (long)void* - public IntPtr ActiveProcessorMask; // DWORD* - public uint NumberOfProcessors; // DWORD (WTF) - public uint ProcessorType; // DWORD - public uint AllocationGranularity; // DWORD - public ushort ProcessorLevel; // WORD - public ushort ProcessorRevision; // WORD - } - - [DllImport("kernel32", SetLastError = true)] - public static extern void GetSystemInfo(out SystemInfo lpSystemInfo); - - [StructLayout(LayoutKind.Sequential)] - public struct LUID - { - private uint lp; - private int hp; - - public uint LowPart - { - get => lp; - set => lp = value; - } - - public int HighPart - { - get => hp; - set => hp = value; - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct LUID_AND_ATTRIBUTES - { - private LUID luid; - private uint attributes; - - public LUID LUID - { - get => luid; - set => luid = value; - } - - public uint Attributes - { - get => attributes; - set => attributes = value; - } - } - - [StructLayout(LayoutKind.Sequential)] - public struct TOKEN_PRIVILEGES - { - private uint prvct; - [MarshalAs(UnmanagedType.ByValArray)] //edited from stackoverflow article - private LUID_AND_ATTRIBUTES[] privileges; - - public uint PrivilegeCount - { - get => prvct; - set => prvct = value; - } - - public LUID_AND_ATTRIBUTES[] Privileges - { - get => privileges; - set => privileges = value; - } - } - - [DllImport("advapi32", SetLastError = true)] - public static extern bool OpenProcessToken(IntPtr ProcessHandle, TokenAccessLevels DesiredAccess, out IntPtr TokenHandle); - - [DllImport("advapi32.dll", SetLastError = true)] - public static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, uint BufferLength, out TOKEN_PRIVILEGES PreviousState, out uint ReturnLength); - - [Flags] - internal enum TokenAccessLevels - { - AssignPrimary = 0x00000001, - Duplicate = 0x00000002, - Impersonate = 0x00000004, - Query = 0x00000008, - QuerySource = 0x00000010, - AdjustPrivileges = 0x00000020, - AdjustGroups = 0x00000040, - AdjustDefault = 0x00000080, - AdjustSessionId = 0x00000100, - - Read = 0x00020000 | Query, - - Write = 0x00020000 | AdjustPrivileges | AdjustGroups | AdjustDefault, - - AllAccess = 0x000F0000 | - AssignPrimary | - Duplicate | - Impersonate | - Query | - QuerySource | - AdjustPrivileges | - AdjustGroups | - AdjustDefault | - AdjustSessionId, - - MaximumAllowed = 0x02000000 - } - - //http://stackoverflow.com/questions/13616330/c-sharp-adjusttokenprivileges-not-working-on-32bit - [DllImport("advapi32.dll", SetLastError = true)] - public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, out LUID lpLuid); - public static bool EnableDisablePrivilege(string PrivilegeName, bool EnableDisable) - { - var htok = IntPtr.Zero; - if (!OpenProcessToken(System.Diagnostics.Process.GetCurrentProcess().Handle, TokenAccessLevels.AdjustPrivileges | TokenAccessLevels.Query, out htok)) - { - Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); - return false; - } - var tkp = new TOKEN_PRIVILEGES { PrivilegeCount = 1, Privileges = new LUID_AND_ATTRIBUTES[1] }; - if (!LookupPrivilegeValue(null, PrivilegeName, out var luid)) - { - Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); - return false; - } - tkp.Privileges[0].LUID = luid; - tkp.Privileges[0].Attributes = (uint)(EnableDisable ? 2 : 0); - TOKEN_PRIVILEGES prv; - uint rb; - if (!AdjustTokenPrivileges(htok, false, ref tkp, 256, out prv, out rb)) - { - Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); - return false; - } - - return true; - } - - static AWEMemoryBlock() - { - var si = new SystemInfo(); - GetSystemInfo(out si); - PageSize = si.PageSize; - } - - static uint PageSize; - static bool PrivilegeAcquired; - static object StaticLock = new object(); - - byte[] pageList; - - static bool TryAcquirePrivilege() - { - lock (StaticLock) - { - if (PrivilegeAcquired) - { - return true; - } - - if (EnableDisablePrivilege("SeLockMemoryPrivilege", true)) - { - PrivilegeAcquired = true; - return true; - } - - return false; - } - } - - /// is equivalent to more than uint.MaxValue pages - public bool Allocate(int byteSize) - { - if (!TryAcquirePrivilege()) - return false; - - long lnPagesRequested = byteSize / PageSize; - if (lnPagesRequested > uint.MaxValue) - throw new InvalidOperationException(); - uint nPagesRequested = (uint)lnPagesRequested; - - long sizePageList = IntPtr.Size * nPagesRequested; - pageList = new byte[sizePageList]; - - fixed (byte* pPageList = &pageList[0]) - { - uint nPagesAllocated = nPagesRequested; - bool bResult = AllocateUserPhysicalPages(System.Diagnostics.Process.GetCurrentProcess().Handle, ref nPagesAllocated, new IntPtr(pPageList)); - if (nPagesRequested != nPagesAllocated) - { - //abort! we're probably about to bomb the process, but just in case, we'll clean up - FreeUserPhysicalPages(System.Diagnostics.Process.GetCurrentProcess().Handle, ref nPagesAllocated, new IntPtr(pPageList)); - pageList = null; - return false; - } - } - - return true; - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - public bool Map(IntPtr targetWindow) - { - // note: unmapping previous mapping seems unnecessary - - if (pageList == null) - return false; - - // map the desired physical pages - fixed (byte* pPageList = &pageList[0]) - { - bool bResult = MapUserPhysicalPages(targetWindow, NumPages, new IntPtr(pPageList)); - return bResult; - } - } - - uint NumPages => (uint)(pageList.Length / (uint)IntPtr.Size); - - protected virtual void Dispose(bool disposing) - { - if (pageList == null) - return; - - fixed (byte* pPageList = &pageList[0]) - { - uint nPagesRequested = NumPages; - FreeUserPhysicalPages(System.Diagnostics.Process.GetCurrentProcess().Handle, ref nPagesRequested, new IntPtr(pPageList)); - pageList = null; - } - } - - ~AWEMemoryBlock() - { - Dispose(false); - } - - } - } -} \ No newline at end of file