Made it so that the Reset flag gets reset (Hehe) every frame, regardless of whether a warning message has been hit already or not. This fixes the ImportFM2 and ImportFCM functions that were broken in the last commit. Thanks TaoTao!
This commit is contained in:
parent
f117e4fce8
commit
05f73ab436
|
@ -205,25 +205,23 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else if (line[0] == '|')
|
else if (line[0] == '|')
|
||||||
{
|
{
|
||||||
// Handle a frame of input.
|
|
||||||
ArrayList frame = new ArrayList();
|
|
||||||
// Split up the sections of the frame.
|
// Split up the sections of the frame.
|
||||||
string[] sections = line.Split('|');
|
string[] sections = line.Split('|');
|
||||||
|
if (Path.GetExtension(path).ToUpper() == ".FM2" && sections[1].Length != 0)
|
||||||
|
{
|
||||||
|
controllers["Reset"] = (sections[1][0] == '1');
|
||||||
// Get the first invalid command warning message that arises.
|
// Get the first invalid command warning message that arises.
|
||||||
if (Path.GetExtension(path).ToUpper() == ".FM2" && warningMsg == "" && sections[1].Length != 0)
|
if (warningMsg == "")
|
||||||
{
|
{
|
||||||
switch (sections[1][0])
|
switch (sections[1][0])
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
controllers["Reset"] = true;
|
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (m.Length() != 0)
|
if (m.Length() != 0)
|
||||||
{
|
|
||||||
warningMsg = "hard reset";
|
warningMsg = "hard reset";
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
warningMsg = "FDS Insert";
|
warningMsg = "FDS Insert";
|
||||||
|
@ -238,6 +236,7 @@ namespace BizHawk.MultiClient
|
||||||
if (warningMsg != "")
|
if (warningMsg != "")
|
||||||
warningMsg = "Unable to import " + warningMsg + " command on line " + lineNum + ".";
|
warningMsg = "Unable to import " + warningMsg + " command on line " + lineNum + ".";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Skip the first two sections of the split, which consist of everything before the starting | and the
|
Skip the first two sections of the split, which consist of everything before the starting | and the
|
||||||
command. Do not use the section after the last |. In other words, get the sections for the players.
|
command. Do not use the section after the last |. In other words, get the sections for the players.
|
||||||
|
@ -282,13 +281,15 @@ namespace BizHawk.MultiClient
|
||||||
// Decode a blob used in FM2 (base64:..., 0x123456...)
|
// Decode a blob used in FM2 (base64:..., 0x123456...)
|
||||||
private static byte[] DecodeBlob(string blob)
|
private static byte[] DecodeBlob(string blob)
|
||||||
{
|
{
|
||||||
if (blob.Length < 2) return null;
|
if (blob.Length < 2)
|
||||||
if (blob[0] == '0' && (blob[1] == 'x' || blob[1] == 'X')) // hex
|
return null;
|
||||||
{
|
if (blob[0] == '0' && (blob[1] == 'x' || blob[1] == 'X'))
|
||||||
|
// hex
|
||||||
return BizHawk.Util.HexStringToBytes(blob.Substring(2));
|
return BizHawk.Util.HexStringToBytes(blob.Substring(2));
|
||||||
}
|
else {
|
||||||
else{ // base64
|
// base64
|
||||||
if(!blob.StartsWith("base64:")) return null;
|
if(!blob.StartsWith("base64:"))
|
||||||
|
return null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Convert.FromBase64String(blob.Substring(7));
|
return Convert.FromBase64String(blob.Substring(7));
|
||||||
|
@ -442,6 +443,7 @@ namespace BizHawk.MultiClient
|
||||||
*/
|
*/
|
||||||
for (int b = 0; b < delta; b++)
|
for (int b = 0; b < delta; b++)
|
||||||
frames += r.ReadByte() * (int)Math.Pow(2, b * 8);
|
frames += r.ReadByte() * (int)Math.Pow(2, b * 8);
|
||||||
|
frame += frames;
|
||||||
while (frames > 0)
|
while (frames > 0)
|
||||||
{
|
{
|
||||||
m.AppendFrame(mnemonic);
|
m.AppendFrame(mnemonic);
|
||||||
|
@ -450,7 +452,6 @@ namespace BizHawk.MultiClient
|
||||||
controllers["Reset"] = false;
|
controllers["Reset"] = false;
|
||||||
mnemonic = mg.GetControllersAsMnemonic();
|
mnemonic = mg.GetControllersAsMnemonic();
|
||||||
}
|
}
|
||||||
frame++;
|
|
||||||
frames--;
|
frames--;
|
||||||
}
|
}
|
||||||
if (((update >> 7) & 1) == 1)
|
if (((update >> 7) & 1) == 1)
|
||||||
|
@ -459,6 +460,7 @@ namespace BizHawk.MultiClient
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
int command = update & 0x1F;
|
int command = update & 0x1F;
|
||||||
// bbbbb:
|
// bbbbb:
|
||||||
|
controllers["Reset"] = (command == 1);
|
||||||
if (warningMsg == "")
|
if (warningMsg == "")
|
||||||
{
|
{
|
||||||
switch (command)
|
switch (command)
|
||||||
|
@ -468,7 +470,7 @@ namespace BizHawk.MultiClient
|
||||||
break;
|
break;
|
||||||
// Reset
|
// Reset
|
||||||
case 1:
|
case 1:
|
||||||
reset = controllers["Reset"] = true;
|
reset = true;
|
||||||
break;
|
break;
|
||||||
// Power cycle
|
// Power cycle
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -889,8 +891,8 @@ namespace BizHawk.MultiClient
|
||||||
for (int player = 1; player <= INPUT_PORT_COUNT; ++player)
|
for (int player = 1; player <= INPUT_PORT_COUNT; ++player)
|
||||||
{
|
{
|
||||||
byte pad = input[1 + 2 * (player - 1)];
|
byte pad = input[1 + 2 * (player - 1)];
|
||||||
for(int i = 0; i < 8; ++i)
|
for (int button = 0; button < CTRL_BUTTONS.Length; button++)
|
||||||
controllers["P" + player + " " + CTRL_BUTTONS[i]] = (pad&(1<<i)) != 0;
|
controllers["P" + player + " " + CTRL_BUTTONS[button]] = (pad & (1 << button)) != 0;
|
||||||
}
|
}
|
||||||
MnemonicsGenerator mg = new MnemonicsGenerator();
|
MnemonicsGenerator mg = new MnemonicsGenerator();
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
|
|
Loading…
Reference in New Issue