summaryrefslogtreecommitdiffstats
path: root/src/hid_core/resources
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2024-01-23 06:30:34 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2024-01-26 00:14:18 +0100
commit53b321c945d7e6782a6011b7ee55035da8f54dbc (patch)
treeab538a4d934f71453bd4b16a929599ae5f525668 /src/hid_core/resources
parentMerge pull request #12759 from liamwhite/mp-misc (diff)
downloadyuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar.gz
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar.bz2
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar.lz
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar.xz
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.tar.zst
yuzu-53b321c945d7e6782a6011b7ee55035da8f54dbc.zip
Diffstat (limited to 'src/hid_core/resources')
-rw-r--r--src/hid_core/resources/hid_firmware_settings.cpp12
-rw-r--r--src/hid_core/resources/hid_firmware_settings.h3
-rw-r--r--src/hid_core/resources/npad/npad.cpp5
-rw-r--r--src/hid_core/resources/npad/npad.h7
-rw-r--r--src/hid_core/resources/npad/npad_vibration.cpp36
-rw-r--r--src/hid_core/resources/npad/npad_vibration.h7
6 files changed, 55 insertions, 15 deletions
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp
index 00ceff7e6..9c9019e8f 100644
--- a/src/hid_core/resources/hid_firmware_settings.cpp
+++ b/src/hid_core/resources/hid_firmware_settings.cpp
@@ -40,6 +40,13 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
"touch_firmware_auto_update_disabled");
+ bool has_rail_interface{};
+ bool has_sio_mcu{};
+ m_set_sys->GetSettingsItemValue<bool>(has_rail_interface, "hid", "has_rail_interface");
+ m_set_sys->GetSettingsItemValue<bool>(has_sio_mcu, "hid", "has_sio_mcu");
+ platform_config.has_rail_interface.Assign(has_rail_interface);
+ platform_config.has_sio_mcu.Assign(has_sio_mcu);
+
is_initialized = true;
}
@@ -103,4 +110,9 @@ HidFirmwareSettings::FeaturesPerId HidFirmwareSettings::FeaturesDisabledPerId()
return features_per_id_disabled;
}
+Set::PlatformConfig HidFirmwareSettings::GetPlatformConfig() {
+ LoadSettings(false);
+ return platform_config;
+}
+
} // namespace Service::HID
diff --git a/src/hid_core/resources/hid_firmware_settings.h b/src/hid_core/resources/hid_firmware_settings.h
index 3694fa9a3..7f146f1e6 100644
--- a/src/hid_core/resources/hid_firmware_settings.h
+++ b/src/hid_core/resources/hid_firmware_settings.h
@@ -4,6 +4,7 @@
#pragma once
#include "common/common_types.h"
+#include "core/hle/service/set/settings_types.h"
namespace Core {
class System;
@@ -39,6 +40,7 @@ public:
FirmwareSetting GetFirmwareUpdateFailure();
FeaturesPerId FeaturesDisabledPerId();
+ Set::PlatformConfig GetPlatformConfig();
private:
bool is_initialized{};
@@ -57,6 +59,7 @@ private:
bool is_touch_firmware_auto_update_disabled{};
FirmwareSetting is_firmware_update_failure{};
FeaturesPerId features_per_id_disabled{};
+ Set::PlatformConfig platform_config{};
std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
};
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index d13a489c9..cde84b1bb 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -1080,12 +1080,15 @@ void NPad::UnregisterAppletResourceUserId(u64 aruid) {
void NPad::SetNpadExternals(std::shared_ptr<AppletResource> resource,
std::recursive_mutex* shared_mutex,
- std::shared_ptr<HandheldConfig> handheld_config) {
+ std::shared_ptr<HandheldConfig> handheld_config,
+ std::shared_ptr<Service::Set::ISystemSettingsServer> settings) {
applet_resource_holder.applet_resource = resource;
applet_resource_holder.shared_mutex = shared_mutex;
applet_resource_holder.shared_npad_resource = &npad_resource;
applet_resource_holder.handheld_config = handheld_config;
+ vibration_handler.SetSettingsService(settings);
+
for (auto& abstract_pad : abstracted_pads) {
abstract_pad.SetExternals(&applet_resource_holder, nullptr, nullptr, nullptr, nullptr,
&vibration_handler, &hid_core);
diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h
index 88289fa2b..502cb9b55 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -34,6 +34,10 @@ namespace Service::KernelHelpers {
class ServiceContext;
} // namespace Service::KernelHelpers
+namespace Service::Set {
+class ISystemSettingsServer;
+}
+
union Result;
namespace Service::HID {
@@ -128,7 +132,8 @@ public:
void UnregisterAppletResourceUserId(u64 aruid);
void SetNpadExternals(std::shared_ptr<AppletResource> resource,
std::recursive_mutex* shared_mutex,
- std::shared_ptr<HandheldConfig> handheld_config);
+ std::shared_ptr<HandheldConfig> handheld_config,
+ std::shared_ptr<Service::Set::ISystemSettingsServer> settings);
AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id);
diff --git a/src/hid_core/resources/npad/npad_vibration.cpp b/src/hid_core/resources/npad/npad_vibration.cpp
index 05aad4c54..02b1f0290 100644
--- a/src/hid_core/resources/npad/npad_vibration.cpp
+++ b/src/hid_core/resources/npad/npad_vibration.cpp
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
+#include "core/hle/service/set/system_settings_server.h"
#include "hid_core/hid_result.h"
#include "hid_core/resources/npad/npad_vibration.h"
@@ -13,10 +14,11 @@ NpadVibration::~NpadVibration() = default;
Result NpadVibration::Activate() {
std::scoped_lock lock{mutex};
- const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
- // if (master_volume < 0.0f || master_volume > 1.0f) {
- // return ResultVibrationStrengthOutOfRange;
- // }
+ f32 master_volume = 1.0f;
+ m_set_sys->GetVibrationMasterVolume(master_volume);
+ if (master_volume < 0.0f || master_volume > 1.0f) {
+ return ResultVibrationStrengthOutOfRange;
+ }
volume = master_volume;
return ResultSuccess;
@@ -26,6 +28,12 @@ Result NpadVibration::Deactivate() {
return ResultSuccess;
}
+Result NpadVibration::SetSettingsService(
+ std::shared_ptr<Service::Set::ISystemSettingsServer> settings) {
+ m_set_sys = settings;
+ return ResultSuccess;
+}
+
Result NpadVibration::SetVibrationMasterVolume(f32 master_volume) {
std::scoped_lock lock{mutex};
@@ -34,7 +42,7 @@ Result NpadVibration::SetVibrationMasterVolume(f32 master_volume) {
}
volume = master_volume;
- // nn::settings::system::SetVibrationMasterVolume(master_volume);
+ m_set_sys->SetVibrationMasterVolume(master_volume);
return ResultSuccess;
}
@@ -48,10 +56,11 @@ Result NpadVibration::GetVibrationVolume(f32& out_volume) const {
Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
std::scoped_lock lock{mutex};
- const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
- // if (master_volume < 0.0f || master_volume > 1.0f) {
- // return ResultVibrationStrengthOutOfRange;
- // }
+ f32 master_volume = 1.0f;
+ m_set_sys->GetVibrationMasterVolume(master_volume);
+ if (master_volume < 0.0f || master_volume > 1.0f) {
+ return ResultVibrationStrengthOutOfRange;
+ }
out_volume = master_volume;
return ResultSuccess;
@@ -67,10 +76,11 @@ Result NpadVibration::BeginPermitVibrationSession(u64 aruid) {
Result NpadVibration::EndPermitVibrationSession() {
std::scoped_lock lock{mutex};
- const f32 master_volume = 1.0f; // nn::settings::system::GetVibrationMasterVolume();
- // if (master_volume < 0.0f || master_volume > 1.0f) {
- // return ResultVibrationStrengthOutOfRange;
- // }
+ f32 master_volume = 1.0f;
+ m_set_sys->GetVibrationMasterVolume(master_volume);
+ if (master_volume < 0.0f || master_volume > 1.0f) {
+ return ResultVibrationStrengthOutOfRange;
+ }
volume = master_volume;
session_aruid = 0;
diff --git a/src/hid_core/resources/npad/npad_vibration.h b/src/hid_core/resources/npad/npad_vibration.h
index d5a95f2a0..6412ca4ab 100644
--- a/src/hid_core/resources/npad/npad_vibration.h
+++ b/src/hid_core/resources/npad/npad_vibration.h
@@ -8,6 +8,10 @@
#include "common/common_types.h"
#include "core/hle/result.h"
+namespace Service::Set {
+class ISystemSettingsServer;
+}
+
namespace Service::HID {
class NpadVibration final {
@@ -18,6 +22,7 @@ public:
Result Activate();
Result Deactivate();
+ Result SetSettingsService(std::shared_ptr<Service::Set::ISystemSettingsServer> settings);
Result SetVibrationMasterVolume(f32 master_volume);
Result GetVibrationVolume(f32& out_volume) const;
Result GetVibrationMasterVolume(f32& out_volume) const;
@@ -31,6 +36,8 @@ private:
f32 volume{};
u64 session_aruid{};
mutable std::mutex mutex;
+
+ std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
};
} // namespace Service::HID