summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_code_memory.cpp6
-rw-r--r--src/core/hle/kernel/svc.cpp2
-rw-r--r--src/core/hle/service/pm/pm.cpp45
-rw-r--r--src/input_common/drivers/sdl_driver.cpp6
-rw-r--r--src/input_common/input_poller.cpp2
-rw-r--r--src/yuzu/configuration/config.cpp6
-rw-r--r--src/yuzu/configuration/config.h2
-rw-r--r--src/yuzu/configuration/configure_general.cpp2
-rw-r--r--src/yuzu/configuration/configure_general.ui7
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp26
-rw-r--r--src/yuzu/main.cpp137
-rw-r--r--src/yuzu/main.h4
-rw-r--r--src/yuzu/uisettings.h1
-rw-r--r--src/yuzu_cmd/config.cpp36
14 files changed, 204 insertions, 78 deletions
diff --git a/src/core/hle/kernel/k_code_memory.cpp b/src/core/hle/kernel/k_code_memory.cpp
index d69f7ffb7..0b225e8e0 100644
--- a/src/core/hle/kernel/k_code_memory.cpp
+++ b/src/core/hle/kernel/k_code_memory.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "common/alignment.h"
#include "common/common_types.h"
#include "core/device_memory.h"
#include "core/hle/kernel/k_auto_object.h"
@@ -28,8 +29,7 @@ ResultCode KCodeMemory::Initialize(Core::DeviceMemory& device_memory, VAddr addr
auto& page_table = m_owner->PageTable();
// Construct the page group.
- KMemoryInfo kBlockInfo = page_table.QueryInfo(addr);
- m_page_group = KPageLinkedList(kBlockInfo.GetAddress(), kBlockInfo.GetNumPages());
+ m_page_group = KPageLinkedList(addr, Common::DivideUp(size, PageSize));
// Lock the memory.
R_TRY(page_table.LockForCodeMemory(addr, size))
@@ -143,4 +143,4 @@ ResultCode KCodeMemory::UnmapFromOwner(VAddr address, size_t size) {
return ResultSuccess;
}
-} // namespace Kernel \ No newline at end of file
+} // namespace Kernel
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 4f7aebf3f..9387373c1 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -396,7 +396,7 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle
// Get the process id.
*out_process_id = process->GetId();
- return ResultInvalidHandle;
+ return ResultSuccess;
}
static ResultCode GetProcessId32(Core::System& system, u32* out_process_id_low,
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp
index 277abc17a..057666021 100644
--- a/src/core/hle/service/pm/pm.cpp
+++ b/src/core/hle/service/pm/pm.cpp
@@ -91,6 +91,8 @@ public:
{4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"},
{5, nullptr, "HookToCreateApplicationProgress"},
{6, nullptr, "ClearHook"},
+ {65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"},
+ {65001, nullptr, "AtmosphereGetCurrentLimitInfo"},
};
// clang-format on
@@ -125,6 +127,49 @@ private:
GetApplicationPidGeneric(ctx, kernel.GetProcessList());
}
+ void AtmosphereGetProcessInfo(Kernel::HLERequestContext& ctx) {
+ // https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/pm/source/impl/pm_process_manager.cpp#L614
+ // This implementation is incomplete; only a handle to the process is returned.
+ IPC::RequestParser rp{ctx};
+ const auto pid = rp.PopRaw<u64>();
+
+ LOG_WARNING(Service_PM, "(Partial Implementation) called, pid={:016X}", pid);
+
+ const auto process = SearchProcessList(kernel.GetProcessList(), [pid](const auto& proc) {
+ return proc->GetProcessID() == pid;
+ });
+
+ if (!process.has_value()) {
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultProcessNotFound);
+ return;
+ }
+
+ struct ProgramLocation {
+ u64 program_id;
+ u8 storage_id;
+ };
+ static_assert(sizeof(ProgramLocation) == 0x10, "ProgramLocation has an invalid size");
+
+ struct OverrideStatus {
+ u64 keys_held;
+ u64 flags;
+ };
+ static_assert(sizeof(OverrideStatus) == 0x10, "OverrideStatus has an invalid size");
+
+ OverrideStatus override_status{};
+ ProgramLocation program_location{
+ .program_id = (*process)->GetProgramID(),
+ .storage_id = 0,
+ };
+
+ IPC::ResponseBuilder rb{ctx, 10, 1};
+ rb.Push(ResultSuccess);
+ rb.PushCopyObjects(*process);
+ rb.PushRaw(program_location);
+ rb.PushRaw(override_status);
+ }
+
const Kernel::KernelCore& kernel;
};
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 655eb5275..5cf1987ad 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -811,7 +811,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
PreSetAxis(identifier, binding_left_x.value.axis);
PreSetAxis(identifier, binding_left_y.value.axis);
const auto left_offset_x = -GetAxis(identifier, binding_left_x.value.axis);
- const auto left_offset_y = -GetAxis(identifier, binding_left_y.value.axis);
+ const auto left_offset_y = GetAxis(identifier, binding_left_y.value.axis);
mapping.insert_or_assign(Settings::NativeAnalog::LStick,
BuildParamPackageForAnalog(identifier, binding_left_x.value.axis,
binding_left_y.value.axis,
@@ -822,7 +822,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
PreSetAxis(identifier, binding_left_x.value.axis);
PreSetAxis(identifier, binding_left_y.value.axis);
const auto left_offset_x = -GetAxis(identifier, binding_left_x.value.axis);
- const auto left_offset_y = -GetAxis(identifier, binding_left_y.value.axis);
+ const auto left_offset_y = GetAxis(identifier, binding_left_y.value.axis);
mapping.insert_or_assign(Settings::NativeAnalog::LStick,
BuildParamPackageForAnalog(identifier, binding_left_x.value.axis,
binding_left_y.value.axis,
@@ -837,7 +837,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
PreSetAxis(identifier, binding_right_x.value.axis);
PreSetAxis(identifier, binding_right_y.value.axis);
const auto right_offset_x = -GetAxis(identifier, binding_right_x.value.axis);
- const auto right_offset_y = -GetAxis(identifier, binding_right_y.value.axis);
+ const auto right_offset_y = GetAxis(identifier, binding_right_y.value.axis);
mapping.insert_or_assign(Settings::NativeAnalog::RStick,
BuildParamPackageForAnalog(identifier, binding_right_x.value.axis,
binding_right_y.value.axis, right_offset_x,
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp
index 2f3c0735a..7f3c08597 100644
--- a/src/input_common/input_poller.cpp
+++ b/src/input_common/input_poller.cpp
@@ -181,7 +181,7 @@ public:
.raw_value = input_engine->GetAxis(identifier, axis_y),
.properties = properties_y,
};
- // This is a workaround too keep compatibility with old yuzu versions. Vertical axis is
+ // This is a workaround to keep compatibility with old yuzu versions. Vertical axis is
// inverted on SDL compared to Nintendo
if (invert_axis_y) {
status.y.raw_value = -status.y.raw_value;
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 2c8c10c50..9ee7992e7 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -65,12 +65,14 @@ const std::array<int, 2> Config::default_stick_mod = {
// This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off
-const std::array<UISettings::Shortcut, 20> Config::default_hotkeys{{
+const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{
{QStringLiteral("Audio Mute/Unmute"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), QStringLiteral("Home+Dpad_Right"), Qt::WindowShortcut}},
{QStringLiteral("Audio Volume Down"), QStringLiteral("Main Window"), {QStringLiteral("-"), QStringLiteral("Home+Dpad_Down"), Qt::ApplicationShortcut}},
{QStringLiteral("Audio Volume Up"), QStringLiteral("Main Window"), {QStringLiteral("+"), QStringLiteral("Home+Dpad_Up"), Qt::ApplicationShortcut}},
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), QStringLiteral("Screenshot"), Qt::WidgetWithChildrenShortcut}},
+ {QStringLiteral("Change Adapting Filter"), QStringLiteral("Main Window"), {QStringLiteral("F8"), QStringLiteral("Home+L"), Qt::ApplicationShortcut}},
{QStringLiteral("Change Docked Mode"), QStringLiteral("Main Window"), {QStringLiteral("F10"), QStringLiteral("Home+X"), Qt::ApplicationShortcut}},
+ {QStringLiteral("Change GPU Accuracy"), QStringLiteral("Main Window"), {QStringLiteral("F9"), QStringLiteral("Home+R"), Qt::ApplicationShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), QStringLiteral("Home+Plus"), Qt::WindowShortcut}},
{QStringLiteral("Exit Fullscreen"), QStringLiteral("Main Window"), {QStringLiteral("Esc"), QStringLiteral(""), Qt::WindowShortcut}},
{QStringLiteral("Exit yuzu"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+Q"), QStringLiteral("Home+Minus"), Qt::WindowShortcut}},
@@ -767,6 +769,7 @@ void Config::ReadUIValues() {
ReadBasicSetting(UISettings::values.callout_flags);
ReadBasicSetting(UISettings::values.show_console);
ReadBasicSetting(UISettings::values.pause_when_in_background);
+ ReadBasicSetting(UISettings::values.mute_when_in_background);
ReadBasicSetting(UISettings::values.hide_mouse);
qt_config->endGroup();
@@ -1295,6 +1298,7 @@ void Config::SaveUIValues() {
WriteBasicSetting(UISettings::values.callout_flags);
WriteBasicSetting(UISettings::values.show_console);
WriteBasicSetting(UISettings::values.pause_when_in_background);
+ WriteBasicSetting(UISettings::values.mute_when_in_background);
WriteBasicSetting(UISettings::values.hide_mouse);
qt_config->endGroup();
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index 60b20a62f..ae3e36a11 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -46,7 +46,7 @@ public:
default_mouse_buttons;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> default_keyboard_keys;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> default_keyboard_mods;
- static const std::array<UISettings::Shortcut, 20> default_hotkeys;
+ static const std::array<UISettings::Shortcut, 22> default_hotkeys;
static constexpr UISettings::Theme default_theme{
#ifdef _WIN32
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 566879317..978a29fe6 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -46,6 +46,7 @@ void ConfigureGeneral::SetConfiguration() {
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue());
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue());
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue());
+ ui->toggle_background_mute->setChecked(UISettings::values.mute_when_in_background.GetValue());
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
ui->toggle_speed_limit->setChecked(Settings::values.use_speed_limit.GetValue());
@@ -95,6 +96,7 @@ void ConfigureGeneral::ApplyConfiguration() {
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
+ UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
Settings::values.fps_cap.SetValue(ui->fps_cap->value());
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui
index 112dc72b3..bfc771135 100644
--- a/src/yuzu/configuration/configure_general.ui
+++ b/src/yuzu/configuration/configure_general.ui
@@ -164,6 +164,13 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="toggle_background_mute">
+ <property name="text">
+ <string>Mute audio when in background</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QCheckBox" name="toggle_hide_mouse">
<property name="text">
<string>Hide mouse on inactivity</string>
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index cc0534907..9db564663 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -488,6 +488,32 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller->SetStickParam(analog_id, {});
analog_map_buttons[analog_id][sub_button_id]->setText(tr("[not set]"));
});
+ context_menu.addAction(tr("Center axis"), [&] {
+ const auto stick_value =
+ emulated_controller->GetSticksValues()[analog_id];
+ const float offset_x = stick_value.x.properties.offset;
+ const float offset_y = stick_value.y.properties.offset;
+ float raw_value_x = stick_value.x.raw_value;
+ float raw_value_y = stick_value.y.raw_value;
+ // See Core::HID::SanitizeStick() to obtain the original raw axis value
+ if (std::abs(offset_x) < 0.5f) {
+ if (raw_value_x > 0) {
+ raw_value_x *= 1 + offset_x;
+ } else {
+ raw_value_x *= 1 - offset_x;
+ }
+ }
+ if (std::abs(offset_x) < 0.5f) {
+ if (raw_value_y > 0) {
+ raw_value_y *= 1 + offset_y;
+ } else {
+ raw_value_y *= 1 - offset_y;
+ }
+ }
+ param.Set("offset_x", -raw_value_x + offset_x);
+ param.Set("offset_y", -raw_value_y + offset_y);
+ emulated_controller->SetStickParam(analog_id, param);
+ });
context_menu.addAction(tr("Invert axis"), [&] {
if (sub_button_id == 2 || sub_button_id == 3) {
const bool invert_value = param.Get("invert_x", "+") == "-";
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c89909737..3c2d7d080 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -806,21 +806,8 @@ void GMainWindow::InitializeWidgets() {
filter_status_button = new QPushButton();
filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
filter_status_button->setFocusPolicy(Qt::NoFocus);
- connect(filter_status_button, &QPushButton::clicked, [&] {
- auto filter = Settings::values.scaling_filter.GetValue();
- if (filter == Settings::ScalingFilter::LastFilter) {
- filter = Settings::ScalingFilter::NearestNeighbor;
- } else {
- filter = static_cast<Settings::ScalingFilter>(static_cast<u32>(filter) + 1);
- }
- if (Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::OpenGL &&
- filter == Settings::ScalingFilter::Fsr) {
- filter = Settings::ScalingFilter::NearestNeighbor;
- }
- Settings::values.scaling_filter.SetValue(filter);
- filter_status_button->setChecked(true);
- UpdateFilterText();
- });
+ connect(filter_status_button, &QPushButton::clicked, this,
+ &GMainWindow::OnToggleAdaptingFilter);
auto filter = Settings::values.scaling_filter.GetValue();
if (Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::OpenGL &&
filter == Settings::ScalingFilter::Fsr) {
@@ -835,25 +822,7 @@ void GMainWindow::InitializeWidgets() {
dock_status_button = new QPushButton();
dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton"));
dock_status_button->setFocusPolicy(Qt::NoFocus);
- connect(dock_status_button, &QPushButton::clicked, [&] {
- const bool is_docked = Settings::values.use_docked_mode.GetValue();
- auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
- auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
-
- if (!is_docked && handheld->IsConnected()) {
- QMessageBox::warning(this, tr("Invalid config detected"),
- tr("Handheld controller can't be used on docked mode. Pro "
- "controller will be selected."));
- handheld->Disconnect();
- player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
- player_1->Connect();
- controller_dialog->refreshConfiguration();
- }
-
- Settings::values.use_docked_mode.SetValue(!is_docked);
- dock_status_button->setChecked(!is_docked);
- OnDockedModeChanged(is_docked, !is_docked, *system);
- });
+ connect(dock_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleDockedMode);
dock_status_button->setText(tr("DOCK"));
dock_status_button->setCheckable(true);
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
@@ -863,22 +832,7 @@ void GMainWindow::InitializeWidgets() {
gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton"));
gpu_accuracy_button->setCheckable(true);
gpu_accuracy_button->setFocusPolicy(Qt::NoFocus);
- connect(gpu_accuracy_button, &QPushButton::clicked, [this] {
- switch (Settings::values.gpu_accuracy.GetValue()) {
- case Settings::GPUAccuracy::High: {
- Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::Normal);
- break;
- }
- case Settings::GPUAccuracy::Normal:
- case Settings::GPUAccuracy::Extreme:
- default: {
- Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High);
- }
- }
-
- system->ApplySettings();
- UpdateGPUAccuracyButton();
- });
+ connect(gpu_accuracy_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGpuAccuracy);
UpdateGPUAccuracyButton();
statusBar()->insertPermanentWidget(0, gpu_accuracy_button);
@@ -1009,12 +963,10 @@ void GMainWindow::InitializeHotkeys() {
ToggleFullscreen();
}
});
- connect_shortcut(QStringLiteral("Change Docked Mode"), [&] {
- Settings::values.use_docked_mode.SetValue(!Settings::values.use_docked_mode.GetValue());
- OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(),
- Settings::values.use_docked_mode.GetValue(), *system);
- dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
- });
+ connect_shortcut(QStringLiteral("Change Adapting Filter"),
+ &GMainWindow::OnToggleAdaptingFilter);
+ connect_shortcut(QStringLiteral("Change Docked Mode"), &GMainWindow::OnToggleDockedMode);
+ connect_shortcut(QStringLiteral("Change GPU Accuracy"), &GMainWindow::OnToggleGpuAccuracy);
connect_shortcut(QStringLiteral("Audio Mute/Unmute"),
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
connect_shortcut(QStringLiteral("Audio Volume Down"), [] {
@@ -1052,8 +1004,10 @@ void GMainWindow::SetDefaultUIGeometry() {
}
void GMainWindow::RestoreUIState() {
+ setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
restoreGeometry(UISettings::values.geometry);
restoreState(UISettings::values.state);
+ render_window->setWindowFlags(render_window->windowFlags() & ~Qt::FramelessWindowHint);
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
#if MICROPROFILE_ENABLED
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
@@ -1080,14 +1034,14 @@ void GMainWindow::RestoreUIState() {
}
void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
- if (!UISettings::values.pause_when_in_background) {
- return;
- }
if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
state != Qt::ApplicationActive) {
LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
}
- if (emulation_running) {
+ if (!emulation_running) {
+ return;
+ }
+ if (UISettings::values.pause_when_in_background) {
if (emu_thread->IsRunning() &&
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
auto_paused = true;
@@ -1097,6 +1051,16 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
OnStartGame();
}
}
+ if (UISettings::values.mute_when_in_background) {
+ if (!Settings::values.audio_muted &&
+ (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
+ Settings::values.audio_muted = true;
+ auto_muted = true;
+ } else if (auto_muted && state == Qt::ApplicationActive) {
+ Settings::values.audio_muted = false;
+ auto_muted = false;
+ }
+ }
}
void GMainWindow::ConnectWidgetEvents() {
@@ -2866,6 +2830,59 @@ void GMainWindow::OnTasReset() {
input_subsystem->GetTas()->Reset();
}
+void GMainWindow::OnToggleDockedMode() {
+ const bool is_docked = Settings::values.use_docked_mode.GetValue();
+ auto* player_1 = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
+ auto* handheld = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
+
+ if (!is_docked && handheld->IsConnected()) {
+ QMessageBox::warning(this, tr("Invalid config detected"),
+ tr("Handheld controller can't be used on docked mode. Pro "
+ "controller will be selected."));
+ handheld->Disconnect();
+ player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
+ player_1->Connect();
+ controller_dialog->refreshConfiguration();
+ }
+
+ Settings::values.use_docked_mode.SetValue(!is_docked);
+ dock_status_button->setChecked(!is_docked);
+ OnDockedModeChanged(is_docked, !is_docked, *system);
+}
+
+void GMainWindow::OnToggleGpuAccuracy() {
+ switch (Settings::values.gpu_accuracy.GetValue()) {
+ case Settings::GPUAccuracy::High: {
+ Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::Normal);
+ break;
+ }
+ case Settings::GPUAccuracy::Normal:
+ case Settings::GPUAccuracy::Extreme:
+ default: {
+ Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High);
+ }
+ }
+
+ system->ApplySettings();
+ UpdateGPUAccuracyButton();
+}
+
+void GMainWindow::OnToggleAdaptingFilter() {
+ auto filter = Settings::values.scaling_filter.GetValue();
+ if (filter == Settings::ScalingFilter::LastFilter) {
+ filter = Settings::ScalingFilter::NearestNeighbor;
+ } else {
+ filter = static_cast<Settings::ScalingFilter>(static_cast<u32>(filter) + 1);
+ }
+ if (Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::OpenGL &&
+ filter == Settings::ScalingFilter::Fsr) {
+ filter = Settings::ScalingFilter::NearestNeighbor;
+ }
+ Settings::values.scaling_filter.SetValue(filter);
+ filter_status_button->setChecked(true);
+ UpdateFilterText();
+}
+
void GMainWindow::OnConfigurePerGame() {
const u64 title_id = system->GetCurrentProcessProgramID();
OpenPerGameConfiguration(title_id, game_path.toStdString());
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index ca4ab9af5..6a35b9e3d 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -284,6 +284,9 @@ private slots:
void OnTasStartStop();
void OnTasRecord();
void OnTasReset();
+ void OnToggleDockedMode();
+ void OnToggleGpuAccuracy();
+ void OnToggleAdaptingFilter();
void OnConfigurePerGame();
void OnLoadAmiibo();
void OnOpenYuzuFolder();
@@ -369,6 +372,7 @@ private:
QString game_path;
bool auto_paused = false;
+ bool auto_muted = false;
QTimer mouse_hide_timer;
// FS
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index f7298ddad..06e8b46da 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -73,6 +73,7 @@ struct Values {
Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
Settings::BasicSetting<bool> first_start{true, "firstStart"};
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
+ Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"};
Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 8e9c7d211..ff616da70 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -66,6 +66,11 @@ static const std::array<int, Settings::NativeButton::NumButtons> default_buttons
SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_B,
};
+static const std::array<int, Settings::NativeMotion::NumMotions> default_motions = {
+ SDL_SCANCODE_7,
+ SDL_SCANCODE_8,
+};
+
static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> default_analogs{{
{
SDL_SCANCODE_UP,
@@ -102,27 +107,42 @@ void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>&
void Config::ReadValues() {
// Controls
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
+ auto& player = Settings::values.players.GetValue()[p];
+
const auto group = fmt::format("ControlsP{}", p);
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
- Settings::values.players.GetValue()[p].buttons[i] =
+ player.buttons[i] =
sdl2_config->Get(group, Settings::NativeButton::mapping[i], default_param);
- if (Settings::values.players.GetValue()[p].buttons[i].empty())
- Settings::values.players.GetValue()[p].buttons[i] = default_param;
+ if (player.buttons[i].empty()) {
+ player.buttons[i] = default_param;
+ }
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_analogs[i][4], 0.5f);
- Settings::values.players.GetValue()[p].analogs[i] =
+ player.analogs[i] =
sdl2_config->Get(group, Settings::NativeAnalog::mapping[i], default_param);
- if (Settings::values.players.GetValue()[p].analogs[i].empty())
- Settings::values.players.GetValue()[p].analogs[i] = default_param;
+ if (player.analogs[i].empty()) {
+ player.analogs[i] = default_param;
+ }
+ }
+
+ for (int i = 0; i < Settings::NativeMotion::NumMotions; ++i) {
+ const std::string default_param =
+ InputCommon::GenerateKeyboardParam(default_motions[i]);
+ auto& player_motions = player.motions[i];
+
+ player_motions =
+ sdl2_config->Get(group, Settings::NativeMotion::mapping[i], default_param);
+ if (player_motions.empty()) {
+ player_motions = default_param;
+ }
}
- Settings::values.players.GetValue()[p].connected =
- sdl2_config->GetBoolean(group, "connected", false);
+ player.connected = sdl2_config->GetBoolean(group, "connected", false);
}
ReadSetting("ControlsGeneral", Settings::values.mouse_enabled);