2015-09-21 23:47:03 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
namespace BizHawk.Client.Common.movie.import
|
|
|
|
|
{
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
// PXM files are directly compatible with binary-format PJM files, with the only
|
|
|
|
|
// difference being fewer flags implemented in the header, hence just calling the
|
|
|
|
|
// base class methods via a subclass.
|
|
|
|
|
//
|
|
|
|
|
// However, the magic number/file signature is slightly different, requiring some
|
|
|
|
|
// refactoring to avoid PXM-specific code in the PJMImport class.
|
|
|
|
|
[ImportExtension(".pxm")]
|
|
|
|
|
class PXMImport : PJMImport
|
|
|
|
|
{
|
|
|
|
|
protected override void RunImport()
|
|
|
|
|
{
|
|
|
|
|
Bk2Movie movie = Result.Movie;
|
|
|
|
|
MiscHeaderInfo info;
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 21:46:59 +00:00
|
|
|
|
movie.HeaderEntries[HeaderKeys.PLATFORM] = "PSX";
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
using (var fs = SourceFile.OpenRead())
|
|
|
|
|
{
|
|
|
|
|
using (var br = new BinaryReader(fs))
|
|
|
|
|
{
|
|
|
|
|
info = parseHeader(movie, "PXM ", br);
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
fs.Seek(info.controllerDataOffset, SeekOrigin.Begin);
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
if (info.binaryFormat)
|
|
|
|
|
{
|
|
|
|
|
parseBinaryInputLog(br, movie, info);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
parseTextInputLog(br, movie, info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-21 23:47:03 +00:00
|
|
|
|
|
2015-09-22 00:02:49 +00:00
|
|
|
|
movie.Save();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-21 23:47:03 +00:00
|
|
|
|
}
|