From 5258f9385c22eb73d882fd569c003a3a78b5fabf Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 4 Dec 2016 12:30:51 -0600 Subject: [PATCH] Tastudio - use the Emulator property not Global.Emulator, fix another CoreExension method --- .../tools/TAStudio/BookmarksBranchesBox.cs | 2 +- .../tools/TAStudio/MarkerControl.cs | 4 ++-- .../tools/TAStudio/TAStudio.IToolForm.cs | 2 +- .../tools/TAStudio/TAStudio.ListView.cs | 12 ++++++------ .../tools/TAStudio/TAStudio.MenuItems.cs | 4 ++-- .../tools/TAStudio/TAStudio.cs | 16 ++++++++-------- .../Extensions/CoreExtensions.cs | 6 +++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 8cbfd5e8fe..9f7964522d 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk return new TasBranch { Frame = Tastudio.Emulator.Frame, - CoreData = (byte[])((Global.Emulator as IStatable).SaveStateBinary().Clone()), + CoreData = (byte[])(Tastudio.StatableEmulator.SaveStateBinary().Clone()), InputLog = Movie.InputLog.Clone(), OSDFrameBuffer = GlobalWin.MainForm.CaptureOSD(), LagLog = Movie.TasLagLog.Clone(), diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 0c6818d5a8..c49f75ef31 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color) { - var prev = Markers.PreviousOrCurrent(Global.Emulator.Frame);//Temp fix + var prev = Markers.PreviousOrCurrent(Emulator.Frame);//Temp fix if (prev != null && index == Markers.IndexOf(prev)) { @@ -161,7 +161,7 @@ namespace BizHawk.Client.EmuHawk public void AddMarker(bool editText = false, int? frame = null) { // feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame - var markerFrame = frame ?? Global.Emulator.Frame; + var markerFrame = frame ?? Emulator.Frame; if (editText) { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs index b476bccf5e..fb4dde2a12 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs @@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk MaybeFollowCursor(); - if (TasView.IsPartiallyVisible(Global.Emulator.Frame) || TasView.IsPartiallyVisible(lastRefresh)) + if (TasView.IsPartiallyVisible(Emulator.Frame) || TasView.IsPartiallyVisible(lastRefresh)) refreshNeeded = true; RefreshDialog(refreshNeeded); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 8e84880066..46a768c09a 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -68,7 +68,7 @@ namespace BizHawk.Client.EmuHawk private void JumpToGreenzone() { - if (Global.Emulator.Frame > CurrentTasMovie.LastValidFrame) + if (Emulator.Frame > CurrentTasMovie.LastValidFrame) { GoToLastEmulatedFrameIfNecessary(CurrentTasMovie.LastValidFrame); } @@ -209,8 +209,8 @@ namespace BizHawk.Client.EmuHawk { if (Emulator.Frame != index && CurrentTasMovie.Markers.IsMarker(index) && Settings.DenoteMarkersWithBGColor) color = Marker_FrameCol; - else - color = Color.FromArgb(0x60FFFFFF); + else + color = Color.FromArgb(0x60FFFFFF); } else if (FloatEditingMode && (index == _floatEditRow || _extraFloatRows.Contains(index)) && @@ -219,7 +219,7 @@ namespace BizHawk.Client.EmuHawk color = AnalogEdit_Col; } - int player = Global.Emulator.ControllerDefinition.PlayerNumber(columnName); + int player = Emulator.ControllerDefinition.PlayerNumber(columnName); if (player != 0 && player % 2 == 0) color = Color.FromArgb(0x0D000000); } @@ -413,7 +413,7 @@ namespace BizHawk.Client.EmuHawk if (Mainform.EmulatorPaused) { TasMovieRecord record = CurrentTasMovie[LastPositionFrame]; - if (!record.Lagged.HasValue && LastPositionFrame > Global.Emulator.Frame) + if (!record.Lagged.HasValue && LastPositionFrame > Emulator.Frame) StartSeeking(LastPositionFrame); else Mainform.UnpauseEmulator(); @@ -703,7 +703,7 @@ namespace BizHawk.Client.EmuHawk { Mainform.PauseOnFrame -= notch; // that's a weird condition here, but for whatever reason it works best - if (notch > 0 && Global.Emulator.Frame >= Mainform.PauseOnFrame) + if (notch > 0 && Emulator.Frame >= Mainform.PauseOnFrame) { Mainform.PauseEmulator(); Mainform.PauseOnFrame = null; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index f4f3396138..b571fca0d5 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -716,7 +716,7 @@ namespace BizHawk.Client.EmuHawk lastState = Emulator.Frame; } - } while (Global.Emulator.Frame < goToFrame); + } while (Emulator.Frame < goToFrame); MessageBox.Show("Integrity Check passed"); } @@ -1100,7 +1100,7 @@ namespace BizHawk.Client.EmuHawk .Where(x => !string.IsNullOrWhiteSpace(x.Text)) .Where(x => x.Name != "FrameColumn"); - ToolStripMenuItem[] playerMenus = new ToolStripMenuItem[Global.Emulator.ControllerDefinition.PlayerCount + 1]; + ToolStripMenuItem[] playerMenus = new ToolStripMenuItem[Emulator.ControllerDefinition.PlayerCount + 1]; playerMenus[0] = ColumnsSubMenu; for (int i = 1; i < playerMenus.Length; i++) { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 0ce48168e1..8bd9088db2 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -234,7 +234,7 @@ namespace BizHawk.Client.EmuHawk break; } - int diff = Global.Emulator.Frame - _seekStartFrame.Value; + int diff = Emulator.Frame - _seekStartFrame.Value; int unit = Mainform.PauseOnFrame.Value - _seekStartFrame.Value; double progress = 0; @@ -785,7 +785,7 @@ namespace BizHawk.Client.EmuHawk CurrentTasMovie.FlushInputCache(); CurrentTasMovie.UseInputCache = false; - lastRefresh = Global.Emulator.Frame; + lastRefresh = Emulator.Frame; } private void DoAutoRestore() @@ -988,12 +988,12 @@ namespace BizHawk.Client.EmuHawk { if (lagLog.WasLagged.Value && !isLag) { // Deleting this frame requires rewinding a frame. - CurrentTasMovie.ChangeLog.AddInputBind(Global.Emulator.Frame - 1, true, "Bind Input; Delete " + (Global.Emulator.Frame - 1)); + CurrentTasMovie.ChangeLog.AddInputBind(Emulator.Frame - 1, true, "Bind Input; Delete " + (Emulator.Frame - 1)); bool wasRecording = CurrentTasMovie.ChangeLog.IsRecording; CurrentTasMovie.ChangeLog.IsRecording = false; - CurrentTasMovie.RemoveFrame(Global.Emulator.Frame - 1); - CurrentTasMovie.RemoveLagHistory(Global.Emulator.Frame); // Removes from WasLag + CurrentTasMovie.RemoveFrame(Emulator.Frame - 1); + CurrentTasMovie.RemoveLagHistory(Emulator.Frame); // Removes from WasLag CurrentTasMovie.ChangeLog.IsRecording = wasRecording; GoToFrame(Emulator.Frame - 1); @@ -1001,12 +1001,12 @@ namespace BizHawk.Client.EmuHawk } else if (!lagLog.WasLagged.Value && isLag) { // (it shouldn't need to rewind, since the inserted input wasn't polled) - CurrentTasMovie.ChangeLog.AddInputBind(Global.Emulator.Frame - 1, false, "Bind Input; Insert " + (Global.Emulator.Frame - 1)); + CurrentTasMovie.ChangeLog.AddInputBind(Emulator.Frame - 1, false, "Bind Input; Insert " + (Emulator.Frame - 1)); bool wasRecording = CurrentTasMovie.ChangeLog.IsRecording; CurrentTasMovie.ChangeLog.IsRecording = false; - CurrentTasMovie.InsertInput(Global.Emulator.Frame - 1, CurrentTasMovie.GetInputLogEntry(Emulator.Frame - 2)); - CurrentTasMovie.InsertLagHistory(Global.Emulator.Frame, true); + CurrentTasMovie.InsertInput(Emulator.Frame - 1, CurrentTasMovie.GetInputLogEntry(Emulator.Frame - 2)); + CurrentTasMovie.InsertLagHistory(Emulator.Frame, true); CurrentTasMovie.ChangeLog.IsRecording = wasRecording; return true; diff --git a/BizHawk.Client.MultiHawk/Extensions/CoreExtensions.cs b/BizHawk.Client.MultiHawk/Extensions/CoreExtensions.cs index 6ba52ac171..b48c795836 100644 --- a/BizHawk.Client.MultiHawk/Extensions/CoreExtensions.cs +++ b/BizHawk.Client.MultiHawk/Extensions/CoreExtensions.cs @@ -9,14 +9,14 @@ namespace BizHawk.Client.MultiHawk.CoreExtensions { public static string DisplayName(this IEmulator core) { - var attributes = Global.Emulator.Attributes(); + var attributes = core.Attributes(); var str = (!attributes.Released ? "(Experimental) " : string.Empty) + attributes.CoreName; - if (Global.Emulator is LibsnesCore) + if (core is LibsnesCore) { - str += " (" + ((LibsnesCore)Global.Emulator).CurrentProfile + ")"; + str += " (" + ((LibsnesCore)core).CurrentProfile + ")"; } return str;