UI: Added "reload rom" option and changed power cycle to not reload from disk

This commit is contained in:
Sour 2019-11-17 18:44:36 -05:00
parent 5f7b2319ce
commit 43811ae7ac
24 changed files with 108 additions and 70 deletions

View file

@ -433,11 +433,6 @@ string BaseMapper::GetBatteryFilename()
{
return FolderUtilities::CombinePath(FolderUtilities::GetSaveFolder(), FolderUtilities::GetFilename(_romInfo.RomName, false) + ".sav");
}
void BaseMapper::RestoreOriginalPrgRam()
{
memcpy(_prgRom, _originalPrgRom.data(), _originalPrgRom.size());
}
void BaseMapper::InitializeChrRam(int32_t chrRamSize)
{
@ -637,8 +632,6 @@ void BaseMapper::Initialize(RomData &romData)
//Load battery data if present
LoadBattery();
ApplyCheats();
_romInfo.HasChrRam = HasChrRam();
}
@ -652,24 +645,6 @@ BaseMapper::~BaseMapper()
delete[] _nametableRam;
}
void BaseMapper::ProcessNotification(ConsoleNotificationType type, void* parameter)
{
switch(type) {
case ConsoleNotificationType::CheatAdded:
case ConsoleNotificationType::CheatRemoved:
ApplyCheats();
break;
default:
break;
}
}
void BaseMapper::ApplyCheats()
{
RestoreOriginalPrgRam();
_console->GetCheatManager()->ApplyPrgCodes(_prgRom, _prgSize);
}
void BaseMapper::GetMemoryRanges(MemoryRanges &ranges)
{
if(_romInfo.System == GameSystem::VsSystem) {
@ -1267,4 +1242,14 @@ bool BaseMapper::HasPrgChrChanges()
}
}
return false;
}
void BaseMapper::CopyPrgChrRom(shared_ptr<BaseMapper> mapper)
{
if(_prgSize == mapper->_prgSize && _chrRomSize == mapper->_chrRomSize) {
memcpy(_prgRom, mapper->_prgRom, _prgSize);
if(!_onlyChrRam) {
memcpy(_chrRom, mapper->_chrRom, _chrRomSize);
}
}
}

View file

@ -12,7 +12,7 @@
class BaseControlDevice;
class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificationListener, public IBattery
class BaseMapper : public IMemoryHandler, public Snapshotable, public IBattery
{
private:
MirroringType _mirroringType;
@ -135,7 +135,6 @@ protected:
void SetupDefaultWorkRam();
void RestoreOriginalPrgRam();
void InitializeChrRam(int32_t chrRamSize = -1);
void AddRegisterRange(uint16_t startAddr, uint16_t endAddr, MemoryOperation operation = MemoryOperation::Any);
@ -167,11 +166,8 @@ public:
virtual void SetNesModel(NesModel model) { }
virtual void ProcessCpuClock() { }
virtual void NotifyVRAMAddressChange(uint16_t addr);
void ProcessNotification(ConsoleNotificationType type, void* parameter) override;
virtual void GetMemoryRanges(MemoryRanges &ranges) override;
void ApplyCheats();
virtual void SaveBattery() override;
void SetConsole(shared_ptr<Console> console);
@ -240,4 +236,5 @@ public:
void RestorePrgChrBackup(vector<uint8_t>& backupData);
void RevertPrgChrChanges();
bool HasPrgChrChanges();
void CopyPrgChrRom(shared_ptr<BaseMapper> mapper);
};

View file

@ -2,6 +2,7 @@
#include "CheatManager.h"
#include "Console.h"
#include "BaseMapper.h"
#include "MessageManager.h"
#include "NotificationManager.h"
@ -98,6 +99,7 @@ void CheatManager::AddCode(CodeInfo &code)
} else {
_absoluteCheatCodes.push_back(code);
}
_hasCode = true;
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::CheatAdded);
}
@ -137,14 +139,19 @@ void CheatManager::ClearCodes()
cheatRemoved |= _absoluteCheatCodes.size() > 0;
_absoluteCheatCodes.clear();
_hasCode = false;
if(cheatRemoved) {
_console->GetNotificationManager()->SendNotification(ConsoleNotificationType::CheatRemoved);
}
}
void CheatManager::ApplyRamCodes(uint16_t addr, uint8_t &value)
void CheatManager::ApplyCodes(uint16_t addr, uint8_t &value)
{
if(!_hasCode) {
return;
}
if(_relativeCheatCodes[addr] != nullptr) {
for(uint32_t i = 0, len = i < _relativeCheatCodes[addr]->size(); i < len; i++) {
CodeInfo code = _relativeCheatCodes[addr]->at(i);
@ -153,16 +160,14 @@ void CheatManager::ApplyRamCodes(uint16_t addr, uint8_t &value)
return;
}
}
}
}
void CheatManager::ApplyPrgCodes(uint8_t *prgRam, uint32_t prgSize)
{
for(uint32_t i = 0, len = i < _absoluteCheatCodes.size(); i < len; i++) {
CodeInfo code = _absoluteCheatCodes[i];
if(code.Address < prgSize) {
if(code.CompareValue == -1 || code.CompareValue == prgRam[code.Address]) {
prgRam[code.Address] = code.Value;
} else if(!_absoluteCheatCodes.empty()) {
int32_t absAddr = _console->GetMapper()->ToAbsoluteAddress(addr);
if(absAddr >= 0) {
for(CodeInfo &code : _absoluteCheatCodes) {
if(code.Address == (uint32_t)absAddr && (code.CompareValue == -1 || code.CompareValue == value)) {
value = code.Value;
return;
}
}
}
}

View file

@ -36,6 +36,7 @@ class CheatManager
private:
shared_ptr<Console> _console;
bool _hasCode = false;
vector<unique_ptr<vector<CodeInfo>>> _relativeCheatCodes;
vector<CodeInfo> _absoluteCheatCodes;
@ -56,6 +57,5 @@ public:
void SetCheats(vector<CodeInfo> &cheats);
void SetCheats(CheatInfo cheats[], uint32_t length);
void ApplyRamCodes(uint16_t addr, uint8_t &value);
void ApplyPrgCodes(uint8_t *prgRam, uint32_t prgSize);
void ApplyCodes(uint16_t addr, uint8_t &value);
};

View file

@ -255,7 +255,7 @@ bool Console::Initialize(VirtualFile &romFile)
return Initialize(romFile, patchFile);
}
bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forPowerCycle)
{
if(romFile.IsValid()) {
Pause();
@ -306,6 +306,7 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
StopRecordingHdPack();
}
shared_ptr<BaseMapper> previousMapper = _mapper;
_mapper = mapper;
_memoryManager.reset(new MemoryManager(shared_from_this()));
_cpu.reset(new CPU(shared_from_this()));
@ -313,7 +314,9 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
_mapper->SetConsole(shared_from_this());
_mapper->Initialize(romData);
GetNotificationManager()->RegisterNotificationListener(_mapper);
if(!isDifferentGame && forPowerCycle) {
_mapper->CopyPrgChrRom(previousMapper);
}
if(_slave) {
_slave->Release(false);
@ -400,8 +403,10 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
ResetComponents(false);
//Reset components before creating rewindmanager, otherwise the first save state it takes will be invalid
_rewindManager.reset(new RewindManager(shared_from_this()));
_notificationManager->RegisterNotificationListener(_rewindManager);
if(!forPowerCycle) {
_rewindManager.reset(new RewindManager(shared_from_this()));
_notificationManager->RegisterNotificationListener(_rewindManager);
}
//Poll controller input after creating rewind manager, to make sure it catches the first frame's input
_controlManager->UpdateInputState();
@ -418,9 +423,12 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
FolderUtilities::AddKnownGameFolder(romFile.GetFolderPath());
if(IsMaster()) {
string modelName = _model == NesModel::PAL ? "PAL" : (_model == NesModel::Dendy ? "Dendy" : "NTSC");
string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")";
MessageManager::DisplayMessage(messageTitle, FolderUtilities::GetFilename(GetRomInfo().RomName, false));
if(!forPowerCycle) {
string modelName = _model == NesModel::PAL ? "PAL" : (_model == NesModel::Dendy ? "Dendy" : "NTSC");
string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")";
MessageManager::DisplayMessage(messageTitle, FolderUtilities::GetFilename(GetRomInfo().RomName, false));
}
_settings->ClearFlags(EmulationFlags::ForceMaxSpeed);
if(_slave) {
@ -565,11 +573,16 @@ shared_ptr<SystemActionManager> Console::GetSystemActionManager()
}
void Console::PowerCycle()
{
ReloadRom(true);
}
void Console::ReloadRom(bool forPowerCycle)
{
if(_initialized && !_romFilepath.empty()) {
VirtualFile romFile = _romFilepath;
VirtualFile patchFile = _patchFilename;
Initialize(romFile, patchFile);
Initialize(romFile, patchFile, forPowerCycle);
}
}

View file

@ -143,7 +143,7 @@ public:
bool Initialize(string romFile, string patchFile = "");
bool Initialize(VirtualFile &romFile);
bool Initialize(VirtualFile &romFile, VirtualFile &patchFile);
bool Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forPowerCycle = false);
void SaveBatteries();
@ -179,6 +179,7 @@ public:
void Reset(bool softReset = true);
void PowerCycle();
void ReloadRom(bool forPowerCycle = false);
void ResetComponents(bool softReset);
//Used to pause the emu loop to perform thread-safe operations

View file

@ -431,6 +431,7 @@ enum class EmulatorShortcut
Pause,
Reset,
PowerCycle,
ReloadRom,
PowerOff,
Exit,

View file

@ -101,7 +101,7 @@ uint8_t MemoryManager::DebugRead(uint16_t addr, bool disableSideEffects)
}
}
_console->GetCheatManager()->ApplyRamCodes(addr, value);
_console->GetCheatManager()->ApplyCodes(addr, value);
return value;
}
@ -114,7 +114,7 @@ uint16_t MemoryManager::DebugReadWord(uint16_t addr)
uint8_t MemoryManager::Read(uint16_t addr, MemoryOperationType operationType)
{
uint8_t value = _ramReadHandlers[addr]->ReadRAM(addr);
_console->GetCheatManager()->ApplyRamCodes(addr, value);
_console->GetCheatManager()->ApplyCodes(addr, value);
_console->DebugProcessRamOperation(operationType, addr, value);
_openBusHandler.SetOpenBus(value);

View file

@ -66,8 +66,9 @@ Available shortcuts:
* **Rewind 10 seconds**: Instantly rewinds 10 seconds of gameplay.
* **Rewind 1 minute**: Instantly rewinds 1 minute of gameplay.
* **Pause**: Pauses or unpauses the game.
* **Reset**: Resets the game.
* **Power Cycle**: Power cycles the game and reloads the file from disk.
* **Reset**: Resets the game (equivalent to pressing the reset button on the NES.)
* **Power Cycle**: Power cycles the game (equivalent to turning the power off and then back on.)
* **Reload ROM**: Reloads the ROM from the disk and power cycles the console.
* **Power Off**: Powers off the game, returning to the game selection screen.
* **Exit**: Exits the emulator.
* **FDS - Insert Next Disk**: Inserts face A of the next disk.

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pausa</Control>
<Control ID="mnuReset">Reinicia el joc</Control>
<Control ID="mnuPowerCycle">Atura i reinicia el joc</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Atura el joc</Control>
<Control ID="mnuSwitchDiskSide">Canvia la cara del disc</Control>
<Control ID="mnuSelectDisk">Escull el disc</Control>
@ -856,6 +857,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pausa</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reinicia el joc</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Atura i reinicia el joc</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Atura el joc</Message>
<Message ID="EmulatorShortcutMappings_Exit">Surt</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Captura de pantalla</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pause</Control>
<Control ID="mnuReset">Reset</Control>
<Control ID="mnuPowerCycle">Power Cycle</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Power Off</Control>
<Control ID="mnuSwitchDiskSide">Switch Disk Side</Control>
<Control ID="mnuSelectDisk">Select Disk</Control>
@ -888,6 +889,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pause</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reset</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Power Cycle</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Power Off</Message>
<Message ID="EmulatorShortcutMappings_Exit">Exit</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Take Screenshot</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pausa</Control>
<Control ID="mnuReset">Reiniciar</Control>
<Control ID="mnuPowerCycle">Detener y reiniciar</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Detener el juego</Control>
<Control ID="mnuSwitchDiskSide">Cambiar la cara del disco</Control>
<Control ID="mnuSelectDisk">Elegir el disco</Control>
@ -873,6 +874,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pausa</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reiniciar</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Detener y reiniciar</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Detener el juego</Message>
<Message ID="EmulatorShortcutMappings_Exit">Salir</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Captura de pantalla</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pause</Control>
<Control ID="mnuReset">Reset</Control>
<Control ID="mnuPowerCycle">Arrêt &amp;&amp; redémarrage</Control>
<Control ID="mnuReloadRom">Recharger le ROM à partir du disque</Control>
<Control ID="mnuPowerOff">Arrêter le jeu</Control>
<Control ID="mnuSwitchDiskSide">Changer le disque de côté</Control>
<Control ID="mnuSelectDisk">Choisir le disque</Control>
@ -887,6 +888,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pause</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reset</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Arrêt &amp; redémarrage</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Recharger le ROM à partir du disque</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Arrêter le jeu</Message>
<Message ID="EmulatorShortcutMappings_Exit">Quitter</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Capture d'écran</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pausa</Control>
<Control ID="mnuReset">Reset</Control>
<Control ID="mnuPowerCycle">Spegni/Riaccendi</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Spegni</Control>
<Control ID="mnuSwitchDiskSide">Cambia Lato Disco</Control>
<Control ID="mnuSelectDisk">Seleziona Disco</Control>
@ -888,6 +889,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pausa</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reset</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Spegni e Riaccendi</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Spegni</Message>
<Message ID="EmulatorShortcutMappings_Exit">Esci</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Fai uno Screenshot</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">ポーズ</Control>
<Control ID="mnuReset">リセット</Control>
<Control ID="mnuPowerCycle">停止と再起動</Control>
<Control ID="mnuReloadRom">ディスクからROMをリロードする</Control>
<Control ID="mnuPowerOff">ゲームを停止する</Control>
<Control ID="mnuSwitchDiskSide">A面B面切り替え</Control>
<Control ID="mnuSelectDisk">ディスク選択</Control>
@ -875,6 +876,7 @@
<Message ID="EmulatorShortcutMappings_Pause">ポーズ</Message>
<Message ID="EmulatorShortcutMappings_Reset">リセット</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">停止と再起動</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">ディスクからROMをリロードする</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">ゲームを停止する</Message>
<Message ID="EmulatorShortcutMappings_Exit">終了</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">スクリーンショットを撮る</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Pausar</Control>
<Control ID="mnuReset">Reiniciar</Control>
<Control ID="mnuPowerCycle">Parar e reiniciar</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Desligar</Control>
<Control ID="mnuSwitchDiskSide">Trocar o lado do disco</Control>
<Control ID="mnuSelectDisk">Selecionar o disco</Control>
@ -888,6 +889,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Pausar</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reiniciar</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Parar e ligar</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Desligar</Message>
<Message ID="EmulatorShortcutMappings_Exit">Sair</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Fazer uma captura de tela</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Пауза</Control>
<Control ID="mnuReset">Сброс</Control>
<Control ID="mnuPowerCycle">Power Cycle</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Power Off</Control>
<Control ID="mnuSwitchDiskSide">Сменить сторону диска</Control>
<Control ID="mnuSelectDisk">Выбрать диск</Control>
@ -875,6 +876,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Пауза</Message>
<Message ID="EmulatorShortcutMappings_Reset">Сброс</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Power Cycle</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Power Off</Message>
<Message ID="EmulatorShortcutMappings_Exit">Exit</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Сделать сриншот</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">Пауза</Control>
<Control ID="mnuReset">Скидання</Control>
<Control ID="mnuPowerCycle">Цикл включення</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">Power Off</Control>
<Control ID="mnuSwitchDiskSide">Змінити сторону диска</Control>
<Control ID="mnuSelectDisk">Вибрати диск</Control>
@ -875,6 +876,7 @@
<Message ID="EmulatorShortcutMappings_Pause">Пауза</Message>
<Message ID="EmulatorShortcutMappings_Reset">Скидання</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Цикл включення</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Вимкнення</Message>
<Message ID="EmulatorShortcutMappings_Exit">Вихід</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Скріншот</Message>

View file

@ -13,6 +13,7 @@
<Control ID="mnuPause">暂停</Control>
<Control ID="mnuReset">重设</Control>
<Control ID="mnuPowerCycle">电源</Control>
<Control ID="mnuReloadRom">Reload ROM</Control>
<Control ID="mnuPowerOff">关机</Control>
<Control ID="mnuSwitchDiskSide">磁盘换面</Control>
<Control ID="mnuSelectDisk">选择磁盘</Control>
@ -893,6 +894,7 @@
<Message ID="EmulatorShortcutMappings_Pause">暂停</Message>
<Message ID="EmulatorShortcutMappings_Reset">重设</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">电源</Message>
<Message ID="EmulatorShortcutMappings_ReloadRom">Reload ROM</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">关机</Message>
<Message ID="EmulatorShortcutMappings_Exit">退出</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">截图</Message>

View file

@ -40,6 +40,7 @@ namespace Mesen.GUI.Forms.Config
EmulatorShortcut.Pause,
EmulatorShortcut.Reset,
EmulatorShortcut.PowerCycle,
EmulatorShortcut.ReloadRom,
EmulatorShortcut.PowerOff,
EmulatorShortcut.Exit,

View file

@ -45,6 +45,7 @@ namespace Mesen.GUI.Forms
this.menuStrip = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem();
this.mnuReloadRom = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.mnuSaveState = new System.Windows.Forms.ToolStripMenuItem();
this.mnuLoadState = new System.Windows.Forms.ToolStripMenuItem();
@ -203,6 +204,7 @@ namespace Mesen.GUI.Forms
this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTextHooker = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuWatchWindow = new System.Windows.Forms.ToolStripMenuItem();
this.sepDebugDualSystemSecondaryCpu = new System.Windows.Forms.ToolStripSeparator();
this.mnuDebugDualSystemSecondaryCpu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem25 = new System.Windows.Forms.ToolStripSeparator();
@ -222,7 +224,6 @@ namespace Mesen.GUI.Forms
this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.mnuWatchWindow = new System.Windows.Forms.ToolStripMenuItem();
this.panelRenderer.SuspendLayout();
this.panelInfo.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
@ -378,6 +379,7 @@ namespace Mesen.GUI.Forms
//
this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuOpen,
this.mnuReloadRom,
this.toolStripMenuItem4,
this.mnuSaveState,
this.mnuLoadState,
@ -401,6 +403,12 @@ namespace Mesen.GUI.Forms
this.mnuOpen.Size = new System.Drawing.Size(166, 22);
this.mnuOpen.Text = "Open";
//
// mnuReloadRom
//
this.mnuReloadRom.Name = "mnuReloadRom";
this.mnuReloadRom.Size = new System.Drawing.Size(166, 22);
this.mnuReloadRom.Text = "Reload ROM";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
@ -1662,6 +1670,14 @@ namespace Mesen.GUI.Forms
this.mnuTraceLogger.Text = "Trace Logger";
this.mnuTraceLogger.Click += new System.EventHandler(this.mnuTraceLogger_Click);
//
// mnuWatchWindow
//
this.mnuWatchWindow.Image = global::Mesen.GUI.Properties.Resources.Find;
this.mnuWatchWindow.Name = "mnuWatchWindow";
this.mnuWatchWindow.Size = new System.Drawing.Size(258, 22);
this.mnuWatchWindow.Text = "Watch Window";
this.mnuWatchWindow.Click += new System.EventHandler(this.mnuWatchWindow_Click);
//
// sepDebugDualSystemSecondaryCpu
//
this.sepDebugDualSystemSecondaryCpu.Name = "sepDebugDualSystemSecondaryCpu";
@ -1804,14 +1820,6 @@ namespace Mesen.GUI.Forms
this.mnuAbout.Text = "About";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
// mnuWatchWindow
//
this.mnuWatchWindow.Image = global::Mesen.GUI.Properties.Resources.Find;
this.mnuWatchWindow.Name = "mnuWatchWindow";
this.mnuWatchWindow.Size = new System.Drawing.Size(258, 22);
this.mnuWatchWindow.Text = "Watch Window";
this.mnuWatchWindow.Click += new System.EventHandler(this.mnuWatchWindow_Click);
//
// frmMain
//
this.AllowDrop = true;
@ -2034,6 +2042,7 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripMenuItem mnuProfiler;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.ToolStripMenuItem mnuWatchWindow;
private System.Windows.Forms.ToolStripMenuItem mnuReloadRom;
}
}

View file

@ -690,15 +690,15 @@ namespace Mesen.GUI.Forms
case InteropEmu.ConsoleNotificationType.GameStopped:
this._currentGame = null;
CheatInfo.ClearCheats();
this.BeginInvoke((MethodInvoker)(() => {
if(_hdPackEditorWindow != null) {
_hdPackEditorWindow.Close();
}
if(!ConfigManager.Config.PreferenceInfo.DisableGameSelectionScreen) {
ctrlRecentGames.Initialize();
}
if(e.Parameter == IntPtr.Zero) {
if(!ConfigManager.Config.PreferenceInfo.DisableGameSelectionScreen) {
ctrlRecentGames.Initialize();
}
//We are completely stopping the emulation, close fullscreen mode
StopExclusiveFullscreenMode();
}
@ -806,6 +806,7 @@ namespace Mesen.GUI.Forms
BindShortcut(mnuPause, EmulatorShortcut.Pause, runningNotClient);
BindShortcut(mnuReset, EmulatorShortcut.Reset, runningNotClientNotMovie);
BindShortcut(mnuPowerCycle, EmulatorShortcut.PowerCycle, runningNotClientNotMovie);
BindShortcut(mnuReloadRom, EmulatorShortcut.ReloadRom, runningNotClientNotMovie);
BindShortcut(mnuPowerOff, EmulatorShortcut.PowerOff, runningNotClient);
BindShortcut(mnuSwitchDiskSide, EmulatorShortcut.SwitchDiskSide, runningFdsMultipleDisks);
@ -903,6 +904,7 @@ namespace Mesen.GUI.Forms
case EmulatorShortcut.Pause: PauseEmu(); break;
case EmulatorShortcut.Reset: this.ResetEmu(); break;
case EmulatorShortcut.PowerCycle: this.PowerCycleEmu(); break;
case EmulatorShortcut.ReloadRom: InteropEmu.ReloadRom(); break;
case EmulatorShortcut.PowerOff: Task.Run(() => InteropEmu.Stop()); break;
case EmulatorShortcut.Exit: this.Close(); break;

View file

@ -93,6 +93,7 @@ namespace Mesen.GUI
[DllImport(DLLPath, EntryPoint = "GetRomInfo")] private static extern UInt32 GetRomInfoWrapper(ref InteropRomInfo romInfo, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename = "");
[DllImport(DLLPath)] public static extern void ReloadRom();
[DllImport(DLLPath)] public static extern void PowerCycle();
[DllImport(DLLPath)] public static extern void Reset();
[DllImport(DLLPath)] public static extern void ResetLagCounter();
@ -1925,6 +1926,7 @@ namespace Mesen.GUI
Pause,
Reset,
PowerCycle,
ReloadRom,
PowerOff,
Exit,

View file

@ -441,6 +441,7 @@ namespace InteropEmu {
DllExport void __stdcall Reset() { _console->Reset(true); }
DllExport void __stdcall PowerCycle() { _console->Reset(false); }
DllExport void __stdcall ReloadRom() { _console->ReloadRom(); }
DllExport void __stdcall ResetLagCounter() { _console->ResetLagCounter(); }
DllExport void __stdcall StartServer(uint16_t port, char* password, char* hostPlayerName) { GameServer::StartServer(_console, port, password, hostPlayerName); }