when loading GB/GBC movies, store the core and auto-switch between gamebatte and gbHawk, fixes #1805

This commit is contained in:
adelikat 2020-02-02 12:27:45 -06:00
parent 880f584674
commit 6990b6f51f
3 changed files with 27 additions and 0 deletions

View File

@ -3,10 +3,12 @@ using System.IO;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.GBA;
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
namespace BizHawk.Client.Common
{
@ -420,6 +422,7 @@ namespace BizHawk.Client.Common
public bool? PreviousNesInQuickNES { get; set; }
public bool? PreviousSnesInSnes9x { get; set; }
public bool? PreviousGbaUsemGba { get; set; }
public bool? PreviousGbUseGbHawk { get; set; }
/// <exception cref="MoviePlatformMismatchException"><paramref name="record"/> is <see langword="false"/> and <paramref name="movie"/>.<see cref="IMovie.SystemID"/> does not match <paramref name="emulator"/>.<see cref="IEmulator.SystemId"/></exception>
public void QueueNewMovie(IMovie movie, bool record, IEmulator emulator)
@ -488,6 +491,22 @@ namespace BizHawk.Client.Common
Global.Config.GbaUsemGba = false;
}
}
else if (!record && (emulator.SystemId == "GB" || emulator.SystemId == "GBC"))
{
var gbHawkName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(GBHawk), typeof(CoreAttribute))).CoreName;
var gambatteName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(Gameboy), typeof(CoreAttribute))).CoreName;
if (movie.Core == gbHawkName)
{
PreviousGbUseGbHawk = Global.Config.GbUseGbHawk;
Global.Config.GbUseGbHawk = true;
}
else if (movie.Core == gambatteName)
{
PreviousGbUseGbHawk = Global.Config.GbUseGbHawk;
Global.Config.GbUseGbHawk = false;
}
}
if (record) // This is a hack really, we need to set the movie to its proper state so that it will be considered active later
{

View File

@ -17,9 +17,11 @@ namespace BizHawk.Client.Common
bool ReadOnly { get; set; }
bool MovieIsQueued { get; }
// TODO: this isn't sustainable
bool? PreviousNesInQuickNES { get; set; }
bool? PreviousSnesInSnes9x { get; set; }
bool? PreviousGbaUsemGba { get; set; }
bool? PreviousGbUseGbHawk { get; set; }
void HandleMovieOnFrameLoop();
void HandleMovieAfterFrameLoop();

View File

@ -50,6 +50,12 @@ namespace BizHawk.Client.EmuHawk
MovieSession.PreviousGbaUsemGba = null;
}
if (MovieSession.PreviousGbUseGbHawk.HasValue)
{
Config.GbUseGbHawk = MovieSession.PreviousGbUseGbHawk.Value;
MovieSession.PreviousGbUseGbHawk = null;
}
Config.RecentMovies.Add(movie.Filename);
if (Emulator.HasSavestates() && movie.StartsFromSavestate)