[Base] Moved IsUseNexusForGameBarEnabled from emulator_window to system.h

This will remove direct usage of system specific code from emulator_window
This commit is contained in:
Gliniak 2024-12-26 12:04:59 +01:00 committed by Radosław Gliński
parent bcc3c3172d
commit 9dfb0d0b68
6 changed files with 18 additions and 19 deletions

View File

@ -1870,24 +1870,6 @@ void EmulatorWindow::ToggleGPUSetting(gpu_cvar value) {
}
}
// Determine if the Xbox Gamebar is enabled via the Windows registry
bool EmulatorWindow::IsUseNexusForGameBarEnabled() {
#ifdef _WIN32
const LPCWSTR reg_path = L"SOFTWARE\\Microsoft\\GameBar";
const LPCWSTR key = L"UseNexusForGameBarEnabled";
DWORD value = 0;
DWORD dataSize = sizeof(value);
RegGetValue(HKEY_CURRENT_USER, reg_path, key, RRF_RT_DWORD, nullptr, &value,
&dataSize);
return (bool)value;
#else
return false;
#endif
}
void EmulatorWindow::DisplayHotKeysConfig() {
std::string msg = "";
std::string msg_passthru = "";

View File

@ -236,7 +236,6 @@ class EmulatorWindow {
bool vibrate = true);
void GamepadHotKeys();
void ToggleGPUSetting(gpu_cvar index);
bool IsUseNexusForGameBarEnabled();
void DisplayHotKeysConfig();
static std::string CanonicalizeFileExtension(

View File

@ -29,6 +29,9 @@ void LaunchFileExplorer(const std::filesystem::path& path);
bool SetProcessPriorityClass(const uint32_t priority_class);
// Determine if the Xbox Gamebar is enabled via the Windows registry
bool IsUseNexusForGameBarEnabled();
enum class SimpleMessageBoxType {
Help,
Warning,

View File

@ -296,4 +296,5 @@ void ShowSimpleMessageBox(SimpleMessageBoxType type, std::string_view message) {
bool SetProcessPriorityClass(const uint32_t priority_class) { return true; }
bool IsUseNexusForGameBarEnabled() { return false; }
} // namespace xe

View File

@ -69,4 +69,5 @@ void ShowSimpleMessageBox(SimpleMessageBoxType type, std::string_view message) {
bool SetProcessPriorityClass(const uint32_t priority_class) { return true; }
bool IsUseNexusForGameBarEnabled() { return false; }
} // namespace xe

View File

@ -64,4 +64,17 @@ bool SetProcessPriorityClass(const uint32_t priority_class) {
xeniaToWindowsPriorityClassMapping[priority_class]);
}
bool IsUseNexusForGameBarEnabled() {
const LPCWSTR reg_path = L"SOFTWARE\\Microsoft\\GameBar";
const LPCWSTR key = L"UseNexusForGameBarEnabled";
DWORD value = 0;
DWORD dataSize = sizeof(value);
RegGetValue(HKEY_CURRENT_USER, reg_path, key, RRF_RT_DWORD, nullptr, &value,
&dataSize);
return static_cast<bool>(value);
}
} // namespace xe