From 2304b2d4e28f5082693cd488b633d8105b3e275a Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 12 Jul 2012 19:23:39 +0000 Subject: [PATCH] Lua - implement emu.limitframerate, also add on screen message when limit frame rate is toggled --- BizHawk.MultiClient/LuaImplementation.cs | 22 ++++++++++++++++++++-- BizHawk.MultiClient/MainForm.MenuItems.cs | 13 +++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index dcaa0521d2..91d432c7d3 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -289,6 +289,7 @@ namespace BizHawk.MultiClient "setrenderplanes", "frameskip", "minimizeframeskip", + "limitframerate", }; public static string[] MemoryFunctions = new string[] @@ -845,9 +846,9 @@ namespace BizHawk.MultiClient } } - public void emu_minimizeframeskip(object minimize) + public void emu_minimizeframeskip(object boolean) { - string temp = minimize.ToString(); + string temp = boolean.ToString(); if (!String.IsNullOrWhiteSpace(temp)) { if (temp == "0" || temp.ToLower() == "false") @@ -862,6 +863,23 @@ namespace BizHawk.MultiClient } } + public void emu_limitframerate(object boolean) + { + string temp = boolean.ToString(); + if (!String.IsNullOrWhiteSpace(temp)) + { + if (temp == "0" || temp.ToLower() == "false") + { + Global.Config.LimitFramerate = false; + } + else + { + Global.Config.LimitFramerate = true; + } + Global.MainForm.LimitFrameRateMessage(); + } + } + public void emu_frameskip(object num_frames) { try diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index d7f2859d39..a489681a80 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -53,6 +53,19 @@ namespace BizHawk.MultiClient private void miLimitFramerate_Click(object sender, EventArgs e) { Global.Config.LimitFramerate ^= true; + LimitFrameRateMessage(); + } + + public void LimitFrameRateMessage() + { + if (Global.Config.LimitFramerate) + { + Global.OSD.AddMessage("Framerate limiting on"); + } + else + { + Global.OSD.AddMessage("Framerate limiting off"); + } } private void miDisplayVsync_Click(object sender, EventArgs e)