yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Stub set and get NpadCommunicationMode

This commit is contained in:
german 2020-11-26 21:15:48 -06:00
parent ab315011fb
commit 3898d8f0d7
4 changed files with 50 additions and 2 deletions

View File

@ -677,6 +677,14 @@ Controller_NPad::NpadHandheldActivationMode Controller_NPad::GetNpadHandheldActi
return handheld_activation_mode; return handheld_activation_mode;
} }
void Controller_NPad::SetNpadCommunicationMode(NpadCommunicationMode communication_mode_) {
communication_mode = communication_mode_;
}
Controller_NPad::NpadCommunicationMode Controller_NPad::GetNpadCommunicationMode() const {
return communication_mode;
}
void Controller_NPad::SetNpadMode(u32 npad_id, NpadAssignments assignment_mode) { void Controller_NPad::SetNpadMode(u32 npad_id, NpadAssignments assignment_mode) {
const std::size_t npad_index = NPadIdToIndex(npad_id); const std::size_t npad_index = NPadIdToIndex(npad_id);
ASSERT(npad_index < shared_memory_entries.size()); ASSERT(npad_index < shared_memory_entries.size());

View File

@ -86,6 +86,11 @@ public:
None = 2, None = 2,
}; };
enum class NpadCommunicationMode : u64 {
Unknown0 = 0,
Unknown1 = 1,
};
struct DeviceHandle { struct DeviceHandle {
NpadType npad_type{}; NpadType npad_type{};
u8 npad_id{}; u8 npad_id{};
@ -146,6 +151,9 @@ public:
void SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode); void SetNpadHandheldActivationMode(NpadHandheldActivationMode activation_mode);
NpadHandheldActivationMode GetNpadHandheldActivationMode() const; NpadHandheldActivationMode GetNpadHandheldActivationMode() const;
void SetNpadCommunicationMode(NpadCommunicationMode communication_mode_);
NpadCommunicationMode GetNpadCommunicationMode() const;
void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode);
bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index,
@ -424,6 +432,8 @@ private:
std::vector<u32> supported_npad_id_types{}; std::vector<u32> supported_npad_id_types{};
NpadHoldType hold_type{NpadHoldType::Vertical}; NpadHoldType hold_type{NpadHoldType::Vertical};
NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual};
// NpadCommunicationMode is unknown, default value is 1
NpadCommunicationMode communication_mode{NpadCommunicationMode::Unknown1};
// Each controller should have their own styleset changed event // Each controller should have their own styleset changed event
std::array<Kernel::EventPair, 10> styleset_changed_events; std::array<Kernel::EventPair, 10> styleset_changed_events;
std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> last_vibration_timepoints; std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> last_vibration_timepoints;

View File

@ -306,8 +306,8 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) {
{527, nullptr, "EnablePalmaBoostMode"}, {527, nullptr, "EnablePalmaBoostMode"},
{528, nullptr, "GetPalmaBluetoothAddress"}, {528, nullptr, "GetPalmaBluetoothAddress"},
{529, nullptr, "SetDisallowedPalmaConnection"}, {529, nullptr, "SetDisallowedPalmaConnection"},
{1000, nullptr, "SetNpadCommunicationMode"}, {1000, &Hid::SetNpadCommunicationMode, "SetNpadCommunicationMode"},
{1001, nullptr, "GetNpadCommunicationMode"}, {1001, &Hid::GetNpadCommunicationMode, "GetNpadCommunicationMode"},
{1002, nullptr, "SetTouchScreenConfiguration"}, {1002, nullptr, "SetTouchScreenConfiguration"},
{1003, nullptr, "IsFirmwareUpdateNeededForNotification"}, {1003, nullptr, "IsFirmwareUpdateNeededForNotification"},
{2000, nullptr, "ActivateDigitizer"}, {2000, nullptr, "ActivateDigitizer"},
@ -1296,6 +1296,34 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
void Hid::SetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
const auto communication_mode{rp.PopEnum<Controller_NPad::NpadCommunicationMode>()};
applet_resource->GetController<Controller_NPad>(HidController::NPad)
.SetNpadCommunicationMode(communication_mode);
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}, communication_mode={}",
applet_resource_user_id, communication_mode);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
}
void Hid::GetNpadCommunicationMode(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);
rb.PushEnum(applet_resource->GetController<Controller_NPad>(HidController::NPad)
.GetNpadCommunicationMode());
}
class HidDbg final : public ServiceFramework<HidDbg> { class HidDbg final : public ServiceFramework<HidDbg> {
public: public:
explicit HidDbg() : ServiceFramework{"hid:dbg"} { explicit HidDbg() : ServiceFramework{"hid:dbg"} {

View File

@ -146,6 +146,8 @@ private:
void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx); void ResetSevenSixAxisSensorTimestamp(Kernel::HLERequestContext& ctx);
void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx);
void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); void SetPalmaBoostMode(Kernel::HLERequestContext& ctx);
void SetNpadCommunicationMode(Kernel::HLERequestContext& ctx);
void GetNpadCommunicationMode(Kernel::HLERequestContext& ctx);
enum class VibrationDeviceType : u32 { enum class VibrationDeviceType : u32 {
LinearResonantActuator = 1, LinearResonantActuator = 1,