tastudio - more fixes to startup logic, still convolted, buggy and wrong, but better!
This commit is contained in:
parent
863d6f09ee
commit
7e39e67b1f
|
@ -1,4 +1,8 @@
|
||||||
namespace BizHawk.Client.Common.MovieConversionExtensions
|
using System;
|
||||||
|
using BizHawk.Common.ReflectionExtensions;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
public static class MovieConversionExtensions
|
public static class MovieConversionExtensions
|
||||||
{
|
{
|
||||||
|
@ -73,5 +77,47 @@
|
||||||
|
|
||||||
return bk2;
|
return bk2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This doesn't really belong here, but not sure where to put it
|
||||||
|
public static void PopulateWithDefaultHeaderValues(this IMovie movie, string author = null)
|
||||||
|
{
|
||||||
|
movie.Author = author ?? Global.Config.DefaultAuthor;
|
||||||
|
movie.EmulatorVersion = VersionInfo.GetEmuVersion();
|
||||||
|
movie.Platform = Global.Game.System;
|
||||||
|
|
||||||
|
movie.SyncSettingsJson = ConfigService.SaveWithType(Global.Emulator.GetSyncSettings());
|
||||||
|
|
||||||
|
if (Global.Game != null)
|
||||||
|
{
|
||||||
|
movie.GameName = PathManager.FilesystemSafeName(Global.Game);
|
||||||
|
movie.Hash = Global.Game.Hash;
|
||||||
|
if (Global.Game.FirmwareHash != null)
|
||||||
|
{
|
||||||
|
movie.FirmwareHash = Global.Game.FirmwareHash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
movie.GameName = "NULL";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.Emulator.BoardName != null)
|
||||||
|
{
|
||||||
|
movie.BoardName = Global.Emulator.BoardName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Global.Emulator.HasPublicProperty("DisplayType"))
|
||||||
|
{
|
||||||
|
var region = Global.Emulator.GetPropertyValue("DisplayType");
|
||||||
|
if ((DisplayType)region == DisplayType.PAL)
|
||||||
|
{
|
||||||
|
movie.HeaderEntries.Add(HeaderKeys.PAL, "1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
movie.Core = ((CoreAttributes)Attribute
|
||||||
|
.GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttributes)))
|
||||||
|
.CoreName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
|
|
||||||
//If a movie is already loaded, save it before starting a new movie
|
//If a movie is already loaded, save it before starting a new movie
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive && !string.IsNullOrEmpty(Global.MovieSession.Movie.Filename))
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.Save();
|
Global.MovieSession.Movie.Save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@ using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Common.ReflectionExtensions;
|
using BizHawk.Common.ReflectionExtensions;
|
||||||
using BizHawk.Client.Common;
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
using BizHawk.Client.Common;
|
||||||
|
using BizHawk.Client.Common.MovieConversionExtensions;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
|
@ -85,44 +86,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
movieToRecord.PopulateWithDefaultHeaderValues(AuthorBox.Text);
|
||||||
movieToRecord.Author = AuthorBox.Text;
|
|
||||||
movieToRecord.EmulatorVersion = VersionInfo.GetEmuVersion();
|
|
||||||
movieToRecord.Platform = Global.Game.System;
|
|
||||||
|
|
||||||
movieToRecord.SyncSettingsJson = ConfigService.SaveWithType(Global.Emulator.GetSyncSettings());
|
|
||||||
|
|
||||||
if (Global.Game != null)
|
|
||||||
{
|
|
||||||
movieToRecord.GameName = PathManager.FilesystemSafeName(Global.Game);
|
|
||||||
movieToRecord.Hash = Global.Game.Hash;
|
|
||||||
if (Global.Game.FirmwareHash != null)
|
|
||||||
{
|
|
||||||
movieToRecord.FirmwareHash = Global.Game.FirmwareHash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
movieToRecord.GameName = "NULL";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Global.Emulator.BoardName != null)
|
|
||||||
{
|
|
||||||
movieToRecord.BoardName = Global.Emulator.BoardName;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Global.Emulator.HasPublicProperty("DisplayType"))
|
|
||||||
{
|
|
||||||
var region = Global.Emulator.GetPropertyValue("DisplayType");
|
|
||||||
if ((DisplayType)region == DisplayType.PAL)
|
|
||||||
{
|
|
||||||
movieToRecord.HeaderEntries.Add(HeaderKeys.PAL, "1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
movieToRecord.Core = ((CoreAttributes)Attribute
|
|
||||||
.GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttributes)))
|
|
||||||
.CoreName;
|
|
||||||
|
|
||||||
movieToRecord.Save();
|
movieToRecord.Save();
|
||||||
GlobalWin.MainForm.StartNewMovie(movieToRecord, true);
|
GlobalWin.MainForm.StartNewMovie(movieToRecord, true);
|
||||||
|
|
|
@ -225,7 +225,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void EngageTasStudio(TasMovie newMovie = null)
|
private void EngageTasStudio(TasMovie newMovie = null)
|
||||||
{
|
{
|
||||||
GlobalWin.OSD.AddMessage("TAStudio engaged");
|
GlobalWin.OSD.AddMessage("TAStudio engaged");
|
||||||
|
|
||||||
Global.MovieSession.Movie = newMovie ?? new TasMovie();
|
Global.MovieSession.Movie = newMovie ?? new TasMovie();
|
||||||
|
if (newMovie == null)
|
||||||
|
{
|
||||||
|
Global.MovieSession.Movie.PopulateWithDefaultHeaderValues();
|
||||||
|
}
|
||||||
|
|
||||||
_tas = Global.MovieSession.Movie as TasMovie;
|
_tas = Global.MovieSession.Movie as TasMovie;
|
||||||
StartNewSession();
|
StartNewSession();
|
||||||
}
|
}
|
||||||
|
@ -234,7 +240,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (AskSave())
|
if (AskSave())
|
||||||
{
|
{
|
||||||
_tas.StartNewRecording();
|
|
||||||
GlobalWin.MainForm.StartNewMovie(_tas, record: true);
|
GlobalWin.MainForm.StartNewMovie(_tas, record: true);
|
||||||
TasView.ItemCount = _tas.InputLogLength;
|
TasView.ItemCount = _tas.InputLogLength;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue