From f561528846c1f66dc43ccafd7b993e0a289a3567 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 19 Jun 2014 21:55:15 +0000 Subject: [PATCH] More input display fixes --- BizHawk.Client.Common/movie/InputAdapters.cs | 24 ++++++++++++++++--- .../DisplayManager/OSDManager.cs | 6 ++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.Common/movie/InputAdapters.cs b/BizHawk.Client.Common/movie/InputAdapters.cs index fc378ddd2d..304a9342b0 100644 --- a/BizHawk.Client.Common/movie/InputAdapters.cs +++ b/BizHawk.Client.Common/movie/InputAdapters.cs @@ -192,7 +192,8 @@ namespace BizHawk.Client.Common { get { - return Source[button] | SourceOr[button]; + return (Source != null ? Source[button] : false) | + (SourceOr != null ? SourceOr[button] : false); } set { @@ -221,7 +222,12 @@ namespace BizHawk.Client.Common { get { - return Source[button] & SourceAnd[button]; + if (Source != null && SourceAnd != null) + { + return Source[button] & SourceAnd[button]; + } + + return false; } set @@ -304,7 +310,19 @@ namespace BizHawk.Client.Common public float GetFloat(string name) { - return _floatSet[name] ?? Source.GetFloat(name); + var val = _floatSet[name]; + + if (val.HasValue) + { + return val.Value; + } + + if (Source == null) + { + return 0; + } + + return Source.GetFloat(name); } public void ClearStickyFloats() diff --git a/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs b/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs index c244193ff5..caa27a0309 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs @@ -255,7 +255,9 @@ namespace BizHawk.Client.EmuHawk public string InputStrOrAll() { - var m = Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished ? + var m = (Global.MovieSession.Movie.IsActive && + !Global.MovieSession.Movie.IsFinished && + Global.Emulator.Frame > 0) ? Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) : Global.MovieSession.MovieControllerInstance(); @@ -265,7 +267,9 @@ namespace BizHawk.Client.EmuHawk SourceOr = m }; + var lg = Global.MovieSession.LogGeneratorInstance(); + lg.SetSource(orAdaptor); return lg.GenerateInputDisplay(); }