-Fixed the value to & with the update to determine the difference between a Control and Controller.

-Set the buttons to the opposite state when they are updated.
--Presumably, this is how this works.
-Read the delta bytes.

TODO: Figure out where in the world the writing of frames actually comes into play.
This commit is contained in:
brandman211 2012-03-02 15:59:34 +00:00
parent e5fb7a6958
commit b07fa3b7c2
1 changed files with 5 additions and 8 deletions

View File

@ -369,9 +369,7 @@ namespace BizHawk.MultiClient
// 034 name of the ROM used - UTF8 encoded nul-terminated string.
List<byte> gameBytes = new List<byte>();
while (r.PeekChar() != 0)
{
gameBytes.Add(r.ReadByte());
}
// Advance past null byte.
r.ReadByte();
string gameName = System.Text.Encoding.UTF8.GetString(gameBytes.ToArray());
@ -383,9 +381,7 @@ namespace BizHawk.MultiClient
*/
List<byte> authorBytes = new List<byte>();
while (r.PeekChar() != 0)
{
authorBytes.Add(r.ReadByte());
}
// Advance past null byte.
r.ReadByte();
string author = System.Text.Encoding.UTF8.GetString(authorBytes.ToArray());
@ -401,13 +397,13 @@ namespace BizHawk.MultiClient
SimpleController controllers = new SimpleController();
controllers.Type = new ControllerDefinition();
controllers.Type.Name = "NES Controller";
if ((int)(update & 0x128) != 0)
if ((int)(update & 0x80) != 0)
{
// Control update: 1aabbbbb
bool reset = false;
int command = update & 0x1F;
/*
bbbbb:
bbbbb:
** 0 Do nothing
** 1 Reset
** 2 Power cycle
@ -486,14 +482,15 @@ namespace BizHawk.MultiClient
* 7 Right
*/
int button = update & 7;
controllers["P" + player + " " + buttons[button]] = !controllers["P" + player + " " + buttons[button]];
}
// aa: Number of delta bytes to follow
int delta = (update >> 5) & 3;
r.ReadBytes(delta);
MnemonicsGenerator mg = new MnemonicsGenerator();
mg.SetSource(controllers);
string mnemonic = mg.GetControllersAsMnemonic();
while (false)
m.AppendFrame(mnemonic);
m.AppendFrame(mnemonic);
frame++;
}
m.Header.SetHeaderLine(MovieHeader.FOURSCORE, fourscore.ToString());