summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/settings.h1
-rw-r--r--src/core/hle/kernel/k_affinity_mask.h2
-rw-r--r--src/core/hle/kernel/k_process.cpp26
-rw-r--r--src/core/hle/kernel/k_process.h8
-rw-r--r--src/core/hle/kernel/k_thread.cpp11
-rw-r--r--src/input_common/drivers/udp_client.cpp8
-rw-r--r--src/input_common/drivers/udp_client.h4
-rw-r--r--src/input_common/input_engine.h4
-rw-r--r--src/input_common/input_mapping.cpp11
-rw-r--r--src/input_common/input_mapping.h8
-rw-r--r--src/input_common/main.cpp6
-rw-r--r--src/input_common/main.h2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate_program.h3
-rw-r--r--src/video_core/gpu.h16
-rw-r--r--src/video_core/renderer_vulkan/vk_fsr.cpp2
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/configuration/configure_graphics.ui2
-rw-r--r--src/yuzu/configuration/configure_input_advanced.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_advanced.ui19
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp59
-rw-r--r--src/yuzu/hotkeys.cpp3
-rw-r--r--src/yuzu/util/controller_navigation.cpp3
22 files changed, 110 insertions, 93 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index d01c0448c..9bee6e10f 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -554,6 +554,7 @@ struct Values {
Setting<bool> use_docked_mode{true, "use_docked_mode"};
BasicSetting<bool> enable_raw_input{false, "enable_raw_input"};
+ BasicSetting<bool> controller_navigation{true, "controller_navigation"};
Setting<bool> vibration_enabled{true, "vibration_enabled"};
Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"};
diff --git a/src/core/hle/kernel/k_affinity_mask.h b/src/core/hle/kernel/k_affinity_mask.h
index b906895fc..cf704ce87 100644
--- a/src/core/hle/kernel/k_affinity_mask.h
+++ b/src/core/hle/kernel/k_affinity_mask.h
@@ -31,8 +31,6 @@ public:
}
constexpr void SetAffinity(s32 core, bool set) {
- ASSERT(0 <= core && core < static_cast<s32>(Core::Hardware::NUM_CPU_CORES));
-
if (set) {
this->mask |= GetCoreBit(core);
} else {
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index 265ac6fa1..85c506979 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -146,6 +146,13 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st
// Open a reference to the resource limit.
process->resource_limit->Open();
+ // Clear remaining fields.
+ process->num_running_threads = 0;
+ process->is_signaled = false;
+ process->exception_thread = nullptr;
+ process->is_suspended = false;
+ process->schedule_count = 0;
+
return ResultSuccess;
}
@@ -157,20 +164,17 @@ KResourceLimit* KProcess::GetResourceLimit() const {
return resource_limit;
}
-void KProcess::IncrementThreadCount() {
- ASSERT(num_threads >= 0);
- num_created_threads++;
-
- if (const auto count = ++num_threads; count > peak_num_threads) {
- peak_num_threads = count;
- }
+void KProcess::IncrementRunningThreadCount() {
+ ASSERT(num_running_threads.load() >= 0);
+ ++num_running_threads;
}
-void KProcess::DecrementThreadCount() {
- ASSERT(num_threads > 0);
+void KProcess::DecrementRunningThreadCount() {
+ ASSERT(num_running_threads.load() > 0);
- if (const auto count = --num_threads; count == 0) {
- LOG_WARNING(Kernel, "Process termination is not fully implemented.");
+ if (const auto prev = num_running_threads--; prev == 1) {
+ // TODO(bunnei): Process termination to be implemented when multiprocess is supported.
+ UNIMPLEMENTED_MSG("KProcess termination is not implemennted!");
}
}
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h
index c2a672021..38b446350 100644
--- a/src/core/hle/kernel/k_process.h
+++ b/src/core/hle/kernel/k_process.h
@@ -235,8 +235,8 @@ public:
++schedule_count;
}
- void IncrementThreadCount();
- void DecrementThreadCount();
+ void IncrementRunningThreadCount();
+ void DecrementRunningThreadCount();
void SetRunningThread(s32 core, KThread* thread, u64 idle_count) {
running_threads[core] = thread;
@@ -473,9 +473,7 @@ private:
bool is_suspended{};
bool is_initialized{};
- std::atomic<s32> num_created_threads{};
- std::atomic<u16> num_threads{};
- u16 peak_num_threads{};
+ std::atomic<u16> num_running_threads{};
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> running_threads{};
std::array<u64, Core::Hardware::NUM_CPU_CORES> running_thread_idle_counts{};
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index f42abb8a1..de3ffe0c7 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -215,7 +215,6 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
parent = owner;
parent->Open();
- parent->IncrementThreadCount();
}
// Initialize thread context.
@@ -327,11 +326,6 @@ void KThread::Finalize() {
}
}
- // Decrement the parent process's thread count.
- if (parent != nullptr) {
- parent->DecrementThreadCount();
- }
-
// Perform inherited finalization.
KSynchronizationObject::Finalize();
}
@@ -1011,7 +1005,7 @@ ResultCode KThread::Run() {
if (IsUserThread() && IsSuspended()) {
this->UpdateState();
}
- owner->IncrementThreadCount();
+ owner->IncrementRunningThreadCount();
}
// Set our state and finish.
@@ -1026,10 +1020,11 @@ ResultCode KThread::Run() {
void KThread::Exit() {
ASSERT(this == GetCurrentThreadPointer(kernel));
- // Release the thread resource hint from parent.
+ // Release the thread resource hint, running thread count from parent.
if (parent != nullptr) {
parent->GetResourceLimit()->Release(Kernel::LimitableResource::Threads, 0, 1);
resource_limit_release_hint = true;
+ parent->DecrementRunningThreadCount();
}
// Perform termination.
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index 9aaeb91be..d1cdb1ab2 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -339,7 +339,7 @@ void UDPClient::StartCommunication(std::size_t client, const std::string& host,
}
}
-const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
+PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
const std::size_t client = pad_index / PADS_PER_CLIENT;
return {
.guid = clients[client].uuid,
@@ -348,9 +348,9 @@ const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
};
}
-const Common::UUID UDPClient::GetHostUUID(const std::string host) const {
- const auto ip = boost::asio::ip::address_v4::from_string(host);
- const auto hex_host = fmt::format("{:06x}", ip.to_ulong());
+Common::UUID UDPClient::GetHostUUID(const std::string& host) const {
+ const auto ip = boost::asio::ip::make_address_v4(host);
+ const auto hex_host = fmt::format("{:06x}", ip.to_uint());
return Common::UUID{hex_host};
}
diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h
index 61a1fff37..30d7c2682 100644
--- a/src/input_common/drivers/udp_client.h
+++ b/src/input_common/drivers/udp_client.h
@@ -145,8 +145,8 @@ private:
void OnPortInfo(Response::PortInfo);
void OnPadData(Response::PadData, std::size_t client);
void StartCommunication(std::size_t client, const std::string& host, u16 port);
- const PadIdentifier GetPadIdentifier(std::size_t pad_index) const;
- const Common::UUID GetHostUUID(const std::string host) const;
+ PadIdentifier GetPadIdentifier(std::size_t pad_index) const;
+ Common::UUID GetHostUUID(const std::string& host) const;
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h
index 390581c94..fe2faee5a 100644
--- a/src/input_common/input_engine.h
+++ b/src/input_common/input_engine.h
@@ -16,7 +16,7 @@
// Pad Identifier of data source
struct PadIdentifier {
- Common::UUID guid{};
+ Common::UUID guid{Common::INVALID_UUID};
std::size_t port{};
std::size_t pad{};
@@ -89,7 +89,7 @@ struct UpdateCallback {
// Triggered if data changed on the controller and the engine is on configuring mode
struct MappingCallback {
- std::function<void(MappingData)> on_data;
+ std::function<void(const MappingData&)> on_data;
};
// Input Identifier of data source
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp
index 475257f42..a7a6ad8c2 100644
--- a/src/input_common/input_mapping.cpp
+++ b/src/input_common/input_mapping.cpp
@@ -2,14 +2,13 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included
-#include "common/common_types.h"
#include "common/settings.h"
#include "input_common/input_engine.h"
#include "input_common/input_mapping.h"
namespace InputCommon {
-MappingFactory::MappingFactory() {}
+MappingFactory::MappingFactory() = default;
void MappingFactory::BeginMapping(Polling::InputType type) {
is_enabled = true;
@@ -19,7 +18,7 @@ void MappingFactory::BeginMapping(Polling::InputType type) {
second_axis = -1;
}
-[[nodiscard]] const Common::ParamPackage MappingFactory::GetNextInput() {
+Common::ParamPackage MappingFactory::GetNextInput() {
Common::ParamPackage input;
input_queue.Pop(input);
return input;
@@ -57,7 +56,7 @@ void MappingFactory::StopMapping() {
void MappingFactory::RegisterButton(const MappingData& data) {
Common::ParamPackage new_input;
new_input.Set("engine", data.engine);
- if (data.pad.guid != Common::UUID{}) {
+ if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format());
}
new_input.Set("port", static_cast<int>(data.pad.port));
@@ -93,7 +92,7 @@ void MappingFactory::RegisterButton(const MappingData& data) {
void MappingFactory::RegisterStick(const MappingData& data) {
Common::ParamPackage new_input;
new_input.Set("engine", data.engine);
- if (data.pad.guid != Common::UUID{}) {
+ if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format());
}
new_input.Set("port", static_cast<int>(data.pad.port));
@@ -138,7 +137,7 @@ void MappingFactory::RegisterStick(const MappingData& data) {
void MappingFactory::RegisterMotion(const MappingData& data) {
Common::ParamPackage new_input;
new_input.Set("engine", data.engine);
- if (data.pad.guid != Common::UUID{}) {
+ if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format());
}
new_input.Set("port", static_cast<int>(data.pad.port));
diff --git a/src/input_common/input_mapping.h b/src/input_common/input_mapping.h
index 93564b5f8..e0dfbc7ad 100644
--- a/src/input_common/input_mapping.h
+++ b/src/input_common/input_mapping.h
@@ -3,8 +3,14 @@
// Refer to the license.txt file included
#pragma once
+
+#include "common/param_package.h"
#include "common/threadsafe_queue.h"
+namespace InputCommon::Polling {
+enum class InputType;
+}
+
namespace InputCommon {
class InputEngine;
struct MappingData;
@@ -20,7 +26,7 @@ public:
void BeginMapping(Polling::InputType type);
/// Returns an input event with mapping information from the input_queue
- [[nodiscard]] const Common::ParamPackage GetNextInput();
+ [[nodiscard]] Common::ParamPackage GetNextInput();
/**
* Registers mapping input data from the driver
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 940744c5f..a4d7ed645 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -27,7 +27,7 @@ namespace InputCommon {
struct InputSubsystem::Impl {
void Initialize() {
mapping_factory = std::make_shared<MappingFactory>();
- MappingCallback mapping_callback{[this](MappingData data) { RegisterInput(data); }};
+ MappingCallback mapping_callback{[this](const MappingData& data) { RegisterInput(data); }};
keyboard = std::make_shared<Keyboard>("keyboard");
keyboard->SetMappingCallback(mapping_callback);
@@ -284,7 +284,7 @@ struct InputSubsystem::Impl {
#endif
}
- void RegisterInput(MappingData data) {
+ void RegisterInput(const MappingData& data) {
mapping_factory->RegisterInput(data);
}
@@ -394,7 +394,7 @@ void InputSubsystem::BeginMapping(Polling::InputType type) {
impl->mapping_factory->BeginMapping(type);
}
-const Common::ParamPackage InputSubsystem::GetNextInput() const {
+Common::ParamPackage InputSubsystem::GetNextInput() const {
return impl->mapping_factory->GetNextInput();
}
diff --git a/src/input_common/main.h b/src/input_common/main.h
index c6f97f691..baf107e0f 100644
--- a/src/input_common/main.h
+++ b/src/input_common/main.h
@@ -126,7 +126,7 @@ public:
void BeginMapping(Polling::InputType type);
/// Returns an input event with mapping information.
- [[nodiscard]] const Common::ParamPackage GetNextInput() const;
+ [[nodiscard]] Common::ParamPackage GetNextInput() const;
/// Stop polling from all backends.
void StopMapping() const;
diff --git a/src/shader_recompiler/frontend/maxwell/translate_program.h b/src/shader_recompiler/frontend/maxwell/translate_program.h
index cd535f20d..eac83da9d 100644
--- a/src/shader_recompiler/frontend/maxwell/translate_program.h
+++ b/src/shader_recompiler/frontend/maxwell/translate_program.h
@@ -21,7 +21,6 @@ namespace Shader::Maxwell {
[[nodiscard]] IR::Program MergeDualVertexPrograms(IR::Program& vertex_a, IR::Program& vertex_b,
Environment& env_vertex_b);
-[[nodiscard]] void ConvertLegacyToGeneric(IR::Program& program,
- const Shader::RuntimeInfo& runtime_info);
+void ConvertLegacyToGeneric(IR::Program& program, const RuntimeInfo& runtime_info);
} // namespace Shader::Maxwell
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 3188b83ed..26b8ea233 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -12,9 +12,6 @@
#include "video_core/framebuffer_config.h"
namespace Core {
-namespace Frontend {
-class EmuWindow;
-}
class System;
} // namespace Core
@@ -25,7 +22,6 @@ class ShaderNotify;
namespace Tegra {
class DmaPusher;
-class CDmaPusher;
struct CommandList;
enum class RenderTargetFormat : u32 {
@@ -88,15 +84,9 @@ enum class DepthFormat : u32 {
D32_FLOAT_S8X24_UINT = 0x19,
};
-struct CommandListHeader;
-class DebugContext;
-
namespace Engines {
-class Fermi2D;
class Maxwell3D;
-class MaxwellDMA;
class KeplerCompute;
-class KeplerMemory;
} // namespace Engines
enum class EngineID {
@@ -190,12 +180,6 @@ public:
/// Returns a const reference to the GPU DMA pusher.
[[nodiscard]] const Tegra::DmaPusher& DmaPusher() const;
- /// Returns a reference to the GPU CDMA pusher.
- [[nodiscard]] Tegra::CDmaPusher& CDmaPusher();
-
- /// Returns a const reference to the GPU CDMA pusher.
- [[nodiscard]] const Tegra::CDmaPusher& CDmaPusher() const;
-
/// Returns a reference to the underlying renderer.
[[nodiscard]] VideoCore::RendererBase& Renderer();
diff --git a/src/video_core/renderer_vulkan/vk_fsr.cpp b/src/video_core/renderer_vulkan/vk_fsr.cpp
index 73629d229..b630090e8 100644
--- a/src/video_core/renderer_vulkan/vk_fsr.cpp
+++ b/src/video_core/renderer_vulkan/vk_fsr.cpp
@@ -214,7 +214,7 @@ VkImageView FSR::Draw(VKScheduler& scheduler, size_t image_index, VkImageView im
{
VkImageMemoryBarrier fsr_write_barrier = base_barrier;
- fsr_write_barrier.image = *images[image_index],
+ fsr_write_barrier.image = *images[image_index];
fsr_write_barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 7e8f92840..2c8c10c50 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -393,6 +393,8 @@ void Config::ReadControlValues() {
ReadGlobalSetting(Settings::values.enable_accurate_vibrations);
ReadGlobalSetting(Settings::values.motion_enabled);
+ ReadBasicSetting(Settings::values.controller_navigation);
+
qt_config->endGroup();
}
@@ -1001,6 +1003,7 @@ void Config::SaveControlValues() {
WriteBasicSetting(Settings::values.keyboard_enabled);
WriteBasicSetting(Settings::values.emulate_analog_keyboard);
WriteBasicSetting(Settings::values.mouse_panning_sensitivity);
+ WriteBasicSetting(Settings::values.controller_navigation);
WriteBasicSetting(Settings::values.tas_enable);
WriteBasicSetting(Settings::values.tas_loop);
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui
index 9241678e4..74f0e0b79 100644
--- a/src/yuzu/configuration/configure_graphics.ui
+++ b/src/yuzu/configuration/configure_graphics.ui
@@ -429,7 +429,7 @@
</item>
<item>
<property name="text">
- <string>AMD FidelityFX™️ Super Resolution [Vulkan Only]</string>
+ <string>AMD FidelityFX™️ Super Resolution (Vulkan Only)</string>
</property>
</item>
</widget>
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp
index 65c8e59ac..20fc2599d 100644
--- a/src/yuzu/configuration/configure_input_advanced.cpp
+++ b/src/yuzu/configuration/configure_input_advanced.cpp
@@ -131,6 +131,7 @@ void ConfigureInputAdvanced::ApplyConfiguration() {
Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked();
Settings::values.enable_raw_input = ui->enable_raw_input->isChecked();
Settings::values.enable_udp_controller = ui->enable_udp_controller->isChecked();
+ Settings::values.controller_navigation = ui->controller_navigation->isChecked();
}
void ConfigureInputAdvanced::LoadConfiguration() {
@@ -162,6 +163,7 @@ void ConfigureInputAdvanced::LoadConfiguration() {
ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled);
ui->enable_raw_input->setChecked(Settings::values.enable_raw_input.GetValue());
ui->enable_udp_controller->setChecked(Settings::values.enable_udp_controller.GetValue());
+ ui->controller_navigation->setChecked(Settings::values.controller_navigation.GetValue());
UpdateUIEnabled();
}
diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui
index df0e4d602..66f2075f2 100644
--- a/src/yuzu/configuration/configure_input_advanced.ui
+++ b/src/yuzu/configuration/configure_input_advanced.ui
@@ -2655,6 +2655,19 @@
</widget>
</item>
<item row="4" column="0">
+ <widget class="QCheckBox" name="controller_navigation">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>23</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Controller navigation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
<widget class="QCheckBox" name="mouse_panning">
<property name="minimumSize">
<size>
@@ -2667,7 +2680,7 @@
</property>
</widget>
</item>
- <item row="4" column="2">
+ <item row="5" column="2">
<widget class="QSpinBox" name="mouse_panning_sensitivity">
<property name="toolTip">
<string>Mouse sensitivity</string>
@@ -2689,14 +2702,14 @@
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="motion_touch">
<property name="text">
<string>Motion / Touch</string>
</property>
</widget>
</item>
- <item row="5" column="2">
+ <item row="6" column="2">
<widget class="QPushButton" name="buttonMotionTouch">
<property name="text">
<string>Configure</string>
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index d2132b408..7029287a9 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -147,7 +147,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
// Retrieve the names from Qt
if (param.Get("engine", "") == "keyboard") {
const QString button_str = GetKeyName(param.Get("code", 0));
- return QObject::tr("%1%2").arg(toggle, button_str);
+ return QObject::tr("%1%2%3").arg(toggle, inverted, button_str);
}
if (common_button_name == Common::Input::ButtonNames::Invalid) {
@@ -341,7 +341,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller->SetButtonParam(button_id, {});
button_map[button_id]->setText(tr("[not set]"));
});
- if (param.Has("button") || param.Has("hat")) {
+ if (param.Has("code") || param.Has("button") || param.Has("hat")) {
context_menu.addAction(tr("Toggle button"), [&] {
const bool toggle_value = !param.Get("toggle", false);
param.Set("toggle", toggle_value);
@@ -349,8 +349,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
emulated_controller->SetButtonParam(button_id, param);
});
context_menu.addAction(tr("Invert button"), [&] {
- const bool toggle_value = !param.Get("inverted", false);
- param.Set("inverted", toggle_value);
+ const bool invert_value = !param.Get("inverted", false);
+ param.Set("inverted", invert_value);
button_map[button_id]->setText(ButtonToText(param));
emulated_controller->SetButtonParam(button_id, param);
});
@@ -510,28 +510,37 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
analog_map_modifier_button[analog_id]->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(analog_map_modifier_button[analog_id], &QPushButton::customContextMenuRequested,
- [=, this](const QPoint& menu_location) {
- QMenu context_menu;
- Common::ParamPackage param = emulated_controller->GetStickParam(analog_id);
- context_menu.addAction(tr("Clear"), [&] {
- param.Set("modifier", "");
- analog_map_modifier_button[analog_id]->setText(tr("[not set]"));
- emulated_controller->SetStickParam(analog_id, param);
- });
- context_menu.addAction(tr("Toggle button"), [&] {
- Common::ParamPackage modifier_param =
- Common::ParamPackage{param.Get("modifier", "")};
- const bool toggle_value = !modifier_param.Get("toggle", false);
- modifier_param.Set("toggle", toggle_value);
- param.Set("modifier", modifier_param.Serialize());
- analog_map_modifier_button[analog_id]->setText(
- ButtonToText(modifier_param));
- emulated_controller->SetStickParam(analog_id, param);
- });
- context_menu.exec(
- analog_map_modifier_button[analog_id]->mapToGlobal(menu_location));
+ connect(
+ analog_map_modifier_button[analog_id], &QPushButton::customContextMenuRequested,
+ [=, this](const QPoint& menu_location) {
+ QMenu context_menu;
+ Common::ParamPackage param = emulated_controller->GetStickParam(analog_id);
+ context_menu.addAction(tr("Clear"), [&] {
+ param.Set("modifier", "");
+ analog_map_modifier_button[analog_id]->setText(tr("[not set]"));
+ emulated_controller->SetStickParam(analog_id, param);
+ });
+ context_menu.addAction(tr("Toggle button"), [&] {
+ Common::ParamPackage modifier_param =
+ Common::ParamPackage{param.Get("modifier", "")};
+ const bool toggle_value = !modifier_param.Get("toggle", false);
+ modifier_param.Set("toggle", toggle_value);
+ param.Set("modifier", modifier_param.Serialize());
+ analog_map_modifier_button[analog_id]->setText(ButtonToText(modifier_param));
+ emulated_controller->SetStickParam(analog_id, param);
});
+ context_menu.addAction(tr("Invert button"), [&] {
+ Common::ParamPackage modifier_param =
+ Common::ParamPackage{param.Get("modifier", "")};
+ const bool invert_value = !modifier_param.Get("inverted", false);
+ modifier_param.Set("inverted", invert_value);
+ param.Set("modifier", modifier_param.Serialize());
+ analog_map_modifier_button[analog_id]->setText(ButtonToText(modifier_param));
+ emulated_controller->SetStickParam(analog_id, param);
+ });
+ context_menu.exec(
+ analog_map_modifier_button[analog_id]->mapToGlobal(menu_location));
+ });
connect(analog_map_range_spinbox[analog_id], qOverload<int>(&QSpinBox::valueChanged),
[=, this] {
diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp
index d96497c4e..6ed9611c7 100644
--- a/src/yuzu/hotkeys.cpp
+++ b/src/yuzu/hotkeys.cpp
@@ -190,6 +190,9 @@ void ControllerShortcut::ControllerUpdateEvent(Core::HID::ControllerTriggerType
if (type != Core::HID::ControllerTriggerType::Button) {
return;
}
+ if (!Settings::values.controller_navigation) {
+ return;
+ }
if (button_sequence.npad.raw == Core::HID::NpadButton::None &&
button_sequence.capture.raw == 0 && button_sequence.home.raw == 0) {
return;
diff --git a/src/yuzu/util/controller_navigation.cpp b/src/yuzu/util/controller_navigation.cpp
index 86fb28b9f..c2b13123d 100644
--- a/src/yuzu/util/controller_navigation.cpp
+++ b/src/yuzu/util/controller_navigation.cpp
@@ -40,6 +40,9 @@ void ControllerNavigation::TriggerButton(Settings::NativeButton::Values native_b
void ControllerNavigation::ControllerUpdateEvent(Core::HID::ControllerTriggerType type) {
std::lock_guard lock{mutex};
+ if (!Settings::values.controller_navigation) {
+ return;
+ }
if (type == Core::HID::ControllerTriggerType::Button) {
ControllerUpdateButton();
return;