Movie class has a GetSeconds() function that returns the number of seconds based on frames / fps. It is loaded with lots of fps formulas for various consoles.
This commit is contained in:
parent
3dbf342dbe
commit
99babf743f
|
@ -27,221 +27,6 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
|||
bool m_CursorMoved;
|
||||
//-------
|
||||
|
||||
/* public string GetControllersAsMnemonic()
|
||||
{
|
||||
string input = "|";
|
||||
|
||||
if (Controller.IsPressed("0")) input += "0";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("1")) input += "1";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("2")) input += "2";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("3")) input += "3";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("4")) input += "4";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("5")) input += "5";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("6")) input += "6";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("7")) input += "7";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("8")) input += "8";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("9")) input += "9";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("DOT")) input += ".";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("ON")) input += "O";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("ENTER")) input += "=";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("UP")) input += "U";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("DOWN")) input += "D";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("LEFT")) input += "L";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("RIGHT")) input += "R";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("PLUS")) input += "+";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("MINUS")) input += "_";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("MULTIPLY")) input += "*";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("DIVIDE")) input += "/";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("CLEAR")) input += "c";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("EXP")) input += "^";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("DASH")) input += "-";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("PARAOPEN")) input += "(";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("PARACLOSE")) input += ")";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("TAN")) input += "T";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("VARS")) input += "V";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("COS")) input += "C";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("PRGM")) input += "P";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("STAT")) input += "s";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("MATRIX")) input += "m";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("X")) input += "X";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("STO")) input += ">";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("LN")) input += "n";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("LOG")) input += "L";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("SQUARED")) input += "2";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("NEG1")) input += "1";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("MATH")) input += "H";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("ALPHA")) input += "A";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("GRAPH")) input += "G";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("TRACE")) input += "t";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("ZOOM")) input += "Z";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("WINDOW")) input += "W";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("Y")) input += "Y";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("2ND")) input += "&";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("MODE")) input += "O";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("DEL")) input += "D";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("COMMA")) input += ",";
|
||||
else input += ".";
|
||||
if (Controller.IsPressed("SIN")) input += "S";
|
||||
else input += ".";
|
||||
|
||||
input += "|.|"; //TODO: perhaps ON should go here?
|
||||
|
||||
return input;
|
||||
}
|
||||
public void SetControllersAsMnemonic(string mnemonic)
|
||||
{
|
||||
if (mnemonic.Length == 0) return;
|
||||
|
||||
if (mnemonic[1] != '.')
|
||||
Controller.ForceButton("0");
|
||||
if (mnemonic[2] != '.')
|
||||
Controller.ForceButton("1");
|
||||
if (mnemonic[3] != '.')
|
||||
Controller.ForceButton("2");
|
||||
if (mnemonic[4] != '.')
|
||||
Controller.ForceButton("3");
|
||||
if (mnemonic[5] != '.')
|
||||
Controller.ForceButton("4");
|
||||
if (mnemonic[6] != '.')
|
||||
Controller.ForceButton("5");
|
||||
if (mnemonic[7] != '.')
|
||||
Controller.ForceButton("6");
|
||||
if (mnemonic[8] != '.')
|
||||
Controller.ForceButton("7");
|
||||
if (mnemonic[9] != '.')
|
||||
Controller.ForceButton("8");
|
||||
if (mnemonic[10] != '.')
|
||||
Controller.ForceButton("9");
|
||||
if (mnemonic[11] != '.')
|
||||
Controller.ForceButton("DOT");
|
||||
if (mnemonic[12] != '.')
|
||||
Controller.ForceButton("ON");
|
||||
if (mnemonic[13] != '.')
|
||||
Controller.ForceButton("ENTER");
|
||||
if (mnemonic[14] != '.')
|
||||
Controller.ForceButton("UP");
|
||||
if (mnemonic[15] != '.')
|
||||
Controller.ForceButton("DOWN");
|
||||
if (mnemonic[16] != '.')
|
||||
Controller.ForceButton("LEFT");
|
||||
if (mnemonic[17] != '.')
|
||||
Controller.ForceButton("RIGHT");
|
||||
if (mnemonic[18] != '.')
|
||||
Controller.ForceButton("PLUS");
|
||||
if (mnemonic[19] != '.')
|
||||
Controller.ForceButton("MINUS");
|
||||
if (mnemonic[20] != '.')
|
||||
Controller.ForceButton("MULTIPLY");
|
||||
if (mnemonic[21] != '.')
|
||||
Controller.ForceButton("DIVIDE");
|
||||
if (mnemonic[22] != '.')
|
||||
Controller.ForceButton("CLEAR");
|
||||
if (mnemonic[23] != '.')
|
||||
Controller.ForceButton("EXP");
|
||||
if (mnemonic[24] != '.')
|
||||
Controller.ForceButton("DASH");
|
||||
if (mnemonic[25] != '.')
|
||||
Controller.ForceButton("PARAOPEN");
|
||||
if (mnemonic[26] != '.')
|
||||
Controller.ForceButton("PARACLOSE");
|
||||
if (mnemonic[27] != '.')
|
||||
Controller.ForceButton("TAN");
|
||||
if (mnemonic[28] != '.')
|
||||
Controller.ForceButton("VARS");
|
||||
if (mnemonic[29] != '.')
|
||||
Controller.ForceButton("COS");
|
||||
if (mnemonic[30] != '.')
|
||||
Controller.ForceButton("PGRM");
|
||||
if (mnemonic[31] != '.')
|
||||
Controller.ForceButton("STAT");
|
||||
if (mnemonic[32] != '.')
|
||||
Controller.ForceButton("MATRIX");
|
||||
if (mnemonic[33] != '.')
|
||||
Controller.ForceButton("X");
|
||||
if (mnemonic[34] != '.')
|
||||
Controller.ForceButton("STO");
|
||||
if (mnemonic[35] != '.')
|
||||
Controller.ForceButton("LN");
|
||||
if (mnemonic[36] != '.')
|
||||
Controller.ForceButton("LOG");
|
||||
if (mnemonic[37] != '.')
|
||||
Controller.ForceButton("SQUARED");
|
||||
if (mnemonic[38] != '.')
|
||||
Controller.ForceButton("NEG");
|
||||
if (mnemonic[39] != '.')
|
||||
Controller.ForceButton("MATH");
|
||||
if (mnemonic[40] != '.')
|
||||
Controller.ForceButton("ALPHA");
|
||||
if (mnemonic[41] != '.')
|
||||
Controller.ForceButton("GRAPH");
|
||||
if (mnemonic[42] != '.')
|
||||
Controller.ForceButton("TRACE");
|
||||
if (mnemonic[43] != '.')
|
||||
Controller.ForceButton("ZOOM");
|
||||
if (mnemonic[44] != '.')
|
||||
Controller.ForceButton("WINDOW");
|
||||
if (mnemonic[45] != '.')
|
||||
Controller.ForceButton("Y");
|
||||
if (mnemonic[46] != '.')
|
||||
Controller.ForceButton("2ND");
|
||||
if (mnemonic[47] != '.')
|
||||
Controller.ForceButton("MODE");
|
||||
if (mnemonic[48] != '.')
|
||||
Controller.ForceButton("DEL");
|
||||
if (mnemonic[49] != '.')
|
||||
Controller.ForceButton("COMMA");
|
||||
if (mnemonic[50] != '.')
|
||||
Controller.ForceButton("SIN");
|
||||
}*/
|
||||
|
||||
public byte ReadMemory(ushort addr)
|
||||
{
|
||||
int romPage = romPageLow3Bits | (romPageHighBit << 3);
|
||||
|
|
|
@ -335,5 +335,73 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
return Header.SetHeaderLine(key, value);
|
||||
}
|
||||
|
||||
private decimal GetSeconds()
|
||||
{
|
||||
const decimal NES_PAL = (decimal)50.006977968268290849;
|
||||
const decimal NES_NTSC = (decimal)60.098813897440515532;
|
||||
const decimal PCE_PAL = (decimal)(50.0); //TODO ?
|
||||
const decimal PCE_NTSC = (decimal)(7159090.90909090 / 455 / 263); //~59.826
|
||||
const decimal SMS_PAL = (decimal)60.0;
|
||||
const decimal SMS_NTSC = (decimal)50.0;
|
||||
const decimal GEN = (decimal)60.0;
|
||||
|
||||
//const decimal REAL_SMS_NTSC = (decimal)(3579545 / 262.0 / 228.0);
|
||||
//const decimal REAL_SMS_PAL = (decimal)(3546893 / 313.0 / 228.0);
|
||||
const decimal NGP = (decimal)(6144000.0 / (515 * 198));
|
||||
const decimal VBOY = (decimal)(20000000 / (259 * 384 * 4)); //~50.273
|
||||
const decimal LYNX = (decimal)59.8;
|
||||
const decimal WSWAN = (decimal)(3072000.0 / (159 * 256));
|
||||
decimal seconds = 0;
|
||||
int frames = Log.Length();
|
||||
|
||||
if (frames == 0)
|
||||
return seconds;
|
||||
|
||||
bool pal = false; //TODO: pal flag
|
||||
|
||||
switch (Header.GetHeaderLine(MovieHeader.PLATFORM))
|
||||
{
|
||||
case "GG":
|
||||
case "SG":
|
||||
case "SMS":
|
||||
if (pal)
|
||||
return frames / SMS_PAL;
|
||||
else
|
||||
return frames / SMS_NTSC;
|
||||
case "FDS":
|
||||
case "NES":
|
||||
case "SNES":
|
||||
if (pal)
|
||||
return frames / NES_PAL;
|
||||
else
|
||||
return frames / NES_NTSC;
|
||||
case "PCE":
|
||||
if (pal)
|
||||
return frames / PCE_PAL;
|
||||
else
|
||||
return frames / PCE_NTSC;
|
||||
case "GEN":
|
||||
return frames / GEN;
|
||||
|
||||
//One Day!
|
||||
case "VBOY":
|
||||
return frames / VBOY;
|
||||
case "NGP":
|
||||
return frames / NGP;
|
||||
case "LYNX":
|
||||
return frames / LYNX;
|
||||
case "WSWAN":
|
||||
return frames / WSWAN;
|
||||
//********
|
||||
|
||||
case "":
|
||||
default:
|
||||
if (pal)
|
||||
return (decimal)(frames / 50.0);
|
||||
else
|
||||
return (decimal)(frames / 60.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue