UI: Added option to confirm reset/power cycle/exit + added shortcut entries for power cycle/power off

This commit is contained in:
Souryo 2017-08-12 18:58:38 -04:00
parent 2ee5b59db4
commit 97c9fb88dd
16 changed files with 140 additions and 21 deletions

View File

@ -64,6 +64,8 @@ enum EmulationFlags : uint64_t
DisableOsd = 0x100000000000,
DisableGameSelectionScreen = 0x200000000000,
ConfirmExitResetPower = 0x400000000000,
ForceMaxSpeed = 0x4000000000000000,
ConsoleMode = 0x8000000000000000,
@ -275,6 +277,8 @@ struct EmulatorKeyMappings
uint32_t Pause;
uint32_t Reset;
uint32_t PowerCycle;
uint32_t PowerOff;
uint32_t Exit;
uint32_t MoveToNextStateSlot;

View File

@ -23,6 +23,8 @@ enum class ConsoleNotificationType
RequestExit = 17,
ToggleCheats = 18,
ToggleAudio = 19,
RequestReset = 20,
RequestPowerCycle = 21,
};
class INotificationListener

View File

@ -51,6 +51,7 @@ void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
{
bool isNetplayClient = GameClient::Connected();
bool isMovieActive = MovieManager::Playing() || MovieManager::Recording();
bool needConfirm = EmulationSettings::CheckFlag(ConfirmExitResetPower);
if(DetectKeyPress(mappings.FastForward)) {
EmulationSettings::SetFlags(EmulationFlags::Turbo);
@ -110,8 +111,29 @@ void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
SaveStateManager::LoadState();
}
if(DetectKeyPress(mappings.Reset) && !isNetplayClient && !isMovieActive) {
Console::Reset(true);
if(!isNetplayClient && !isMovieActive) {
if(DetectKeyPress(mappings.Reset)) {
if(needConfirm) {
MessageManager::SendNotification(ConsoleNotificationType::RequestReset);
} else {
Console::Reset(true);
}
}
if(DetectKeyPress(mappings.PowerCycle)) {
if(needConfirm) {
MessageManager::SendNotification(ConsoleNotificationType::RequestPowerCycle);
} else {
Console::Reset(false);
}
}
}
if(DetectKeyPress(mappings.PowerOff)) {
Console::GetInstance()->Stop();
}
if(DetectKeyPress(mappings.Exit)) {
MessageManager::SendNotification(ConsoleNotificationType::RequestExit);
}
if(DetectKeyPress(mappings.Pause) && !isNetplayClient) {
@ -122,10 +144,6 @@ void ShortcutKeyHandler::CheckMappedKeys(EmulatorKeyMappings mappings)
}
}
if(DetectKeyPress(mappings.Exit)) {
MessageManager::SendNotification(ConsoleNotificationType::RequestExit);
}
if(DetectKeyPress(mappings.ToggleCheats) && !isNetplayClient && !isMovieActive) {
MessageManager::SendNotification(ConsoleNotificationType::ToggleCheats);
}

View File

@ -59,6 +59,8 @@ namespace Mesen.GUI.Config
public bool DisableGameSelectionScreen = false;
public bool GameSelectionScreenResetGame = false;
public bool ConfirmExitResetPower = false;
public UInt32 RewindBufferSize = 300;
public bool OverrideAviFolder = false;
@ -128,6 +130,7 @@ namespace Mesen.GUI.Config
InteropEmu.SetFlag(EmulationFlags.HidePauseOverlay, preferenceInfo.HidePauseOverlay);
InteropEmu.SetFlag(EmulationFlags.DisplayMovieIcons, preferenceInfo.DisplayMovieIcons);
InteropEmu.SetFlag(EmulationFlags.DisableGameSelectionScreen, preferenceInfo.DisableGameSelectionScreen);
InteropEmu.SetFlag(EmulationFlags.ConfirmExitResetPower, preferenceInfo.ConfirmExitResetPower);
InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, preferenceInfo.NsfDisableApuIrqs);
InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify);

View File

@ -71,6 +71,10 @@
<Message ID="InvalidXmlFile">The selected file ({0}) is not a valid XML file.</Message>
<Message ID="NoMatchingCheats">The selected cheat file ({0}) contains no cheats that match the selected game.</Message>
<Message ID="ConfirmReset">Are you sure you want to reset?</Message>
<Message ID="ConfirmPowerCycle">Are you sure you want to power cycle?</Message>
<Message ID="ConfirmExit">Are you sure you want to exit?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Fast Forward</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Rewind</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Rewind 10 seconds</Message>
@ -79,6 +83,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Decrease Speed</Message>
<Message ID="EmulatorShortcutMappings_Pause">Pause</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reset</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Power Cycle</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Power Off</Message>
<Message ID="EmulatorShortcutMappings_Exit">Exit</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Take Screenshot</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Switch Side</Message>

View File

@ -10,7 +10,7 @@
<Control ID="mnuExit">Salir</Control>
<Control ID="mnuGame">Juego</Control>
<Control ID="mnuPause">Pausa</Control>
<Control ID="mnuReset">Reset</Control>
<Control ID="mnuReset">Reiniciar</Control>
<Control ID="mnuPowerCycle">Detener y reiniciar</Control>
<Control ID="mnuPowerOff">Detener el juego</Control>
<Control ID="mnuSwitchDiskSide">Cambiar la cara del disco</Control>
@ -352,6 +352,7 @@
<Control ID="chkAutoHideMenu">Ocultar barra de menú automáticamente</Control>
<Control ID="chkDisplayTitleBarInfo">Mostrar información adicional en la barra de título</Control>
<Control ID="chkConfirmExitResetPower">Display confirmation dialog before reset/power cycle/exit</Control>
<Control ID="chkPauseOnMovieEnd">Pausar la emulación al finalizar el video</Control>
<Control ID="chkAllowBackgroundInput">Permitir entradas aunque Mesen esté en segundo plano</Control>
<Control ID="chkPauseWhenInBackground">Pausar la emulación cuando Mesen esté en segundo plano</Control>
@ -676,6 +677,10 @@
<Message ID="InvalidXmlFile">El archivo seleccionado ({0}) no es un archivo XML válido.</Message>
<Message ID="NoMatchingCheats">El archivo de trucos seleccionado ({0}) no contiene trucos que coincidan con el juego seleccionado.</Message>
<Message ID="ConfirmReset">Are you sure you want to reset?</Message>
<Message ID="ConfirmPowerCycle">Are you sure you want to power cycle?</Message>
<Message ID="ConfirmExit">Are you sure you want to exit?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Avance rápido</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Rebobinar</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Rebobinar 10 segundos</Message>
@ -684,6 +689,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Reducir velocidad</Message>
<Message ID="EmulatorShortcutMappings_Pause">Pausa</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reiniciar</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Detener y reiniciar</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Detener el juego</Message>
<Message ID="EmulatorShortcutMappings_Exit">Salir</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Captura de pantalla</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Cambiar cara del disco</Message>

View File

@ -354,7 +354,8 @@
<Control ID="lblMiscSettings">Options diverses</Control>
<Control ID="chkAutoHideMenu">Cacher la barre de menu automatiquement</Control>
<Control ID="chkDisplayTitleBarInfo">Afficher plus d'informations dans la barre de titre</Control>
<Control ID="chkConfirmExitResetPower">Confirmer avant un redémarrage/arrêt ou avant de quitter Mesen</Control>
<Control ID="chkPauseOnMovieEnd">Pauser l'émulation à la fin d'un film</Control>
<Control ID="chkAllowBackgroundInput">Permettre les entrées lorsque Mesen est en arrière-plan</Control>
<Control ID="chkPauseWhenInBackground">Pauser l'émulation lorsque Mesen est en arrière-plan</Control>
@ -691,6 +692,10 @@
<Message ID="InvalidXmlFile">Le fichier sélectionné ({0}) n'est pas un fichier XML valide.</Message>
<Message ID="NoMatchingCheats">Le fichier sélectionné ({0}) ne contient aucun code correspondant au jeu sélectionné.</Message>
<Message ID="ConfirmReset">Êtes-vous certain de vouloir redémarrer le jeu?</Message>
<Message ID="ConfirmPowerCycle">Êtes-vous certain de vouloir arrêter et redémarrer le jeu?</Message>
<Message ID="ConfirmExit">Êtes-vous certain de vouloir quitter?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Avance rapide</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Rembobiner</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Reculer de 10 secondes</Message>
@ -699,6 +704,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Réduire la vitesse</Message>
<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_PowerOff">Arrêter le jeu</Message>
<Message ID="EmulatorShortcutMappings_Exit">Quitter</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Capture d'écran</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Changer le disque de côté</Message>

View File

@ -354,6 +354,7 @@
<Control ID="chkAutoHideMenu">自動的にメニューバーを隠す</Control>
<Control ID="chkDisplayTitleBarInfo">タイトルバーに追加情報を表す。</Control>
<Control ID="chkConfirmExitResetPower">リセットと再起度とMesenを終了する前に確認する</Control>
<Control ID="chkPauseOnMovieEnd">動画が終わると自動的にポーズする</Control>
<Control ID="chkAllowBackgroundInput">Mesenが最前面ではない時でも、コントローラの入力を受け付ける</Control>
<Control ID="chkPauseWhenInBackground">Mesenが最前面ではない時、自動的にポーズする</Control>
@ -674,6 +675,10 @@
<Message ID="InvalidXmlFile">このファイル({0}はXMLファイルではないため読めませんでした.</Message>
<Message ID="NoMatchingCheats">このファイル({0})に選択されたゲームに該当するチートコードを見つかりませんでした。</Message>
<Message ID="ConfirmReset">ゲームをリセットします。よろしいですか?</Message>
<Message ID="ConfirmPowerCycle">ゲームを停止して再起動します。よろしいですか?</Message>
<Message ID="ConfirmExit">Mesenを終了します。よろしいですか</Message>
<Message ID="EmulatorShortcutMappings_FastForward">早送り</Message>
<Message ID="EmulatorShortcutMappings_Rewind">巻き戻す</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">10秒前に戻る</Message>
@ -682,6 +687,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">速度を下げる</Message>
<Message ID="EmulatorShortcutMappings_Pause">ポーズ</Message>
<Message ID="EmulatorShortcutMappings_Reset">リセット</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">停止と再起動</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">ゲームを停止する</Message>
<Message ID="EmulatorShortcutMappings_Exit">終了</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">スクリーンショットを撮る</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - A面B面切り替え</Message>

View File

@ -351,7 +351,8 @@
<Control ID="lblMiscSettings">Configurações diversas</Control>
<Control ID="chkAutoHideMenu">Ocultar automaticamente a barra de menus</Control>
<Control ID="chkDisplayTitleBarInfo">Exibir informações adicionais na barra de título</Control>
<Control ID="chkConfirmExitResetPower">Display confirmation dialog before reset/power cycle/exit</Control>
<Control ID="chkPauseOnMovieEnd">Pausar a emulação ao finalizar o vídeo</Control>
<Control ID="chkAllowBackgroundInput">Permitir inputs quando Mesen estiver em segundo plano</Control>
<Control ID="chkPauseWhenInBackground">Pausar a emulação quando Mesen estiver em segundo plano</Control>
@ -675,7 +676,11 @@
<Message ID="InvalidCheatFile">O arquivo selecionado ({0}) não é um arquivo de cheats válido.</Message>
<Message ID="InvalidXmlFile">O arquivo selecionado ({0}) não é um arquivo XML válido.</Message>
<Message ID="NoMatchingCheats">O arquivo de cheats selecionado ({0}) não contém cheats que pertencem ao jogo selecionado.</Message>
<Message ID="ConfirmReset">Are you sure you want to reset?</Message>
<Message ID="ConfirmPowerCycle">Are you sure you want to power cycle?</Message>
<Message ID="ConfirmExit">Are you sure you want to exit?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Fast Forward</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Rewind</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Rewind 10 seconds</Message>
@ -684,6 +689,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Reduzir velocidade</Message>
<Message ID="EmulatorShortcutMappings_Pause">Pausar</Message>
<Message ID="EmulatorShortcutMappings_Reset">Reiniciar</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Parar e ligar</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Desligar</Message>
<Message ID="EmulatorShortcutMappings_Exit">Exit</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Tirar screenshot</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Mudar lado do disco</Message>

View File

@ -354,6 +354,7 @@
<Control ID="chkAutoHideMenu">Automatically hide menu bar</Control>
<Control ID="chkDisplayTitleBarInfo">Display additional information in title bar</Control>
<Control ID="chkConfirmExitResetPower">Display confirmation dialog before reset/power cycle/exit</Control>
<Control ID="chkPauseOnMovieEnd">Ставить на паузу после проигрывания записи</Control>
<Control ID="chkAllowBackgroundInput">Разрешить ввод в фоне</Control>
<Control ID="chkPauseWhenInBackground">Ставить на паузу при потере фокуса</Control>
@ -681,6 +682,10 @@
<Message ID="InvalidXmlFile">Выбранный XML файл ({0}) не является корректным.</Message>
<Message ID="NoMatchingCheats">Выбранный Cheat файл ({0}) не содержит читов для данной игры.</Message>
<Message ID="ConfirmReset">Are you sure you want to reset?</Message>
<Message ID="ConfirmPowerCycle">Are you sure you want to power cycle?</Message>
<Message ID="ConfirmExit">Are you sure you want to exit?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Перемотка</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Rewind</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Rewind 10 seconds</Message>
@ -689,6 +694,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Decrease Speed</Message>
<Message ID="EmulatorShortcutMappings_Pause">Пауза</Message>
<Message ID="EmulatorShortcutMappings_Reset">Сброс</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Power Cycle</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Power Off</Message>
<Message ID="EmulatorShortcutMappings_Exit">Exit</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Сделать сриншот</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Перевернуть диск</Message>

View File

@ -353,7 +353,8 @@
<Control ID="lblMiscSettings">Різнi настройки</Control>
<Control ID="chkAutoHideMenu">Автоматично приховувати панель меню</Control>
<Control ID="chkDisplayTitleBarInfo">Відображення додаткової інформації в рядку заголовка</Control>
<Control ID="chkConfirmExitResetPower">Display confirmation dialog before reset/power cycle/exit</Control>
<Control ID="chkPauseOnMovieEnd">Ставити на паузу після програвання запису</Control>
<Control ID="chkAllowBackgroundInput">Дозволити введення в тлі</Control>
<Control ID="chkPauseWhenInBackground">Ставити на паузу при втраті фокуса</Control>
@ -681,6 +682,10 @@
<Message ID="InvalidXmlFile">Обраний XML файл ({0}) не є коректним.</Message>
<Message ID="NoMatchingCheats">Обраний Cheat файл ({0}) не містить читiв для даної гри.</Message>
<Message ID="ConfirmReset">Are you sure you want to reset?</Message>
<Message ID="ConfirmPowerCycle">Are you sure you want to power cycle?</Message>
<Message ID="ConfirmExit">Are you sure you want to exit?</Message>
<Message ID="EmulatorShortcutMappings_FastForward">Швидке перемотування</Message>
<Message ID="EmulatorShortcutMappings_Rewind">Перемотка</Message>
<Message ID="EmulatorShortcutMappings_RewindTenSecs">Перемотати 10 секунд</Message>
@ -689,6 +694,8 @@
<Message ID="EmulatorShortcutMappings_DecreaseSpeed">Зменшити Швидкість</Message>
<Message ID="EmulatorShortcutMappings_Pause">Пауза</Message>
<Message ID="EmulatorShortcutMappings_Reset">Скидання</Message>
<Message ID="EmulatorShortcutMappings_PowerCycle">Цикл включення</Message>
<Message ID="EmulatorShortcutMappings_PowerOff">Power Off</Message>
<Message ID="EmulatorShortcutMappings_Exit">Вихід</Message>
<Message ID="EmulatorShortcutMappings_TakeScreenshot">Зробити скріншот</Message>
<Message ID="EmulatorShortcutMappings_SwitchDiskSide">FDS - Перевернути диск</Message>

View File

@ -140,6 +140,7 @@ namespace Mesen.GUI.Forms.Config
this.lblUiDisplaySettings = new System.Windows.Forms.Label();
this.lblGameSelectionScreenSettings = new System.Windows.Forms.Label();
this.tmrSyncDateTime = new System.Windows.Forms.Timer(this.components);
this.chkConfirmExitResetPower = new System.Windows.Forms.CheckBox();
this.tlpMain.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
@ -196,17 +197,18 @@ namespace Mesen.GUI.Forms.Config
this.tlpMain.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tlpMain.Controls.Add(this.lblMiscSettings, 0, 8);
this.tlpMain.Controls.Add(this.chkAutoLoadIps, 0, 9);
this.tlpMain.Controls.Add(this.chkDisplayMovieIcons, 0, 11);
this.tlpMain.Controls.Add(this.chkDisplayMovieIcons, 0, 12);
this.tlpMain.Controls.Add(this.chkAutoHideMenu, 0, 10);
this.tlpMain.Controls.Add(this.chkHidePauseOverlay, 0, 4);
this.tlpMain.Controls.Add(this.chkAllowBackgroundInput, 0, 7);
this.tlpMain.Controls.Add(this.chkPauseWhenInBackground, 0, 6);
this.tlpMain.Controls.Add(this.chkPauseOnMovieEnd, 0, 5);
this.tlpMain.Controls.Add(this.tableLayoutPanel5, 0, 13);
this.tlpMain.Controls.Add(this.tableLayoutPanel5, 0, 14);
this.tlpMain.Controls.Add(this.chkConfirmExitResetPower, 0, 11);
this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpMain.Location = new System.Drawing.Point(3, 3);
this.tlpMain.Name = "tlpMain";
this.tlpMain.RowCount = 14;
this.tlpMain.RowCount = 15;
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
@ -219,6 +221,7 @@ namespace Mesen.GUI.Forms.Config
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.Size = new System.Drawing.Size(483, 353);
@ -312,7 +315,7 @@ namespace Mesen.GUI.Forms.Config
// chkDisplayMovieIcons
//
this.chkDisplayMovieIcons.AutoSize = true;
this.chkDisplayMovieIcons.Location = new System.Drawing.Point(13, 253);
this.chkDisplayMovieIcons.Location = new System.Drawing.Point(13, 276);
this.chkDisplayMovieIcons.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkDisplayMovieIcons.Name = "chkDisplayMovieIcons";
this.chkDisplayMovieIcons.Size = new System.Drawing.Size(304, 17);
@ -963,7 +966,7 @@ namespace Mesen.GUI.Forms.Config
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel10.Size = new System.Drawing.Size(471, 135);
this.tableLayoutPanel10.Size = new System.Drawing.Size(471, 139);
this.tableLayoutPanel10.TabIndex = 0;
//
// psWave
@ -1307,9 +1310,9 @@ namespace Mesen.GUI.Forms.Config
this.lblLocation.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblLocation.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLocation.ForeColor = System.Drawing.SystemColors.ControlText;
this.lblLocation.Location = new System.Drawing.Point(60, 5);
this.lblLocation.Location = new System.Drawing.Point(48, 5);
this.lblLocation.Name = "lblLocation";
this.lblLocation.Size = new System.Drawing.Size(402, 13);
this.lblLocation.Size = new System.Drawing.Size(414, 13);
this.lblLocation.TabIndex = 1;
this.lblLocation.Text = "....";
//
@ -1318,7 +1321,7 @@ namespace Mesen.GUI.Forms.Config
this.lblDataLocation.AutoSize = true;
this.lblDataLocation.Location = new System.Drawing.Point(3, 5);
this.lblDataLocation.Name = "lblDataLocation";
this.lblDataLocation.Size = new System.Drawing.Size(51, 13);
this.lblDataLocation.Size = new System.Drawing.Size(39, 13);
this.lblDataLocation.TabIndex = 0;
this.lblDataLocation.Text = "Folder:";
//
@ -1585,6 +1588,17 @@ namespace Mesen.GUI.Forms.Config
this.tmrSyncDateTime.Enabled = true;
this.tmrSyncDateTime.Tick += new System.EventHandler(this.tmrSyncDateTime_Tick);
//
// chkConfirmExitResetPower
//
this.chkConfirmExitResetPower.AutoSize = true;
this.chkConfirmExitResetPower.Location = new System.Drawing.Point(13, 253);
this.chkConfirmExitResetPower.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkConfirmExitResetPower.Name = "chkConfirmExitResetPower";
this.chkConfirmExitResetPower.Size = new System.Drawing.Size(293, 17);
this.chkConfirmExitResetPower.TabIndex = 25;
this.chkConfirmExitResetPower.Text = "Display confirmation dialog before reset/power cycle/exit";
this.chkConfirmExitResetPower.UseVisualStyleBackColor = true;
//
// frmPreferences
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1772,5 +1786,6 @@ namespace Mesen.GUI.Forms.Config
private ctrlPathSelection psSaveStates;
private ctrlPathSelection psScreenshots;
private ctrlPathSelection psAvi;
private System.Windows.Forms.CheckBox chkConfirmExitResetPower;
}
}

View File

@ -45,6 +45,7 @@ namespace Mesen.GUI.Forms.Config
AddBinding("PauseWhenInBackground", chkPauseWhenInBackground);
AddBinding("AllowBackgroundInput", chkAllowBackgroundInput);
AddBinding("ConfirmExitResetPower", chkConfirmExitResetPower);
AddBinding("PauseOnMovieEnd", chkPauseOnMovieEnd);

View File

@ -23,7 +23,7 @@ namespace Mesen.GUI.Forms
private void mnuPowerCycle_Click(object sender, EventArgs e)
{
InteropEmu.PowerCycle();
PowerCycleEmu();
}
private void mnuPowerOff_Click(object sender, EventArgs e)

View File

@ -203,6 +203,11 @@ namespace Mesen.GUI.Forms
protected override void OnClosing(CancelEventArgs e)
{
if(ConfigManager.Config.PreferenceInfo.ConfirmExitResetPower && MesenMsgBox.Show("ConfirmExit", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) {
e.Cancel = true;
return;
}
if(_notifListener != null) {
_notifListener.Dispose();
_notifListener = null;
@ -429,6 +434,14 @@ namespace Mesen.GUI.Forms
}));
break;
case InteropEmu.ConsoleNotificationType.RequestReset:
this.BeginInvoke((MethodInvoker)(() => this.ResetEmu()));
break;
case InteropEmu.ConsoleNotificationType.RequestPowerCycle:
this.BeginInvoke((MethodInvoker)(() => this.PowerCycleEmu()));
break;
case InteropEmu.ConsoleNotificationType.RequestExit:
this.BeginInvoke((MethodInvoker)(() => this.Close()));
break;
@ -634,7 +647,16 @@ namespace Mesen.GUI.Forms
private void ResetEmu()
{
InteropEmu.Reset();
if(!ConfigManager.Config.PreferenceInfo.ConfirmExitResetPower || MesenMsgBox.Show("ConfirmReset", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
InteropEmu.Reset();
}
}
private void PowerCycleEmu()
{
if(!ConfigManager.Config.PreferenceInfo.ConfirmExitResetPower || MesenMsgBox.Show("ConfirmPowerCycle", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
InteropEmu.PowerCycle();
}
}
bool IMessageFilter.PreFilterMessage(ref Message m)

View File

@ -692,6 +692,8 @@ namespace Mesen.GUI
RequestExit = 17,
ToggleCheats = 18,
ToggleAudio = 19,
RequestReset = 20,
RequestPowerCycle = 21,
}
public enum ControllerType
@ -1085,6 +1087,8 @@ namespace Mesen.GUI
DisableOsd = 0x100000000000,
DisableGameSelectionScreen = 0x200000000000,
ConfirmExitResetPower = 0x400000000000,
ForceMaxSpeed = 0x4000000000000000,
ConsoleMode = 0x8000000000000000,
}
@ -1172,6 +1176,8 @@ namespace Mesen.GUI
public UInt32 Pause;
public UInt32 Reset;
public UInt32 PowerCycle;
public UInt32 PowerOff;
public UInt32 Exit;
public UInt32 MoveToNextStateSlot;