Пример #1
0
        private void BindShortcuts()
        {
            Func <bool> notClient                = () => { return(!NetplayApi.IsConnected()); };
            Func <bool> running                  = () => { return(EmuRunner.IsRunning()); };
            Func <bool> runningNotClient         = () => { return(EmuRunner.IsRunning() && !NetplayApi.IsConnected()); };
            Func <bool> runningNotClientNotMovie = () => { return(EmuRunner.IsRunning() && !NetplayApi.IsConnected() && !RecordApi.MoviePlaying()); };

            _shortcuts.BindShortcut(mnuOpen, EmulatorShortcut.OpenFile);
            _shortcuts.BindShortcut(mnuReloadRom, EmulatorShortcut.ReloadRom, runningNotClientNotMovie);
            _shortcuts.BindShortcut(mnuExit, EmulatorShortcut.Exit);
            _shortcuts.BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient);
            _shortcuts.BindShortcut(mnuDecreaseSpeed, EmulatorShortcut.DecreaseSpeed, notClient);
            _shortcuts.BindShortcut(mnuEmuSpeedMaximumSpeed, EmulatorShortcut.MaxSpeed, notClient);

            _shortcuts.BindShortcut(mnuPause, EmulatorShortcut.Pause, runningNotClient);
            _shortcuts.BindShortcut(mnuReset, EmulatorShortcut.Reset, runningNotClientNotMovie);
            _shortcuts.BindShortcut(mnuPowerCycle, EmulatorShortcut.PowerCycle, runningNotClientNotMovie);
            _shortcuts.BindShortcut(mnuPowerOff, EmulatorShortcut.PowerOff, runningNotClient);

            _shortcuts.BindShortcut(mnuShowFPS, EmulatorShortcut.ToggleFps);

            _shortcuts.BindShortcut(mnuScale1x, EmulatorShortcut.SetScale1x);
            _shortcuts.BindShortcut(mnuScale2x, EmulatorShortcut.SetScale2x);
            _shortcuts.BindShortcut(mnuScale3x, EmulatorShortcut.SetScale3x);
            _shortcuts.BindShortcut(mnuScale4x, EmulatorShortcut.SetScale4x);
            _shortcuts.BindShortcut(mnuScale5x, EmulatorShortcut.SetScale5x);
            _shortcuts.BindShortcut(mnuScale6x, EmulatorShortcut.SetScale6x);

            _shortcuts.BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);

            _shortcuts.BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, running);
            _shortcuts.BindShortcut(mnuRandomGame, EmulatorShortcut.LoadRandomGame);

            mnuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenDebugger));
            mnuSpcDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSpcDebugger));
            mnuSa1Debugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSa1Debugger));
            mnuGsuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenGsuDebugger));
            mnuNecDspDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenNecDspDebugger));
            mnuCx4Debugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenCx4Debugger));
            mnuGbDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenGameboyDebugger));
            mnuMemoryTools.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenMemoryTools));
            mnuEventViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenEventViewer));
            mnuTilemapViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTilemapViewer));
            mnuTileViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTileViewer));
            mnuSpriteViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSpriteViewer));
            mnuPaletteViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenPaletteViewer));
            mnuTraceLogger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTraceLogger));
            mnuScriptWindow.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenScriptWindow));
            mnuRegisterViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenRegisterViewer));
            mnuProfiler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenProfiler));
            mnuAssembler.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenAssembler));

            mnuNoneFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.None); };
            mnuNtscFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.NTSC); };

            mnuHQ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ2x); };
            mnuHQ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ3x); };
            mnuHQ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ4x); };

            mnuPrescale2xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale2x); };
            mnuPrescale3xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale3x); };
            mnuPrescale4xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale4x); };
            mnuPrescale6xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale6x); };
            mnuPrescale8xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale8x); };
            mnuPrescale10xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale10x); };

            mnuScale2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale2x); };
            mnuScale3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale3x); };
            mnuScale4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale4x); };

            mnu2xSaiFilter.Click      += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType._2xSai); };
            mnuSuper2xSaiFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Super2xSai); };
            mnuSuperEagleFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.SuperEagle); };

            mnuXBRZ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ2x); };
            mnuXBRZ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ3x); };
            mnuXBRZ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ4x); };
            mnuXBRZ5xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ5x); };
            mnuXBRZ6xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ6x); };

            mnuBilinearInterpolation.Click    += (s, e) => { _shortcuts.ToggleBilinearInterpolation(); };
            mnuBlendHighResolutionModes.Click += (s, e) => { _shortcuts.ToggleBlendHighResolutionModes(); };

            mnuRegionAuto.Click += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Auto); };
            mnuRegionNtsc.Click += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Ntsc); };
            mnuRegionPal.Click  += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Pal); };

            mnuCheats.Click += (s, e) => { frmCheatList.ShowWindow(); };

            mnuOptions.DropDownOpening += (s, e) => {
                bool isConnected = NetplayApi.IsConnected();
                mnuRegion.Enabled          = !isConnected;
                mnuInputConfig.Enabled     = !isConnected;
                mnuEmulationConfig.Enabled = !isConnected;
            };

            InitNetPlayMenus();

            mnuDebugger.Click       += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Debugger); };
            mnuSpcDebugger.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.SpcDebugger); };
            mnuSa1Debugger.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Sa1Debugger); };
            mnuGsuDebugger.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GsuDebugger); };
            mnuNecDspDebugger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.NecDspDebugger); };
            mnuCx4Debugger.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Cx4Debugger); };
            mnuGbDebugger.Click     += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GbDebugger); };
            mnuTraceLogger.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger); };
            mnuMemoryTools.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.MemoryTools); };
            mnuTilemapViewer.Click  += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TilemapViewer); };
            mnuTileViewer.Click     += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TileViewer); };
            mnuSpriteViewer.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.SpriteViewer); };
            mnuPaletteViewer.Click  += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.PaletteViewer); };
            mnuEventViewer.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.EventViewer); };
            mnuScriptWindow.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.ScriptWindow); };
            mnuRegisterViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.RegisterViewer); };
            mnuProfiler.Click       += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Profiler); };
            mnuAssembler.Click      += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Assembler); };

            mnuTestRun.Click     += (s, e) => { RomTestHelper.RunTest(); };
            mnuTestRecord.Click  += (s, e) => { RomTestHelper.RecordTest(); };
            mnuTestStop.Click    += (s, e) => { RomTestHelper.StopRecording(); };
            mnuRunAllTests.Click += (s, e) => { RomTestHelper.RunAllTests(); };

            UpdateDebuggerMenu();
        }
Пример #2
0
        private void BindShortcuts()
        {
            Func <bool> notClient                = () => { return(true); };                  //TODO
            Func <bool> running                  = () => { return(EmuRunner.IsRunning()); };
            Func <bool> runningNotClient         = () => { return(EmuRunner.IsRunning()); }; //TODO
            Func <bool> runningNotClientNotMovie = () => { return(EmuRunner.IsRunning()); }; //TODO

            _shortcuts.BindShortcut(mnuOpen, EmulatorShortcut.OpenFile);
            _shortcuts.BindShortcut(mnuExit, EmulatorShortcut.Exit);
            _shortcuts.BindShortcut(mnuIncreaseSpeed, EmulatorShortcut.IncreaseSpeed, notClient);
            _shortcuts.BindShortcut(mnuDecreaseSpeed, EmulatorShortcut.DecreaseSpeed, notClient);
            _shortcuts.BindShortcut(mnuEmuSpeedMaximumSpeed, EmulatorShortcut.MaxSpeed, notClient);

            _shortcuts.BindShortcut(mnuPause, EmulatorShortcut.Pause, runningNotClient);
            _shortcuts.BindShortcut(mnuReset, EmulatorShortcut.Reset, runningNotClientNotMovie);
            _shortcuts.BindShortcut(mnuPowerCycle, EmulatorShortcut.PowerCycle, runningNotClientNotMovie);
            _shortcuts.BindShortcut(mnuPowerOff, EmulatorShortcut.PowerOff, runningNotClient);

            _shortcuts.BindShortcut(mnuShowFPS, EmulatorShortcut.ToggleFps);

            _shortcuts.BindShortcut(mnuScale1x, EmulatorShortcut.SetScale1x);
            _shortcuts.BindShortcut(mnuScale2x, EmulatorShortcut.SetScale2x);
            _shortcuts.BindShortcut(mnuScale3x, EmulatorShortcut.SetScale3x);
            _shortcuts.BindShortcut(mnuScale4x, EmulatorShortcut.SetScale4x);
            _shortcuts.BindShortcut(mnuScale5x, EmulatorShortcut.SetScale5x);
            _shortcuts.BindShortcut(mnuScale6x, EmulatorShortcut.SetScale6x);

            _shortcuts.BindShortcut(mnuFullscreen, EmulatorShortcut.ToggleFullscreen);

            _shortcuts.BindShortcut(mnuTakeScreenshot, EmulatorShortcut.TakeScreenshot, running);

            mnuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenDebugger));
            mnuSpcDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSpcDebugger));
            mnuSa1Debugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSa1Debugger));
            mnuGsuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenGsuDebugger));
            mnuMemoryTools.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenMemoryTools));
            mnuEventViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenEventViewer));
            mnuTilemapViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTilemapViewer));
            mnuTileViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTileViewer));
            mnuSpriteViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSpriteViewer));
            mnuPaletteViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenPaletteViewer));
            mnuTraceLogger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTraceLogger));
            mnuScriptWindow.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenScriptWindow));

            mnuNoneFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.None); };
            mnuNtscFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.NTSC); };

            mnuHQ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ2x); };
            mnuHQ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ3x); };
            mnuHQ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.HQ4x); };

            mnuPrescale2xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale2x); };
            mnuPrescale3xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale3x); };
            mnuPrescale4xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale4x); };
            mnuPrescale6xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale6x); };
            mnuPrescale8xFilter.Click  += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale8x); };
            mnuPrescale10xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Prescale10x); };

            mnuScale2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale2x); };
            mnuScale3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale3x); };
            mnuScale4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Scale4x); };

            mnu2xSaiFilter.Click      += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType._2xSai); };
            mnuSuper2xSaiFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.Super2xSai); };
            mnuSuperEagleFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.SuperEagle); };

            mnuXBRZ2xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ2x); };
            mnuXBRZ3xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ3x); };
            mnuXBRZ4xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ4x); };
            mnuXBRZ5xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ5x); };
            mnuXBRZ6xFilter.Click += (s, e) => { _shortcuts.SetVideoFilter(VideoFilterType.xBRZ6x); };

            mnuBilinearInterpolation.Click += (s, e) => { _shortcuts.ToggleBilinearInterpolation(); };

            mnuRegionAuto.Click += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Auto); };
            mnuRegionNtsc.Click += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Ntsc); };
            mnuRegionPal.Click  += (s, e) => { _shortcuts.SetRegion(ConsoleRegion.Pal); };

            mnuDebugger.Click      += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Debugger); };
            mnuSpcDebugger.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.SpcDebugger); };
            mnuSa1Debugger.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Sa1Debugger); };
            mnuGsuDebugger.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GsuDebugger); };
            mnuTraceLogger.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger); };
            mnuMemoryTools.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.MemoryTools); };
            mnuTilemapViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TilemapViewer); };
            mnuTileViewer.Click    += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TileViewer); };
            mnuSpriteViewer.Click  += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.SpriteViewer); };
            mnuPaletteViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.PaletteViewer); };
            mnuEventViewer.Click   += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.EventViewer); };
            mnuScriptWindow.Click  += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.ScriptWindow); };

            UpdateDebuggerMenu();
        }