Record movie dialog now allows user to type in name of file to record, and will auto fill in directory path if user does not. Play movie now uses the PreLoad function so length calculation is significantly faster

This commit is contained in:
andres.delikat 2011-05-18 01:49:20 +00:00
parent 250f424629
commit 97ef68e64e
4 changed files with 29 additions and 9 deletions

View File

@ -148,6 +148,7 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="movie\Movie.cs" />
<Compile Include="movie\MovieConvert.cs" />
<Compile Include="movie\MovieHeader.cs" />
<Compile Include="movie\MovieLog.cs" />
<Compile Include="MruStack.cs" />

View File

@ -38,7 +38,7 @@ namespace BizHawk.MultiClient
if (column == 2) //Game
text = MovieList[index].GetGameName();
if (column == 3) //Time
text = MovieList[index].GetTime();
text = MovieList[index].GetTime(true);
}
private void MovieView_QueryItemBkColor(int index, int column, ref Color color)

View File

@ -13,6 +13,7 @@ namespace BizHawk.MultiClient
public partial class RecordMovie : Form
{
//TODO: on OK check that the user actually selected a movie (text box != empty?)
//Allow relative paths in record textbox
//Have an editiable listview for header info and any other settings, or appropriate widgets
//Some header/settings that needs to be editable:
// System ID
@ -21,6 +22,7 @@ namespace BizHawk.MultiClient
// Some comments?
// Platform specific bools like PAL vs NTSC or an FDS flag, etc
Movie MovieToRecord;
public RecordMovie()
@ -28,8 +30,23 @@ namespace BizHawk.MultiClient
InitializeComponent();
}
private string MakePath()
{
string path = RecordBox.Text;
int x = path.LastIndexOf('\\');
if (path.LastIndexOf('\\') == -1)
{
path = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "") + RecordBox.Text;
return path;
}
else
return path;
}
private void OK_Click(object sender, EventArgs e)
{
string path = MakePath();
MovieToRecord = new Movie(RecordBox.Text, MOVIEMODE.RECORD);
Global.MainForm.StartNewMovie(MovieToRecord, true);
this.Close();
}
@ -52,8 +69,6 @@ namespace BizHawk.MultiClient
Global.Sound.StartSound();
if (result == DialogResult.OK)
{
var file = new FileInfo(sfd.FileName);
MovieToRecord = new Movie(sfd.FileName, MOVIEMODE.RECORD);
RecordBox.Text = sfd.FileName;
}
}

View File

@ -280,7 +280,7 @@ namespace BizHawk.MultiClient
length -= line;
int lines = (int)file.Length - length;
this.Frames = lines / line;
break; //This right?
break;
}
else
{
@ -365,10 +365,15 @@ namespace BizHawk.MultiClient
Header.SetHeaderLine(key, value);
}
public string GetTime()
public string GetTime(bool preLoad)
{
string time = "";
double seconds = GetSeconds();
double seconds;
if (preLoad)
seconds = GetSeconds(Frames);
else
seconds = GetSeconds(Log.Length());
int hours = ((int)seconds) / 3600;
int minutes = (((int)seconds) / 60) % 60;
double sec = seconds % 60;
@ -395,7 +400,7 @@ namespace BizHawk.MultiClient
return num.ToString();
}
private double GetSeconds()
private double GetSeconds(int frameCount)
{ //Should these be placed somewhere more accessible? Perhaps as a public dictionary object in MainForm?
const double NES_PAL = 50.006977968268290849;
const double NES_NTSC = (double)60.098813897440515532;
@ -407,8 +412,7 @@ namespace BizHawk.MultiClient
const double LYNX = 59.8;
const double WSWAN = (3072000.0 / (159 * 256));
double seconds = 0;
double frames = (double)Log.Length();
double frames = (double)frameCount;
if (frames < 1)
return seconds;