public static void SaveState(uint slot) { if (EmuRunner.IsRunning()) { EmuApi.SaveState(slot); } }
public static void LoadState(uint slot) { if (EmuRunner.IsRunning()) { EmuApi.LoadState(slot); } }
public static void LoadStateFromFile() { if (EmuRunner.IsRunning()) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.InitialDirectory = ConfigManager.SaveStateFolder; ofd.SetFilter(ResourceHelper.GetMessage("FilterSavestate")); if (ofd.ShowDialog(frmMain.Instance) == DialogResult.OK) { EmuApi.LoadStateFile(ofd.FileName); } } } }
public static void SaveStateToFile() { if (EmuRunner.IsRunning()) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.InitialDirectory = ConfigManager.SaveStateFolder; sfd.FileName = EmuApi.GetRomInfo().GetRomName() + ".mss"; sfd.SetFilter(ResourceHelper.GetMessage("FilterSavestate")); if (sfd.ShowDialog(frmMain.Instance) == DialogResult.OK) { EmuApi.SaveStateFile(sfd.FileName); } } } }
private static void tmrHideMouse_Tick(object sender, EventArgs e) { bool running = EmuRunner.IsRunning() && !EmuApi.IsPaused(); if (running) { HideMouse(); _tmrHideMouse.Stop(); } else { ShowMouse(); _tmrHideMouse.Stop(); } }
public static void OnMouseMove(Control ctrl) { if (_mouseCaptured && AllowMouseCapture) { HideMouse(); _tmrHideMouse.Stop(); Form frm = frmMain.Instance; Point centerPos = frm.PointToScreen(new Point(frm.Width / 2, frm.Height / 2)); Point diff = new Point(Cursor.Position.X - centerPos.X, Cursor.Position.Y - centerPos.Y); if (diff.X != 0 || diff.Y != 0) { InputApi.SetMouseMovement((Int16)diff.X, (Int16)diff.Y); Cursor.Position = centerPos; } } else { _mouseCaptured = false; if (!EmuRunner.IsRunning() || EmuApi.IsPaused()) { ShowMouse(); } /* TODO else if(ConfigManager.Config.Input.HideMousePointerForZapper && CursorManager.IsLightGun) { * //Keep mouse hidden when using zapper if option to hide mouse is enabled * HideMouse(); * return; * }*/ _tmrHideMouse.Stop(); if (!CursorManager.NeedMouseIcon) { //Only hide mouse if no zapper (otherwise this could be pretty annoying) ctrl.Cursor = Cursors.Default; if (EmuRunner.IsRunning() && !EmuApi.IsPaused()) { _tmrHideMouse.Start(); } } } }
private void OpenFile() { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.SetFilter(ResourceHelper.GetMessage("FilterRom")); if (ConfigManager.Config.Preferences.OverrideGameFolder && Directory.Exists(ConfigManager.Config.Preferences.GameFolder)) { ofd.InitialDirectory = ConfigManager.Config.Preferences.GameFolder; } else if (ConfigManager.Config.RecentFiles.Items.Count > 0) { ofd.InitialDirectory = ConfigManager.Config.RecentFiles.Items[0].RomFile.Folder; } if (ofd.ShowDialog(frmMain.Instance) == DialogResult.OK) { EmuRunner.LoadFile(ofd.FileName); } } }
public void SetFullscreenState(bool enabled) { if (_fullscreenMode == enabled) { //Fullscreen mode already matches, no need to do anything return; } bool saveState = !_fullscreenMode; _fullscreenMode = enabled; if (ConfigManager.Config.Video.UseExclusiveFullscreen) { if (enabled && EmuRunner.IsRunning()) { StartExclusiveFullscreenMode(); } else { StopExclusiveFullscreenMode(); } } else { _frm.Resize -= frmMain_Resize; if (enabled) { StartFullscreenWindowMode(saveState); } else { StopFullscreenWindowMode(); } _frm.Resize += frmMain_Resize; UpdateViewerSize(); } }
public static void InitializeStateMenu(ToolStripMenuItem menu, bool forSave, ShortcutHandler shortcutHandler) { Action <uint> addSaveStateInfo = (i) => { ToolStripMenuItem item = new ToolStripMenuItem(); menu.DropDownItems.Add(item); if (forSave) { shortcutHandler.BindShortcut(item, (EmulatorShortcut)((int)EmulatorShortcut.SaveStateSlot1 + i - 1)); } else { shortcutHandler.BindShortcut(item, (EmulatorShortcut)((int)EmulatorShortcut.LoadStateSlot1 + i - 1)); } }; for (uint i = 1; i <= NumberOfSaveSlots; i++) { addSaveStateInfo(i); } if (!forSave) { menu.DropDownItems.Add("-"); addSaveStateInfo(NumberOfSaveSlots + 1); menu.DropDownItems.Add("-"); ToolStripMenuItem loadDialog = new ToolStripMenuItem(ResourceHelper.GetMessage("LoadStateDialog"), Resources.SplitView); menu.DropDownItems.Add(loadDialog); shortcutHandler.BindShortcut(loadDialog, EmulatorShortcut.LoadStateDialog, () => EmuRunner.IsRunning() && !NetplayApi.IsConnected()); ToolStripMenuItem loadFromFile = new ToolStripMenuItem(ResourceHelper.GetMessage("LoadFromFile"), Resources.Folder); menu.DropDownItems.Add(loadFromFile); shortcutHandler.BindShortcut(loadFromFile, EmulatorShortcut.LoadStateFromFile); } else { menu.DropDownItems.Add("-"); ToolStripMenuItem saveDialog = new ToolStripMenuItem(ResourceHelper.GetMessage("SaveStateDialog"), Resources.SplitView); menu.DropDownItems.Add(saveDialog); shortcutHandler.BindShortcut(saveDialog, EmulatorShortcut.SaveStateDialog, () => EmuRunner.IsRunning() && !NetplayApi.IsConnected()); ToolStripMenuItem saveToFile = new ToolStripMenuItem(ResourceHelper.GetMessage("SaveToFile"), Resources.SaveFloppy); menu.DropDownItems.Add(saveToFile); shortcutHandler.BindShortcut(saveToFile, EmulatorShortcut.SaveStateToFile); } }