Пример #1
0
        private void CheckCommands()
        {
            if (_cheatCodes == null)
                InitCodes();

            if (_currentCodeLetter >= _cheatCodes[(int)_currentCode].Length)
            {
                CheckExecutedCommand();
            }
            else if (Input.anyKeyDown)
            {
                if (Input.GetKeyDown(_cheatCodes[(int)_currentCode][_currentCodeLetter]))
                    _currentCodeLetter++;
                else
                {
                    _currentCodeLetter = 0;
                    for (int i = 0; i < _cheatCodes.Length; i++)
                    {
                        if (Input.GetKeyDown(_cheatCodes[i][_currentCodeLetter]))
                        {
                            _currentCodeLetter++;
                            _currentCode = (CheatCodes)i;
                            break;
                        }
                    }
                }
            }
        }
Пример #2
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;
            }
        }
Пример #3
0
 private void ToggleCheats()
 {
     InvertConfigFlag(ref ConfigManager.Config.Cheats.DisableAllCheats);
     CheatCodes.ApplyCheats();
 }