public void QueueNewMovie(IMovie movie, bool record, IEmulator emulator) { if (!record) // The semantics of record is that we are starting a new movie, and even wiping a pre-existing movie with the same path, but non-record means we are loading an existing movie into playback mode { movie.Load(false); if (movie.SystemID != emulator.SystemId) { throw new MoviePlatformMismatchException( $"Movie system Id ({movie.SystemID}) does not match the currently loaded platform ({emulator.SystemId}), unable to load"); } } // Note: this populates MovieControllerAdapter's Type with the approparite controller // Don't set it to a movie instance of the adapter or you will lose the definition! InputManager.RewireInputChain(); if (!record && emulator.SystemId == "NES") // For NES we need special logic since the movie will drive which core to load { var quicknesName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(QuickNES), typeof(CoreAttribute))).CoreName; var neshawkName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(NES), typeof(CoreAttribute))).CoreName; // If either is specified use that, else use whatever is currently set if (movie.Core == quicknesName) { PreviousNES_InQuickNES = Global.Config.NES_InQuickNES; Global.Config.NES_InQuickNES = true; } else if (movie.Core == neshawkName) { PreviousNES_InQuickNES = Global.Config.NES_InQuickNES; Global.Config.NES_InQuickNES = false; } } else if (!record && emulator.SystemId == "SNES") // ditto with snes9x vs bsnes { var snes9xName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(Snes9x), typeof(CoreAttribute))).CoreName; var bsnesName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(LibsnesCore), typeof(CoreAttribute))).CoreName; if (movie.Core == snes9xName) { PreviousSNES_InSnes9x = Global.Config.SNES_InSnes9x; Global.Config.SNES_InSnes9x = true; } else if (movie.Core == bsnesName) { PreviousSNES_InSnes9x = Global.Config.SNES_InSnes9x; Global.Config.SNES_InSnes9x = false; } } else if (!record && emulator.SystemId == "GBA") // ditto with GBA, we should probably architect this at some point, this isn't sustainable { var mGBAName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(MGBAHawk), typeof(CoreAttribute))).CoreName; var vbaNextName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(VBANext), typeof(CoreAttribute))).CoreName; if (movie.Core == mGBAName) { PreviousGBA_UsemGBA = Global.Config.GBA_UsemGBA; Global.Config.GBA_UsemGBA = true; } else if (movie.Core == vbaNextName) { PreviousGBA_UsemGBA = Global.Config.GBA_UsemGBA; Global.Config.GBA_UsemGBA = false; } } if (record) // This is a hack really, we need to set the movie to its propert state so that it will be considered active later { movie.SwitchToRecord(); } else { movie.SwitchToPlay(); } QueuedMovie = movie; }
public void QueueNewMovie(IMovie movie, bool record) { if (!record) // The semantics of record is that we are starting a new movie, and even wiping a pre-existing movie with the same path, but non-record means we are loading an existing movie into playback mode { movie.Load(); if (movie.SystemID != Global.Emulator.SystemId) { MessageCallback("Movie does not match the currently loaded system, unable to load"); return; } } //If a movie is already loaded, save it before starting a new movie if (Global.MovieSession.Movie.IsActive && !string.IsNullOrEmpty(Global.MovieSession.Movie.Filename)) { Global.MovieSession.Movie.Save(); } // Note: this populates MovieControllerAdapter's Type with the approparite controller // Don't set it to a movie instance of the adapter or you will lose the definition! InputManager.RewireInputChain(); if (!record && Global.Emulator.SystemId == "NES") // For NES we need special logic since the movie will drive which core to load { var quicknesName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(QuickNES), typeof(CoreAttributes))).CoreName; var neshawkName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(NES), typeof(CoreAttributes))).CoreName; // If either is specified use that, else use whatever is currently set if (Global.MovieSession.Movie.Core == quicknesName) { Global.Config.NES_InQuickNES = true; } else if (Global.MovieSession.Movie.Core == neshawkName) { Global.Config.NES_InQuickNES = false; } } else if (!record && Global.Emulator.SystemId == "SNES") // ditto with snes9x vs bsnes { var snes9xName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(Snes9x), typeof(CoreAttributes))).CoreName; var bsnesName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(LibsnesCore), typeof(CoreAttributes))).CoreName; if (Global.MovieSession.Movie.Core == snes9xName) { Global.Config.SNES_InSnes9x = true; } else { Global.Config.SNES_InSnes9x = false; } } if (record) // This is a hack really, we need to set the movie to its propert state so that it will be considered active later { movie.SwitchToRecord(); } else { movie.SwitchToPlay(); } QueuedMovie = movie; }