Some fix ups to input recording, and setting up the ability to test recording & playback

This commit is contained in:
andres.delikat 2011-02-28 01:26:38 +00:00
parent 59744ed2dd
commit d7ba739b30
7 changed files with 68 additions and 205 deletions

View File

@ -14,30 +14,48 @@
public void SetControllersAsMnemonic(string mnemonic)
{
return; //TODO
if (mnemonic.Length == 0) return;
if (mnemonic[1] != '.')
Controller.ForceButton("Up");
if (mnemonic[2] != '.')
Controller.ForceButton("Down");
if (mnemonic[3] != '.')
Controller.ForceButton("Left");
if (mnemonic[4] != '.')
Controller.ForceButton("Right");
if (mnemonic[5] != '.')
Controller.ForceButton("I");
if (mnemonic[6] != '.')
Controller.ForceButton("II");
if (mnemonic[7] != '.')
Controller.ForceButton("Select");
if (mnemonic[8] != '.')
Controller.ForceButton("Run");
}
public string GetControllersAsMnemonic()
{
//TODO: Implement all controllers
string input = "";
string input = "|";
if (Controller.IsPressed("Up")) input += "U";
else input += " ";
else input += ".";
if (Controller.IsPressed("Down")) input += "D";
else input += " ";
else input += ".";
if (Controller.IsPressed("Left")) input += "L";
else input += " ";
else input += ".";
if (Controller.IsPressed("Right")) input += "R";
else input += " ";
else input += ".";
if (Controller.IsPressed("I")) input += "1";
else input += " ";
else input += ".";
if (Controller.IsPressed("II")) input += "2";
else input += " ";
else input += ".";
if (Controller.IsPressed("Select")) input += "S";
else input += " ";
else input += ".";
if (Controller.IsPressed("Run")) input += "R";
else input += " ";
else input += ".";
input += "|.|"; //TODO: Add commands like reset here

View File

@ -46,7 +46,6 @@
if (mnemonic[15] != '.' && mnemonic[15] != '0')
Controller.ForceButton("Reset");
}

View File

@ -157,6 +157,7 @@
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.replayInputLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -613,7 +614,8 @@
this.recordMovieToolStripMenuItem,
this.playMovieToolStripMenuItem,
this.stopMovieToolStripMenuItem,
this.playFromBeginningToolStripMenuItem});
this.playFromBeginningToolStripMenuItem,
this.replayInputLogToolStripMenuItem});
this.movieToolStripMenuItem.Name = "movieToolStripMenuItem";
this.movieToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.movieToolStripMenuItem.Text = "Movie";
@ -870,26 +872,26 @@
// controllersToolStripMenuItem
//
this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem";
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.controllersToolStripMenuItem.Text = "&Controllers";
this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click);
//
// hotkeysToolStripMenuItem
//
this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem";
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.hotkeysToolStripMenuItem.Text = "&Hotkeys";
this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(140, 6);
//
// soundToolStripMenuItem
//
this.soundToolStripMenuItem.Name = "soundToolStripMenuItem";
this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.soundToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.soundToolStripMenuItem.Text = "&Sound";
this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click);
//
@ -900,7 +902,7 @@
this.saveWindowPositionToolStripMenuItem,
this.startPausedToolStripMenuItem});
this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem";
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.gUIToolStripMenuItem.Text = "GUI";
this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened);
//
@ -949,7 +951,7 @@
this.miSpeed150,
this.miSpeed200});
this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem";
this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.frameSkipToolStripMenuItem.Text = "Speed/Skip";
this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened);
//
@ -1092,19 +1094,19 @@
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(140, 6);
//
// saveConfigToolStripMenuItem
//
this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem";
this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.saveConfigToolStripMenuItem.Text = "Save Config";
this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click);
//
// loadConfigToolStripMenuItem
//
this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem";
this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.loadConfigToolStripMenuItem.Text = "Load Config";
//
// toolsToolStripMenuItem
@ -1186,6 +1188,13 @@
this.aboutToolStripMenuItem.Text = "&About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// replayInputLogToolStripMenuItem
//
this.replayInputLogToolStripMenuItem.Name = "replayInputLogToolStripMenuItem";
this.replayInputLogToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.replayInputLogToolStripMenuItem.Text = "Replay Input Log";
this.replayInputLogToolStripMenuItem.Click += new System.EventHandler(this.replayInputLogToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1336,6 +1345,7 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
private System.Windows.Forms.ToolStripMenuItem saveConfigToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadConfigToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem replayInputLogToolStripMenuItem;
}
}

View File

@ -124,12 +124,8 @@ namespace BizHawk.MultiClient
private void playMovieToolStripMenuItem_Click(object sender, EventArgs e)
{
//PlayMovie p = new PlayMovie();
//p.ShowDialog();
//Hacky testing
//InputLog.LoadMovie();
//InputLog.WriteMovie();
PlayMovie p = new PlayMovie();
p.ShowDialog();
}
private void stopMovieToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -21,7 +21,7 @@ namespace BizHawk.MultiClient
private string CurrentlyOpenRom;
//TODO: adelikat: can this be the official file extension?
Movie InputLog = new Movie("log.tas"); //This movie is always recording while user is playing
Movie InputLog = new Movie("log.tas", MOVIEMODE.RECORD); //This movie is always recording while user is playing
//the currently selected savestate slot
private int SaveSlot = 0;
@ -79,6 +79,7 @@ namespace BizHawk.MultiClient
Closing += (o, e) =>
{
CloseGame();
InputLog.StopMovie();
SaveConfig();
};
@ -128,9 +129,6 @@ namespace BizHawk.MultiClient
if (Global.Config.StartPaused)
PauseEmulator();
InputLog.LoadMovie(); //TODO: Debug
InputLog.StartPlayback(); //TODO: Debug
}
void SetSpeedPercent(int value)
@ -427,8 +425,14 @@ namespace BizHawk.MultiClient
{
new BizHawk.Emulation.Consoles.Gameboy.Debugger(Global.Emulator as Gameboy).Show();
}
//InputLog.StartNewRecording(); //TODO: Uncomment and check for a user movie selected?
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.StartNewRecording(); //TODO: Uncomment and check for a user movie selected?
else if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
{
InputLog.LoadMovie(); //TODO: Debug
InputLog.StartPlayback(); //TODO: Debug
}
//setup the throttle based on platform's specifications
//(one day later for some systems we will need to modify it at runtime as the display mode changes)
@ -1087,5 +1091,11 @@ namespace BizHawk.MultiClient
RamSearch1.SaveConfigSettings();
ConfigService.Save("config.ini", Global.Config);
}
private void replayInputLogToolStripMenuItem_Click(object sender, EventArgs e)
{
InputLog.StartPlayback();
LoadRom(CurrentlyOpenRom);
}
}
}

View File

@ -17,10 +17,10 @@ namespace BizHawk.MultiClient
private MOVIEMODE MovieMode = new MOVIEMODE();
public Movie(string filename)
public Movie(string filename, MOVIEMODE m)
{
Filename = filename; //TODO: Validate that file is writable
MovieMode = MOVIEMODE.PLAY;
MovieMode = m;
}
public void StopMovie()

View File

@ -1,170 +0,0 @@
EmulationVersion v1.0.0
MovieVersion v1.0.0
Platform
GameName
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|...R.........|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|.D...........|0|
|.D...........|0|
|.D...........|0|
|.D...........|0|
|.D...........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|..L..........|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|....12.......|0|
|U...12.......|0|
|U...12.......|0|
|U...12.......|0|
|U...12.......|0|
|U...12.......|0|
|.............|0|
|.D...........|0|
|.D...........|0|
|.D...........|0|
|..L..........|0|
|..L..........|0|
|...R.........|0|
|...R.........|0|
|U............|0|
|U............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|
|.............|0|