Example #1
0
 private void ApplyCheats()
 {
     if (chkDisableCheats.Checked)
     {
         EmuApi.ClearCheats();
     }
     else
     {
         CheatCodes.ApplyCheats(_cheats);
     }
 }
Example #2
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            _notifListener?.Dispose();

            ConfigManager.Config.Cheats.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            ConfigManager.Config.Cheats.WindowSize     = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;

            if (this.DialogResult == DialogResult.OK)
            {
                ConfigManager.Config.Cheats.DisableAllCheats = chkDisableCheats.Checked;
                (new CheatCodes()
                {
                    Cheats = _cheats
                }).Save();
            }
            ConfigManager.ApplyChanges();
            CheatCodes.ApplyCheats();
        }
Example #3
0
 private void ToggleCheats()
 {
     InvertConfigFlag(ref ConfigManager.Config.Cheats.DisableAllCheats);
     CheatCodes.ApplyCheats();
 }
Example #4
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded:
                CheatCodes.ApplyCheats();

                this.BeginInvoke((Action)(() => {
                    UpdateDebuggerMenu();
                    ctrlRecentGames.Visible = false;
                    SaveStateManager.UpdateStateMenu(mnuLoadState, false);
                    SaveStateManager.UpdateStateMenu(mnuSaveState, true);

                    RomInfo romInfo = EmuApi.GetRomInfo();
                    this.Text = "Mesen-S - " + romInfo.GetRomName();

                    if (DebugWindowManager.HasOpenedWindow)
                    {
                        DebugWorkspaceManager.GetWorkspace();
                    }
                }));
                break;

            case ConsoleNotificationType.BeforeEmulationStop:
                this.Invoke((Action)(() => {
                    DebugWindowManager.CloseAll();
                }));
                break;

            case ConsoleNotificationType.GameResumed:
                this.BeginInvoke((Action)(() => {
                    //Ensure mouse is hidden when game is resumed
                    CursorManager.OnMouseMove(ctrlRenderer);
                }));
                break;

            case ConsoleNotificationType.EmulationStopped:
                this.BeginInvoke((Action)(() => {
                    this.Text = "Mesen-S";
                    UpdateDebuggerMenu();
                    ShowGameScreen(GameScreenMode.RecentGames);
                    ResizeRecentGames();
                    if (_displayManager.ExclusiveFullscreen)
                    {
                        _displayManager.SetFullscreenState(false);
                    }
                }));
                break;

            case ConsoleNotificationType.ResolutionChanged:
                this.BeginInvoke((Action)(() => {
                    _displayManager.UpdateViewerSize();
                }));
                break;

            case ConsoleNotificationType.ExecuteShortcut:
                this.BeginInvoke((Action)(() => {
                    _shortcuts.ExecuteShortcut((EmulatorShortcut)e.Parameter);
                }));
                break;

            case ConsoleNotificationType.MissingFirmware:
                this.Invoke((Action)(() => {
                    MissingFirmwareMessage msg = (MissingFirmwareMessage)Marshal.PtrToStructure(e.Parameter, typeof(MissingFirmwareMessage));
                    FirmwareHelper.RequestFirmwareFile(msg);
                }));
                break;
            }
        }