protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (_displayManager.HideMenuStrip && (keyData & Keys.Alt) == Keys.Alt) { if (mnuMain.Visible && !mnuMain.ContainsFocus) { mnuMain.Visible = false; } else { mnuMain.Visible = true; mnuMain.Focus(); } } #if !HIDETESTMENU if (keyData == Keys.Pause && EmuRunner.IsRunning()) { if (TestApi.RomTestRecording()) { TestApi.RomTestStop(); } else { TestApi.RomTestRecord(ConfigManager.TestFolder + "\\" + EmuApi.GetRomInfo().GetRomName() + ".mtp", true); } } #endif return(base.ProcessCmdKey(ref msg, keyData)); }
public List <ToolStripItem> GetMenuItems() { List <ToolStripItem> menuItems = new List <ToolStripItem>(); foreach (RecentItem recentItem in Items) { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = recentItem.ToString(); tsmi.Click += (object sender, EventArgs args) => { EmuRunner.LoadRom(recentItem.RomFile, recentItem.PatchFile); }; //Display shortened folder path as the "shortcut" tsmi.ShortcutKeyDisplayString = "(" + recentItem.GetShortenedFolder() + ")"; menuItems.Add(tsmi); } menuItems.Add(new ToolStripSeparator()); ToolStripMenuItem clearHistory = new ToolStripMenuItem(); clearHistory.Text = ResourceHelper.GetMessage("ClearHistory"); clearHistory.Image = Resources.Close; clearHistory.Click += (object sender, EventArgs args) => { ConfigManager.Config.RecentFiles.Items.Clear(); }; menuItems.Add(clearHistory); return(menuItems); }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.UpdateViewerSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); ctrlRecentGames.Initialize(); ResizeRecentGames(); _commandLine.LoadGameFromCommandLine(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } this.Resize += frmMain_Resize; }
private void UpdateDebuggerMenu() { bool running = EmuRunner.IsRunning(); mnuDebugger.Enabled = running; mnuSpcDebugger.Enabled = running; CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType; mnuSa1Debugger.Enabled = coprocessor == CoprocessorType.SA1; mnuSa1Debugger.Visible = coprocessor == CoprocessorType.SA1; mnuGsuDebugger.Enabled = coprocessor == CoprocessorType.GSU; mnuGsuDebugger.Visible = coprocessor == CoprocessorType.GSU; mnuTraceLogger.Enabled = running; mnuScriptWindow.Enabled = running; mnuMemoryTools.Enabled = running; mnuTilemapViewer.Enabled = running; mnuTileViewer.Enabled = running; mnuSpriteViewer.Enabled = running; mnuPaletteViewer.Enabled = running; mnuEventViewer.Enabled = running; mnuRegisterViewer.Enabled = running; }
public void LoadGameFromCommandLine() { List <string> switches = CommandLineHelper.PreprocessCommandLineArguments(_args, false); string romPath; CommandLineHelper.GetRomPathFromCommandLine(switches, out romPath, out _luaScriptsToLoad); if (romPath != null) { EmuRunner.LoadFile(romPath); } else { if (!EmuRunner.IsRunning()) { //When no ROM is loaded, only process Lua scripts if a ROM was specified as a command line param _luaScriptsToLoad.Clear(); _movieToRecord = null; //_loadLastSessionRequested = false; } else { //No game was specified, but a game is running already, load the scripts right away ProcessPostLoadCommandSwitches(); } } }
private void UpdateDebuggerMenu() { bool running = EmuRunner.IsRunning(); mnuDebugger.Enabled = running; mnuSpcDebugger.Enabled = running; CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType; mnuSa1Debugger.Enabled = coprocessor == CoprocessorType.SA1; mnuSa1Debugger.Visible = coprocessor == CoprocessorType.SA1; mnuGsuDebugger.Enabled = coprocessor == CoprocessorType.GSU; mnuGsuDebugger.Visible = coprocessor == CoprocessorType.GSU; bool isNecDsp = ( coprocessor == CoprocessorType.DSP1 || coprocessor == CoprocessorType.DSP1B || coprocessor == CoprocessorType.DSP2 || coprocessor == CoprocessorType.DSP3 || coprocessor == CoprocessorType.DSP4 || coprocessor == CoprocessorType.ST010 || coprocessor == CoprocessorType.ST011 ); mnuNecDspDebugger.Enabled = isNecDsp; mnuNecDspDebugger.Visible = isNecDsp; mnuCx4Debugger.Enabled = coprocessor == CoprocessorType.CX4; mnuCx4Debugger.Visible = coprocessor == CoprocessorType.CX4; mnuTraceLogger.Enabled = running; mnuScriptWindow.Enabled = running; mnuMemoryTools.Enabled = running; mnuTilemapViewer.Enabled = running; mnuTileViewer.Enabled = running; mnuSpriteViewer.Enabled = running; mnuPaletteViewer.Enabled = running; mnuEventViewer.Enabled = running; mnuRegisterViewer.Enabled = running; mnuProfiler.Enabled = running; mnuAssembler.Enabled = running; bool isGameboyMode = coprocessor == CoprocessorType.Gameboy; mnuGbDebugger.Enabled = isGameboyMode; mnuGbDebugger.Visible = isGameboyMode; sepGameboyDebugger.Visible = isGameboyMode; //Remove/disable all tools that aren't useful when running a plain GB game mnuGbDebugger.Text = isGameboyMode ? "Debugger" : "Game Boy Debugger"; mnuDebugger.Enabled = running && !isGameboyMode; mnuDebugger.Visible = !isGameboyMode; mnuSpcDebugger.Enabled = running && !isGameboyMode; mnuSpcDebugger.Visible = !isGameboyMode; sepCoprocessors.Visible = !isGameboyMode; }
private void mnuFile_DropDownOpening(object sender, EventArgs e) { mnuRecentFiles.DropDownItems.Clear(); mnuRecentFiles.DropDownItems.AddRange(ConfigManager.Config.RecentFiles.GetMenuItems().ToArray()); mnuRecentFiles.Enabled = ConfigManager.Config.RecentFiles.Items.Count > 0; mnuSaveState.Enabled = EmuRunner.IsRunning(); mnuLoadState.Enabled = EmuRunner.IsRunning() && !NetplayApi.IsConnected(); }
private void mnuPreferences_Click(object sender, EventArgs e) { using (frmPreferences frm = new frmPreferences()) { frm.ShowDialog(sender, this); ConfigManager.Config.Preferences.ApplyConfig(); ctrlRecentGames.Visible = !EmuRunner.IsRunning(); if (frm.NeedRestart) { this.Close(); } } }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); bool showUpgradeMessage = UpdateHelper.PerformUpgrade(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.SetScaleBasedOnWindowSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _commandLine.LoadGameFromCommandLine(); SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); Task.Run(() => { Thread.Sleep(25); this.BeginInvoke((Action)(() => { ResizeRecentGames(); ctrlRecentGames.Initialize(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } })); }); if (showUpgradeMessage) { MesenMsgBox.Show("UpgradeSuccess", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (ConfigManager.Config.Preferences.AutomaticallyCheckForUpdates) { UpdateHelper.CheckForUpdates(true); } InBackgroundHelper.StartBackgroundTimer(); this.Resize += frmMain_Resize; }
private void UpdateDebuggerMenu() { bool running = EmuRunner.IsRunning(); mnuDebugger.Enabled = running; mnuSpcDebugger.Enabled = running; mnuTraceLogger.Enabled = running; mnuMemoryTools.Enabled = running; mnuTilemapViewer.Enabled = running; mnuTileViewer.Enabled = running; mnuPaletteViewer.Enabled = running; mnuEventViewer.Enabled = running; }
public List <ToolStripItem> GetMenuItems() { List <ToolStripItem> menuItems = new List <ToolStripItem>(); foreach (RecentItem recentItem in Items) { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = recentItem.ToString(); tsmi.Click += (object sender, EventArgs args) => { EmuRunner.LoadRom(recentItem.RomFile, recentItem.PatchFile); }; menuItems.Add(tsmi); } return(menuItems); }
private void mnuTools_DropDownOpening(object sender, EventArgs e) { mnuMovies.Enabled = EmuRunner.IsRunning(); mnuPlayMovie.Enabled = EmuRunner.IsRunning() && !RecordApi.MoviePlaying() && !RecordApi.MovieRecording(); mnuRecordMovie.Enabled = EmuRunner.IsRunning() && !RecordApi.MoviePlaying() && !RecordApi.MovieRecording(); mnuStopMovie.Enabled = EmuRunner.IsRunning() && (RecordApi.MoviePlaying() || RecordApi.MovieRecording()); mnuSoundRecorder.Enabled = EmuRunner.IsRunning(); mnuWaveRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.WaveIsRecording(); mnuWaveStop.Enabled = EmuRunner.IsRunning() && RecordApi.WaveIsRecording(); mnuVideoRecorder.Enabled = EmuRunner.IsRunning(); mnuAviRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.AviIsRecording(); mnuAviStop.Enabled = EmuRunner.IsRunning() && RecordApi.AviIsRecording(); }
protected override void OnDragDrop(DragEventArgs e) { base.OnDragDrop(e); try { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (File.Exists(files[0])) { EmuRunner.LoadFile(files[0]); this.Activate(); } else { EmuApi.DisplayMessage("Error", "File not found: " + files[0]); } } catch (Exception ex) { MesenMsgBox.Show("UnexpectedError", MessageBoxButtons.OK, MessageBoxIcon.Error, ex.ToString()); } }
public void ProcessClick() { if (!this.Enabled) { return; } if (Path.GetExtension(_recentGame.FileName) == ".rgd") { EmuRunner.LoadRecentGame(_recentGame.FileName); } else { switch (this.Mode) { case GameScreenMode.LoadState: EmuApi.LoadState(_recentGame.SaveSlot); break; case GameScreenMode.SaveState: EmuApi.SaveState(_recentGame.SaveSlot); break; } } OnRecentGameLoaded?.Invoke(_recentGame); }
private void mnuTools_DropDownOpening(object sender, EventArgs e) { bool isClient = NetplayApi.IsConnected(); bool runAheadDisabled = ConfigManager.Config.Emulation.RunAheadFrames == 0; bool isGameboyMode = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy; mnuNetPlay.Enabled = runAheadDisabled && !isGameboyMode; mnuMovies.Enabled = runAheadDisabled && EmuRunner.IsRunning(); mnuPlayMovie.Enabled = runAheadDisabled && EmuRunner.IsRunning() && !RecordApi.MoviePlaying() && !RecordApi.MovieRecording() && !isClient; mnuRecordMovie.Enabled = runAheadDisabled && EmuRunner.IsRunning() && !RecordApi.MoviePlaying() && !RecordApi.MovieRecording(); mnuStopMovie.Enabled = runAheadDisabled && EmuRunner.IsRunning() && (RecordApi.MoviePlaying() || RecordApi.MovieRecording()); mnuSoundRecorder.Enabled = EmuRunner.IsRunning(); mnuWaveRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.WaveIsRecording(); mnuWaveStop.Enabled = EmuRunner.IsRunning() && RecordApi.WaveIsRecording(); mnuVideoRecorder.Enabled = EmuRunner.IsRunning(); mnuAviRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.AviIsRecording(); mnuAviStop.Enabled = EmuRunner.IsRunning() && RecordApi.AviIsRecording(); mnuCheats.Enabled = EmuRunner.IsRunning() && !isClient && !isGameboyMode; }
public static void LoadRandomGame() { IEnumerable <string> gameFolders; SearchOption searchOptions = SearchOption.TopDirectoryOnly; if (ConfigManager.Config.Preferences.OverrideGameFolder && Directory.Exists(ConfigManager.Config.Preferences.GameFolder)) { gameFolders = new List <string>() { ConfigManager.Config.Preferences.GameFolder }; searchOptions = SearchOption.AllDirectories; } else { gameFolders = ConfigManager.Config.RecentFiles.Items.Select(recentFile => recentFile.RomFile.Folder).Distinct(); } List <string> gameRoms = new List <string>(); foreach (string folder in gameFolders) { if (Directory.Exists(folder)) { foreach (string file in Directory.EnumerateFiles(folder, "*.*", searchOptions)) { if (FolderHelper.IsRomFile(file) || (searchOptions == SearchOption.AllDirectories && FolderHelper.IsArchiveFile(file))) { gameRoms.Add(file); } } } } if (gameRoms.Count == 0) { MesenMsgBox.Show("RandomGameNoGameFound", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int retryCount = 0; Random random = new Random(); do { string randomGame = gameRoms[random.Next(gameRoms.Count)]; if (FolderHelper.IsArchiveFile(randomGame)) { List <ArchiveRomEntry> archiveRomList = ArchiveHelper.GetArchiveRomList(randomGame); if (archiveRomList.Count > 0) { ResourcePath res = new ResourcePath() { InnerFile = archiveRomList[0].Filename, Path = randomGame }; if (!archiveRomList[0].IsUtf8) { res.InnerFileIndex = 1; } EmuRunner.LoadRom(res); break; } else { retryCount++; } } else { EmuRunner.LoadRom(randomGame); break; } } while(retryCount < 5); } }
private void toolsToolStripMenuItem_DropDownOpening(object sender, EventArgs e) { mnuVideoRecorder.Enabled = EmuRunner.IsRunning(); mnuAviRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.AviIsRecording(); mnuAviStop.Enabled = EmuRunner.IsRunning() && RecordApi.AviIsRecording(); }
private void mnuSoundRecorder_DropDownOpening(object sender, EventArgs e) { mnuSoundRecorder.Enabled = EmuRunner.IsRunning(); mnuWaveRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.WaveIsRecording(); mnuWaveStop.Enabled = EmuRunner.IsRunning() && RecordApi.WaveIsRecording(); }
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(); }
private void picPreviousState_Click(object sender, EventArgs e) { EmuRunner.LoadRecentGame(_recentGame.FileName); }
private void UpdateDebuggerMenu() { bool running = EmuRunner.IsRunning(); mnuDebugger.Enabled = running; mnuSpcDebugger.Enabled = running; CoprocessorType coprocessor = EmuApi.GetRomInfo().CoprocessorType; mnuSa1Debugger.Enabled = coprocessor == CoprocessorType.SA1; mnuSa1Debugger.Visible = coprocessor == CoprocessorType.SA1; mnuGsuDebugger.Enabled = coprocessor == CoprocessorType.GSU; mnuGsuDebugger.Visible = coprocessor == CoprocessorType.GSU; bool isNecDsp = ( coprocessor == CoprocessorType.DSP1 || coprocessor == CoprocessorType.DSP1B || coprocessor == CoprocessorType.DSP2 || coprocessor == CoprocessorType.DSP3 || coprocessor == CoprocessorType.DSP4 || coprocessor == CoprocessorType.ST010 || coprocessor == CoprocessorType.ST011 ); mnuNecDspDebugger.Enabled = isNecDsp; mnuNecDspDebugger.Visible = isNecDsp; mnuCx4Debugger.Enabled = coprocessor == CoprocessorType.CX4; mnuCx4Debugger.Visible = coprocessor == CoprocessorType.CX4; mnuTraceLogger.Enabled = running; mnuScriptWindow.Enabled = running; mnuMemoryTools.Enabled = running; mnuTilemapViewer.Enabled = running; mnuTileViewer.Enabled = running; mnuSpriteViewer.Enabled = running; mnuPaletteViewer.Enabled = running; mnuEventViewer.Enabled = running; mnuRegisterViewer.Enabled = running; mnuProfiler.Enabled = running; mnuAssembler.Enabled = running; mnuDebugLog.Enabled = running; mnuWatchWindow.Enabled = running; bool isGameboyMode = coprocessor == CoprocessorType.Gameboy; bool isSuperGameboy = coprocessor == CoprocessorType.SGB; //Only show in super gameboy mode mnuGbDebugger.Enabled = isSuperGameboy; mnuGbDebugger.Visible = isSuperGameboy; mnuGbEventViewer.Enabled = isSuperGameboy; mnuGbEventViewer.Visible = isSuperGameboy; mnuGbPaletteViewer.Enabled = isSuperGameboy; mnuGbPaletteViewer.Visible = isSuperGameboy; mnuGbSpriteViewer.Enabled = isSuperGameboy; mnuGbSpriteViewer.Visible = isSuperGameboy; mnuGbTilemapViewer.Enabled = isSuperGameboy; mnuGbTilemapViewer.Visible = isSuperGameboy; mnuGbTileViewer.Enabled = isSuperGameboy; mnuGbTileViewer.Visible = isSuperGameboy; sepGameboyDebugger.Visible = isSuperGameboy; //Hide in gameboy-only mode mnuSpcDebugger.Enabled = running && !isGameboyMode; mnuSpcDebugger.Visible = !isGameboyMode; sepCoprocessors.Visible = !isGameboyMode; }
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(); }
private void LoadSelectedGame() { EmuRunner.LoadRecentGame(_recentGames[_currentIndex].FileName); }
private void tmrInput_Tick(object sender, EventArgs e) { //Use player 1's controls to navigate the recent game selection screen if (Application.OpenForms.Count > 0 && Application.OpenForms[0].ContainsFocus && !EmuRunner.IsRunning()) { List <uint> keyCodes = InputApi.GetPressedKeys(); uint keyCode = keyCodes.Count > 0 ? keyCodes[0] : 0; if (keyCode > 0) { if (!_waitForRelease) { List <KeyMapping> mappings = new List <KeyMapping>() { ConfigManager.Config.Input.Controllers[0].Keys.Mapping1, ConfigManager.Config.Input.Controllers[0].Keys.Mapping2, ConfigManager.Config.Input.Controllers[0].Keys.Mapping3, ConfigManager.Config.Input.Controllers[0].Keys.Mapping4 }; foreach (KeyMapping mapping in mappings) { if (mapping.Left == keyCode) { _waitForRelease = true; GoToPreviousGame(); } else if (mapping.Right == keyCode) { _waitForRelease = true; GoToNextGame(); } else if (mapping.A == keyCode || mapping.B == keyCode) { _waitForRelease = true; LoadSelectedGame(); } } } } else { _waitForRelease = false; } } }
private void tmrInput_Tick(object sender, EventArgs e) { //Use player 1's controls to navigate the recent game selection screen if (frmMain.Instance?.ContainsFocus == true && !EmuRunner.IsRunning()) { List <uint> keyCodes = InputApi.GetPressedKeys(); uint keyCode = keyCodes.Count > 0 ? keyCodes[0] : 0; if (keyCode > 0) { if (!_waitForRelease) { List <KeyMapping> mappings = new List <KeyMapping>() { ConfigManager.Config.Input.Controllers[0].Keys.Mapping1, ConfigManager.Config.Input.Controllers[0].Keys.Mapping2, ConfigManager.Config.Input.Controllers[0].Keys.Mapping3, ConfigManager.Config.Input.Controllers[0].Keys.Mapping4 }; foreach (KeyMapping mapping in mappings) { if (mapping.Left == keyCode) { _waitForRelease = true; if (_currentIndex == 0) { _currentIndex = _recentGames.Count - 1; } else { _currentIndex--; } UpdateGameInfo(); } else if (mapping.Right == keyCode) { _waitForRelease = true; _currentIndex = (_currentIndex + 1) % _recentGames.Count; UpdateGameInfo(); } else if (mapping.Down == keyCode) { _waitForRelease = true; if (_currentIndex + _elementsPerRow < _recentGames.Count) { _currentIndex += _elementsPerRow; } else { _currentIndex = IsOnLastPage ? 0 : (_recentGames.Count - 1); } UpdateGameInfo(); } else if (mapping.Up == keyCode) { _waitForRelease = true; if (_currentIndex < _elementsPerRow) { _currentIndex = _recentGames.Count - 1; } else { _currentIndex -= _elementsPerRow; } UpdateGameInfo(); } else if (mapping.L == keyCode) { _waitForRelease = true; if (_currentIndex < _elementsPerPage) { _currentIndex = _recentGames.Count - 1; } else { _currentIndex -= _elementsPerPage; } UpdateGameInfo(); } else if (mapping.R == keyCode) { _waitForRelease = true; if (_currentIndex + _elementsPerPage < _recentGames.Count) { _currentIndex += _elementsPerPage; } else { _currentIndex = IsOnLastPage ? 0 : (_recentGames.Count - 1); } UpdateGameInfo(); } else if (mapping.A == keyCode || mapping.B == keyCode || mapping.X == keyCode || mapping.Y == keyCode || mapping.Select == keyCode || mapping.Start == keyCode) { _waitForRelease = true; EmuRunner.LoadRecentGame(_recentGames[_currentIndex].FileName); } } } } else { _waitForRelease = false; } } }