Add GetControllerAsMneumonic() to IEmulator that returns a formatted string of controller inputs. Implemented this function in SMS input.cs and hooked up Movie recording.

This commit is contained in:
andres.delikat 2011-02-26 21:36:46 +00:00
parent c59b9ff6ce
commit 0ed57b443b
12 changed files with 272 additions and 8 deletions

View File

@ -27,6 +27,8 @@ namespace BizHawk.Emulation.Consoles.Calculator
bool m_CursorMoved;
//-------
public string GetControllersAsMneumonic() { return "|.|0|"; } //TODO: Implement this
public byte ReadMemory(ushort addr)
{
int romPage = romPageLow3Bits | (romPageHighBit << 3);

View File

@ -11,6 +11,11 @@
}
};
public string GetControllersAsMneumonic()
{
return "|........|0|";
}
public ControllerDefinition ControllerDefinition { get { return GbController; } }
public IController Controller { get; set; }
}

View File

@ -165,5 +165,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
return null;
}
public string GetControllersAsMneumonic()
{
return "|........|........|0|"; //TODO: implement
}
}
}

View File

@ -12,6 +12,12 @@
public ControllerDefinition ControllerDefinition { get { return PCEngineController; } }
public IController Controller { get; set; }
public string GetControllersAsMneumonic()
{
return "|........|0|"; //TODO: implement
}
private byte inputSelector;
public bool SEL { get { return ((inputSelector & 1) != 0) ;} }

View File

@ -12,6 +12,12 @@
}
};
public string GetControllersAsMneumonic()
{
return "|........|0|"; //TODO: implement
}
public ControllerDefinition ControllerDefinition { get { return GenesisController; } }
public IController Controller { get; set; }
}

View File

@ -13,6 +13,48 @@
}
};
public string GetControllersAsMneumonic()
{
string input = "|";
if (Controller.IsPressed("P1 Up")) input += "U";
else input += ".";
if (Controller.IsPressed("P1 Down")) input += "D";
else input += ".";
if (Controller.IsPressed("P1 Left")) input += "L";
else input += ".";
if (Controller.IsPressed("P1 Right")) input += "R";
else input += ".";
if (Controller.IsPressed("P1 B1")) input += "1";
else input += ".";
if (Controller.IsPressed("P1 B2")) input += "2";
else input += ".";
if (Controller.IsPressed("P2 Up")) input += "U";
else input += ".";
if (Controller.IsPressed("P2 Down")) input += "D";
else input += ".";
if (Controller.IsPressed("P2 Left")) input += "L";
else input += ".";
if (Controller.IsPressed("P2 Right")) input += "R";
else input += ".";
if (Controller.IsPressed("P2 B1")) input += "1";
else input += ".";
if (Controller.IsPressed("P2 B2")) input += "2";
else input += ".";
if (Controller.IsPressed("Pause")) input += "S";
else input += ".";
input += "|";
if (Controller.IsPressed("Reset")) input += "R";
else input += "0";
input += "|";
return input;
}
public ControllerDefinition ControllerDefinition { get { return SmsController; } }
public IController Controller { get; set; }

View File

@ -28,6 +28,9 @@ namespace BizHawk
}
public ControllerDefinition ControllerDefinition { get { return NullController; } }
public IController Controller { get; set; }
public string GetControllersAsMneumonic() { return "|.|0|"; }
public int Frame { get; set; }
public byte[] SaveRam { get { return new byte[0]; } }
public bool DeterministicEmulation { get; set; }

View File

@ -12,6 +12,8 @@ namespace BizHawk
ControllerDefinition ControllerDefinition { get; }
IController Controller { get; set; }
string GetControllersAsMneumonic();
void LoadGame(IGame game);
void FrameAdvance(bool render);

View File

@ -128,13 +128,13 @@ namespace BizHawk.MultiClient
//p.ShowDialog();
//Hacky testing
InputLog.LoadMovie();
InputLog.WriteMovie();
//InputLog.LoadMovie();
//InputLog.WriteMovie();
}
private void stopMovieToolStripMenuItem_Click(object sender, EventArgs e)
{
InputLog.StopMovie(); //TODO: stop user movie if it exists, and start InputLog logging, else do nothing
}
private void playFromBeginningToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -425,6 +425,7 @@ namespace BizHawk.MultiClient
new BizHawk.Emulation.Consoles.Gameboy.Debugger(Global.Emulator as Gameboy).Show();
}
InputLog.StartNewRecording();
//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)
@ -469,11 +470,12 @@ namespace BizHawk.MultiClient
/// <summary>
/// This functions calls Emulator.FrameAdvance(true) and handles any updates that need to happen on a per frame basis
/// </summary>
public void DoFrameAdvance()
public void DoFrameAdvance() //TODO: rename this and run it once per frame
{
Global.Emulator.FrameAdvance(true); //TODO: Do these things need to happen on (false) as well? Think about it
RamWatch1.UpdateValues();
RamSearch1.UpdateValues();
InputLog.GetMneumonic(); //TODO: log to input log or user choice, if user choice & playback don't log!
}
public void CheckHotkeys()
@ -635,6 +637,7 @@ namespace BizHawk.MultiClient
Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues();
RamSearch1.UpdateValues();
InputLog.GetMneumonic();
}
if(genSound)

View File

@ -6,6 +6,7 @@ using System.IO;
namespace BizHawk.MultiClient
{
public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED };
class Movie
{
private MovieHeader Header = new MovieHeader();
@ -14,10 +15,35 @@ namespace BizHawk.MultiClient
private bool IsText = true;
private string Filename;
private MOVIEMODE MovieMode = new MOVIEMODE();
public Movie(string filename)
{
Filename = filename; //TODO: Validate that file is writable
Log.AddFrame("|........|0|");
MovieMode = MOVIEMODE.PLAY;
}
public void StopMovie()
{
MovieMode = MOVIEMODE.INACTIVE;
WriteMovie();
}
public void StartNewRecording()
{
MovieMode = MOVIEMODE.RECORD;
Log.Clear();
}
public MOVIEMODE GetMovieMode()
{
return MovieMode;
}
public void GetMneumonic()
{
if (MovieMode == MOVIEMODE.RECORD)
Log.AddFrame(Global.Emulator.GetControllersAsMneumonic());
}
public void AddMovieRecord()

View File

@ -1,6 +1,170 @@
EmulationVersion v1.0.0
MovieVersion v1.0.0
Platform PCE
GameName Bonk.pce
|........|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|