Merge r5447 to trunk
This commit is contained in:
parent
9e521a1f14
commit
27cc689176
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -298,10 +298,10 @@ namespace BizHawk.Client.Common
|
|||
/// Load Header information only for displaying file information in dialogs such as play movie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PreLoadText()
|
||||
public bool PreLoadText(HawkFile hawkFile)
|
||||
{
|
||||
Loaded = false;
|
||||
var file = new FileInfo(Filename);
|
||||
var file = new FileInfo(hawkFile.CanonicalFullPath);
|
||||
|
||||
if (file.Exists == false)
|
||||
return false;
|
||||
|
@ -311,7 +311,10 @@ namespace BizHawk.Client.Common
|
|||
_log.Clear();
|
||||
}
|
||||
|
||||
using (StreamReader sr = file.OpenText())
|
||||
long origStreamPosn = hawkFile.GetStream().Position;
|
||||
hawkFile.GetStream().Position = 0; //Reset to start
|
||||
StreamReader sr = new StreamReader(hawkFile.GetStream()); //No using block because we're sharing the stream and need to give it back undisposed.
|
||||
if(!sr.EndOfStream)
|
||||
{
|
||||
string str;
|
||||
while ((str = sr.ReadLine()) != null)
|
||||
|
@ -346,6 +349,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
hawkFile.GetStream().Position = origStreamPosn;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -171,15 +171,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
return 0;
|
||||
}
|
||||
|
||||
private void PreLoadMovieFile(HawkFile path, bool force)
|
||||
private void PreLoadMovieFile(HawkFile hf, bool force)
|
||||
{
|
||||
Movie movie = new Movie(path.CanonicalFullPath);
|
||||
movie.PreLoadText();
|
||||
if (path.Extension == ".FM2")
|
||||
Movie movie = new Movie(hf.CanonicalFullPath);
|
||||
movie.PreLoadText(hf);
|
||||
if (hf.Extension == ".FM2")
|
||||
{
|
||||
movie.Header.SetHeaderLine(MovieHeader.PLATFORM, "NES");
|
||||
}
|
||||
else if (path.Extension == ".MC2")
|
||||
else if (hf.Extension == ".MC2")
|
||||
{
|
||||
movie.Header.SetHeaderLine(MovieHeader.PLATFORM, "PCE");
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (RecordBox.Text.Length == 0)
|
||||
return "";
|
||||
string path = RecordBox.Text;
|
||||
if (path.LastIndexOf('\\') == -1)
|
||||
if (path.LastIndexOf(Path.DirectorySeparatorChar) == -1)
|
||||
{
|
||||
if (path[0] != '\\')
|
||||
path = path.Insert(0, "\\");
|
||||
if (path[0] != Path.DirectorySeparatorChar)
|
||||
path = path.Insert(0, Path.DirectorySeparatorChar.ToString());
|
||||
path = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null) + path;
|
||||
|
||||
if (path[path.Length - 4] != '.') //If no file extension, add movie extension
|
||||
|
|
Loading…
Reference in New Issue