public bool StartNewMovie(IMovie movie, bool record) { if (movie == null) { throw new ArgumentNullException($"{nameof(movie)} cannot be null."); } try { MovieSession.QueueNewMovie(movie, record, Emulator.SystemId); } catch (MoviePlatformMismatchException ex) { using var ownerForm = new Form { TopMost = true }; MessageBox.Show(ownerForm, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } RebootCore(); Config.RecentMovies.Add(movie.Filename); MovieSession.RunQueuedMovie(record, Emulator); SetMainformMovieInfo(); if (MovieSession.Movie.Hash != Game.Hash) { AddOnScreenMessage("Warning: Movie hash does not match the ROM"); } return(!Emulator.IsNull()); }
public bool StartNewMovie(IMovie movie, bool record) { if (movie == null) { throw new ArgumentNullException($"{nameof(movie)} cannot be null."); } var oldPreferredCores = new Dictionary <string, string>(Config.PreferredCores); try { try { MovieSession.QueueNewMovie(movie, record, Emulator.SystemId, Config.PreferredCores); } catch (MoviePlatformMismatchException ex) { using var ownerForm = new Form { TopMost = true }; MessageBox.Show(ownerForm, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (!_isLoadingRom) { var rebootSucceeded = RebootCore(); if (!rebootSucceeded) { return(false); } } Config.RecentMovies.Add(movie.Filename); MovieSession.RunQueuedMovie(record, Emulator); } finally { Config.PreferredCores = oldPreferredCores; } SetMainformMovieInfo(); if (MovieSession.Movie.Hash != Game.Hash) { AddOnScreenMessage("Warning: Movie hash does not match the ROM"); } return(!Emulator.IsNull()); }
public bool StartNewMovie(IMovie movie, bool record) { // SuuperW: Check changes. adelikat: this could break bk2 movies // TODO: Clean up the saving process if (movie.IsActive() && (movie.Changes || !(movie is TasMovie))) { movie.Save(); } try { MovieSession.QueueNewMovie(movie, record, Emulator); } catch (MoviePlatformMismatchException ex) { using var ownerForm = new Form { TopMost = true }; MessageBox.Show(ownerForm, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } RebootCore(); if (MovieSession.PreviousNesInQuickNES.HasValue) { Config.NesInQuickNes = MovieSession.PreviousNesInQuickNES.Value; MovieSession.PreviousNesInQuickNES = null; } if (MovieSession.PreviousSnesInSnes9x.HasValue) { Config.SnesInSnes9x = MovieSession.PreviousSnesInSnes9x.Value; MovieSession.PreviousSnesInSnes9x = null; } if (MovieSession.PreviousGbaUsemGba.HasValue) { Config.GbaUsemGba = MovieSession.PreviousGbaUsemGba.Value; 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) { if (movie.TextSavestate != null) { Emulator.AsStatable().LoadStateText(new StringReader(movie.TextSavestate)); } else { Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false))); } if (movie.SavestateFramebuffer != null && Emulator.HasVideoProvider()) { var b1 = movie.SavestateFramebuffer; var b2 = Emulator.AsVideoProvider().GetVideoBuffer(); int len = Math.Min(b1.Length, b2.Length); for (int i = 0; i < len; i++) { b2[i] = b1[i]; } } Emulator.ResetCounters(); } else if (Emulator.HasSaveRam() && movie.StartsFromSaveRam) { Emulator.AsSaveRam().StoreSaveRam(movie.SaveRam); } MovieSession.RunQueuedMovie(record); SetMainformMovieInfo(); Tools.Restart <VirtualpadTool>(); if (MovieSession.Movie.Hash != Game.Hash) { AddOnScreenMessage("Warning: Movie hash does not match the ROM"); } return(!(Emulator is NullEmulator)); }