diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index fa6977cd9f..78817fbbf2 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -609,7 +609,7 @@ namespace BizHawk.Client.EmuHawk private bool IsTurboSeeking => PauseOnFrame.HasValue && Global.Config.TurboSeek; - private bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking; + public bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking; #endregion @@ -2969,11 +2969,6 @@ namespace BizHawk.Client.EmuHawk Global.CheatList.Pulse(); - if (!PauseAvi) - { - AvFrameAdvance(); - } - if (IsLagFrame && Global.Config.AutofireLagFrames) { Global.AutoFireController.IncrementStarts(); @@ -2997,6 +2992,11 @@ namespace BizHawk.Client.EmuHawk UpdateToolsAfter(SuppressLua); } + if (!PauseAvi) + { + AvFrameAdvance(); + } + if (GlobalWin.Tools.IsLoaded() && GlobalWin.Tools.TAStudio.LastPositionFrame == Emulator.Frame) { diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs index 7a20625169..40b99bd2b9 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs @@ -150,6 +150,18 @@ namespace BizHawk.Client.EmuHawk return GlobalWin.MainForm.EmulatorPaused; } + [LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")] + public static bool IsTurbo() + { + return GlobalWin.MainForm.IsTurboing; + } + + [LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")] + public static bool IsSeeking() + { + return GlobalWin.MainForm.IsSeeking; + } + [LuaMethod("opencheats", "opens the Cheats dialog")] public static void OpenCheats() { diff --git a/Bizware/BizHawk.Bizware.BizwareGL/StringRenderer.cs b/Bizware/BizHawk.Bizware.BizwareGL/StringRenderer.cs index 94a879483d..11e4d360b2 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/StringRenderer.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/StringRenderer.cs @@ -32,34 +32,66 @@ namespace BizHawk.Bizware.BizwareGL public sd.SizeF Measure(string str) { float x = 0; + float y = FontInfo.LineHeight; + float ox = x; int len = str.Length; + for (int i = 0; i < len; i++) { - Cyotek.Drawing.BitmapFont.Character c; - if (!FontInfo.Characters.TryGetValue(str[i], out c)) - c = FontInfo.Characters[unchecked((char)-1)]; + int c = str[i]; - x += c.XAdvance; + if (c == '\r') + { + if (i != len - 1 && str[i + 1] == '\n') + i++; + } + + if (c == '\r') + { + c = '\n'; + } + + if (c == '\n') + { + if (x > ox) + ox = x; + x = 0; + y += FontInfo.LineHeight; + continue; + } + + Cyotek.Drawing.BitmapFont.Character bfc; + if (!FontInfo.Characters.TryGetValue((char)c, out bfc)) + bfc = FontInfo.Characters[unchecked((char)-1)]; + + x += bfc.XAdvance; } - return new sd.SizeF(x, FontInfo.LineHeight); + return new sd.SizeF(Math.Max(x, ox), y); } public void RenderString(IGuiRenderer renderer, float x, float y, string str) { float ox = x; int len = str.Length; + for (int i = 0; i < len; i++) { int c = str[i]; + if (c == '\r') { if (i != len - 1 && str[i + 1] == '\n') i++; } - if (c == '\r') c = '\n'; - if(c == '\n') { + if (c == '\r') + { + c = '\n'; + } + + if(c == '\n') + { x = ox; y += FontInfo.LineHeight; continue;