Refactor to put multitrack logic into the multitrack object itself instead of in the OSD manager and hotkey logic
This commit is contained in:
parent
42ee461b2c
commit
3a011ad788
|
@ -317,5 +317,36 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ToggleMultitrack()
|
||||
{
|
||||
if (Movie.IsActive)
|
||||
{
|
||||
|
||||
if (Global.Config.VBAStyleMovieLoadState)
|
||||
{
|
||||
MessageCallback("Multi-track can not be used in Full Movie Loadstates mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.MultiTrack.IsActive = !Global.MovieSession.MultiTrack.IsActive;
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
MessageCallback("MultiTrack Enabled");
|
||||
MultiTrack.CurrentState = "Recording None";
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageCallback("MultiTrack Disabled");
|
||||
}
|
||||
|
||||
Global.MovieSession.MultiTrack.SelectNone();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageCallback("MultiTrack cannot be enabled while not recording.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,52 @@
|
|||
public class MultitrackRecording
|
||||
{
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public int CurrentPlayer { get; set; }
|
||||
|
||||
public bool RecordAll { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A user friendly multitrack status
|
||||
/// </summary>
|
||||
public string CurrentState { get; set; }
|
||||
|
||||
public void SelectAll()
|
||||
{
|
||||
CurrentPlayer = 0;
|
||||
RecordAll = true;
|
||||
CurrentState = "Recording All";
|
||||
}
|
||||
|
||||
public void SelectNone()
|
||||
{
|
||||
RecordAll = false;
|
||||
CurrentPlayer = 0;
|
||||
CurrentState = "Recording None";
|
||||
}
|
||||
|
||||
public void Increment()
|
||||
{
|
||||
RecordAll = false;
|
||||
CurrentPlayer++;
|
||||
if (CurrentPlayer > Global.Emulator.ControllerDefinition.PlayerCount)
|
||||
{
|
||||
CurrentPlayer = 1;
|
||||
}
|
||||
|
||||
CurrentState = "Recording Player " + CurrentPlayer;
|
||||
}
|
||||
|
||||
public void Decrement()
|
||||
{
|
||||
RecordAll = false;
|
||||
CurrentPlayer--;
|
||||
if (CurrentPlayer < 1)
|
||||
{
|
||||
CurrentPlayer = Global.Emulator.ControllerDefinition.PlayerCount;
|
||||
}
|
||||
|
||||
CurrentState = "Recording Player " + CurrentPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
public class OSDManager
|
||||
{
|
||||
public string FPS { get; set; }
|
||||
public string MT { get; set; }
|
||||
public IBlitterFont MessageFont;
|
||||
|
||||
public void Dispose()
|
||||
|
@ -373,10 +372,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
float x = GetX(g, Global.Config.DispMultix, Global.Config.DispMultianchor, MT);
|
||||
float y = GetY(g, Global.Config.DispMultiy, Global.Config.DispMultianchor, MT);
|
||||
float x = GetX(g, Global.Config.DispMultix, Global.Config.DispMultianchor, Global.MovieSession.MultiTrack.CurrentState);
|
||||
float y = GetY(g, Global.Config.DispMultiy, Global.Config.DispMultianchor, Global.MovieSession.MultiTrack.CurrentState);
|
||||
|
||||
DrawOsdMessage(g, MT, FixedMessagesColor, x, y);
|
||||
DrawOsdMessage(g, Global.MovieSession.MultiTrack.CurrentState, FixedMessagesColor, x, y);
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayFPS && FPS != null)
|
||||
|
|
|
@ -259,65 +259,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
SaveMovie();
|
||||
break;
|
||||
case "Toggle MultiTrack":
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
|
||||
if (Global.Config.VBAStyleMovieLoadState)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Multi-track can not be used in Full Movie Loadstates mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.MultiTrack.IsActive = !Global.MovieSession.MultiTrack.IsActive;
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("MultiTrack Enabled");
|
||||
GlobalWin.OSD.MT = "Recording None";
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("MultiTrack Disabled");
|
||||
}
|
||||
Global.MovieSession.MultiTrack.RecordAll = false;
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("MultiTrack cannot be enabled while not recording.");
|
||||
}
|
||||
Global.MovieSession.ToggleMultitrack();
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
break;
|
||||
case "MT Select All":
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 0;
|
||||
Global.MovieSession.MultiTrack.RecordAll = true;
|
||||
GlobalWin.OSD.MT = "Recording All";
|
||||
Global.MovieSession.MultiTrack.SelectAll();
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
break;
|
||||
case "MT Select None":
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 0;
|
||||
Global.MovieSession.MultiTrack.RecordAll = false;
|
||||
GlobalWin.OSD.MT = "Recording None";
|
||||
Global.MovieSession.MultiTrack.SelectNone();
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
break;
|
||||
case "MT Increment Player":
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer++;
|
||||
Global.MovieSession.MultiTrack.RecordAll = false;
|
||||
if (Global.MovieSession.MultiTrack.CurrentPlayer > Global.Emulator.ControllerDefinition.PlayerCount)
|
||||
{
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = 1;
|
||||
}
|
||||
GlobalWin.OSD.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer;
|
||||
Global.MovieSession.MultiTrack.Increment();
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
break;
|
||||
case "MT Decrement Player":
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer--;
|
||||
Global.MovieSession.MultiTrack.RecordAll = false;
|
||||
if (Global.MovieSession.MultiTrack.CurrentPlayer < 1)
|
||||
{
|
||||
Global.MovieSession.MultiTrack.CurrentPlayer = Global.Emulator.ControllerDefinition.PlayerCount;
|
||||
}
|
||||
GlobalWin.OSD.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer;
|
||||
Global.MovieSession.MultiTrack.Decrement();
|
||||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
break;
|
||||
case "Movie Poke":
|
||||
|
|
Loading…
Reference in New Issue