implement npad interface part 1
This commit is contained in:
parent
69f5f567d2
commit
5c6a5487c7
|
@ -513,10 +513,13 @@ add_library(core STATIC
|
||||||
hle/service/hid/hid.h
|
hle/service/hid/hid.h
|
||||||
hle/service/hid/hid_debug_server.cpp
|
hle/service/hid/hid_debug_server.cpp
|
||||||
hle/service/hid/hid_debug_server.h
|
hle/service/hid/hid_debug_server.h
|
||||||
|
hle/service/hid/hid_result.h
|
||||||
hle/service/hid/hid_server.cpp
|
hle/service/hid/hid_server.cpp
|
||||||
hle/service/hid/hid_server.h
|
hle/service/hid/hid_server.h
|
||||||
hle/service/hid/hid_system_server.cpp
|
hle/service/hid/hid_system_server.cpp
|
||||||
hle/service/hid/hid_system_server.h
|
hle/service/hid/hid_system_server.h
|
||||||
|
hle/service/hid/hid_types.h
|
||||||
|
hle/service/hid/hid_util.h
|
||||||
hle/service/hid/hidbus.cpp
|
hle/service/hid/hidbus.cpp
|
||||||
hle/service/hid/hidbus.h
|
hle/service/hid/hidbus.h
|
||||||
hle/service/hid/irs.cpp
|
hle/service/hid/irs.cpp
|
||||||
|
@ -525,15 +528,24 @@ add_library(core STATIC
|
||||||
hle/service/hid/resource_manager.h
|
hle/service/hid/resource_manager.h
|
||||||
hle/service/hid/xcd.cpp
|
hle/service/hid/xcd.cpp
|
||||||
hle/service/hid/xcd.h
|
hle/service/hid/xcd.h
|
||||||
hle/service/hid/hid_server/base_resource.cpp
|
hle/service/hid/resource_manager/base_resource.cpp
|
||||||
hle/service/hid/hid_server/base_resource.h
|
hle/service/hid/resource_manager/base_resource.h
|
||||||
hle/service/hid/hid_server/hid_result.h
|
hle/service/hid/resource_manager/debug_pad.cpp
|
||||||
hle/service/hid/hid_server/hid_types.h
|
hle/service/hid/resource_manager/debug_pad.h
|
||||||
hle/service/hid/hid_server/hid_util.h
|
hle/service/hid/resource_manager/gesture.cpp
|
||||||
hle/service/hid/hid_server/npad.cpp
|
hle/service/hid/resource_manager/gesture.h
|
||||||
hle/service/hid/hid_server/npad.h
|
hle/service/hid/resource_manager/keyboard.cpp
|
||||||
hle/service/hid/hid_server/sixaxis.cpp
|
hle/service/hid/resource_manager/keyboard.h
|
||||||
hle/service/hid/hid_server/sixaxis.h
|
hle/service/hid/resource_manager/mouse.cpp
|
||||||
|
hle/service/hid/resource_manager/mouse.h
|
||||||
|
hle/service/hid/resource_manager/npad.cpp
|
||||||
|
hle/service/hid/resource_manager/npad.h
|
||||||
|
hle/service/hid/resource_manager/palma.cpp
|
||||||
|
hle/service/hid/resource_manager/palma.h
|
||||||
|
hle/service/hid/resource_manager/sixaxis.cpp
|
||||||
|
hle/service/hid/resource_manager/sixaxis.h
|
||||||
|
hle/service/hid/resource_manager/touch_screen.cpp
|
||||||
|
hle/service/hid/resource_manager/touch_screen.h
|
||||||
hle/service/hid/hidbus/hidbus_result.h
|
hle/service/hid/hidbus/hidbus_result.h
|
||||||
hle/service/hid/hidbus/hidbus_types.h
|
hle/service/hid/hidbus/hidbus_types.h
|
||||||
hle/service/hid/irs/irs_result.h
|
hle/service/hid/irs/irs_result.h
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid//hid_result.h"
|
||||||
|
#include "core/hle/service/hid//hid_types.h"
|
||||||
#include "core/hle/service/hid/hid_debug_server.h"
|
#include "core/hle/service/hid/hid_debug_server.h"
|
||||||
#include "core/hle/service/hid/hid_server/hid_result.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/sixaxis.h"
|
|
||||||
#include "core/hle/service/hid/resource_manager.h"
|
#include "core/hle/service/hid/resource_manager.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/sixaxis.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
constexpr Result ResultPalmaResultSuccess{ErrorModule::HID, 0};
|
||||||
|
constexpr Result ResultNpadInvalidHandle{ErrorModule::HID, 100};
|
||||||
|
constexpr Result ResultNpadDeviceIndexOutOfRange{ErrorModule::HID, 107};
|
||||||
|
constexpr Result ResultVibrationInvalidStyleIndex{ErrorModule::HID, 122};
|
||||||
|
constexpr Result ResultVibrationInvalidNpadId{ErrorModule::HID, 123};
|
||||||
|
constexpr Result ResultVibrationDeviceIndexOutOfRange{ErrorModule::HID, 124};
|
||||||
|
constexpr Result ResultInvalidSixAxisFusionRange{ErrorModule::HID, 423};
|
||||||
|
constexpr Result ResultNpadIsDualJoycon{ErrorModule::HID, 601};
|
||||||
|
constexpr Result ResultNpadIsSameType{ErrorModule::HID, 602};
|
||||||
|
constexpr Result ResultInvalidNpadId{ErrorModule::HID, 709};
|
||||||
|
constexpr Result ResultNpadNotConnected{ErrorModule::HID, 710};
|
||||||
|
constexpr Result ResultInvalidArraySize{ErrorModule::HID, 715};
|
||||||
|
constexpr Result ResultUndefinedStyleSet{ErrorModule::HID, 716};
|
||||||
|
|
||||||
|
constexpr Result ResultUnknown108{ErrorModule::HID, 108};
|
||||||
|
|
||||||
|
constexpr Result ResultInvalidPalmaHandle{ErrorModule::HID, 3302};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -1,14 +1,22 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_shared_memory.h"
|
#include "core/hle/kernel/k_shared_memory.h"
|
||||||
|
#include "core/hle/service/hid/hid_result.h"
|
||||||
#include "core/hle/service/hid/hid_server.h"
|
#include "core/hle/service/hid/hid_server.h"
|
||||||
#include "core/hle/service/hid/hid_server/hid_result.h"
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/npad.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/sixaxis.h"
|
|
||||||
#include "core/hle/service/hid/resource_manager.h"
|
#include "core/hle/service/hid/resource_manager.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/debug_pad.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/gesture.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/keyboard.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/mouse.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/npad.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/palma.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/sixaxis.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/touch_screen.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
@ -82,45 +90,45 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr<ResourceManager> r
|
||||||
{87, &IHidServer::LoadSixAxisSensorCalibrationParameter, "LoadSixAxisSensorCalibrationParameter"},
|
{87, &IHidServer::LoadSixAxisSensorCalibrationParameter, "LoadSixAxisSensorCalibrationParameter"},
|
||||||
{88, &IHidServer::GetSixAxisSensorIcInformation, "GetSixAxisSensorIcInformation"},
|
{88, &IHidServer::GetSixAxisSensorIcInformation, "GetSixAxisSensorIcInformation"},
|
||||||
{89, &IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned, "ResetIsSixAxisSensorDeviceNewlyAssigned"},
|
{89, &IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned, "ResetIsSixAxisSensorDeviceNewlyAssigned"},
|
||||||
{91, nullptr, "ActivateGesture"},
|
{91, &IHidServer::ActivateGesture, "ActivateGesture"},
|
||||||
{100, nullptr, "SetSupportedNpadStyleSet"},
|
{100, &IHidServer::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"},
|
||||||
{101, nullptr, "GetSupportedNpadStyleSet"},
|
{101, &IHidServer::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"},
|
||||||
{102, nullptr, "SetSupportedNpadIdType"},
|
{102, &IHidServer::SetSupportedNpadIdType, "SetSupportedNpadIdType"},
|
||||||
{103, nullptr, "ActivateNpad"},
|
{103, &IHidServer::ActivateNpad, "ActivateNpad"},
|
||||||
{104, nullptr, "DeactivateNpad"},
|
{104, &IHidServer::DeactivateNpad, "DeactivateNpad"},
|
||||||
{106, nullptr, "AcquireNpadStyleSetUpdateEventHandle"},
|
{106, &IHidServer::AcquireNpadStyleSetUpdateEventHandle, "AcquireNpadStyleSetUpdateEventHandle"},
|
||||||
{107, nullptr, "DisconnectNpad"},
|
{107, &IHidServer::DisconnectNpad, "DisconnectNpad"},
|
||||||
{108, nullptr, "GetPlayerLedPattern"},
|
{108, &IHidServer::GetPlayerLedPattern, "GetPlayerLedPattern"},
|
||||||
{109, nullptr, "ActivateNpadWithRevision"},
|
{109, &IHidServer::ActivateNpadWithRevision, "ActivateNpadWithRevision"},
|
||||||
{120, nullptr, "SetNpadJoyHoldType"},
|
{120, &IHidServer::SetNpadJoyHoldType, "SetNpadJoyHoldType"},
|
||||||
{121, nullptr, "GetNpadJoyHoldType"},
|
{121, &IHidServer::GetNpadJoyHoldType, "GetNpadJoyHoldType"},
|
||||||
{122, nullptr, "SetNpadJoyAssignmentModeSingleByDefault"},
|
{122, &IHidServer::SetNpadJoyAssignmentModeSingleByDefault, "SetNpadJoyAssignmentModeSingleByDefault"},
|
||||||
{123, nullptr, "SetNpadJoyAssignmentModeSingle"},
|
{123, &IHidServer::SetNpadJoyAssignmentModeSingle, "SetNpadJoyAssignmentModeSingle"},
|
||||||
{124, nullptr, "SetNpadJoyAssignmentModeDual"},
|
{124, &IHidServer::SetNpadJoyAssignmentModeDual, "SetNpadJoyAssignmentModeDual"},
|
||||||
{125, nullptr, "MergeSingleJoyAsDualJoy"},
|
{125, &IHidServer::MergeSingleJoyAsDualJoy, "MergeSingleJoyAsDualJoy"},
|
||||||
{126, nullptr, "StartLrAssignmentMode"},
|
{126, &IHidServer::StartLrAssignmentMode, "StartLrAssignmentMode"},
|
||||||
{127, nullptr, "StopLrAssignmentMode"},
|
{127, &IHidServer::StopLrAssignmentMode, "StopLrAssignmentMode"},
|
||||||
{128, nullptr, "SetNpadHandheldActivationMode"},
|
{128, &IHidServer::SetNpadHandheldActivationMode, "SetNpadHandheldActivationMode"},
|
||||||
{129, nullptr, "GetNpadHandheldActivationMode"},
|
{129, &IHidServer::GetNpadHandheldActivationMode, "GetNpadHandheldActivationMode"},
|
||||||
{130, nullptr, "SwapNpadAssignment"},
|
{130, &IHidServer::SwapNpadAssignment, "SwapNpadAssignment"},
|
||||||
{131, nullptr, "IsUnintendedHomeButtonInputProtectionEnabled"},
|
{131, &IHidServer::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"},
|
||||||
{132, nullptr, "EnableUnintendedHomeButtonInputProtection"},
|
{132, &IHidServer::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"},
|
||||||
{133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"},
|
{133, &IHidServer::SetNpadJoyAssignmentModeSingleWithDestination, "SetNpadJoyAssignmentModeSingleWithDestination"},
|
||||||
{134, nullptr, "SetNpadAnalogStickUseCenterClamp"},
|
{134, &IHidServer::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"},
|
||||||
{135, nullptr, "SetNpadCaptureButtonAssignment"},
|
{135, &IHidServer::SetNpadCaptureButtonAssignment, "SetNpadCaptureButtonAssignment"},
|
||||||
{136, nullptr, "ClearNpadCaptureButtonAssignment"},
|
{136, &IHidServer::ClearNpadCaptureButtonAssignment, "ClearNpadCaptureButtonAssignment"},
|
||||||
{200, nullptr, "GetVibrationDeviceInfo"},
|
{200, &IHidServer::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"},
|
||||||
{201, nullptr, "SendVibrationValue"},
|
{201, &IHidServer::SendVibrationValue, "SendVibrationValue"},
|
||||||
{202, nullptr, "GetActualVibrationValue"},
|
{202, &IHidServer::GetActualVibrationValue, "GetActualVibrationValue"},
|
||||||
{203, nullptr, "CreateActiveVibrationDeviceList"},
|
{203, &IHidServer::CreateActiveVibrationDeviceList, "CreateActiveVibrationDeviceList"},
|
||||||
{204, nullptr, "PermitVibration"},
|
{204, &IHidServer::PermitVibration, "PermitVibration"},
|
||||||
{205, nullptr, "IsVibrationPermitted"},
|
{205, &IHidServer::IsVibrationPermitted, "IsVibrationPermitted"},
|
||||||
{206, nullptr, "SendVibrationValues"},
|
{206, &IHidServer::SendVibrationValues, "SendVibrationValues"},
|
||||||
{207, nullptr, "SendVibrationGcErmCommand"},
|
{207, &IHidServer::SendVibrationGcErmCommand, "SendVibrationGcErmCommand"},
|
||||||
{208, nullptr, "GetActualVibrationGcErmCommand"},
|
{208, &IHidServer::GetActualVibrationGcErmCommand, "GetActualVibrationGcErmCommand"},
|
||||||
{209, nullptr, "BeginPermitVibrationSession"},
|
{209, &IHidServer::BeginPermitVibrationSession, "BeginPermitVibrationSession"},
|
||||||
{210, nullptr, "EndPermitVibrationSession"},
|
{210, &IHidServer::EndPermitVibrationSession, "EndPermitVibrationSession"},
|
||||||
{211, nullptr, "IsVibrationDeviceMounted"},
|
{211, &IHidServer::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"},
|
||||||
{212, nullptr, "SendVibrationValueInBool"},
|
{212, nullptr, "SendVibrationValueInBool"},
|
||||||
{300, nullptr, "ActivateConsoleSixAxisSensor"},
|
{300, nullptr, "ActivateConsoleSixAxisSensor"},
|
||||||
{301, nullptr, "StartConsoleSixAxisSensor"},
|
{301, nullptr, "StartConsoleSixAxisSensor"},
|
||||||
|
@ -927,13 +935,13 @@ void IHidServer::IsSixAxisSensorAtRest(HLERequestContext& ctx) {
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
const auto npad = GetResourceManager()->GetNpad();
|
// const auto npad = GetResourceManager()->GetNpad();
|
||||||
const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
// const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
||||||
const bool is_at_rest = sixaxis->IsAtRest();
|
// const bool is_at_rest = sixaxis->IsAtRest();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
// IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
// rb.Push(ResultSuccess);
|
||||||
rb.Push<u8>(is_at_rest);
|
// rb.Push<u8>(is_at_rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx) {
|
void IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx) {
|
||||||
|
@ -1043,20 +1051,20 @@ void IHidServer::StoreSixAxisSensorCalibrationParameter(HLERequestContext& ctx)
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
SixAxisSensorCalibrationParameter calibration{};
|
// SixAxisSensorCalibrationParameter calibration{};
|
||||||
const auto npad = GetResourceManager()->GetNpad();
|
// const auto npad = GetResourceManager()->GetNpad();
|
||||||
const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
// const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
||||||
|
|
||||||
if (sixaxis == nullptr) {
|
// if (sixaxis == nullptr) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultUnknown108);
|
// rb.Push(ResultUnknown108);
|
||||||
}
|
// }
|
||||||
|
|
||||||
memcpy(&calibration, buffer.data(), sizeof(SixAxisSensorCalibrationParameter));
|
// memcpy(&calibration, buffer.data(), sizeof(SixAxisSensorCalibrationParameter));
|
||||||
const auto result = sixaxis.StoreSixAxisSensorCalibrationParameter(calibration);
|
// const auto result = sixaxis.StoreSixAxisSensorCalibrationParameter(calibration);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
// rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx) {
|
void IHidServer::LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx) {
|
||||||
|
@ -1076,23 +1084,23 @@ void IHidServer::LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx) {
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
SixAxisSensorCalibrationParameter calibration{};
|
// SixAxisSensorCalibrationParameter calibration{};
|
||||||
const auto npad = GetResourceManager()->GetNpad();
|
// const auto npad = GetResourceManager()->GetNpad();
|
||||||
const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
// const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
||||||
|
|
||||||
if (sixaxis == nullptr) {
|
// if (sixaxis == nullptr) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultUnknown108);
|
// rb.Push(ResultUnknown108);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const auto result = sixaxis.LoadSixAxisSensorCalibrationParameter(calibration);
|
// const auto result = sixaxis.LoadSixAxisSensorCalibrationParameter(calibration);
|
||||||
|
|
||||||
if (result.IsSuccess()) {
|
// if (result.IsSuccess()) {
|
||||||
ctx.WriteBuffer(calibration);
|
// ctx.WriteBuffer(calibration);
|
||||||
}
|
// }
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
// rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::GetSixAxisSensorIcInformation(HLERequestContext& ctx) {
|
void IHidServer::GetSixAxisSensorIcInformation(HLERequestContext& ctx) {
|
||||||
|
@ -1112,23 +1120,23 @@ void IHidServer::GetSixAxisSensorIcInformation(HLERequestContext& ctx) {
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
SixAxisSensorIcInformation ic_information{};
|
// SixAxisSensorIcInformation ic_information{};
|
||||||
const auto npad = GetResourceManager()->GetNpad();
|
// const auto npad = GetResourceManager()->GetNpad();
|
||||||
const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
// const auto sixaxis = npad()->GetNpadSharedMemory(parameters.sixaxis_handle);
|
||||||
|
|
||||||
if (sixaxis == nullptr) {
|
// if (sixaxis == nullptr) {
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultUnknown108);
|
// rb.Push(ResultUnknown108);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const auto result = sixaxis.GetSixAxisSensorIcInformation(ic_information);
|
// const auto result = sixaxis.GetSixAxisSensorIcInformation(ic_information);
|
||||||
|
|
||||||
if (result.IsSuccess()) {
|
// if (result.IsSuccess()) {
|
||||||
ctx.WriteBuffer(ic_information);
|
// ctx.WriteBuffer(ic_information);
|
||||||
}
|
// }
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
// IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(result);
|
// rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx) {
|
void IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx) {
|
||||||
|
@ -1156,6 +1164,337 @@ void IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx)
|
||||||
rb.Push(result);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IHidServer::ActivateGesture(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
u32 basic_gesture_id;
|
||||||
|
INSERT_PADDING_WORDS_NOINIT(1);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, basic_gesture_id={}, applet_resource_user_id={}",
|
||||||
|
parameters.basic_gesture_id, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
Result result = ResultSuccess;
|
||||||
|
auto gesture = GetResourceManager()->GetGesture();
|
||||||
|
|
||||||
|
if (IsDeviceManaged()) {
|
||||||
|
result = gesture->Activate(parameters.applet_resource_user_id, parameters.basic_gesture_id);
|
||||||
|
} else {
|
||||||
|
result = gesture->Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::SetSupportedNpadStyleSet(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
NpadStyleSet supported_style_set;
|
||||||
|
INSERT_PADDING_WORDS_NOINIT(1);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, supported_style_set={}, applet_resource_user_id={}",
|
||||||
|
parameters.supported_style_set, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result = npad->SetSupportedNpadStyleSet(parameters.applet_resource_user_id,
|
||||||
|
parameters.supported_style_set);
|
||||||
|
|
||||||
|
if (result.IsSuccess()) {
|
||||||
|
// NpadStyleTag style_tag{parameters.supported_style_set};
|
||||||
|
// u32 aruid_index = GetResourceManager()->GetValue(parameters.applet_resource_user_id);
|
||||||
|
// if (style_tag.gamecube != 0 && aruid_index < 3) {
|
||||||
|
// const auto palma = GetResourceManager()->GetPalma();
|
||||||
|
// palma->EnablePalmaBoostMode(parameters.applet_resource_user_id, true);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetSupportedNpadStyleSet(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
NpadStyleSet supported_style_set{};
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result =
|
||||||
|
npad->GetSupportedNpadStyleSet(applet_resource_user_id, supported_style_set);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(result);
|
||||||
|
rb.PushEnum(supported_style_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::SetSupportedNpadIdType(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
const auto buffer = ctx.ReadBuffer();
|
||||||
|
const std::size_t elements = ctx.GetReadBufferNumElements<NpadIdType>();
|
||||||
|
|
||||||
|
std::vector<NpadIdType> npad_list(elements);
|
||||||
|
memcpy(npad_list.data(), buffer.data(), buffer.size());
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result = npad->SetSupportedNpadIdType(applet_resource_user_id, npad_list);
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::ActivateNpad(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
npad->ActivateWithRevision(applet_resource_user_id, 0);
|
||||||
|
const auto result = npad->Activate(applet_resource_user_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::DeactivateNpad(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
// This function does nothing since 10.0.0+
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
NpadIdType npad_id;
|
||||||
|
INSERT_PADDING_WORDS_NOINIT(1);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
u64 unknown;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
|
||||||
|
|
||||||
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}, unknown={}",
|
||||||
|
parameters.npad_id, parameters.applet_resource_user_id, parameters.unknown);
|
||||||
|
|
||||||
|
Kernel::KReadableEvent* out_event = nullptr;
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result = npad->AcquireNpadStyleSetUpdateEventHandle(
|
||||||
|
parameters.applet_resource_user_id, &out_event, parameters.npad_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(result);
|
||||||
|
rb.PushCopyObjects(out_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::DisconnectNpad(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
NpadIdType npad_id;
|
||||||
|
INSERT_PADDING_WORDS_NOINIT(1);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, npad_id={}, applet_resource_user_id={}", parameters.npad_id,
|
||||||
|
parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
npad->DisconnectNpad(parameters.applet_resource_user_id, parameters.npad_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetPlayerLedPattern(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto npad_id{rp.PopEnum<NpadIdType>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id);
|
||||||
|
|
||||||
|
LedPattern pattern{0, 0, 0, 0};
|
||||||
|
switch (npad_id) {
|
||||||
|
case NpadIdType::Player1:
|
||||||
|
pattern = LedPattern{1, 0, 0, 0};
|
||||||
|
case NpadIdType::Player2:
|
||||||
|
pattern = LedPattern{1, 1, 0, 0};
|
||||||
|
case NpadIdType::Player3:
|
||||||
|
pattern = LedPattern{1, 1, 1, 0};
|
||||||
|
case NpadIdType::Player4:
|
||||||
|
pattern = LedPattern{1, 1, 1, 1};
|
||||||
|
case NpadIdType::Player5:
|
||||||
|
pattern = LedPattern{1, 0, 0, 1};
|
||||||
|
case NpadIdType::Player6:
|
||||||
|
pattern = LedPattern{1, 0, 1, 0};
|
||||||
|
case NpadIdType::Player7:
|
||||||
|
pattern = LedPattern{1, 0, 1, 1};
|
||||||
|
case NpadIdType::Player8:
|
||||||
|
pattern = LedPattern{0, 1, 1, 0};
|
||||||
|
case NpadIdType::Other:
|
||||||
|
case NpadIdType::Handheld:
|
||||||
|
pattern = LedPattern{0, 0, 0, 0};
|
||||||
|
default:
|
||||||
|
// This should crash console
|
||||||
|
ASSERT_MSG("Invalid npad id type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.Push(pattern.raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::ActivateNpadWithRevision(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
s32 revision;
|
||||||
|
INSERT_PADDING_WORDS_NOINIT(1);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, revision={}, applet_resource_user_id={}", parameters.revision,
|
||||||
|
parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
npad->ActivateWithRevision(parameters.applet_resource_user_id, parameters.revision);
|
||||||
|
const auto result = npad->Activate(parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::SetNpadJoyHoldType(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
const auto hold_type{rp.PopEnum<NpadJoyHoldType>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, hold_type={}",
|
||||||
|
applet_resource_user_id, hold_type);
|
||||||
|
|
||||||
|
if (hold_type != NpadJoyHoldType::Horizontal && hold_type != NpadJoyHoldType::Vertical) {
|
||||||
|
// This should crash console
|
||||||
|
ASSERT_MSG("Invalid npad joy hold type");
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result = npad->SetNpadJoyHoldType(applet_resource_user_id, hold_type);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::GetNpadJoyHoldType(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
NpadJoyHoldType hold_type{};
|
||||||
|
const auto npad = GetResourceManager()->GetNpad();
|
||||||
|
const auto result = npad->GetNpadJoyHoldType(applet_resource_user_id, hold_type);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(result);
|
||||||
|
rb.PushEnum(hold_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IHidServer::SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadJoyAssignmentModeDual(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::MergeSingleJoyAsDualJoy(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StartLrAssignmentMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StopLrAssignmentMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadHandheldActivationMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetNpadHandheldActivationMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SwapNpadAssignment(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadCaptureButtonAssignment(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SendVibrationValue(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetActualVibrationValue(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::CreateActiveVibrationDeviceList(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::PermitVibration(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::IsVibrationPermitted(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SendVibrationValues(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::BeginPermitVibrationSession(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::EndPermitVibrationSession(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::IsVibrationDeviceMounted(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ActivateConsoleSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StartConsoleSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StopConsoleSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ActivateSevenSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StartSevenSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::StopSevenSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::InitializeSevenSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::FinalizeSevenSixAxisSensor(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetPalmaConnectionHandle(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::InitializePalma(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetPalmaOperationInfo(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::PlayPalmaActivity(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetPalmaFrModeType(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ReadPalmaStep(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::EnablePalmaStep(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ResetPalmaStep(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ReadPalmaApplicationSection(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::WritePalmaApplicationSection(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ReadPalmaUniqueCode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetPalmaUniqueCodeInvalid(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::WritePalmaActivityEntry(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::WritePalmaRgbLedPatternEntry(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::WritePalmaWaveEntry(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SuspendPalmaFeature(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetPalmaOperationResult(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ReadPalmaPlayLog(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::ResetPalmaPlayLog(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetIsPalmaAllConnectable(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetIsPalmaPairedConnectable(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::PairPalma(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetPalmaBoostMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::CancelWritePalmaWaveEntry(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::EnablePalmaBoostMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetPalmaBluetoothAddress(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetDisallowedPalmaConnection(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetNpadCommunicationMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::GetNpadCommunicationMode(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::SetTouchScreenConfiguration(HLERequestContext& ctx) {}
|
||||||
|
void IHidServer::IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx) {}
|
||||||
|
|
||||||
bool IHidServer::IsDeviceManaged() {
|
bool IHidServer::IsDeviceManaged() {
|
||||||
InitializeDebugSettings();
|
InitializeDebugSettings();
|
||||||
return is_device_managed;
|
return is_device_managed;
|
||||||
|
|
|
@ -70,6 +70,89 @@ private:
|
||||||
void LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx);
|
void LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx);
|
||||||
void GetSixAxisSensorIcInformation(HLERequestContext& ctx);
|
void GetSixAxisSensorIcInformation(HLERequestContext& ctx);
|
||||||
void ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx);
|
void ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx);
|
||||||
|
void ActivateGesture(HLERequestContext& ctx);
|
||||||
|
void SetSupportedNpadStyleSet(HLERequestContext& ctx);
|
||||||
|
void GetSupportedNpadStyleSet(HLERequestContext& ctx);
|
||||||
|
void SetSupportedNpadIdType(HLERequestContext& ctx);
|
||||||
|
void ActivateNpad(HLERequestContext& ctx);
|
||||||
|
void DeactivateNpad(HLERequestContext& ctx);
|
||||||
|
void AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx);
|
||||||
|
void DisconnectNpad(HLERequestContext& ctx);
|
||||||
|
void GetPlayerLedPattern(HLERequestContext& ctx);
|
||||||
|
void ActivateNpadWithRevision(HLERequestContext& ctx);
|
||||||
|
void SetNpadJoyHoldType(HLERequestContext& ctx);
|
||||||
|
void GetNpadJoyHoldType(HLERequestContext& ctx);
|
||||||
|
void SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx);
|
||||||
|
void SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx);
|
||||||
|
void SetNpadJoyAssignmentModeDual(HLERequestContext& ctx);
|
||||||
|
void MergeSingleJoyAsDualJoy(HLERequestContext& ctx);
|
||||||
|
void StartLrAssignmentMode(HLERequestContext& ctx);
|
||||||
|
void StopLrAssignmentMode(HLERequestContext& ctx);
|
||||||
|
void SetNpadHandheldActivationMode(HLERequestContext& ctx);
|
||||||
|
void GetNpadHandheldActivationMode(HLERequestContext& ctx);
|
||||||
|
void SwapNpadAssignment(HLERequestContext& ctx);
|
||||||
|
void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx);
|
||||||
|
void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx);
|
||||||
|
void SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx);
|
||||||
|
void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx);
|
||||||
|
void SetNpadCaptureButtonAssignment(HLERequestContext& ctx);
|
||||||
|
void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx);
|
||||||
|
void GetVibrationDeviceInfo(HLERequestContext& ctx);
|
||||||
|
void SendVibrationValue(HLERequestContext& ctx);
|
||||||
|
void GetActualVibrationValue(HLERequestContext& ctx);
|
||||||
|
void CreateActiveVibrationDeviceList(HLERequestContext& ctx);
|
||||||
|
void PermitVibration(HLERequestContext& ctx);
|
||||||
|
void IsVibrationPermitted(HLERequestContext& ctx);
|
||||||
|
void SendVibrationValues(HLERequestContext& ctx);
|
||||||
|
void SendVibrationGcErmCommand(HLERequestContext& ctx);
|
||||||
|
void GetActualVibrationGcErmCommand(HLERequestContext& ctx);
|
||||||
|
void BeginPermitVibrationSession(HLERequestContext& ctx);
|
||||||
|
void EndPermitVibrationSession(HLERequestContext& ctx);
|
||||||
|
void IsVibrationDeviceMounted(HLERequestContext& ctx);
|
||||||
|
void ActivateConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void StartConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void StopConsoleSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void ActivateSevenSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void StartSevenSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void StopSevenSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void InitializeSevenSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void FinalizeSevenSixAxisSensor(HLERequestContext& ctx);
|
||||||
|
void ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx);
|
||||||
|
void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx);
|
||||||
|
void GetPalmaConnectionHandle(HLERequestContext& ctx);
|
||||||
|
void InitializePalma(HLERequestContext& ctx);
|
||||||
|
void AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx);
|
||||||
|
void GetPalmaOperationInfo(HLERequestContext& ctx);
|
||||||
|
void PlayPalmaActivity(HLERequestContext& ctx);
|
||||||
|
void SetPalmaFrModeType(HLERequestContext& ctx);
|
||||||
|
void ReadPalmaStep(HLERequestContext& ctx);
|
||||||
|
void EnablePalmaStep(HLERequestContext& ctx);
|
||||||
|
void ResetPalmaStep(HLERequestContext& ctx);
|
||||||
|
void ReadPalmaApplicationSection(HLERequestContext& ctx);
|
||||||
|
void WritePalmaApplicationSection(HLERequestContext& ctx);
|
||||||
|
void ReadPalmaUniqueCode(HLERequestContext& ctx);
|
||||||
|
void SetPalmaUniqueCodeInvalid(HLERequestContext& ctx);
|
||||||
|
void WritePalmaActivityEntry(HLERequestContext& ctx);
|
||||||
|
void WritePalmaRgbLedPatternEntry(HLERequestContext& ctx);
|
||||||
|
void WritePalmaWaveEntry(HLERequestContext& ctx);
|
||||||
|
void SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
|
||||||
|
void GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
|
||||||
|
void SuspendPalmaFeature(HLERequestContext& ctx);
|
||||||
|
void GetPalmaOperationResult(HLERequestContext& ctx);
|
||||||
|
void ReadPalmaPlayLog(HLERequestContext& ctx);
|
||||||
|
void ResetPalmaPlayLog(HLERequestContext& ctx);
|
||||||
|
void SetIsPalmaAllConnectable(HLERequestContext& ctx);
|
||||||
|
void SetIsPalmaPairedConnectable(HLERequestContext& ctx);
|
||||||
|
void PairPalma(HLERequestContext& ctx);
|
||||||
|
void SetPalmaBoostMode(HLERequestContext& ctx);
|
||||||
|
void CancelWritePalmaWaveEntry(HLERequestContext& ctx);
|
||||||
|
void EnablePalmaBoostMode(HLERequestContext& ctx);
|
||||||
|
void GetPalmaBluetoothAddress(HLERequestContext& ctx);
|
||||||
|
void SetDisallowedPalmaConnection(HLERequestContext& ctx);
|
||||||
|
void SetNpadCommunicationMode(HLERequestContext& ctx);
|
||||||
|
void GetNpadCommunicationMode(HLERequestContext& ctx);
|
||||||
|
void SetTouchScreenConfiguration(HLERequestContext& ctx);
|
||||||
|
void IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx);
|
||||||
|
|
||||||
bool IsDeviceManaged();
|
bool IsDeviceManaged();
|
||||||
void InitializeDebugSettings();
|
void InitializeDebugSettings();
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "core/hle/result.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
|
||||||
|
|
||||||
constexpr Result PalmaResultSuccess{ErrorModule::HID, 0};
|
|
||||||
constexpr Result NpadInvalidHandle{ErrorModule::HID, 100};
|
|
||||||
constexpr Result NpadDeviceIndexOutOfRange{ErrorModule::HID, 107};
|
|
||||||
constexpr Result VibrationInvalidStyleIndex{ErrorModule::HID, 122};
|
|
||||||
constexpr Result VibrationInvalidNpadId{ErrorModule::HID, 123};
|
|
||||||
constexpr Result VibrationDeviceIndexOutOfRange{ErrorModule::HID, 124};
|
|
||||||
constexpr Result InvalidSixAxisFusionRange{ErrorModule::HID, 423};
|
|
||||||
constexpr Result NpadIsDualJoycon{ErrorModule::HID, 601};
|
|
||||||
constexpr Result NpadIsSameType{ErrorModule::HID, 602};
|
|
||||||
constexpr Result InvalidNpadId{ErrorModule::HID, 709};
|
|
||||||
constexpr Result NpadNotConnected{ErrorModule::HID, 710};
|
|
||||||
constexpr Result InvalidArraySize{ErrorModule::HID, 715};
|
|
||||||
|
|
||||||
constexpr Result ResultUnknown108{ErrorModule::HID, 108};
|
|
||||||
|
|
||||||
constexpr Result InvalidPalmaHandle{ErrorModule::HID, 3302};
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
|
|
@ -1,14 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_util.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/npad.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
|
||||||
|
|
||||||
Npad::Npad() {}
|
|
||||||
|
|
||||||
Npad::~Npad() = default;
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
|
|
@ -317,9 +317,19 @@ struct NpadStyleTag {
|
||||||
BitField<29, 1, u32> system_ext;
|
BitField<29, 1, u32> system_ext;
|
||||||
BitField<30, 1, u32> system;
|
BitField<30, 1, u32> system;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NpadStyleTag(NpadStyleSet style_set) {
|
||||||
|
raw = style_set;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NpadStyleTag) == 4, "NpadStyleTag is an invalid size");
|
static_assert(sizeof(NpadStyleTag) == 4, "NpadStyleTag is an invalid size");
|
||||||
|
|
||||||
|
// This is nn::hid::NpadJoyHoldType
|
||||||
|
enum class NpadJoyHoldType : u64 {
|
||||||
|
Vertical = 0,
|
||||||
|
Horizontal = 1,
|
||||||
|
};
|
||||||
|
|
||||||
// This is nn::hid::TouchAttribute
|
// This is nn::hid::TouchAttribute
|
||||||
struct TouchAttribute {
|
struct TouchAttribute {
|
||||||
union {
|
union {
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ constexpr size_t NpadIdTypeToIndex(NpadIdType npad_id_type) {
|
||||||
case NpadIdType::Other:
|
case NpadIdType::Other:
|
||||||
return 9;
|
return 9;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,11 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_util.h"
|
|
||||||
#include "core/hle/service/hid/resource_manager.h"
|
#include "core/hle/service/hid/resource_manager.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
DebugPad::DebugPad() {}
|
/* std::shared_ptr<NpadSharedMemory> SharedMemory::GetNpadSharedMemory(
|
||||||
|
|
||||||
DebugPad::~DebugPad() = default;
|
|
||||||
|
|
||||||
Result DebugPad::Activate() {
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result DebugPad::Activate(u64 aruid) {
|
|
||||||
return ResultSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
NpadSharedMemory::NpadSharedMemory() {}
|
|
||||||
|
|
||||||
bool NpadSharedMemory::IsAtRest() const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedMemory::SharedMemory() {}
|
|
||||||
|
|
||||||
std::shared_ptr<NpadSharedMemory> SharedMemory::GetNpadSharedMemory(
|
|
||||||
SixAxisSensorHandle handle) const {
|
SixAxisSensorHandle handle) const {
|
||||||
// TODO: THIS REE IS BROKEN
|
// TODO: THIS REE IS BROKEN
|
||||||
|
|
||||||
|
@ -79,7 +57,7 @@ std::shared_ptr<NpadSharedMemory> SharedMemory::GetNpadSharedMemory(
|
||||||
}
|
}
|
||||||
|
|
||||||
return player_memory;
|
return player_memory;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
ResourceManager::ResourceManager(Core::System& system_) {}
|
ResourceManager::ResourceManager(Core::System& system_) {}
|
||||||
|
|
||||||
|
@ -91,29 +69,32 @@ std::shared_ptr<DebugPad> ResourceManager::GetDebugPad() {
|
||||||
return debug_pad;
|
return debug_pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<DebugPad> ResourceManager::GetTouchScreen() {
|
std::shared_ptr<Gesture> ResourceManager::GetGesture() {
|
||||||
return debug_pad;
|
return gesture;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<DebugPad> ResourceManager::GetMouse() {
|
std::shared_ptr<Keyboard> ResourceManager::GetKeyboard() {
|
||||||
return debug_pad;
|
return keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<DebugPad> ResourceManager::GetKeyboard() {
|
std::shared_ptr<Mouse> ResourceManager::GetMouse() {
|
||||||
return debug_pad;
|
return mouse;
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<SixAxis> ResourceManager::GetSixAxis() {
|
|
||||||
return sixaxis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Npad> ResourceManager::GetNpad() {
|
std::shared_ptr<Npad> ResourceManager::GetNpad() {
|
||||||
return npad;
|
return npad;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<NpadSharedMemory> ResourceManager::GetNpadSharedMemory(
|
std::shared_ptr<Palma> ResourceManager::GetPalma() {
|
||||||
SixAxisSensorHandle handle) const {
|
return palma;
|
||||||
return shared_memory.GetNpadSharedMemory(handle);
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<SixAxis> ResourceManager::GetSixAxis() {
|
||||||
|
return sixaxis;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TouchScreen> ResourceManager::GetTouchScreen() {
|
||||||
|
return touch_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
|
@ -10,37 +10,17 @@ class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
struct SixAxisSensorHandle;
|
class DebugPad;
|
||||||
class SixAxis;
|
class Gesture;
|
||||||
|
class Keyboard;
|
||||||
|
class Mouse;
|
||||||
class Npad;
|
class Npad;
|
||||||
|
class Palma;
|
||||||
|
class SixAxis;
|
||||||
|
class TouchScreen;
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
class DebugPad {
|
|
||||||
public:
|
|
||||||
explicit DebugPad();
|
|
||||||
~DebugPad();
|
|
||||||
|
|
||||||
Result Activate();
|
|
||||||
Result Activate(u64 aruid);
|
|
||||||
};
|
|
||||||
|
|
||||||
class NpadSharedMemory {
|
|
||||||
public:
|
|
||||||
explicit NpadSharedMemory();
|
|
||||||
bool IsAtRest() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SharedMemory {
|
|
||||||
public:
|
|
||||||
explicit SharedMemory();
|
|
||||||
std::shared_ptr<NpadSharedMemory> GetNpadSharedMemory(SixAxisSensorHandle handle) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static constexpr std::size_t PLAYERS_MAX = 10;
|
|
||||||
|
|
||||||
std::array<std::shared_ptr<NpadSharedMemory>, PLAYERS_MAX> npad_shared_memory{};
|
|
||||||
};
|
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
public:
|
public:
|
||||||
|
@ -50,19 +30,23 @@ public:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
std::shared_ptr<DebugPad> GetDebugPad();
|
std::shared_ptr<DebugPad> GetDebugPad();
|
||||||
std::shared_ptr<DebugPad> GetTouchScreen();
|
std::shared_ptr<Gesture> GetGesture();
|
||||||
std::shared_ptr<DebugPad> GetMouse();
|
std::shared_ptr<Keyboard> GetKeyboard();
|
||||||
std::shared_ptr<DebugPad> GetKeyboard();
|
std::shared_ptr<Mouse> GetMouse();
|
||||||
std::shared_ptr<SixAxis> GetSixAxis();
|
|
||||||
std::shared_ptr<Npad> GetNpad();
|
std::shared_ptr<Npad> GetNpad();
|
||||||
|
std::shared_ptr<Palma> GetPalma();
|
||||||
|
std::shared_ptr<SixAxis> GetSixAxis();
|
||||||
|
std::shared_ptr<TouchScreen> GetTouchScreen();
|
||||||
|
|
||||||
std::shared_ptr<NpadSharedMemory> GetNpadSharedMemory(SixAxisSensorHandle handle) const;
|
|
||||||
|
|
||||||
std::shared_ptr<SixAxis> sixaxis = nullptr;
|
|
||||||
std::shared_ptr<Npad> npad = nullptr;
|
|
||||||
std::shared_ptr<DebugPad> debug_pad = nullptr;
|
std::shared_ptr<DebugPad> debug_pad = nullptr;
|
||||||
|
std::shared_ptr<Gesture> gesture = nullptr;
|
||||||
SharedMemory shared_memory{};
|
std::shared_ptr<Keyboard> keyboard = nullptr;
|
||||||
|
std::shared_ptr<Mouse> mouse = nullptr;
|
||||||
|
std::shared_ptr<Npad> npad = nullptr;
|
||||||
|
std::shared_ptr<Palma> palma = nullptr;
|
||||||
|
std::shared_ptr<SixAxis> sixaxis = nullptr;
|
||||||
|
std::shared_ptr<TouchScreen> touch_screen = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/am/applets/applets.h"
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
#include "core/hle/service/hid/hid_server/base_resource.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/service/hid/resource_manager.h"
|
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
constexpr std::size_t ARUID_MAX = 0x20;
|
constexpr std::size_t ARUID_MAX = 0x20;
|
||||||
constexpr std::size_t PLAYERS_MAX = 10;
|
constexpr std::size_t PLAYERS_MAX = 10;
|
||||||
|
constexpr std::size_t SUPPORTED_NPAD_TYPES_MAX = 11;
|
||||||
|
|
||||||
class BaseResource {
|
class BaseResource {
|
||||||
public:
|
public:
|
|
@ -0,0 +1,24 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/debug_pad.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
DebugPad::DebugPad() {}
|
||||||
|
|
||||||
|
DebugPad::~DebugPad() = default;
|
||||||
|
|
||||||
|
Result DebugPad::Activate(const u64 aruid) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result DebugPad::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,30 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class DebugPad final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit DebugPad();
|
||||||
|
~DebugPad();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool is_activated;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,24 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/gesture.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
Gesture::Gesture() {}
|
||||||
|
|
||||||
|
Gesture::~Gesture() = default;
|
||||||
|
|
||||||
|
Result Gesture::Activate(const u64 aruid, const u32 basic_gesture_id) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Gesture::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,31 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class Gesture final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit Gesture();
|
||||||
|
~Gesture();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid, const u32 basic_gesture_id);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool is_activated;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,23 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/keyboard.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
Keyboard::Keyboard() {}
|
||||||
|
|
||||||
|
Keyboard::~Keyboard() = default;
|
||||||
|
|
||||||
|
Result Keyboard::Activate(const u64 aruid) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Keyboard::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,31 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class Keyboard final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit Keyboard();
|
||||||
|
~Keyboard();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool is_activated;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,23 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/mouse.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
Mouse::Mouse() {}
|
||||||
|
|
||||||
|
Mouse::~Mouse() = default;
|
||||||
|
|
||||||
|
Result Mouse::Activate(const u64 aruid) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Mouse::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
} // namespace Service::HID
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/base_resource.h"
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
|
@ -16,14 +16,16 @@ namespace Service::HID {
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
class Npad final : public BaseResource {
|
class Mouse final : public BaseResource {
|
||||||
public:
|
public:
|
||||||
explicit Npad();
|
explicit Mouse();
|
||||||
~Npad();
|
~Mouse();
|
||||||
|
|
||||||
bool IsFirmwareUpdateAvailableForSixAxisSensor(const SixAxisSensorHandle& handle);
|
Result Activate(const u64 aruid);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool is_activated;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
|
@ -0,0 +1,290 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/kernel/k_event.h"
|
||||||
|
#include "core/hle/service/hid/hid_result.h"
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/npad.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
NpadControllerState::NpadControllerState() {}
|
||||||
|
|
||||||
|
NpadControllerState::~NpadControllerState() = default;
|
||||||
|
|
||||||
|
NpadIdType NpadControllerState::GetNpadId() const {
|
||||||
|
return npad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpadControllerState::Update() {}
|
||||||
|
|
||||||
|
Kernel::KReadableEvent& NpadControllerState::GetNpadStyleSetUpdateEvent() {
|
||||||
|
return style_set_update_event->GetReadableEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpadControllerState::SignalStyleSetUpdateEvent() {
|
||||||
|
style_set_update_event->Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
NpadState::NpadState() {}
|
||||||
|
|
||||||
|
NpadState::~NpadState() = default;
|
||||||
|
|
||||||
|
std::shared_ptr<NpadControllerState> NpadState::GetControllerState(
|
||||||
|
const NpadIdType& npad_id) const {
|
||||||
|
return state[NpadIdTypeToIndex(npad_id)];
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpadState::SetNpadJoyHoldType(const NpadJoyHoldType hold_type) {
|
||||||
|
status.is_hold_type_set.Assign(1);
|
||||||
|
npad_hold_type = hold_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
NpadJoyHoldType NpadState::GetNpadJoyHoldType() {
|
||||||
|
return npad_hold_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result NpadState::SetSupportedNpadIdType(std::span<const NpadIdType> list) {
|
||||||
|
if (list.size() >= SUPPORTED_NPAD_TYPES_MAX) {
|
||||||
|
return ResultInvalidArraySize;
|
||||||
|
}
|
||||||
|
|
||||||
|
supported_npad_id_types_count = list.size();
|
||||||
|
memcpy(supported_npad_id_types.data(), list.data(), list.size_bytes());
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpadState::SetSupportedNpadStyleSet(const NpadStyleSet supported_style_set) {
|
||||||
|
status.is_supported_style_set.Assign(1);
|
||||||
|
status.is_hold_type_set.Assign(1);
|
||||||
|
supported_npad_style_set = supported_style_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
NpadStyleSet NpadState::GetSupportedNpadStyleSet() {
|
||||||
|
return supported_npad_style_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
Npad::Npad() {}
|
||||||
|
|
||||||
|
Npad::~Npad() = default;
|
||||||
|
|
||||||
|
Result Npad::Activate(const u64 aruid) {
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::ActivateWithRevision(const u64 aruid, const s32 revision) {
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npad::DisconnectNpad(const u64 aruid, const NpadIdType npad_id) {
|
||||||
|
if (aruid != GetNpadActiveAruid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto state = active_npad_state->GetControllerState(npad_id);
|
||||||
|
DisconnectAbstractPad(state->GetNpadId());
|
||||||
|
state->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npad::ForceDisconnectNpad(const NpadIdType npad_id) {
|
||||||
|
DisconnectNpad(GetNpadActiveAruid(), npad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npad::DisconnectAbstractPad(const NpadIdType npad_id) {}
|
||||||
|
|
||||||
|
Result Npad::SetNpadJoyHoldType(const u64 aruid, const NpadJoyHoldType hold_type) {
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
npad_state[index]->SetNpadJoyHoldType(hold_type);
|
||||||
|
if (active_aruid == aruid) {
|
||||||
|
active_npad_state->SetNpadJoyHoldType(hold_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::GetNpadJoyHoldType(const u64 aruid, NpadJoyHoldType& hold_type) {
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto state = npad_state[index];
|
||||||
|
hold_type = state->GetNpadJoyHoldType();
|
||||||
|
if ((state->status.raw & 0x30) != 0) {
|
||||||
|
hold_type = active_npad_state->GetNpadJoyHoldType();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::SetSupportedNpadIdType(const u64 aruid, std::span<const NpadIdType> list) {
|
||||||
|
if (list.size() >= SUPPORTED_NPAD_TYPES_MAX) {
|
||||||
|
return ResultInvalidArraySize;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result result = SetSupportedNpadIdTypeImpl(aruid, list);
|
||||||
|
|
||||||
|
if (result.IsSuccess()) {
|
||||||
|
UpdateSupportedNpadIdType();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::SetSupportedNpadIdTypeImpl(const u64 aruid, std::span<const NpadIdType> list) {
|
||||||
|
if (list.size() >= SUPPORTED_NPAD_TYPES_MAX) {
|
||||||
|
return ResultInvalidArraySize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result result = npad_state[index]->SetSupportedNpadIdType(list);
|
||||||
|
|
||||||
|
if (active_aruid == aruid && result.IsSuccess()) {
|
||||||
|
result = active_npad_state->SetSupportedNpadIdType(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::SetSupportedNpadStyleSet(const u64 aruid, const NpadStyleSet supported_style_set) {
|
||||||
|
const Result result = SetSupportedNpadStyleSetImpl(aruid, supported_style_set);
|
||||||
|
|
||||||
|
if (result.IsSuccess()) {
|
||||||
|
UpdateSupportedStyleSet();
|
||||||
|
// SetIsPalmaPairedConnectable();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::SetSupportedNpadStyleSetImpl(const u64 aruid, const NpadStyleSet supported_style_set) {
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
npad_state[index]->SetSupportedNpadStyleSet(supported_style_set);
|
||||||
|
|
||||||
|
if (active_aruid == aruid) {
|
||||||
|
active_npad_state->SetSupportedNpadStyleSet(supported_style_set);
|
||||||
|
active_npad_state->SetNpadJoyHoldType(npad_state[index]->GetNpadJoyHoldType());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::GetSupportedNpadStyleSet(const u64 aruid, NpadStyleSet& supported_style_set) {
|
||||||
|
const Result result = GetSupportedNpadStyleSetImpl(aruid, supported_style_set);
|
||||||
|
|
||||||
|
if (result == ResultNpadNotConnected) {
|
||||||
|
supported_style_set = NpadStyleSet::None;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::GetSupportedNpadStyleSetImpl(const u64 aruid, NpadStyleSet& supported_style_set) {
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (npad_state[index]->status.is_supported_style_set == 0) {
|
||||||
|
return ResultUndefinedStyleSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
supported_style_set = npad_state[index]->GetSupportedNpadStyleSet();
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Npad::IsFirmwareUpdateAvailableForSixAxisSensor(const SixAxisSensorHandle& handle) {
|
||||||
|
// Not implemented
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::ResetIsSixAxisSensorDeviceNewlyAssigned(const u64 aruid,
|
||||||
|
const SixAxisSensorHandle& handle) {
|
||||||
|
// auto npad_index = NpadIdTypeToIndex(static_cast<NpadIdType>(handle.device_index));
|
||||||
|
|
||||||
|
// TODO: Implement this part
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Npad::AcquireNpadStyleSetUpdateEventHandle(const u64 aruid,
|
||||||
|
Kernel::KReadableEvent** out_event,
|
||||||
|
const NpadIdType npad_id) {
|
||||||
|
const auto index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
|
if (index >= ARUID_MAX) {
|
||||||
|
return ResultNpadNotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is greatly simplified. The event should be created here on first call
|
||||||
|
|
||||||
|
auto state = npad_state[index]->GetControllerState(npad_id);
|
||||||
|
*out_event = &state->GetNpadStyleSetUpdateEvent();
|
||||||
|
state->SignalStyleSetUpdateEvent();
|
||||||
|
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npad::UpdateSupportedNpadIdType() {
|
||||||
|
// Set some u64
|
||||||
|
// Call DisconnectAbstracPads(u64)
|
||||||
|
// Call ConnectAbstractPads(u64)
|
||||||
|
|
||||||
|
auto state = active_npad_state; // Verify this
|
||||||
|
state->GetControllerState(NpadIdType::Player1)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player2)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player3)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player4)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player5)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player6)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player7)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player8)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Other)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Handheld)->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npad::UpdateSupportedStyleSet() {
|
||||||
|
// Set some u64
|
||||||
|
// Call FUN_7100063e68(u64)
|
||||||
|
// Call FUN_7100063fc0(u64)
|
||||||
|
// Call ConnectAbstractPads(u64)
|
||||||
|
|
||||||
|
auto state = active_npad_state; // Verify this
|
||||||
|
state->GetControllerState(NpadIdType::Player1)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player2)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player3)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player4)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player5)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player6)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player7)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Player8)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Other)->Update();
|
||||||
|
state->GetControllerState(NpadIdType::Handheld)->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 Npad::GetNpadActiveAruid() {
|
||||||
|
return active_aruid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,122 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KReadableEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
enum class NpadIdType : u32;
|
||||||
|
enum class NpadStyleSet : u32;
|
||||||
|
enum class NpadJoyHoldType : u64;
|
||||||
|
|
||||||
|
struct SixAxisSensorHandle;
|
||||||
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class NpadControllerState {
|
||||||
|
public:
|
||||||
|
explicit NpadControllerState();
|
||||||
|
~NpadControllerState();
|
||||||
|
|
||||||
|
NpadIdType GetNpadId() const;
|
||||||
|
void Update();
|
||||||
|
|
||||||
|
Kernel::KReadableEvent& GetNpadStyleSetUpdateEvent();
|
||||||
|
void SignalStyleSetUpdateEvent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
NpadIdType npad_id;
|
||||||
|
|
||||||
|
Kernel::KEvent* style_set_update_event = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NpadState {
|
||||||
|
public:
|
||||||
|
struct NpadStatus {
|
||||||
|
union {
|
||||||
|
u32 raw{};
|
||||||
|
|
||||||
|
BitField<0, 1, u32> is_supported_style_set;
|
||||||
|
BitField<1, 1, u32> is_hold_type_set;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(NpadStatus) == 4, "NpadStatus is an invalid size");
|
||||||
|
|
||||||
|
explicit NpadState();
|
||||||
|
~NpadState();
|
||||||
|
|
||||||
|
std::shared_ptr<NpadControllerState> GetControllerState(const NpadIdType& npad_id) const;
|
||||||
|
|
||||||
|
void SetNpadJoyHoldType(const NpadJoyHoldType hold_type);
|
||||||
|
NpadJoyHoldType GetNpadJoyHoldType();
|
||||||
|
|
||||||
|
Result SetSupportedNpadIdType(std::span<const NpadIdType> list);
|
||||||
|
|
||||||
|
void SetSupportedNpadStyleSet(const NpadStyleSet supported_style_set);
|
||||||
|
NpadStyleSet GetSupportedNpadStyleSet();
|
||||||
|
|
||||||
|
NpadStatus status{};
|
||||||
|
|
||||||
|
private:
|
||||||
|
NpadJoyHoldType npad_hold_type{};
|
||||||
|
NpadStyleSet supported_npad_style_set{};
|
||||||
|
|
||||||
|
std::size_t supported_npad_id_types_count{};
|
||||||
|
std::array<NpadIdType, SUPPORTED_NPAD_TYPES_MAX> supported_npad_id_types{};
|
||||||
|
|
||||||
|
std::array<std::shared_ptr<NpadControllerState>, PLAYERS_MAX> state;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Npad final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit Npad();
|
||||||
|
~Npad();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid);
|
||||||
|
Result ActivateWithRevision(const u64 aruid, const s32 revision);
|
||||||
|
void DisconnectNpad(const u64 aruid, const NpadIdType npad_id);
|
||||||
|
void ForceDisconnectNpad(const NpadIdType npad_id);
|
||||||
|
void DisconnectAbstractPad(const NpadIdType npad_id);
|
||||||
|
|
||||||
|
// Config
|
||||||
|
Result SetNpadJoyHoldType(const u64 aruid, const NpadJoyHoldType hold_type);
|
||||||
|
Result GetNpadJoyHoldType(const u64 aruid, NpadJoyHoldType& hold_type);
|
||||||
|
Result SetSupportedNpadIdType(const u64 aruid, std::span<const NpadIdType> list);
|
||||||
|
Result SetSupportedNpadStyleSet(const u64 aruid, const NpadStyleSet supported_style_set);
|
||||||
|
Result GetSupportedNpadStyleSet(const u64 aruid, NpadStyleSet& supported_style_set);
|
||||||
|
|
||||||
|
// Sixaxis
|
||||||
|
bool IsFirmwareUpdateAvailableForSixAxisSensor(const SixAxisSensorHandle& handle);
|
||||||
|
Result ResetIsSixAxisSensorDeviceNewlyAssigned(const u64 aruid,
|
||||||
|
const SixAxisSensorHandle& handle);
|
||||||
|
|
||||||
|
// Events
|
||||||
|
Result AcquireNpadStyleSetUpdateEventHandle(const u64 aruid, Kernel::KReadableEvent** out_event,
|
||||||
|
const NpadIdType npad_id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result SetSupportedNpadIdTypeImpl(const u64 aruid, std::span<const NpadIdType> list);
|
||||||
|
Result SetSupportedNpadStyleSetImpl(const u64 aruid, const NpadStyleSet supported_style_set);
|
||||||
|
Result GetSupportedNpadStyleSetImpl(const u64 aruid, NpadStyleSet& supported_style_set);
|
||||||
|
void UpdateSupportedNpadIdType();
|
||||||
|
void UpdateSupportedStyleSet();
|
||||||
|
u64 GetNpadActiveAruid();
|
||||||
|
|
||||||
|
u64 active_aruid{};
|
||||||
|
std::shared_ptr<NpadState> active_npad_state = nullptr;
|
||||||
|
std::array<std::shared_ptr<NpadState>, ARUID_MAX> npad_state{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,28 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/palma.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
Palma::Palma() {}
|
||||||
|
|
||||||
|
Palma::~Palma() = default;
|
||||||
|
|
||||||
|
Result Palma::Activate(const u64 aruid) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Palma::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Palma::EnablePalmaBoostMode(const u64 aruid, const bool is_enabled) {
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,32 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class Palma final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit Palma();
|
||||||
|
~Palma();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
|
Result EnablePalmaBoostMode(const u64 aruid, const bool is_enabled);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool is_activated;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -1,9 +1,9 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
#include "core/hle/service/hid/hid_server/hid_util.h"
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
#include "core/hle/service/hid/hid_server/sixaxis.h"
|
#include "core/hle/service/hid/resource_manager/sixaxis.h"
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "core/hle/service/hid/hid_server/base_resource.h"
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
|
@ -114,6 +114,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<SixAxisState> GetStateFromAruid(const u64 aruid) const;
|
std::shared_ptr<SixAxisState> GetStateFromAruid(const u64 aruid) const;
|
||||||
|
|
||||||
|
std::shared_ptr<SixAxisState> active_sixaxis_state = nullptr;
|
||||||
std::array<std::shared_ptr<SixAxisState>, ARUID_MAX> sixaxis_state{};
|
std::array<std::shared_ptr<SixAxisState>, ARUID_MAX> sixaxis_state{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
#include "core/hle/service/hid/hid_util.h"
|
||||||
|
#include "core/hle/service/hid/resource_manager/touch_screen.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
TouchScreen::TouchScreen() {}
|
||||||
|
|
||||||
|
TouchScreen::~TouchScreen() = default;
|
||||||
|
|
||||||
|
Result TouchScreen::Activate(const u64 aruid) {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result TouchScreen::Activate() {
|
||||||
|
is_activated = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
}
|
||||||
|
} // namespace Service::HID
|
|
@ -0,0 +1,33 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include "core/hle/service/hid/resource_manager/base_resource.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
struct SixAxisSensorHandle;
|
||||||
|
} // namespace Service::HID
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
class TouchScreen final : public BaseResource {
|
||||||
|
public:
|
||||||
|
explicit TouchScreen();
|
||||||
|
~TouchScreen();
|
||||||
|
|
||||||
|
Result Activate(const u64 aruid);
|
||||||
|
Result Activate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool is_activated;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
|
@ -23,7 +23,7 @@
|
||||||
#include "common/tiny_mt.h"
|
#include "common/tiny_mt.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hid/hid_core.h"
|
#include "core/hid/hid_core.h"
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/hle/service/mii/mii_manager.h"
|
#include "core/hle/service/mii/mii_manager.h"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "core/hle/service/hid/hid_server/hid_types.h"
|
#include "core/hle/service/hid/hid_types.h"
|
||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
class QKeySequence;
|
class QKeySequence;
|
||||||
|
|
Loading…
Reference in New Issue