diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 2c7b285fc2..f8c9edf995 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -226,10 +226,12 @@ namespace BizHawk.MultiClient public int FrameSkip = 4; public int SpeedPercent = 100; public int SpeedPercentAlternate = 400; - public bool LimitFramerate = true; + public bool ClockThrottle = true; public bool AutoMinimizeSkipping = true; - public bool DisplayVSync = false; + public bool VSyncThrottle = false; public bool RewindEnabled = true; + /// use vsync. if VSyncThrottle = false, this will try to use vsync without throttling to it + public bool VSync = false; // Display options public int MessagesColor = -1; diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index f5371c23c7..791c8cde15 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -1080,11 +1080,11 @@ namespace BizHawk.MultiClient { if (temp == "0" || temp.ToLower() == "false") { - Global.Config.LimitFramerate = false; + Global.Config.ClockThrottle = false; } else { - Global.Config.LimitFramerate = true; + Global.Config.ClockThrottle = true; } Global.MainForm.LimitFrameRateMessage(); } @@ -1097,11 +1097,11 @@ namespace BizHawk.MultiClient { if (temp == "0" || temp.ToLower() == "false") { - Global.Config.DisplayVSync = false; + Global.Config.VSyncThrottle = false; } else { - Global.Config.DisplayVSync = true; + Global.Config.VSyncThrottle = true; } Global.MainForm.VsyncMessage(); } diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index e0fa15094b..375561e37d 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -166,7 +166,10 @@ this.logWindowAsConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.frameSkipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miLimitFramerate = new System.Windows.Forms.ToolStripMenuItem(); + this.audioThrottleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miDisplayVsync = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator27 = new System.Windows.Forms.ToolStripSeparator(); + this.vSyncEnabledToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.miAutoMinimizeSkipping = new System.Windows.Forms.ToolStripMenuItem(); this.miFrameskip0 = new System.Windows.Forms.ToolStripMenuItem(); @@ -249,6 +252,7 @@ this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.changeDMGPalettesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadGBInSGBToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.gPUViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.sNESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.bG0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -306,7 +310,6 @@ this.cmiScreenshotClipboard = new System.Windows.Forms.ToolStripMenuItem(); this.cmiCloseRom = new System.Windows.Forms.ToolStripMenuItem(); this.cmiShowMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.gPUViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.StatusSlot0.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); @@ -1267,7 +1270,7 @@ // this.controllersToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.GameController; this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem"; - this.controllersToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.controllersToolStripMenuItem.Text = "&Controllers..."; this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); // @@ -1275,7 +1278,7 @@ // this.hotkeysToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.HotKeys; this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem"; - this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.hotkeysToolStripMenuItem.Text = "&Hotkeys..."; this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); // @@ -1283,7 +1286,7 @@ // this.messagesToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MessageConfig; this.messagesToolStripMenuItem.Name = "messagesToolStripMenuItem"; - this.messagesToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.messagesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.messagesToolStripMenuItem.Text = "&Messages..."; this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click); // @@ -1291,7 +1294,7 @@ // this.pathsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.CopyFolderHS; this.pathsToolStripMenuItem.Name = "pathsToolStripMenuItem"; - this.pathsToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.pathsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.pathsToolStripMenuItem.Text = "Paths..."; this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click); // @@ -1299,7 +1302,7 @@ // this.soundToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.AudioHS; this.soundToolStripMenuItem.Name = "soundToolStripMenuItem"; - this.soundToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.soundToolStripMenuItem.Text = "&Sound..."; this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click); // @@ -1307,14 +1310,14 @@ // this.autofireToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lightning; this.autofireToolStripMenuItem.Name = "autofireToolStripMenuItem"; - this.autofireToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.autofireToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.autofireToolStripMenuItem.Text = "&Autofire..."; this.autofireToolStripMenuItem.Click += new System.EventHandler(this.autofireToolStripMenuItem_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(135, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); // // enableToolStripMenuItem // @@ -1327,7 +1330,7 @@ this.frameAdvanceSkipLagFramesToolStripMenuItem, this.backupSaveramToolStripMenuItem}); this.enableToolStripMenuItem.Name = "enableToolStripMenuItem"; - this.enableToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.enableToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.enableToolStripMenuItem.Text = "&Enable"; this.enableToolStripMenuItem.DropDownOpened += new System.EventHandler(this.enableToolStripMenuItem_DropDownOpened); // @@ -1398,7 +1401,7 @@ this.toolStripSeparator23, this.logWindowAsConsoleToolStripMenuItem}); this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; - this.gUIToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.gUIToolStripMenuItem.Text = "GUI"; this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); // @@ -1500,7 +1503,10 @@ // this.frameSkipToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.miLimitFramerate, + this.audioThrottleToolStripMenuItem, this.miDisplayVsync, + this.toolStripSeparator27, + this.vSyncEnabledToolStripMenuItem, this.toolStripMenuItem3, this.miAutoMinimizeSkipping, this.miFrameskip0, @@ -1520,7 +1526,7 @@ this.miSpeed150, this.miSpeed200}); this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem"; - this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.frameSkipToolStripMenuItem.Text = "Speed/Skip"; this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened); // @@ -1528,16 +1534,36 @@ // this.miLimitFramerate.Name = "miLimitFramerate"; this.miLimitFramerate.Size = new System.Drawing.Size(181, 22); - this.miLimitFramerate.Text = "Limit Framerate"; + this.miLimitFramerate.Text = "Clock Throttle"; + this.miLimitFramerate.DropDownOpened += new System.EventHandler(this.miLimitFramerate_DropDownOpened); this.miLimitFramerate.Click += new System.EventHandler(this.miLimitFramerate_Click); // + // audioThrottleToolStripMenuItem + // + this.audioThrottleToolStripMenuItem.Name = "audioThrottleToolStripMenuItem"; + this.audioThrottleToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.audioThrottleToolStripMenuItem.Text = "Audio Throttle"; + this.audioThrottleToolStripMenuItem.Click += new System.EventHandler(this.audioThrottleToolStripMenuItem_Click); + // // miDisplayVsync // this.miDisplayVsync.Name = "miDisplayVsync"; this.miDisplayVsync.Size = new System.Drawing.Size(181, 22); - this.miDisplayVsync.Text = "Display VSync"; + this.miDisplayVsync.Text = "VSync Throttle"; this.miDisplayVsync.Click += new System.EventHandler(this.miDisplayVsync_Click); // + // toolStripSeparator27 + // + this.toolStripSeparator27.Name = "toolStripSeparator27"; + this.toolStripSeparator27.Size = new System.Drawing.Size(178, 6); + // + // vSyncEnabledToolStripMenuItem + // + this.vSyncEnabledToolStripMenuItem.Name = "vSyncEnabledToolStripMenuItem"; + this.vSyncEnabledToolStripMenuItem.Size = new System.Drawing.Size(181, 22); + this.vSyncEnabledToolStripMenuItem.Text = "VSync Enabled"; + this.vSyncEnabledToolStripMenuItem.Click += new System.EventHandler(this.vSyncEnabledToolStripMenuItem_Click); + // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; @@ -1663,13 +1689,13 @@ // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(135, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6); // // saveConfigToolStripMenuItem // this.saveConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Save; this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem"; - this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.saveConfigToolStripMenuItem.Text = "Save Config"; this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); // @@ -1677,7 +1703,7 @@ // this.loadConfigToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.LoadConfig; this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem"; - this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.loadConfigToolStripMenuItem.Text = "Load Config"; this.loadConfigToolStripMenuItem.Click += new System.EventHandler(this.loadConfigToolStripMenuItem_Click); // @@ -1705,20 +1731,20 @@ // this.toolBoxToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.ToolBox; this.toolBoxToolStripMenuItem.Name = "toolBoxToolStripMenuItem"; - this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.toolBoxToolStripMenuItem.Text = "&Tool Box"; this.toolBoxToolStripMenuItem.Click += new System.EventHandler(this.toolBoxToolStripMenuItem_Click); // // toolStripSeparator12 // this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(134, 6); + this.toolStripSeparator12.Size = new System.Drawing.Size(149, 6); // // rAMWatchToolStripMenuItem // this.rAMWatchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.FindHS; this.rAMWatchToolStripMenuItem.Name = "rAMWatchToolStripMenuItem"; - this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMWatchToolStripMenuItem.Text = "RAM &Watch"; this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click); // @@ -1726,7 +1752,7 @@ // this.rAMSearchToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.search; this.rAMSearchToolStripMenuItem.Name = "rAMSearchToolStripMenuItem"; - this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMSearchToolStripMenuItem.Text = "RAM &Search"; this.rAMSearchToolStripMenuItem.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click); // @@ -1734,7 +1760,7 @@ // this.rAMPokeToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; this.rAMPokeToolStripMenuItem.Name = "rAMPokeToolStripMenuItem"; - this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.rAMPokeToolStripMenuItem.Text = "RAM &Poke"; this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click); // @@ -1742,7 +1768,7 @@ // this.hexEditorToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.poke; this.hexEditorToolStripMenuItem.Name = "hexEditorToolStripMenuItem"; - this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.hexEditorToolStripMenuItem.Text = "&Hex Editor"; this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click); // @@ -1750,7 +1776,7 @@ // this.traceLoggerToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.pencil; this.traceLoggerToolStripMenuItem.Name = "traceLoggerToolStripMenuItem"; - this.traceLoggerToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.traceLoggerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.traceLoggerToolStripMenuItem.Text = "Trace &Logger"; this.traceLoggerToolStripMenuItem.Click += new System.EventHandler(this.traceLoggerToolStripMenuItem_Click); // @@ -1758,7 +1784,7 @@ // this.tAStudioToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.TAStudio; this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem"; - this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.tAStudioToolStripMenuItem.Text = "&TAStudio"; this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click); // @@ -1766,20 +1792,20 @@ // this.virtualPadToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.GameController; this.virtualPadToolStripMenuItem.Name = "virtualPadToolStripMenuItem"; - this.virtualPadToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.virtualPadToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.virtualPadToolStripMenuItem.Text = "Virtual Pad"; this.virtualPadToolStripMenuItem.Click += new System.EventHandler(this.virtualPadToolStripMenuItem_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(134, 6); + this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6); // // luaConsoleToolStripMenuItem // this.luaConsoleToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Lua; this.luaConsoleToolStripMenuItem.Name = "luaConsoleToolStripMenuItem"; - this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.luaConsoleToolStripMenuItem.Text = "Lua Console"; this.luaConsoleToolStripMenuItem.Click += new System.EventHandler(this.luaConsoleToolStripMenuItem_Click); // @@ -1787,7 +1813,7 @@ // this.cheatsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Freeze; this.cheatsToolStripMenuItem.Name = "cheatsToolStripMenuItem"; - this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.cheatsToolStripMenuItem.Text = "Cheats"; this.cheatsToolStripMenuItem.Click += new System.EventHandler(this.cheatsToolStripMenuItem_Click); // @@ -2166,6 +2192,13 @@ this.loadGBInSGBToolStripMenuItem1.Text = "Load GB in SGB"; this.loadGBInSGBToolStripMenuItem1.Click += new System.EventHandler(this.loadGBInSGBToolStripMenuItem1_Click); // + // gPUViewerToolStripMenuItem + // + this.gPUViewerToolStripMenuItem.Name = "gPUViewerToolStripMenuItem"; + this.gPUViewerToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.gPUViewerToolStripMenuItem.Text = "GPU Viewer"; + this.gPUViewerToolStripMenuItem.Click += new System.EventHandler(this.gPUViewerToolStripMenuItem_Click); + // // sNESToolStripMenuItem // this.sNESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -2647,13 +2680,6 @@ this.cmiShowMenu.Text = "Show Menu"; this.cmiShowMenu.Click += new System.EventHandler(this.showMenuToolStripMenuItem_Click); // - // gPUViewerToolStripMenuItem - // - this.gPUViewerToolStripMenuItem.Name = "gPUViewerToolStripMenuItem"; - this.gPUViewerToolStripMenuItem.Size = new System.Drawing.Size(190, 22); - this.gPUViewerToolStripMenuItem.Text = "GPU Viewer"; - this.gPUViewerToolStripMenuItem.Click += new System.EventHandler(this.gPUViewerToolStripMenuItem_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); @@ -2972,6 +2998,9 @@ private System.Windows.Forms.ToolStripMenuItem showBallToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showPlayfieldToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem gPUViewerToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem audioThrottleToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator27; + private System.Windows.Forms.ToolStripMenuItem vSyncEnabledToolStripMenuItem; } } diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 2d3b56503c..82f871269c 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -53,13 +53,61 @@ namespace BizHawk.MultiClient private void miLimitFramerate_Click(object sender, EventArgs e) { - Global.Config.LimitFramerate ^= true; + Global.Config.ClockThrottle ^= true; + if (Global.Config.ClockThrottle) + { + bool old = Global.Config.SoundThrottle; + Global.Config.SoundThrottle = false; + if (old) + RewireSound(); + old = Global.Config.VSyncThrottle; + Global.Config.VSyncThrottle = false; + if (old) + Global.RenderPanel.Resized = true; + } LimitFrameRateMessage(); } + private void audioThrottleToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.SoundThrottle ^= true; + RewireSound(); + if (Global.Config.SoundThrottle) + { + Global.Config.ClockThrottle = false; + bool old = Global.Config.VSyncThrottle; + Global.Config.VSyncThrottle = false; + if (old) + Global.RenderPanel.Resized = true; + } + + } + + private void miDisplayVsync_Click(object sender, EventArgs e) + { + Global.Config.VSyncThrottle ^= true; + Global.RenderPanel.Resized = true; + if (Global.Config.VSyncThrottle) + { + Global.Config.ClockThrottle = false; + bool old = Global.Config.SoundThrottle; + Global.Config.SoundThrottle = false; + if (old) + RewireSound(); + } + VsyncMessage(); + } + + private void vSyncEnabledToolStripMenuItem_Click(object sender, EventArgs e) + { + Global.Config.VSync ^= true; + if (!Global.Config.VSyncThrottle) // when vsync throttle is on, vsync is forced to on, so no change to make here + Global.RenderPanel.Resized = true; + } + public void LimitFrameRateMessage() { - if (Global.Config.LimitFramerate) + if (Global.Config.ClockThrottle) { Global.OSD.AddMessage("Framerate limiting on"); } @@ -69,16 +117,10 @@ namespace BizHawk.MultiClient } } - private void miDisplayVsync_Click(object sender, EventArgs e) - { - Global.Config.DisplayVSync ^= true; - Global.RenderPanel.Resized = true; - VsyncMessage(); - } public void VsyncMessage() { - if (Global.Config.DisplayVSync) + if (Global.Config.VSyncThrottle) { Global.OSD.AddMessage("Display Vsync is set to on"); } @@ -1258,8 +1300,8 @@ namespace BizHawk.MultiClient private void frameSkipToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { miAutoMinimizeSkipping.Checked = Global.Config.AutoMinimizeSkipping; - miLimitFramerate.Checked = Global.Config.LimitFramerate; - miDisplayVsync.Checked = Global.Config.DisplayVSync; + miLimitFramerate.Checked = Global.Config.ClockThrottle; + miDisplayVsync.Checked = Global.Config.VSyncThrottle; miFrameskip0.Checked = Global.Config.FrameSkip == 0; miFrameskip1.Checked = Global.Config.FrameSkip == 1; miFrameskip2.Checked = Global.Config.FrameSkip == 2; @@ -1270,6 +1312,12 @@ namespace BizHawk.MultiClient miFrameskip7.Checked = Global.Config.FrameSkip == 7; miFrameskip8.Checked = Global.Config.FrameSkip == 8; miFrameskip9.Checked = Global.Config.FrameSkip == 9; + miAutoMinimizeSkipping.Enabled = !miFrameskip0.Checked; + if (!miAutoMinimizeSkipping.Enabled) miAutoMinimizeSkipping.Checked = true; + audioThrottleToolStripMenuItem.Enabled = Global.Config.SoundEnabled; + audioThrottleToolStripMenuItem.Checked = Global.Config.SoundThrottle; + vSyncEnabledToolStripMenuItem.Checked = Global.Config.VSync; + miSpeed100.Checked = Global.Config.SpeedPercent == 100; miSpeed100.Image = (Global.Config.SpeedPercentAlternate == 100) ? BizHawk.MultiClient.Properties.Resources.FastForward : null; miSpeed150.Checked = Global.Config.SpeedPercent == 150; @@ -1280,8 +1328,6 @@ namespace BizHawk.MultiClient miSpeed75.Image = (Global.Config.SpeedPercentAlternate == 75) ? BizHawk.MultiClient.Properties.Resources.FastForward : null; miSpeed50.Checked = Global.Config.SpeedPercent == 50; miSpeed50.Image = (Global.Config.SpeedPercentAlternate == 50) ? BizHawk.MultiClient.Properties.Resources.FastForward : null; - miAutoMinimizeSkipping.Enabled = !miFrameskip0.Checked; - if (!miAutoMinimizeSkipping.Enabled) miAutoMinimizeSkipping.Checked = true; } private void gUIToolStripMenuItem_DropDownOpened(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 43bbd70453..52de2f4018 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -24,7 +24,7 @@ namespace BizHawk.MultiClient public partial class MainForm : Form { - public bool INTERIM = false; + public bool INTERIM = true; public const string EMUVERSION = "Version " + VersionInfo.MAINVERSION; public const string RELEASEDATE = "October 20, 2012"; private Control renderTarget; @@ -4389,5 +4389,10 @@ namespace BizHawk.MultiClient { LoadGBGPUView(); } + + private void miLimitFramerate_DropDownOpened(object sender, EventArgs e) + { + } + } } diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index 564a0dd329..76b594867d 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -374,8 +374,9 @@ namespace BizHawk.MultiClient { get { - if (Global.ForceNoThrottle) return false; - return Global.Config.DisplayVSync; + if (Global.ForceNoThrottle) + return false; + return Global.Config.VSyncThrottle || Global.Config.VSync; } } @@ -388,7 +389,7 @@ namespace BizHawk.MultiClient BackBufferWidth = Math.Max(1, backingControl.ClientSize.Width), BackBufferHeight = Math.Max(1, backingControl.ClientSize.Height), DeviceWindowHandle = backingControl.Handle, - PresentationInterval = Vsync ? PresentInterval.One : PresentInterval.Immediate + PresentationInterval = Vsync ? PresentInterval.One : PresentInterval.Immediate }; var flags = CreateFlags.SoftwareVertexProcessing; @@ -516,13 +517,38 @@ namespace BizHawk.MultiClient RenderWrapper(_Present); } + System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); + long stopwatchthrottle = System.Diagnostics.Stopwatch.Frequency / 50; + long stopwatchtmr = 0; private void _Present() { - Device.Present(SlimDX.Direct3D9.Present.None); - vsyncEvent.Set(); + // according to the internet, D3DPRESENT_DONOTWAIT is not terribly reliable + // so instead we measure the time the present takes, and drop the next present call if it was too long + // this code isn't really very good + if (Global.Config.VSync && !Global.Config.VSyncThrottle) + { + if (stopwatchtmr > stopwatchthrottle) + { + stopwatchtmr = 0; + //Console.WriteLine('s'); + } + else + { + stopwatch.Restart(); + //Device.GetSwapChain(0).Present(SlimDX.Direct3D9.Present.DoNotWait); + Device.Present(SlimDX.Direct3D9.Present.None); + stopwatch.Stop(); + stopwatchtmr += stopwatch.ElapsedTicks; + //Console.WriteLine('.'); + stopwatchtmr -= stopwatchthrottle / 4; + } + } + else + Device.Present(SlimDX.Direct3D9.Present.None); } - public static EventWaitHandle vsyncEvent = new EventWaitHandle(false, EventResetMode.AutoReset); + // not used anywhere? + //public static EventWaitHandle vsyncEvent = new EventWaitHandle(false, EventResetMode.AutoReset); private bool disposed; diff --git a/BizHawk.MultiClient/Throttle.cs b/BizHawk.MultiClient/Throttle.cs index 363eed65e0..f9d918017c 100644 --- a/BizHawk.MultiClient/Throttle.cs +++ b/BizHawk.MultiClient/Throttle.cs @@ -44,7 +44,7 @@ namespace BizHawk.MultiClient } else { - return Global.Config.LimitFramerate; + return Global.Config.ClockThrottle; } } } diff --git a/BizHawk.MultiClient/config/SoundConfig.cs b/BizHawk.MultiClient/config/SoundConfig.cs index ff24bf8b4d..10408154a3 100644 --- a/BizHawk.MultiClient/config/SoundConfig.cs +++ b/BizHawk.MultiClient/config/SoundConfig.cs @@ -25,14 +25,15 @@ namespace BizHawk.MultiClient SoundVolNumeric.Value = Global.Config.SoundVolume; UpdateSoundDialog(); - if (Global.MainForm.INTERIM) - { - ThrottlecheckBox.Visible = true; - } - else - { + // to be removed + //if (Global.MainForm.INTERIM) + //{ + // ThrottlecheckBox.Visible = true; + //} + //else + //{ ThrottlecheckBox.Visible = false; - } + //} } private void OK_Click(object sender, EventArgs e)