Broaden usage of TAStudio-specific movie-loading. (#2411)
* Broaden usage of TAStudio-specific movie-loading. fixes #2386 * TAStudio drag-drop: use LoadMovieFile for consistency
This commit is contained in:
parent
a5d166cf71
commit
b1a64e2212
|
@ -95,14 +95,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Emulator.IsNull())
|
||||
{
|
||||
OpenRom();
|
||||
if (Emulator.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Emulator.IsNull())
|
||||
if (GlobalWin.Tools.IsLoaded<TAStudio>())
|
||||
{
|
||||
return;
|
||||
Tools.TAStudio.LoadMovieFile(filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartNewMovie(MovieSession.Get(filename), false);
|
||||
}
|
||||
|
||||
StartNewMovie(MovieSession.Get(filename), false);
|
||||
}
|
||||
|
||||
private void LoadRom(string filename, string archive = null)
|
||||
|
|
|
@ -92,6 +92,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ask whether changes should be saved. Returns false if cancelled, else true.
|
||||
/// </summary>
|
||||
public override bool AskSaveChanges()
|
||||
{
|
||||
if (_suppressAskSave)
|
||||
|
|
|
@ -111,36 +111,49 @@ namespace BizHawk.Client.EmuHawk
|
|||
var result = ofd.ShowHawkDialog();
|
||||
if (result.IsOk())
|
||||
{
|
||||
if (ofd.FileName.EndsWith(MovieService.TasMovieExtension))
|
||||
{
|
||||
LoadFileWithFallback(ofd.FileName);
|
||||
}
|
||||
else if (ofd.FileName.EndsWith(MovieService.StandardMovieExtension))
|
||||
{
|
||||
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
if (result1.IsOk())
|
||||
{
|
||||
_initializing = true; // Starting a new movie causes a core reboot
|
||||
WantsToControlReboot = false;
|
||||
_engaged = false;
|
||||
MainForm.StartNewMovie(MovieSession.Get(ofd.FileName), false);
|
||||
ConvertCurrentMovieToTasproj();
|
||||
_initializing = false;
|
||||
StartNewMovieWrapper(CurrentTasMovie);
|
||||
_engaged = true;
|
||||
WantsToControlReboot = true;
|
||||
SetUpColumns();
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
LoadMovieFile(ofd.FileName, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the movie with the given filename within TAStudio.
|
||||
/// </summary>
|
||||
public void LoadMovieFile(string filename, bool askToSave = true)
|
||||
{
|
||||
if (askToSave && !AskSaveChanges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (filename.EndsWith(MovieService.TasMovieExtension))
|
||||
{
|
||||
LoadFileWithFallback(filename);
|
||||
}
|
||||
else if (filename.EndsWith(MovieService.StandardMovieExtension))
|
||||
{
|
||||
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
if (result1.IsOk())
|
||||
{
|
||||
_initializing = true; // Starting a new movie causes a core reboot
|
||||
WantsToControlReboot = false;
|
||||
_engaged = false;
|
||||
MainForm.StartNewMovie(MovieSession.Get(filename), false);
|
||||
ConvertCurrentMovieToTasproj();
|
||||
_initializing = false;
|
||||
StartNewMovieWrapper(CurrentTasMovie);
|
||||
_engaged = true;
|
||||
WantsToControlReboot = true;
|
||||
SetUpColumns();
|
||||
UpdateWindowTitle();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveTasMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveTas();
|
||||
|
|
|
@ -1129,20 +1129,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void TAStudio_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (!AskSaveChanges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Maybe this should call Mainform's DragDrop method,
|
||||
// since that can file types that are not movies,
|
||||
// and it can process multiple files sequentially
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (Path.GetExtension(filePaths[0]) == $".{MovieService.TasMovieExtension}")
|
||||
{
|
||||
FileInfo file = new FileInfo(filePaths[0]);
|
||||
if (file.Exists)
|
||||
{
|
||||
LoadFile(file);
|
||||
}
|
||||
}
|
||||
LoadMovieFile(filePaths[0]);
|
||||
}
|
||||
|
||||
private void TAStudio_MouseLeave(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in New Issue