private byte[,] ResolvePalette(bool showMsg = false) { if (AutoLoadPalette.Checked) // checkbox checked: try to load palette from file { if (PalettePath.Text.Length > 0) { var palette = new HawkFile(PalettePath.Text); if (palette.Exists) { var data = Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name)); if (showMsg) { _mainForm.AddOnScreenMessage($"Palette file loaded: {palette.Name}"); } return(data); } return(_settings.Palette); } // no filename: interpret this as "reset to default" if (showMsg) { _mainForm.AddOnScreenMessage("Standard Palette set"); } return((byte[, ])Palettes.QuickNESPalette.Clone()); } // checkbox unchecked: we're reusing whatever palette was set return(_settings.Palette); }
private void Ok_Click(object sender, EventArgs e) { SaveSettings(); _config.PathEntries.RefreshTempPath(); _mainForm.AddOnScreenMessage("Path settings saved"); Close(); }
private void OkBtn_Click(object sender, EventArgs e) { _config.StartFullscreen = StartFullScreenCheckbox.Checked; _config.StartPaused = StartPausedCheckbox.Checked; _config.PauseWhenMenuActivated = PauseWhenMenuActivatedCheckbox.Checked; _config.ShowContextMenu = EnableContextMenuCheckbox.Checked; _config.SaveWindowPosition = SaveWindowPositionCheckbox.Checked; _config.RunInBackground = RunInBackgroundCheckbox.Checked; _config.AcceptBackgroundInput = AcceptBackgroundInputCheckbox.Checked; _config.AcceptBackgroundInputControllerOnly = AcceptBackgroundInputControllerOnlyCheckBox.Checked; _config.HandleAlternateKeyboardLayouts = HandleAlternateKeyboardLayoutsCheckBox.Checked; _config.SuppressAskSave = NeverAskSaveCheckbox.Checked; _config.SingleInstanceMode = SingleInstanceModeCheckbox.Checked; if (rbInputMethodDirectInput.Checked) { _config.HostInputMethod = EHostInputMethod.DirectInput; } if (rbInputMethodOpenTK.Checked) { _config.HostInputMethod = EHostInputMethod.OpenTK; } _config.BackupSaveram = BackupSRamCheckbox.Checked; _config.AutosaveSaveRAM = AutosaveSRAMCheckbox.Checked; _config.FlushSaveRamFrames = AutosaveSaveRAMSeconds * 60; if (_mainForm.AutoFlushSaveRamIn > _config.FlushSaveRamFrames) { _mainForm.AutoFlushSaveRamIn = _config.FlushSaveRamFrames; } _config.SkipLagFrame = FrameAdvSkipLagCheckbox.Checked; _config.RunLuaDuringTurbo = LuaDuringTurboCheckbox.Checked; _config.MoviesOnDisk = cbMoviesOnDisk.Checked; _config.SkipWaterboxIntegrityChecks = cbSkipWaterboxIntegrityChecks.Checked; var prevLuaEngine = _config.LuaEngine; if (LuaInterfaceRadio.Checked) { _config.LuaEngine = ELuaEngine.LuaPlusLuaInterface; } else if (NLuaRadio.Checked) { _config.LuaEngine = ELuaEngine.NLuaPlusKopiLua; } _mainForm.AddOnScreenMessage("Custom configurations saved."); if (prevLuaEngine != _config.LuaEngine) { _mainForm.AddOnScreenMessage("Restart emulator for Lua change to take effect"); } Close(); DialogResult = DialogResult.OK; }
private void btnDialogOK_Click(object sender, EventArgs e) { _config.StartFullscreen = cbStartInFS.Checked; _config.StartPaused = cbStartPaused.Checked; _config.PauseWhenMenuActivated = cbMenusPauseEmulation.Checked; _config.ShowContextMenu = cbEnableContextMenu.Checked; _config.SaveWindowPosition = cbSaveWindowPosition.Checked; _config.RunInBackground = cbNoFocusEmulate.Checked; _config.AcceptBackgroundInput = cbNoFocusInput.Checked; _config.AcceptBackgroundInputControllerOnly = cbNoFocusInputGamepadOnly.Checked; _config.HandleAlternateKeyboardLayouts = cbNonQWERTY.Checked; _config.SuppressAskSave = cbNeverAskForSave.Checked; _config.SingleInstanceMode = cbSingleInstance.Checked; _config.BackupSaveram = cbBackupSaveRAM.Checked; _config.AutosaveSaveRAM = cbAutoSaveRAM.Checked; _config.FlushSaveRamFrames = AutosaveSaveRAMSeconds * 60; if (_mainForm.AutoFlushSaveRamIn > _config.FlushSaveRamFrames) { _mainForm.AutoFlushSaveRamIn = _config.FlushSaveRamFrames; } _config.SkipLagFrame = cbFrameAdvPastLag.Checked; _config.RunLuaDuringTurbo = cbRunLuaDuringTurbo.Checked; _config.MoviesOnDisk = cbMoviesOnDisk.Checked; _config.MoviesInAwe = cbMoviesInAWE.Checked; var prevLuaEngine = _config.LuaEngine; if (rbLuaInterface.Checked) { _config.LuaEngine = ELuaEngine.LuaPlusLuaInterface; } else if (rbKopiLua.Checked) { _config.LuaEngine = ELuaEngine.NLuaPlusKopiLua; } _mainForm.AddOnScreenMessage("Custom configurations saved."); if (prevLuaEngine != _config.LuaEngine) { _mainForm.AddOnScreenMessage("Restart emulator for Lua change to take effect"); } Close(); DialogResult = DialogResult.OK; }
private void Disengage() { MainForm.PauseOnFrame = null; MainForm.AddOnScreenMessage("TAStudio disengaged"); MainForm.TakeBackControl(); Config.MovieEndAction = _originalEndAction; MainForm.SetMainformMovieInfo(); }
private void DisengageTastudio() { MainForm.PauseOnFrame = null; MainForm.AddOnScreenMessage("TAStudio disengaged"); Global.MovieSession.Movie = MovieService.DefaultInstance; MainForm.TakeBackControl(); Config.MovieEndAction = _originalEndAction; MainForm.SetMainformMovieInfo(); // Do not keep TAStudio's disk save states. // if (Directory.Exists(statesPath)) Directory.Delete(statesPath, true); // TODO - do we need to dispose something here instead? }
private void EngageTastudio() { MainForm.AddOnScreenMessage("TAStudio engaged"); SetTasMovieCallbacks(); SetTextProperty(); MainForm.RelinquishControl(this); _originalEndAction = Config.MovieEndAction; MainForm.ClearRewindData(); Config.MovieEndAction = MovieEndAction.Record; MainForm.SetMainformMovieInfo(); Global.MovieSession.ReadOnly = true; SetSplicer(); }
private bool Engage() { _engaged = false; MainForm.PauseOnFrame = null; MainForm.PauseEmulator(); // Nag if inaccurate core, but not if auto-loading or movie is already loaded if (!CanAutoload && MovieSession.Movie.NotActive()) { // Nag but allow the user to continue anyway, so ignore the return value MainForm.EnsureCoreIsAccurate(); } // Start Scenario 1: A regular movie is active if (MovieSession.Movie.IsActive() && !(MovieSession.Movie is ITasMovie)) { var changesString = "Would you like to save the current movie before closing it?"; if (MovieSession.Movie.Changes) { changesString = "The current movie has unsaved changes. Would you like to save before closing it?"; } var result = MessageBox.Show( "TAStudio will create a new project file from the current movie.\n\n" + changesString, "Convert movie", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { MovieSession.Movie.Save(); } else if (result.Equals(DialogResult.Cancel)) { return(false); } ConvertCurrentMovieToTasproj(); StartNewMovieWrapper(CurrentTasMovie); SetUpColumns(); } // Start Scenario 2: A tasproj is already active else if (MovieSession.Movie.IsActive() && MovieSession.Movie is ITasMovie) { bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 3: No movie, but user wants to autoload their last project else if (CanAutoload) { bool result = LoadFile(new FileInfo(Settings.RecentTas.MostRecent)); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 4: No movie, default behavior of engaging tastudio with a new default project else { StartNewTasMovie(); } // Attempts to load failed, abort if (Emulator.IsNull()) { Disengage(); return(false); } MainForm.AddOnScreenMessage("TAStudio engaged"); SetTasMovieCallbacks(CurrentTasMovie); UpdateWindowTitle(); MainForm.RelinquishControl(this); _originalEndAction = Config.Movies.MovieEndAction; MainForm.DisableRewind(); Config.Movies.MovieEndAction = MovieEndAction.Record; MainForm.SetMainformMovieInfo(); MovieSession.ReadOnly = true; SetSplicer(); SetupBoolPatterns(); _engaged = true; return(true); }
private bool Engage() { MainForm.PauseOnFrame = null; MainForm.PauseEmulator(); // Nag if inaccurate core, but not if auto-loading or movie is already loaded if (!CanAutoload && MovieSession.Movie.NotActive()) { // Nag but allow the user to continue anyway, so ignore the return value EmuHawkUtil.EnsureCoreIsAccurate(Emulator); } // Start Scenario 1: A regular movie is active if (MovieSession.Movie.IsActive() && !(MovieSession.Movie is ITasMovie)) { var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result.IsOk()) { ConvertCurrentMovieToTasproj(); StartNewMovieWrapper(CurrentTasMovie); SetUpColumns(); } else { return(false); } } // Start Scenario 2: A tasproj is already active else if (MovieSession.Movie.IsActive() && MovieSession.Movie is ITasMovie) { bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 3: No movie, but user wants to autoload their last project else if (CanAutoload) { bool result = LoadFile(new FileInfo(Settings.RecentTas.MostRecent)); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 4: No movie, default behavior of engaging tastudio with a new default project else { StartNewTasMovie(); } // Attempts to load failed, abort if (Emulator.IsNull()) { Disengage(); return(false); } MainForm.AddOnScreenMessage("TAStudio engaged"); SetTasMovieCallbacks(CurrentTasMovie); SetTextProperty(); MainForm.RelinquishControl(this); _originalEndAction = Config.MovieEndAction; MainForm.ClearRewindData(); Config.MovieEndAction = MovieEndAction.Record; MainForm.SetMainformMovieInfo(); MovieSession.ReadOnly = true; SetSplicer(); SetupBoolPatterns(); return(true); }
private void CancelBtn_Click(object sender, EventArgs e) { _mainForm.AddOnScreenMessage("Filter settings aborted"); DialogResult = DialogResult.Cancel; Close(); }
private void BreakpointCallback(uint addr, uint value, uint flags) { MainForm.PauseEmulator(); UpdateValues(); MainForm.AddOnScreenMessage("Breakpoint hit"); }