From 483ffe1143d7e052c2e87096b6a3f2f7a66f3c74 Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 22 Feb 2020 20:54:07 -0500 Subject: [PATCH] UI: Added reload rom option Same as Mesen - Power Cycle no longer resets changes done to PRG. Reload ROM must be used when reloading the rom from the disk is needed. + Fixed some issues with reset and power cycle not pausing emulation when the option to pause when turned on --- Core/Console.cpp | 39 ++++---- Core/Console.h | 3 +- Core/Debugger.cpp | 2 +- Core/SettingTypes.h | 1 + InteropDLL/EmuApiWrapper.cpp | 7 ++ UI/Config/Shortcuts/EmulatorShortcut.cs | 1 + UI/Debugger/Config/DebuggerShortcutsConfig.cs | 2 + UI/Debugger/frmDbgPreferences.cs | 1 + UI/Debugger/frmDebugger.Designer.cs | 58 ++++++++---- UI/Debugger/frmDebugger.cs | 11 ++- UI/Dependencies/resources.en.xml | 2 + UI/Emulation/ShortcutHandler.cs | 1 + UI/Forms/Config/ctrlEmulatorShortcuts.cs | 1 + UI/Forms/frmMain.Designer.cs | 92 ++++++++++--------- UI/Forms/frmMain.cs | 1 + UI/Interop/EmuApi.cs | 1 + 16 files changed, 140 insertions(+), 83 deletions(-) diff --git a/Core/Console.cpp b/Core/Console.cpp index 8ca258b..0285de4 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -307,11 +307,9 @@ void Console::Stop(bool sendNotification) void Console::Reset() { shared_ptr debugger = _debugger; - if(debugger) { - debugger->Run(); - } - Lock(); + _lockCounter++; + _runLock.Acquire(); _dmaController->Reset(); _internalRegisters->Reset(); @@ -334,16 +332,18 @@ void Console::Reset() _spcHud.reset(); } - _memoryManager->IncMasterClockStartup(); - - Unlock(); - if(debugger) { + //Debugger was suspended in SystemActionManager::Reset(), resume debugger here debugger->SuspendDebugger(true); } + + _memoryManager->IncMasterClockStartup(); + + _runLock.Release(); + _lockCounter--; } -void Console::PowerCycle() +void Console::ReloadRom(bool forPowerCycle) { shared_ptr cart = _cart; if(cart) { @@ -354,14 +354,19 @@ void Console::PowerCycle() RomInfo info = cart->GetRomInfo(); Lock(); - LoadRom(info.RomFile, info.PatchFile, false); + LoadRom(info.RomFile, info.PatchFile, false, forPowerCycle); _memoryManager->IncMasterClockStartup(); Unlock(); } } -bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom) +void Console::PowerCycle() +{ + ReloadRom(true); +} + +bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom, bool forPowerCycle) { if(_cart) { //Make sure the battery is saved to disk before we load another game (or reload the same game) @@ -370,7 +375,7 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom) bool result = false; EmulationConfig orgConfig = _settings->GetEmulationConfig(); //backup emulation config (can be temporarily overriden to control the power on RAM state) - shared_ptr cart = BaseCartridge::CreateCartridge(this, romFile, patchFile); + shared_ptr cart = forPowerCycle ? _cart : BaseCartridge::CreateCartridge(this, romFile, patchFile); if(cart) { if(stopRom) { KeyManager::UpdateDevices(); @@ -422,13 +427,15 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom) UpdateRegion(); - _notificationManager->SendNotification(ConsoleNotificationType::GameLoaded); + _notificationManager->SendNotification(ConsoleNotificationType::GameLoaded, (void*)forPowerCycle); _paused = false; - string modelName = _region == ConsoleRegion::Pal ? "PAL" : "NTSC"; - string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")"; - MessageManager::DisplayMessage(messageTitle, FolderUtilities::GetFilename(GetRomInfo().RomFile.GetFileName(), false)); + if(!forPowerCycle) { + string modelName = _region == ConsoleRegion::Pal ? "PAL" : "NTSC"; + string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")"; + MessageManager::DisplayMessage(messageTitle, FolderUtilities::GetFilename(GetRomInfo().RomFile.GetFileName(), false)); + } if(stopRom) { #ifndef LIBRETRO diff --git a/Core/Console.h b/Core/Console.h index de7debb..fec8329 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -113,6 +113,7 @@ public: void ProcessEndOfFrame(); void Reset(); + void ReloadRom(bool forPowerCycle); void PowerCycle(); void PauseOnNextFrame(); @@ -121,7 +122,7 @@ public: void Resume(); bool IsPaused(); - bool LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom = true); + bool LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom = true, bool forPowerCycle = false); RomInfo GetRomInfo(); uint32_t GetMasterClockRate(); ConsoleRegion GetRegion(); diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 86df130..0b7a1d0 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -252,7 +252,7 @@ void Debugger::SleepUntilResume(BreakSource source, MemoryOperationInfo *operati _executionStopped = true; - if(_breakRequestCount == 0) { + if(source != BreakSource::Unspecified || _breakRequestCount == 0) { //Only trigger code break event if the pause was caused by user action BreakEvent evt = {}; evt.BreakpointId = breakpointId; diff --git a/Core/SettingTypes.h b/Core/SettingTypes.h index 16ad89c..1281c6c 100644 --- a/Core/SettingTypes.h +++ b/Core/SettingTypes.h @@ -366,6 +366,7 @@ enum class EmulatorShortcut Pause, Reset, PowerCycle, + ReloadRom, PowerOff, Exit, diff --git a/InteropDLL/EmuApiWrapper.cpp b/InteropDLL/EmuApiWrapper.cpp index d4ac8c8..3f7edd2 100644 --- a/InteropDLL/EmuApiWrapper.cpp +++ b/InteropDLL/EmuApiWrapper.cpp @@ -201,6 +201,13 @@ extern "C" { } } + DllExport void __stdcall ReloadRom() + { + if(!GameClient::Connected()) { + _console->ReloadRom(false); + } + } + DllExport void __stdcall Release() { GameClient::Disconnect(); diff --git a/UI/Config/Shortcuts/EmulatorShortcut.cs b/UI/Config/Shortcuts/EmulatorShortcut.cs index 6d0e3bc..315539f 100644 --- a/UI/Config/Shortcuts/EmulatorShortcut.cs +++ b/UI/Config/Shortcuts/EmulatorShortcut.cs @@ -44,6 +44,7 @@ namespace Mesen.GUI.Config.Shortcuts Pause, Reset, PowerCycle, + ReloadRom, PowerOff, Exit, diff --git a/UI/Debugger/Config/DebuggerShortcutsConfig.cs b/UI/Debugger/Config/DebuggerShortcutsConfig.cs index b145aab..4e3fa8b 100644 --- a/UI/Debugger/Config/DebuggerShortcutsConfig.cs +++ b/UI/Debugger/Config/DebuggerShortcutsConfig.cs @@ -108,6 +108,8 @@ namespace Mesen.GUI.Config public XmlKeys Reset = Keys.Control | Keys.R; [ShortcutName("Power Cycle")] public XmlKeys PowerCycle = Keys.Control | Keys.T; + [ShortcutName("Reload ROM")] + public XmlKeys ReloadRom = Keys.None; [ShortcutName("Continue")] public XmlKeys Continue = Keys.F5; diff --git a/UI/Debugger/frmDbgPreferences.cs b/UI/Debugger/frmDbgPreferences.cs index 2b78a6b..b6fcc6c 100644 --- a/UI/Debugger/frmDbgPreferences.cs +++ b/UI/Debugger/frmDbgPreferences.cs @@ -83,6 +83,7 @@ namespace Mesen.GUI.Debugger }; ctrlDbgShortcutsDebugger.Shortcuts = new FieldInfo[] { + GetMember(nameof(DebuggerShortcutsConfig.ReloadRom)), GetMember(nameof(DebuggerShortcutsConfig.Reset)), GetMember(nameof(DebuggerShortcutsConfig.PowerCycle)), GetMember(nameof(DebuggerShortcutsConfig.Continue)), diff --git a/UI/Debugger/frmDebugger.Designer.cs b/UI/Debugger/frmDebugger.Designer.cs index f9385f6..0614a71 100644 --- a/UI/Debugger/frmDebugger.Designer.cs +++ b/UI/Debugger/frmDebugger.Designer.cs @@ -39,6 +39,9 @@ this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator(); this.importExportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuDbgIntegrationSettings = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuImportLabels = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuExportLabels = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator(); this.codeDataLoggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mnuResetCdlLog = new System.Windows.Forms.ToolStripMenuItem(); @@ -140,9 +143,8 @@ this.grpCallstack = new System.Windows.Forms.GroupBox(); this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack(); this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip(); - this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripSeparator(); - this.mnuImportLabels = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuExportLabels = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuReloadRom = new System.Windows.Forms.ToolStripMenuItem(); this.ctrlMesenMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ctrlSplitContainer)).BeginInit(); this.ctrlSplitContainer.Panel1.SuspendLayout(); @@ -180,6 +182,8 @@ // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuReloadRom, + this.toolStripMenuItem16, this.mnuSaveRomAs, this.mnuSaveAsIps, this.toolStripMenuItem14, @@ -231,6 +235,27 @@ this.mnuDbgIntegrationSettings.Text = "CC65/CA65 Integration Settings"; this.mnuDbgIntegrationSettings.Click += new System.EventHandler(this.mnuDbgIntegrationSettings_Click); // + // toolStripMenuItem15 + // + this.toolStripMenuItem15.Name = "toolStripMenuItem15"; + this.toolStripMenuItem15.Size = new System.Drawing.Size(238, 6); + // + // mnuImportLabels + // + this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import; + this.mnuImportLabels.Name = "mnuImportLabels"; + this.mnuImportLabels.Size = new System.Drawing.Size(241, 22); + this.mnuImportLabels.Text = "Import Labels"; + this.mnuImportLabels.Click += new System.EventHandler(this.mnuImportLabels_Click); + // + // mnuExportLabels + // + this.mnuExportLabels.Image = global::Mesen.GUI.Properties.Resources.Export; + this.mnuExportLabels.Name = "mnuExportLabels"; + this.mnuExportLabels.Size = new System.Drawing.Size(241, 22); + this.mnuExportLabels.Text = "Export Labels"; + this.mnuExportLabels.Click += new System.EventHandler(this.mnuExportLabels_Click); + // // toolStripMenuItem7 // this.toolStripMenuItem7.Name = "toolStripMenuItem7"; @@ -1036,26 +1061,17 @@ this.tsToolbar.TabIndex = 3; this.tsToolbar.Text = "ctrlMesenToolStrip1"; // - // toolStripMenuItem15 + // toolStripMenuItem16 // - this.toolStripMenuItem15.Name = "toolStripMenuItem15"; - this.toolStripMenuItem15.Size = new System.Drawing.Size(238, 6); + this.toolStripMenuItem16.Name = "toolStripMenuItem16"; + this.toolStripMenuItem16.Size = new System.Drawing.Size(198, 6); // - // mnuImportLabels + // mnuReloadRom // - this.mnuImportLabels.Image = global::Mesen.GUI.Properties.Resources.Import; - this.mnuImportLabels.Name = "mnuImportLabels"; - this.mnuImportLabels.Size = new System.Drawing.Size(241, 22); - this.mnuImportLabels.Text = "Import Labels"; - this.mnuImportLabels.Click += new System.EventHandler(this.mnuImportLabels_Click); - // - // mnuExportLabels - // - this.mnuExportLabels.Image = global::Mesen.GUI.Properties.Resources.Export; - this.mnuExportLabels.Name = "mnuExportLabels"; - this.mnuExportLabels.Size = new System.Drawing.Size(241, 22); - this.mnuExportLabels.Text = "Export Labels"; - this.mnuExportLabels.Click += new System.EventHandler(this.mnuExportLabels_Click); + this.mnuReloadRom.Image = global::Mesen.GUI.Properties.Resources.Refresh; + this.mnuReloadRom.Name = "mnuReloadRom"; + this.mnuReloadRom.Size = new System.Drawing.Size(201, 22); + this.mnuReloadRom.Text = "Reload ROM"; // // frmDebugger // @@ -1203,5 +1219,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15; private System.Windows.Forms.ToolStripMenuItem mnuImportLabels; private System.Windows.Forms.ToolStripMenuItem mnuExportLabels; + private System.Windows.Forms.ToolStripMenuItem mnuReloadRom; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16; } } \ No newline at end of file diff --git a/UI/Debugger/frmDebugger.cs b/UI/Debugger/frmDebugger.cs index f3530e8..a3fc49b 100644 --- a/UI/Debugger/frmDebugger.cs +++ b/UI/Debugger/frmDebugger.cs @@ -9,6 +9,7 @@ using System.ComponentModel; using System.Drawing; using System.IO; using System.Runtime.InteropServices; +using System.Threading.Tasks; using System.Windows.Forms; namespace Mesen.GUI.Debugger @@ -145,6 +146,7 @@ namespace Mesen.GUI.Debugger private void InitShortcuts() { + mnuReloadRom.InitShortcut(this, nameof(DebuggerShortcutsConfig.ReloadRom)); mnuReset.InitShortcut(this, nameof(DebuggerShortcutsConfig.Reset)); mnuPowerCycle.InitShortcut(this, nameof(DebuggerShortcutsConfig.PowerCycle)); @@ -165,9 +167,6 @@ namespace Mesen.GUI.Debugger mnuToggleBreakpoint.InitShortcut(this, nameof(DebuggerShortcutsConfig.CodeWindow_ToggleBreakpoint)); mnuEnableDisableBreakpoint.InitShortcut(this, nameof(DebuggerShortcutsConfig.CodeWindow_DisableEnableBreakpoint)); - mnuReset.InitShortcut(this, nameof(DebuggerShortcutsConfig.Reset)); - mnuPowerCycle.InitShortcut(this, nameof(DebuggerShortcutsConfig.PowerCycle)); - mnuGoToAll.InitShortcut(this, nameof(DebuggerShortcutsConfig.GoToAll)); mnuGoToAddress.InitShortcut(this, nameof(DebuggerShortcutsConfig.GoTo)); mnuGoToProgramCounter.InitShortcut(this, nameof(DebuggerShortcutsConfig.GoToProgramCounter)); @@ -200,6 +199,7 @@ namespace Mesen.GUI.Debugger mnuContinue.Click += (s, e) => { DebugApi.ResumeExecution(); }; mnuBreak.Click += (s, e) => { DebugApi.Step(_cpuType, 1, StepType.Step); }; + mnuReloadRom.Click += (s, e) => { Task.Run(() => { EmuApi.ReloadRom(); }); }; mnuReset.Click += (s, e) => { EmuApi.Reset(); }; mnuPowerCycle.Click += (s, e) => { EmuApi.PowerCycle(); }; @@ -445,7 +445,10 @@ namespace Mesen.GUI.Debugger DebugState state = DebugApi.GetState(); this.BeginInvoke((MethodInvoker)(() => { - DebugWorkspaceManager.ImportDbgFile(); + bool isPowerCycle = e.Parameter.ToInt32() != 0; + if(!isPowerCycle) { + DebugWorkspaceManager.ImportDbgFile(); + } LabelManager.RefreshLabels(); DebugApi.RefreshDisassembly(_cpuType); UpdateDebugger(state, null); diff --git a/UI/Dependencies/resources.en.xml b/UI/Dependencies/resources.en.xml index 65a3b99..7384fc5 100644 --- a/UI/Dependencies/resources.en.xml +++ b/UI/Dependencies/resources.en.xml @@ -4,6 +4,7 @@
File Open + Reload ROM Save State Load State Load Last Session @@ -767,6 +768,7 @@ Pause Reset Power Cycle + Reload ROM Power Off Exit Take Screenshot diff --git a/UI/Emulation/ShortcutHandler.cs b/UI/Emulation/ShortcutHandler.cs index 4c34d7c..3cf4904 100644 --- a/UI/Emulation/ShortcutHandler.cs +++ b/UI/Emulation/ShortcutHandler.cs @@ -75,6 +75,7 @@ namespace Mesen.GUI.Emulation case EmulatorShortcut.Pause: TogglePause(); break; case EmulatorShortcut.Reset: EmuApi.Reset(); break; case EmulatorShortcut.PowerCycle: EmuApi.PowerCycle(); break; + case EmulatorShortcut.ReloadRom: Task.Run(() => EmuApi.ReloadRom()); break; case EmulatorShortcut.PowerOff: Task.Run(() => EmuApi.Stop()); restoreFullscreen = false; break; case EmulatorShortcut.Exit: frmMain.Instance.Close(); restoreFullscreen = false; break; diff --git a/UI/Forms/Config/ctrlEmulatorShortcuts.cs b/UI/Forms/Config/ctrlEmulatorShortcuts.cs index bf5ccca..4865671 100644 --- a/UI/Forms/Config/ctrlEmulatorShortcuts.cs +++ b/UI/Forms/Config/ctrlEmulatorShortcuts.cs @@ -44,6 +44,7 @@ namespace Mesen.GUI.Forms.Config EmulatorShortcut.Pause, EmulatorShortcut.Reset, EmulatorShortcut.PowerCycle, + EmulatorShortcut.ReloadRom, EmulatorShortcut.PowerOff, EmulatorShortcut.Exit, diff --git a/UI/Forms/frmMain.Designer.cs b/UI/Forms/frmMain.Designer.cs index 856c17c..079f1c3 100644 --- a/UI/Forms/frmMain.Designer.cs +++ b/UI/Forms/frmMain.Designer.cs @@ -151,10 +151,12 @@ this.mnuDebugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEventViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMemoryTools = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuProfiler = new System.Windows.Forms.ToolStripMenuItem(); this.mnuRegisterViewer = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem26 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuAssembler = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuProfiler = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripSeparator(); this.mnuTilemapViewer = new System.Windows.Forms.ToolStripMenuItem(); this.mnuTileViewer = new System.Windows.Forms.ToolStripMenuItem(); @@ -172,8 +174,7 @@ this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); this.pnlRenderer = new System.Windows.Forms.Panel(); this.ctrlRecentGames = new Mesen.GUI.Controls.ctrlRecentGames(); - this.mnuAssembler = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem26 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuReloadRom = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMain.SuspendLayout(); this.pnlRenderer.SuspendLayout(); this.SuspendLayout(); @@ -204,6 +205,7 @@ // this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuOpen, + this.mnuReloadRom, this.toolStripMenuItem2, this.mnuSaveState, this.mnuLoadState, @@ -222,49 +224,49 @@ // this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.Folder; this.mnuOpen.Name = "mnuOpen"; - this.mnuOpen.Size = new System.Drawing.Size(136, 22); + this.mnuOpen.Size = new System.Drawing.Size(180, 22); this.mnuOpen.Text = "Open"; // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(133, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(177, 6); // // mnuSaveState // this.mnuSaveState.Name = "mnuSaveState"; - this.mnuSaveState.Size = new System.Drawing.Size(136, 22); + this.mnuSaveState.Size = new System.Drawing.Size(180, 22); this.mnuSaveState.Text = "Save State"; this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening); // // mnuLoadState // this.mnuLoadState.Name = "mnuLoadState"; - this.mnuLoadState.Size = new System.Drawing.Size(136, 22); + this.mnuLoadState.Size = new System.Drawing.Size(180, 22); this.mnuLoadState.Text = "Load State"; this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening); // // toolStripMenuItem10 // this.toolStripMenuItem10.Name = "toolStripMenuItem10"; - this.toolStripMenuItem10.Size = new System.Drawing.Size(133, 6); + this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6); // // mnuRecentFiles // this.mnuRecentFiles.Name = "mnuRecentFiles"; - this.mnuRecentFiles.Size = new System.Drawing.Size(136, 22); + this.mnuRecentFiles.Size = new System.Drawing.Size(180, 22); this.mnuRecentFiles.Text = "Recent Files"; // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(133, 6); + this.toolStripMenuItem6.Size = new System.Drawing.Size(177, 6); // // mnuExit // this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit; this.mnuExit.Name = "mnuExit"; - this.mnuExit.Size = new System.Drawing.Size(136, 22); + this.mnuExit.Size = new System.Drawing.Size(180, 22); this.mnuExit.Text = "Exit"; // // mnuGame @@ -286,7 +288,7 @@ this.mnuPause.Enabled = false; this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.MediaPause; this.mnuPause.Name = "mnuPause"; - this.mnuPause.Size = new System.Drawing.Size(139, 22); + this.mnuPause.Size = new System.Drawing.Size(180, 22); this.mnuPause.Text = "Pause"; // // mnuReset @@ -294,7 +296,7 @@ this.mnuReset.Enabled = false; this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Refresh; this.mnuReset.Name = "mnuReset"; - this.mnuReset.Size = new System.Drawing.Size(139, 22); + this.mnuReset.Size = new System.Drawing.Size(180, 22); this.mnuReset.Text = "Reset"; // // mnuPowerCycle @@ -302,19 +304,19 @@ this.mnuPowerCycle.Enabled = false; this.mnuPowerCycle.Image = global::Mesen.GUI.Properties.Resources.PowerCycle; this.mnuPowerCycle.Name = "mnuPowerCycle"; - this.mnuPowerCycle.Size = new System.Drawing.Size(139, 22); + this.mnuPowerCycle.Size = new System.Drawing.Size(180, 22); this.mnuPowerCycle.Text = "Power Cycle"; // // toolStripMenuItem24 // this.toolStripMenuItem24.Name = "toolStripMenuItem24"; - this.toolStripMenuItem24.Size = new System.Drawing.Size(136, 6); + this.toolStripMenuItem24.Size = new System.Drawing.Size(177, 6); // // mnuPowerOff // this.mnuPowerOff.Image = global::Mesen.GUI.Properties.Resources.MediaStop; this.mnuPowerOff.Name = "mnuPowerOff"; - this.mnuPowerOff.Size = new System.Drawing.Size(139, 22); + this.mnuPowerOff.Size = new System.Drawing.Size(180, 22); this.mnuPowerOff.Text = "Power Off"; // // mnuOptions @@ -1126,13 +1128,6 @@ this.mnuMemoryTools.Size = new System.Drawing.Size(183, 22); this.mnuMemoryTools.Text = "Memory Tools"; // - // mnuProfiler - // - this.mnuProfiler.Image = global::Mesen.GUI.Properties.Resources.PerfTracker; - this.mnuProfiler.Name = "mnuProfiler"; - this.mnuProfiler.Size = new System.Drawing.Size(183, 22); - this.mnuProfiler.Text = "Performance Profiler"; - // // mnuRegisterViewer // this.mnuRegisterViewer.Image = global::Mesen.GUI.Properties.Resources.RegisterIcon; @@ -1140,13 +1135,6 @@ this.mnuRegisterViewer.Size = new System.Drawing.Size(183, 22); this.mnuRegisterViewer.Text = "Register Viewer"; // - // mnuScriptWindow - // - this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script; - this.mnuScriptWindow.Name = "mnuScriptWindow"; - this.mnuScriptWindow.Size = new System.Drawing.Size(183, 22); - this.mnuScriptWindow.Text = "Script Window"; - // // mnuTraceLogger // this.mnuTraceLogger.Image = global::Mesen.GUI.Properties.Resources.LogWindow; @@ -1154,6 +1142,32 @@ this.mnuTraceLogger.Size = new System.Drawing.Size(183, 22); this.mnuTraceLogger.Text = "Trace Logger"; // + // toolStripMenuItem26 + // + this.toolStripMenuItem26.Name = "toolStripMenuItem26"; + this.toolStripMenuItem26.Size = new System.Drawing.Size(180, 6); + // + // mnuAssembler + // + this.mnuAssembler.Image = global::Mesen.GUI.Properties.Resources.Chip; + this.mnuAssembler.Name = "mnuAssembler"; + this.mnuAssembler.Size = new System.Drawing.Size(183, 22); + this.mnuAssembler.Text = "Assembler"; + // + // mnuProfiler + // + this.mnuProfiler.Image = global::Mesen.GUI.Properties.Resources.PerfTracker; + this.mnuProfiler.Name = "mnuProfiler"; + this.mnuProfiler.Size = new System.Drawing.Size(183, 22); + this.mnuProfiler.Text = "Performance Profiler"; + // + // mnuScriptWindow + // + this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script; + this.mnuScriptWindow.Name = "mnuScriptWindow"; + this.mnuScriptWindow.Size = new System.Drawing.Size(183, 22); + this.mnuScriptWindow.Text = "Script Window"; + // // toolStripMenuItem12 // this.toolStripMenuItem12.Name = "toolStripMenuItem12"; @@ -1281,17 +1295,12 @@ this.ctrlRecentGames.TabIndex = 1; this.ctrlRecentGames.Visible = false; // - // mnuAssembler + // mnuReloadRom // - this.mnuAssembler.Image = global::Mesen.GUI.Properties.Resources.Chip; - this.mnuAssembler.Name = "mnuAssembler"; - this.mnuAssembler.Size = new System.Drawing.Size(183, 22); - this.mnuAssembler.Text = "Assembler"; - // - // toolStripMenuItem26 - // - this.toolStripMenuItem26.Name = "toolStripMenuItem26"; - this.toolStripMenuItem26.Size = new System.Drawing.Size(180, 6); + this.mnuReloadRom.Image = global::Mesen.GUI.Properties.Resources.Refresh; + this.mnuReloadRom.Name = "mnuReloadRom"; + this.mnuReloadRom.Size = new System.Drawing.Size(180, 22); + this.mnuReloadRom.Text = "Reload ROM"; // // frmMain // @@ -1465,5 +1474,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuProfiler; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem26; private System.Windows.Forms.ToolStripMenuItem mnuAssembler; + private System.Windows.Forms.ToolStripMenuItem mnuReloadRom; } } \ No newline at end of file diff --git a/UI/Forms/frmMain.cs b/UI/Forms/frmMain.cs index d332dc1..1f18bce 100644 --- a/UI/Forms/frmMain.cs +++ b/UI/Forms/frmMain.cs @@ -251,6 +251,7 @@ namespace Mesen.GUI.Forms Func 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); diff --git a/UI/Interop/EmuApi.cs b/UI/Interop/EmuApi.cs index f2d74e3..abd5dfd 100644 --- a/UI/Interop/EmuApi.cs +++ b/UI/Interop/EmuApi.cs @@ -40,6 +40,7 @@ namespace Mesen.GUI [DllImport(DllPath)] public static extern void Reset(); [DllImport(DllPath)] public static extern void PowerCycle(); + [DllImport(DllPath)] public static extern void ReloadRom(); [DllImport(DllPath)] public static extern void Pause(); [DllImport(DllPath)] public static extern void Resume();