Multitrack for PCE done, if my idea works. Now to hook up hotkeys.

This commit is contained in:
kylethomson 2011-06-16 02:29:45 +00:00
parent b5b853196e
commit 882562c452
3 changed files with 63 additions and 52 deletions

View File

@ -186,9 +186,6 @@ namespace BizHawk.MultiClient
input.Append("|");
for (int player = 1; player < 6; player++)
{
if (!Global.MultiTrack.isActive)
{
//If we aren't in multitrack, just send all inputs as normal.
input.Append(IsPressed("P" + player.ToString() + " Up") ? "U" : ".");
input.Append(IsPressed("P" + player.ToString() + " Down") ? "D" : ".");
input.Append(IsPressed("P" + player.ToString() + " Left") ? "L" : ".");
@ -198,34 +195,6 @@ namespace BizHawk.MultiClient
input.Append(IsPressed("P" + player.ToString() + " Run") ? "R" : ".");
input.Append(IsPressed("P" + player.ToString() + " Select") ? "S" : ".");
input.Append("|");
}
else if ((Global.MultiTrack.CurrentPlayer == player) || Global.MultiTrack.RecordAll)
{
//If we are recording the current player, copy player 1's input to the current players input.
input.Append(IsPressed("P1 Up") ? "U" : ".");
input.Append(IsPressed("P1 Down") ? "D" : ".");
input.Append(IsPressed("P1 Left") ? "L" : ".");
input.Append(IsPressed("P1 Right") ? "R" : ".");
input.Append(IsPressed("P1 B1") ? "1" : ".");
input.Append(IsPressed("P1 B2") ? "2" : ".");
input.Append(IsPressed("P1 Run") ? "R" : ".");
input.Append(IsPressed("P1 Select") ? "S" : ".");
input.Append("|");
}
else
{
if (Global.Emulator.Frame < InputLog.Log.Length()) //If there is input left in the log
{
//Use old frame's input
}
else
{
//Add blank frame of input
for (int buttoncount = 0; buttoncount < 8; buttoncount++);
input.Append(".");
input.Append("|");
}
}
}
return input.ToString();
@ -308,6 +277,8 @@ namespace BizHawk.MultiClient
public void SetControllersAsMnemonic(string mnemonic)
{
MovieMode = true;
if (mnemonic == "")
return;
programmaticallyPressedButtons.Clear();
if (type.Name == "SMS Controller")
@ -332,7 +303,9 @@ namespace BizHawk.MultiClient
if (type.Name == "PC Engine Controller")
{
for (int i = 1; i <= 5; i++)
if (!Global.MultiTrack.isActive || (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY))
{
for (int i = 1; i < 6; i++)
{
if (mnemonic.Length < (1 + i * 9)) return;
if (mnemonic[(i - 1) * 9 + 3] != '.') programmaticallyPressedButtons.Add("P" + i + " Up");
@ -345,6 +318,36 @@ namespace BizHawk.MultiClient
if (mnemonic[(i - 1) * 9 + 10] != '.') programmaticallyPressedButtons.Add("P" + i + " Select");
}
}
else
{
for (int i = 1; i < 6; i++)
{
if ((Global.MultiTrack.CurrentPlayer == i) || Global.MultiTrack.RecordAll)
{
if (IsPressedActually("P1 Up")) programmaticallyPressedButtons.Add("P" + i + " Up");
if (IsPressedActually("P1 Down")) programmaticallyPressedButtons.Add("P" + i + " Down");
if (IsPressedActually("P1 Left")) programmaticallyPressedButtons.Add("P" + i + " Left");
if (IsPressedActually("P1 Right")) programmaticallyPressedButtons.Add("P" + i + " Right");
if (IsPressedActually("P1 B1")) programmaticallyPressedButtons.Add("P" + i + " B1");
if (IsPressedActually("P1 B2")) programmaticallyPressedButtons.Add("P" + i + " B2");
if (IsPressedActually("P1 Run")) programmaticallyPressedButtons.Add("P" + i + " Run");
if (IsPressedActually("P1 Select")) programmaticallyPressedButtons.Add("P" + i + " Select");
}
else
{
if (mnemonic.Length < (1 + i * 9)) return;
if (mnemonic[(i - 1) * 9 + 3] != '.') programmaticallyPressedButtons.Add("P" + i + " Up");
if (mnemonic[(i - 1) * 9 + 4] != '.') programmaticallyPressedButtons.Add("P" + i + " Down");
if (mnemonic[(i - 1) * 9 + 5] != '.') programmaticallyPressedButtons.Add("P" + i + " Left");
if (mnemonic[(i - 1) * 9 + 6] != '.') programmaticallyPressedButtons.Add("P" + i + " Right");
if (mnemonic[(i - 1) * 9 + 7] != '.') programmaticallyPressedButtons.Add("P" + i + " B1");
if (mnemonic[(i - 1) * 9 + 8] != '.') programmaticallyPressedButtons.Add("P" + i + " B2");
if (mnemonic[(i - 1) * 9 + 9] != '.') programmaticallyPressedButtons.Add("P" + i + " Run");
if (mnemonic[(i - 1) * 9 + 10] != '.') programmaticallyPressedButtons.Add("P" + i + " Select");
}
}
}
}
if (type.Name == "NES Controls")
{

View File

@ -1250,6 +1250,10 @@ namespace BizHawk.MultiClient
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
}
}
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && Global.MultiTrack.isActive)
{
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
}
Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues();
RamSearch1.UpdateValues();

View File

@ -10,7 +10,7 @@ namespace BizHawk.MultiClient
public class Movie
{
private MovieHeader Header = new MovieHeader();
public MovieLog Log = new MovieLog();
private MovieLog Log = new MovieLog();
private bool IsText = true;
private string Filename;
@ -52,6 +52,10 @@ namespace BizHawk.MultiClient
{
return Header.GetHeaderLine(MovieHeader.GAMENAME);
}
public int GetLength()
{
return Log.Length();
}
public void StopMovie()
{