UI: Confirm closure of the emulator (#47)
This commit is contained in:
parent
cb3ff1241a
commit
f3c0951e88
|
|
@ -1 +1 @@
|
|||
Subproject commit 10c9708a7554d0e3fbe7d5dc995f1a58ae4cb953
|
||||
Subproject commit 1dc05d97e7b624548f29d8c4db7ea5433eef8a25
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
<div class="right"><input type="hslider" min="0" max="200" value="100" id="audioVolume" style="width: 19em" /><span id="VolumeDisplay">100%</span></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="muteAudio"><label for="muteAudio">Mute audio</label></div>
|
||||
<div class="left"><label for="muteAudio">Mute audio</label></div>
|
||||
<div class="right"><input type="checkbox" id="muteAudio"></div>
|
||||
</div>
|
||||
</div>
|
||||
</page>
|
||||
|
|
|
|||
|
|
@ -18,16 +18,18 @@
|
|||
</Page>
|
||||
<Page label="System" Name="System">
|
||||
<div class="input-group">
|
||||
<div class="group-title">Docked Mode</div>
|
||||
<div class="form-row">
|
||||
<div class="left"><label for="DockedMode">Docked Mode:</label></div>
|
||||
<div class="right"><ComboBox id="DockedMode" tooltip="Selects if the console is in Docked or Handheld mode. Games will change resolution and performance settings. Setting to Handheld can help improve performance on low-end systems." /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="group-title">Firmware</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="CheckForUpdatedFirmware"><label for="CheckForUpdatedFirmware">Check for updated firmware</label></div>
|
||||
<div class="left"><label for="CheckForUpdatedFirmware">Check for updated firmware</label></div>
|
||||
<div class="right"><input type="checkbox" id="CheckForUpdatedFirmware"></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="left"><label for="ConfirmBeforeStopping">Confirm before stopping</label></div>
|
||||
<div class="right"><input type="checkbox" id="ConfirmBeforeStopping" tooltip="When to ask before stopping emulation or closing the emulator while a game is running."></div>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
|
|
@ -51,7 +53,8 @@
|
|||
<div class="right"><input type="text" id="LogFilter" name="LogFilter" /></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="ShowLogConsole"><label for="ShowLogConsole">Show Log Console</label></div>
|
||||
<div class="left"><label for="ShowLogConsole">Show Log Console</label></div>
|
||||
<div class="right"><input type="checkbox" id="ShowLogConsole"></div>
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@
|
|||
<div class="input-group">
|
||||
<div class="group-title">Graphics Settings</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="UseDiskPipelineCache" tooltip="Allows saving shaders to storage for faster loading on following game boots.\nDisabling it is only intended for debugging."><label for="UseDiskPipelineCache">Use disk pipeline cache</label></div>
|
||||
<div class="left"><label for="UseDiskPipelineCache">Use disk pipeline cache</label></div>
|
||||
<div class="right"><input type="checkbox" id="UseDiskPipelineCache" tooltip="Allows saving shaders to storage for faster loading on following game boots.\nDisabling it is only intended for debugging."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="UseAsynchronousGPUEmulation" tooltip="Uses an extra CPU thread for rendering.\nThis option should always remain enabled."><label for="UseAsynchronousGPUEmulation">Use asynchronous GPU emulation</label></div>
|
||||
<div class="left"><label for="UseAsynchronousGPUEmulation">Use asynchronous GPU emulation</label></div>
|
||||
<div class="right"><input type="checkbox" id="UseAsynchronousGPUEmulation" tooltip="Uses an extra CPU thread for rendering.\nThis option should always remain enabled."></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="left"><label for="AstcDecodeMode">ASTC Decoding Method:</label></div>
|
||||
|
|
@ -77,28 +79,36 @@
|
|||
<div class="right"><ComboBox id="VRAMUsageMode" tooltip="Selects whether the emulator should prefer to conserve memory or make maximum usage of available video memory for performance. Has no effect on integrated graphics. Aggressive mode may severely impact the performance of other applications such as recording software."/></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="EnableAsynchronousPresentation" tooltip="Slightly improves performance by moving presentation to a separate CPU thread."><label for="EnableAsynchronousPresentation">Enable asynchronous presentation (Vulkan only)</label></div>
|
||||
<div class="left"><label for="EnableAsynchronousPresentation">Enable asynchronous presentation (Vulkan only)</label></div>
|
||||
<div class="right"><input type="checkbox" id="EnableAsynchronousPresentation" tooltip="Slightly improves performance by moving presentation to a separate CPU thread."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="ForceMaximumClocks" tooltip="Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed."><label for="ForceMaximumClocks">Force maximum clocks (Vulkan only)</label></div>
|
||||
<div class="left"><label for="ForceMaximumClocks">Force maximum clocks (Vulkan only)</label></div>
|
||||
<div class="right"><input type="checkbox" id="ForceMaximumClocks" tooltip="Runs work in the background while waiting for graphics commands to keep the GPU from lowering its clock speed."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="EnableReactiveFlushing"><label for="EnableReactiveFlushing" tooltip="Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing.">Enable Reactive Flushing</label></div>
|
||||
<div class="left"><label for="EnableReactiveFlushing">Enable Reactive Flushing</label></div>
|
||||
<div class="right"><input type="checkbox" id="EnableReactiveFlushing" tooltip="Uses reactive flushing instead of predictive flushing, allowing more accurate memory syncing."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="UseAsynchronousShaderBuilding"><label for="UseAsynchronousShaderBuilding" tooltip="Enables asynchronous shader compilation, which may reduce shader stutter.\nThis feature is experimental.">Use asynchronous shader building (Hack)</label></div>
|
||||
<div class="left"><label for="UseAsynchronousShaderBuilding">Use asynchronous shader building (Hack)</label></div>
|
||||
<div class="right"><input type="checkbox" id="UseAsynchronousShaderBuilding" tooltip="Enables asynchronous shader compilation, which may reduce shader stutter.\nThis feature is experimental."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="FastGPUTime" tooltip="Enables Fast GPU Time. This option will force most games to run at their highest native resolution."><label for="FastGPUTime">Fast GPU Time (Hack)</label></div>
|
||||
<div class="left"><label for="FastGPUTime">Fast GPU Time (Hack)</label></div>
|
||||
<div class="right"><input type="checkbox" id="FastGPUTime" tooltip="Enables Fast GPU Time. This option will force most games to run at their highest native resolution."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="UseVulkanPipelineCache" tooltip="Enables GPU vendor-specific pipeline cache.\nThis option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally."><label for="UseVulkanPipelineCache">Use Vulkan pipeline cache</label></div>
|
||||
<div class="left"><label for="UseVulkanPipelineCache">Use Vulkan pipeline cache</label></div>
|
||||
<div class="right"><input type="checkbox" id="UseVulkanPipelineCache" tooltip="Enables GPU vendor-specific pipeline cache.\nThis option can improve shader loading time significantly in cases where the Vulkan driver does not store pipeline cache files internally."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="SyncToFramerateOfVideoPlayback" tooltip="Run the game at normal speed during video playback, even when the framerate is unlocked."><label for="SyncToFramerateOfVideoPlayback">Sync to framerate of video playback</label></div>
|
||||
<div class="left"><label for="SyncToFramerateOfVideoPlayback">Sync to framerate of video playback</label></div>
|
||||
<div class="right"><input type="checkbox" id="SyncToFramerateOfVideoPlayback" tooltip="Run the game at normal speed during video playback, even when the framerate is unlocked."></div>
|
||||
</div>
|
||||
<div class="form-row checkbox-row">
|
||||
<div class="checkbox"><input type="checkbox" id="BarrierFeedbackLoops" tooltip="Improves rendering of transparency effects in specific games."><label for="BarrierFeedbackLoops">Barrier feedback loops</label></div>
|
||||
<div class="left"><label for="BarrierFeedbackLoops">Barrier feedback loops</label></div>
|
||||
<div class="right"><input type="checkbox" id="BarrierFeedbackLoops" tooltip="Improves rendering of transparency effects in specific games."></div>
|
||||
</div>
|
||||
</div>
|
||||
</page>
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@ constexpr const char * RecentFiles = "nxui:RecentFiles";
|
|||
constexpr const char * GameDirectories = "nxui:GameDirectories";
|
||||
constexpr const char * MyGameIconSize = "nxui:MyGameIconSize";
|
||||
constexpr const char * Hotkeys = "nxui:Hotkeys";
|
||||
constexpr const char * ConfirmBeforeStopping = "nxui:ConfirmBeforeStopping";
|
||||
|
||||
} // namespace NXUISetting
|
||||
|
|
@ -99,7 +99,8 @@ namespace
|
|||
{nullptr, "PerformVulkanCheck", &uiSettings.performVulkanCheck, true},
|
||||
{nullptr, nullptr, &uiSettings.hasBrokenVulkan, false},
|
||||
{nullptr, nullptr, &uiSettings.enableAllControllers, false},
|
||||
{nullptr, "View\\StartGamesInFullscreen", &uiSettings.startGamesInFullscreen, false},
|
||||
{nullptr, "StartGamesInFullscreen", &uiSettings.startGamesInFullscreen, false},
|
||||
{NXUISetting::ConfirmBeforeStopping, "ConfirmBeforeStopping", &uiSettings.confirmBeforeStopping, true},
|
||||
{NXUISetting::Hotkeys, "Hotkeys", &uiSettings.hotkeys, &g_defaultHotkeys},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct UISettings
|
|||
bool hasBrokenVulkan;
|
||||
bool enableAllControllers;
|
||||
bool startGamesInFullscreen;
|
||||
bool confirmBeforeStopping;
|
||||
HotkeyMap hotkeys;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -453,6 +453,7 @@ bool SciterMainWindow::Show()
|
|||
m_rootElement = m_window->GetRootElement();
|
||||
m_sciterUI.AttachHandler(m_rootElement, IID_IKEYSINK, (IKeySink *)this);
|
||||
m_sciterUI.AttachHandler(m_rootElement, IID_EVENTSINK, (IEventSink *)this);
|
||||
m_window->OnCloseSinkAdd(this);
|
||||
m_window->OnDestroySinkAdd(this);
|
||||
m_window->CenterWindow();
|
||||
SetCaption(m_windowTitle);
|
||||
|
|
@ -1054,8 +1055,29 @@ void SciterMainWindow::FirmwareInstallTotalChanged(const char * /*setting*/, voi
|
|||
}
|
||||
}
|
||||
|
||||
bool SciterMainWindow::ConfirmCloseEmulator()
|
||||
{
|
||||
if (!m_emulationRunning || !uiSettings.confirmBeforeStopping)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char * msg = "Are you sure you want to exit the emulator?\n\nAny unsaved progress will be lost.";
|
||||
bool exitLocked = m_modules.IsValid() && m_modules.Modules().OperatingSystem().GetExitLocked();
|
||||
if (exitLocked)
|
||||
{
|
||||
msg = "The currently running application has requested NxEmu to not exit.\n\nWould you like to bypass this and close the emulator anyway?";
|
||||
}
|
||||
|
||||
return g_notify->Query(msg, "NxEmu - Exit Emulator?") == NotificationResponse::Yes;
|
||||
}
|
||||
|
||||
void SciterMainWindow::OnFileExit()
|
||||
{
|
||||
if (!ConfirmCloseEmulator())
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_sciterUI.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -1065,6 +1087,20 @@ void SciterMainWindow::OnStopGame()
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (uiSettings.confirmBeforeStopping)
|
||||
{
|
||||
const char * msg = "Are you sure you want to stop the emulation?\n\nAny unsaved progress will be lost.";
|
||||
bool exitLocked = m_modules.IsValid() && m_modules.Modules().OperatingSystem().GetExitLocked();
|
||||
if (exitLocked)
|
||||
{
|
||||
msg = "The currently running application has requested NxEmu to not exit.\n\nWould you like to bypass this and stop emulation anyway?";
|
||||
}
|
||||
|
||||
if (g_notify->Query(msg, "NxEmu - Stop Emulation") == NotificationResponse::No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
AllowOSSleep();
|
||||
SettingsStore & settings = SettingsStore::GetInstance();
|
||||
settings.SetBool(NXCoreSetting::EmulationRunning, false);
|
||||
|
|
@ -1272,6 +1308,11 @@ void SciterMainWindow::OnWindowDestroy(HWINDOW /*hWnd*/)
|
|||
m_sciterUI.Stop();
|
||||
}
|
||||
|
||||
bool SciterMainWindow::OnWindowCloseRequest(HWINDOW hWnd)
|
||||
{
|
||||
return ConfirmCloseEmulator();
|
||||
}
|
||||
|
||||
void SciterMainWindow::OnMenuItem(int32_t id, SCITER_ELEMENT /*item*/)
|
||||
{
|
||||
OnGuiAction(static_cast<GuiAction>(id));
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class InputConfig;
|
|||
|
||||
class SciterMainWindow :
|
||||
public IWindowDestroySink,
|
||||
public IWindowCloseSink,
|
||||
public IMenuBarSink,
|
||||
public IRenderWindow,
|
||||
public IKeySink,
|
||||
|
|
@ -105,6 +106,7 @@ private:
|
|||
|
||||
void OnOpenFile();
|
||||
void OnFileExit();
|
||||
bool ConfirmCloseEmulator();
|
||||
void OnStopGame();
|
||||
void OnPauseContinueGame();
|
||||
void OnSystemConfig();
|
||||
|
|
@ -146,6 +148,9 @@ private:
|
|||
// IWindowDestroySink
|
||||
void OnWindowDestroy(HWINDOW hWnd) override;
|
||||
|
||||
// IWindowCloseSink
|
||||
bool OnWindowCloseRequest(HWINDOW hWnd);
|
||||
|
||||
// IMenuBarSink
|
||||
void OnMenuItem(int32_t id, SCITER_ELEMENT item) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace
|
|||
{
|
||||
static ConfigSetting gameBrowserSettings[] = {
|
||||
ConfigSetting(ConfigSetting::Slider, "myGamesIconSize", true, NXUISetting::MyGameIconSize),
|
||||
ConfigSetting(ConfigSetting::CheckBox, "ConfirmBeforeStopping", true, NXUISetting::ConfirmBeforeStopping),
|
||||
ConfigSetting(ConfigSetting::ListBox, "gameDirectoryList", true, NXUISetting::GameDirectories),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "system_config_system.h"
|
||||
#include "config_setting.h"
|
||||
#include "settings/ui_identifiers.h"
|
||||
#include "system_config.h"
|
||||
#include <nxemu-os/os_settings_identifiers.h>
|
||||
#include <nxemu-loader/loader_settings_identifiers.h>
|
||||
#include <nxemu-os/os_settings_identifiers.h>
|
||||
#include <yuzu_common/settings_enums.h>
|
||||
|
||||
namespace
|
||||
|
|
@ -10,6 +11,7 @@ namespace
|
|||
static ConfigSetting systemSettings[] = {
|
||||
ConfigSetting(ConfigSetting::ComboBox, "DockedMode", true, Settings::EnumMetadata<Settings::DockedMode>::Index(), NXOsSetting::DockedMode),
|
||||
ConfigSetting(ConfigSetting::CheckBox, "CheckForUpdatedFirmware", true, NXLoaderSetting::CheckForUpdatedFirmware),
|
||||
ConfigSetting(ConfigSetting::CheckBox, "ConfirmBeforeStopping", true, NXUISetting::ConfirmBeforeStopping),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue