mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-22 19:05:30 +00:00
Merge pull request #13135 from german77/hid-interface
service: hid: Migrate HidServer to new IPC
This commit is contained in:
commit
dc94882c90
|
@ -668,6 +668,10 @@ add_library(core STATIC
|
||||||
hle/service/glue/time/worker.h
|
hle/service/glue/time/worker.h
|
||||||
hle/service/grc/grc.cpp
|
hle/service/grc/grc.cpp
|
||||||
hle/service/grc/grc.h
|
hle/service/grc/grc.h
|
||||||
|
hle/service/hid/active_vibration_device_list.cpp
|
||||||
|
hle/service/hid/active_vibration_device_list.h
|
||||||
|
hle/service/hid/applet_resource.cpp
|
||||||
|
hle/service/hid/applet_resource.h
|
||||||
hle/service/hid/hid.cpp
|
hle/service/hid/hid.cpp
|
||||||
hle/service/hid/hid.h
|
hle/service/hid/hid.h
|
||||||
hle/service/hid/hid_debug_server.cpp
|
hle/service/hid/hid_debug_server.cpp
|
||||||
|
|
53
src/core/hle/service/hid/active_vibration_device_list.cpp
Normal file
53
src/core/hle/service/hid/active_vibration_device_list.cpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "common/logging/log.h"
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/hid/active_vibration_device_list.h"
|
||||||
|
#include "hid_core/hid_result.h"
|
||||||
|
#include "hid_core/hid_util.h"
|
||||||
|
#include "hid_core/resource_manager.h"
|
||||||
|
#include "hid_core/resources/vibration/vibration_device.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
IActiveVibrationDeviceList::IActiveVibrationDeviceList(Core::System& system_,
|
||||||
|
std::shared_ptr<ResourceManager> resource)
|
||||||
|
: ServiceFramework{system_, "IActiveVibrationDeviceList"}, resource_manager(resource) {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, C<&IActiveVibrationDeviceList::ActivateVibrationDevice>, "ActivateVibrationDevice"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IActiveVibrationDeviceList::~IActiveVibrationDeviceList() = default;
|
||||||
|
|
||||||
|
Result IActiveVibrationDeviceList::ActivateVibrationDevice(
|
||||||
|
Core::HID::VibrationDeviceHandle vibration_device_handle) {
|
||||||
|
LOG_DEBUG(Service_HID, "called, npad_type={}, npad_id={}, device_index={}",
|
||||||
|
vibration_device_handle.npad_type, vibration_device_handle.npad_id,
|
||||||
|
vibration_device_handle.device_index);
|
||||||
|
|
||||||
|
std::scoped_lock lock{mutex};
|
||||||
|
|
||||||
|
R_TRY(IsVibrationHandleValid(vibration_device_handle));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < list_size; i++) {
|
||||||
|
if (vibration_device_handle.device_index == vibration_device_list[i].device_index &&
|
||||||
|
vibration_device_handle.npad_id == vibration_device_list[i].npad_id &&
|
||||||
|
vibration_device_handle.npad_type == vibration_device_list[i].npad_type) {
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R_UNLESS(list_size < MaxVibrationDevicesHandles, ResultVibrationDeviceIndexOutOfRange);
|
||||||
|
R_TRY(resource_manager->GetVibrationDevice(vibration_device_handle)->Activate());
|
||||||
|
|
||||||
|
vibration_device_list[list_size++] = vibration_device_handle;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
39
src/core/hle/service/hid/active_vibration_device_list.h
Normal file
39
src/core/hle/service/hid/active_vibration_device_list.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
#include "hid_core/hid_types.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
class ResourceManager;
|
||||||
|
|
||||||
|
class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> {
|
||||||
|
public:
|
||||||
|
explicit IActiveVibrationDeviceList(Core::System& system_,
|
||||||
|
std::shared_ptr<ResourceManager> resource);
|
||||||
|
~IActiveVibrationDeviceList() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static constexpr std::size_t MaxVibrationDevicesHandles{0x100};
|
||||||
|
|
||||||
|
Result ActivateVibrationDevice(Core::HID::VibrationDeviceHandle vibration_device_handle);
|
||||||
|
|
||||||
|
mutable std::mutex mutex;
|
||||||
|
std::size_t list_size{};
|
||||||
|
std::array<Core::HID::VibrationDeviceHandle, MaxVibrationDevicesHandles>
|
||||||
|
vibration_device_list{};
|
||||||
|
std::shared_ptr<ResourceManager> resource_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
34
src/core/hle/service/hid/applet_resource.cpp
Normal file
34
src/core/hle/service/hid/applet_resource.cpp
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#include "common/logging/log.h"
|
||||||
|
#include "core/hle/kernel/k_shared_memory.h"
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/hid/applet_resource.h"
|
||||||
|
#include "hid_core/resource_manager.h"
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
|
||||||
|
IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
||||||
|
u64 applet_resource_user_id)
|
||||||
|
: ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id},
|
||||||
|
resource_manager{resource} {
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, C<&IAppletResource::GetSharedMemoryHandle>, "GetSharedMemoryHandle"},
|
||||||
|
};
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IAppletResource::~IAppletResource() {
|
||||||
|
resource_manager->FreeAppletResourceId(aruid);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IAppletResource::GetSharedMemoryHandle(
|
||||||
|
OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle) {
|
||||||
|
const auto result = resource_manager->GetSharedMemoryHandle(out_shared_memory_handle, aruid);
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", aruid, result.raw);
|
||||||
|
R_RETURN(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
36
src/core/hle/service/hid/applet_resource.h
Normal file
36
src/core/hle/service/hid/applet_resource.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KSharedMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service::HID {
|
||||||
|
class ResourceManager;
|
||||||
|
|
||||||
|
class IAppletResource final : public ServiceFramework<IAppletResource> {
|
||||||
|
public:
|
||||||
|
explicit IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
||||||
|
u64 applet_resource_user_id);
|
||||||
|
~IAppletResource() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result GetSharedMemoryHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle);
|
||||||
|
|
||||||
|
u64 aruid{};
|
||||||
|
std::shared_ptr<ResourceManager> resource_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::HID
|
File diff suppressed because it is too large
Load diff
|
@ -6,12 +6,20 @@
|
||||||
#include "core/hle/service/cmif_types.h"
|
#include "core/hle/service/cmif_types.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
|
#include "hid_core/resources/npad/npad_types.h"
|
||||||
|
#include "hid_core/resources/palma/palma.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KReadableEvent;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
class IActiveVibrationDeviceList;
|
||||||
|
class IAppletResource;
|
||||||
class ResourceManager;
|
class ResourceManager;
|
||||||
class HidFirmwareSettings;
|
class HidFirmwareSettings;
|
||||||
|
|
||||||
|
@ -24,128 +32,232 @@ public:
|
||||||
std::shared_ptr<ResourceManager> GetResourceManager();
|
std::shared_ptr<ResourceManager> GetResourceManager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateAppletResource(HLERequestContext& ctx);
|
Result CreateAppletResource(OutInterface<IAppletResource> out_applet_resource,
|
||||||
void ActivateDebugPad(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void ActivateTouchScreen(HLERequestContext& ctx);
|
Result ActivateDebugPad(ClientAppletResourceUserId aruid);
|
||||||
void ActivateMouse(HLERequestContext& ctx);
|
Result ActivateTouchScreen(ClientAppletResourceUserId aruid);
|
||||||
void ActivateKeyboard(HLERequestContext& ctx);
|
Result ActivateMouse(ClientAppletResourceUserId aruid);
|
||||||
void SendKeyboardLockKeyEvent(HLERequestContext& ctx);
|
Result ActivateKeyboard(ClientAppletResourceUserId aruid);
|
||||||
void AcquireXpadIdEventHandle(HLERequestContext& ctx);
|
Result SendKeyboardLockKeyEvent(u32 flags);
|
||||||
void ReleaseXpadIdEventHandle(HLERequestContext& ctx);
|
Result AcquireXpadIdEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event,
|
||||||
void ActivateXpad(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetXpadIds(HLERequestContext& ctx);
|
Result ReleaseXpadIdEventHandle(ClientAppletResourceUserId aruid);
|
||||||
void ActivateJoyXpad(HLERequestContext& ctx);
|
Result ActivateXpad(u32 basic_xpad_id, ClientAppletResourceUserId aruid);
|
||||||
void GetJoyXpadLifoHandle(HLERequestContext& ctx);
|
Result GetXpadIds(Out<u64> out_count, OutArray<u32, BufferAttr_HipcPointer> out_basic_pad_ids);
|
||||||
void GetJoyXpadIds(HLERequestContext& ctx);
|
Result ActivateJoyXpad(u32 joy_xpad_id);
|
||||||
void ActivateSixAxisSensor(HLERequestContext& ctx);
|
Result GetJoyXpadLifoHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle,
|
||||||
void DeactivateSixAxisSensor(HLERequestContext& ctx);
|
u32 joy_xpad_id);
|
||||||
void GetSixAxisSensorLifoHandle(HLERequestContext& ctx);
|
Result GetJoyXpadIds(Out<s64> out_basic_xpad_id_count);
|
||||||
void ActivateJoySixAxisSensor(HLERequestContext& ctx);
|
Result ActivateSixAxisSensor(u32 joy_xpad_id);
|
||||||
void DeactivateJoySixAxisSensor(HLERequestContext& ctx);
|
Result DeactivateSixAxisSensor(u32 joy_xpad_id);
|
||||||
void GetJoySixAxisSensorLifoHandle(HLERequestContext& ctx);
|
Result GetSixAxisSensorLifoHandle(OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle,
|
||||||
void StartSixAxisSensor(HLERequestContext& ctx);
|
u32 joy_xpad_id);
|
||||||
void StopSixAxisSensor(HLERequestContext& ctx);
|
Result ActivateJoySixAxisSensor(u32 joy_xpad_id);
|
||||||
void IsSixAxisSensorFusionEnabled(HLERequestContext& ctx);
|
Result DeactivateJoySixAxisSensor(u32 joy_xpad_id);
|
||||||
void EnableSixAxisSensorFusion(HLERequestContext& ctx);
|
Result GetJoySixAxisSensorLifoHandle(
|
||||||
void SetSixAxisSensorFusionParameters(HLERequestContext& ctx);
|
OutCopyHandle<Kernel::KSharedMemory> out_shared_memory_handle, u32 joy_xpad_id);
|
||||||
void GetSixAxisSensorFusionParameters(HLERequestContext& ctx);
|
Result StartSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void ResetSixAxisSensorFusionParameters(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void SetGyroscopeZeroDriftMode(HLERequestContext& ctx);
|
Result StopSixAxisSensor(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void GetGyroscopeZeroDriftMode(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void ResetGyroscopeZeroDriftMode(HLERequestContext& ctx);
|
Result IsSixAxisSensorFusionEnabled(Out<bool> out_is_enabled,
|
||||||
void IsSixAxisSensorAtRest(HLERequestContext& ctx);
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void IsFirmwareUpdateAvailableForSixAxisSensor(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void EnableSixAxisSensorUnalteredPassthrough(HLERequestContext& ctx);
|
Result EnableSixAxisSensorFusion(bool is_enabled, Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void IsSixAxisSensorUnalteredPassthroughEnabled(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void LoadSixAxisSensorCalibrationParameter(HLERequestContext& ctx);
|
Result SetSixAxisSensorFusionParameters(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void GetSixAxisSensorIcInformation(HLERequestContext& ctx);
|
Core::HID::SixAxisSensorFusionParameters sixaxis_fusion,
|
||||||
void ResetIsSixAxisSensorDeviceNewlyAssigned(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void ActivateGesture(HLERequestContext& ctx);
|
Result GetSixAxisSensorFusionParameters(
|
||||||
void SetSupportedNpadStyleSet(HLERequestContext& ctx);
|
Out<Core::HID::SixAxisSensorFusionParameters> out_fusion_parameters,
|
||||||
void GetSupportedNpadStyleSet(HLERequestContext& ctx);
|
Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid);
|
||||||
void SetSupportedNpadIdType(HLERequestContext& ctx);
|
Result ResetSixAxisSensorFusionParameters(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void ActivateNpad(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void DeactivateNpad(HLERequestContext& ctx);
|
Result SetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
void AcquireNpadStyleSetUpdateEventHandle(HLERequestContext& ctx);
|
Core::HID::GyroscopeZeroDriftMode drift_mode,
|
||||||
void DisconnectNpad(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result GetGyroscopeZeroDriftMode(Out<Core::HID::GyroscopeZeroDriftMode> out_drift_mode,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result ResetGyroscopeZeroDriftMode(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result IsSixAxisSensorAtRest(Out<bool> out_is_at_rest,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result IsFirmwareUpdateAvailableForSixAxisSensor(Out<bool> out_is_firmware_available,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result EnableSixAxisSensorUnalteredPassthrough(bool is_enabled,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result IsSixAxisSensorUnalteredPassthroughEnabled(Out<bool> out_is_enabled,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result LoadSixAxisSensorCalibrationParameter(
|
||||||
|
OutLargeData<Core::HID::SixAxisSensorCalibrationParameter, BufferAttr_HipcMapAlias>
|
||||||
|
out_calibration,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid);
|
||||||
|
Result GetSixAxisSensorIcInformation(
|
||||||
|
OutLargeData<Core::HID::SixAxisSensorIcInformation, BufferAttr_HipcPointer>
|
||||||
|
out_ic_information,
|
||||||
|
Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid);
|
||||||
|
Result ResetIsSixAxisSensorDeviceNewlyAssigned(Core::HID::SixAxisSensorHandle sixaxis_handle,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result ActivateGesture(u32 basic_gesture_id, ClientAppletResourceUserId aruid);
|
||||||
|
Result SetSupportedNpadStyleSet(Core::HID::NpadStyleSet supported_style_set,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result GetSupportedNpadStyleSet(Out<Core::HID::NpadStyleSet> out_supported_style_set,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result SetSupportedNpadIdType(
|
||||||
|
ClientAppletResourceUserId aruid,
|
||||||
|
InArray<Core::HID::NpadIdType, BufferAttr_HipcPointer> supported_npad_list);
|
||||||
|
Result ActivateNpad(ClientAppletResourceUserId aruid);
|
||||||
|
Result DeactivateNpad(ClientAppletResourceUserId aruid);
|
||||||
|
Result AcquireNpadStyleSetUpdateEventHandle(OutCopyHandle<Kernel::KReadableEvent> out_event,
|
||||||
|
Core::HID::NpadIdType npad_id,
|
||||||
|
ClientAppletResourceUserId aruid, u64 unknown);
|
||||||
|
Result DisconnectNpad(Core::HID::NpadIdType npad_id, ClientAppletResourceUserId aruid);
|
||||||
Result GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern,
|
Result GetPlayerLedPattern(Out<Core::HID::LedPattern> out_led_pattern,
|
||||||
Core::HID::NpadIdType npad_id);
|
Core::HID::NpadIdType npad_id);
|
||||||
void ActivateNpadWithRevision(HLERequestContext& ctx);
|
Result ActivateNpadWithRevision(NpadRevision revision, ClientAppletResourceUserId aruid);
|
||||||
void SetNpadJoyHoldType(HLERequestContext& ctx);
|
Result SetNpadJoyHoldType(ClientAppletResourceUserId aruid, NpadJoyHoldType hold_type);
|
||||||
void GetNpadJoyHoldType(HLERequestContext& ctx);
|
Result GetNpadJoyHoldType(Out<NpadJoyHoldType> out_hold_type, ClientAppletResourceUserId aruid);
|
||||||
void SetNpadJoyAssignmentModeSingleByDefault(HLERequestContext& ctx);
|
Result SetNpadJoyAssignmentModeSingleByDefault(Core::HID::NpadIdType npad_id,
|
||||||
void SetNpadJoyAssignmentModeSingle(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void SetNpadJoyAssignmentModeDual(HLERequestContext& ctx);
|
Result SetNpadJoyAssignmentModeSingle(Core::HID::NpadIdType npad_id,
|
||||||
void MergeSingleJoyAsDualJoy(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid,
|
||||||
void StartLrAssignmentMode(HLERequestContext& ctx);
|
NpadJoyDeviceType npad_joy_device_type);
|
||||||
void StopLrAssignmentMode(HLERequestContext& ctx);
|
Result SetNpadJoyAssignmentModeDual(Core::HID::NpadIdType npad_id,
|
||||||
void SetNpadHandheldActivationMode(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetNpadHandheldActivationMode(HLERequestContext& ctx);
|
Result MergeSingleJoyAsDualJoy(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2,
|
||||||
void SwapNpadAssignment(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void IsUnintendedHomeButtonInputProtectionEnabled(HLERequestContext& ctx);
|
Result StartLrAssignmentMode(ClientAppletResourceUserId aruid);
|
||||||
void EnableUnintendedHomeButtonInputProtection(HLERequestContext& ctx);
|
Result StopLrAssignmentMode(ClientAppletResourceUserId aruid);
|
||||||
void SetNpadJoyAssignmentModeSingleWithDestination(HLERequestContext& ctx);
|
Result SetNpadHandheldActivationMode(ClientAppletResourceUserId aruid,
|
||||||
void SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx);
|
NpadHandheldActivationMode activation_mode);
|
||||||
void SetNpadCaptureButtonAssignment(HLERequestContext& ctx);
|
Result GetNpadHandheldActivationMode(Out<NpadHandheldActivationMode> out_activation_mode,
|
||||||
void ClearNpadCaptureButtonAssignment(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetVibrationDeviceInfo(HLERequestContext& ctx);
|
Result SwapNpadAssignment(Core::HID::NpadIdType npad_id_1, Core::HID::NpadIdType npad_id_2,
|
||||||
void SendVibrationValue(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetActualVibrationValue(HLERequestContext& ctx);
|
Result IsUnintendedHomeButtonInputProtectionEnabled(Out<bool> out_is_enabled,
|
||||||
void CreateActiveVibrationDeviceList(HLERequestContext& ctx);
|
Core::HID::NpadIdType npad_id,
|
||||||
void PermitVibration(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void IsVibrationPermitted(HLERequestContext& ctx);
|
Result EnableUnintendedHomeButtonInputProtection(bool is_enabled, Core::HID::NpadIdType npad_id,
|
||||||
void SendVibrationValues(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void SendVibrationGcErmCommand(HLERequestContext& ctx);
|
Result SetNpadJoyAssignmentModeSingleWithDestination(Out<bool> out_is_reassigned,
|
||||||
void GetActualVibrationGcErmCommand(HLERequestContext& ctx);
|
Out<Core::HID::NpadIdType> out_new_npad_id,
|
||||||
void BeginPermitVibrationSession(HLERequestContext& ctx);
|
Core::HID::NpadIdType npad_id,
|
||||||
void EndPermitVibrationSession(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid,
|
||||||
void IsVibrationDeviceMounted(HLERequestContext& ctx);
|
NpadJoyDeviceType npad_joy_device_type);
|
||||||
void SendVibrationValueInBool(HLERequestContext& ctx);
|
Result SetNpadAnalogStickUseCenterClamp(bool use_center_clamp,
|
||||||
void ActivateConsoleSixAxisSensor(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void StartConsoleSixAxisSensor(HLERequestContext& ctx);
|
Result SetNpadCaptureButtonAssignment(Core::HID::NpadStyleSet npad_styleset,
|
||||||
void StopConsoleSixAxisSensor(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid,
|
||||||
void ActivateSevenSixAxisSensor(HLERequestContext& ctx);
|
Core::HID::NpadButton button);
|
||||||
void StartSevenSixAxisSensor(HLERequestContext& ctx);
|
Result ClearNpadCaptureButtonAssignment(ClientAppletResourceUserId aruid);
|
||||||
void StopSevenSixAxisSensor(HLERequestContext& ctx);
|
Result GetVibrationDeviceInfo(Out<Core::HID::VibrationDeviceInfo> out_vibration_device_info,
|
||||||
void InitializeSevenSixAxisSensor(HLERequestContext& ctx);
|
Core::HID::VibrationDeviceHandle vibration_device_handle);
|
||||||
void FinalizeSevenSixAxisSensor(HLERequestContext& ctx);
|
Result SendVibrationValue(Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void ResetSevenSixAxisSensorTimestamp(HLERequestContext& ctx);
|
Core::HID::VibrationValue vibration_value,
|
||||||
void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetPalmaConnectionHandle(HLERequestContext& ctx);
|
Result GetActualVibrationValue(Out<Core::HID::VibrationValue> out_vibration_value,
|
||||||
void InitializePalma(HLERequestContext& ctx);
|
Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void AcquirePalmaOperationCompleteEvent(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void GetPalmaOperationInfo(HLERequestContext& ctx);
|
Result CreateActiveVibrationDeviceList(OutInterface<IActiveVibrationDeviceList> out_interface);
|
||||||
void PlayPalmaActivity(HLERequestContext& ctx);
|
Result PermitVibration(bool can_vibrate);
|
||||||
void SetPalmaFrModeType(HLERequestContext& ctx);
|
Result IsVibrationPermitted(Out<bool> out_is_permitted);
|
||||||
void ReadPalmaStep(HLERequestContext& ctx);
|
Result SendVibrationValues(
|
||||||
void EnablePalmaStep(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid,
|
||||||
void ResetPalmaStep(HLERequestContext& ctx);
|
InArray<Core::HID::VibrationDeviceHandle, BufferAttr_HipcPointer> vibration_handles,
|
||||||
void ReadPalmaApplicationSection(HLERequestContext& ctx);
|
InArray<Core::HID::VibrationValue, BufferAttr_HipcPointer> vibration_values);
|
||||||
void WritePalmaApplicationSection(HLERequestContext& ctx);
|
Result SendVibrationGcErmCommand(Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void ReadPalmaUniqueCode(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid,
|
||||||
void SetPalmaUniqueCodeInvalid(HLERequestContext& ctx);
|
Core::HID::VibrationGcErmCommand gc_erm_command);
|
||||||
void WritePalmaActivityEntry(HLERequestContext& ctx);
|
Result GetActualVibrationGcErmCommand(Out<Core::HID::VibrationGcErmCommand> out_gc_erm_command,
|
||||||
void WritePalmaRgbLedPatternEntry(HLERequestContext& ctx);
|
Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void WritePalmaWaveEntry(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void SetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
|
Result BeginPermitVibrationSession(ClientAppletResourceUserId aruid);
|
||||||
void GetPalmaDataBaseIdentificationVersion(HLERequestContext& ctx);
|
Result EndPermitVibrationSession(ClientAppletResourceUserId aruid);
|
||||||
void SuspendPalmaFeature(HLERequestContext& ctx);
|
Result IsVibrationDeviceMounted(Out<bool> out_is_mounted,
|
||||||
void GetPalmaOperationResult(HLERequestContext& ctx);
|
Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void ReadPalmaPlayLog(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void ResetPalmaPlayLog(HLERequestContext& ctx);
|
Result SendVibrationValueInBool(bool is_vibrating,
|
||||||
void SetIsPalmaAllConnectable(HLERequestContext& ctx);
|
Core::HID::VibrationDeviceHandle vibration_device_handle,
|
||||||
void SetIsPalmaPairedConnectable(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void PairPalma(HLERequestContext& ctx);
|
Result ActivateConsoleSixAxisSensor(ClientAppletResourceUserId aruid);
|
||||||
void SetPalmaBoostMode(HLERequestContext& ctx);
|
Result StartConsoleSixAxisSensor(Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle,
|
||||||
void CancelWritePalmaWaveEntry(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void EnablePalmaBoostMode(HLERequestContext& ctx);
|
Result StopConsoleSixAxisSensor(Core::HID::ConsoleSixAxisSensorHandle console_sixaxis_handle,
|
||||||
void GetPalmaBluetoothAddress(HLERequestContext& ctx);
|
ClientAppletResourceUserId aruid);
|
||||||
void SetDisallowedPalmaConnection(HLERequestContext& ctx);
|
Result ActivateSevenSixAxisSensor(ClientAppletResourceUserId aruid);
|
||||||
void SetNpadCommunicationMode(HLERequestContext& ctx);
|
Result StartSevenSixAxisSensor(ClientAppletResourceUserId aruid);
|
||||||
void GetNpadCommunicationMode(HLERequestContext& ctx);
|
Result StopSevenSixAxisSensor(ClientAppletResourceUserId aruid);
|
||||||
void SetTouchScreenConfiguration(HLERequestContext& ctx);
|
Result InitializeSevenSixAxisSensor(ClientAppletResourceUserId aruid, u64 t_mem_1_size,
|
||||||
void IsFirmwareUpdateNeededForNotification(HLERequestContext& ctx);
|
u64 t_mem_2_size,
|
||||||
void SetTouchScreenResolution(HLERequestContext& ctx);
|
InCopyHandle<Kernel::KTransferMemory> t_mem_1,
|
||||||
|
InCopyHandle<Kernel::KTransferMemory> t_mem_2);
|
||||||
|
Result FinalizeSevenSixAxisSensor(ClientAppletResourceUserId aruid);
|
||||||
|
Result ResetSevenSixAxisSensorTimestamp(ClientAppletResourceUserId aruid);
|
||||||
|
Result IsUsbFullKeyControllerEnabled(Out<bool> out_is_enabled,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result GetPalmaConnectionHandle(Out<Palma::PalmaConnectionHandle> out_handle,
|
||||||
|
Core::HID::NpadIdType npad_id,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result InitializePalma(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result AcquirePalmaOperationCompleteEvent(OutCopyHandle<Kernel::KReadableEvent> out_event,
|
||||||
|
Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result GetPalmaOperationInfo(Out<Palma::PalmaOperationType> out_operation_type,
|
||||||
|
Palma::PalmaConnectionHandle connection_handle,
|
||||||
|
OutBuffer<BufferAttr_HipcMapAlias> out_data);
|
||||||
|
Result PlayPalmaActivity(Palma::PalmaConnectionHandle connection_handle, u64 palma_activity);
|
||||||
|
Result SetPalmaFrModeType(Palma::PalmaConnectionHandle connection_handle,
|
||||||
|
Palma::PalmaFrModeType fr_mode);
|
||||||
|
Result ReadPalmaStep(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result EnablePalmaStep(bool is_enabled, Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result ResetPalmaStep(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result ReadPalmaApplicationSection(Palma::PalmaConnectionHandle connection_handle, u64 offset,
|
||||||
|
u64 size);
|
||||||
|
Result WritePalmaApplicationSection(
|
||||||
|
Palma::PalmaConnectionHandle connection_handle, u64 offset, u64 size,
|
||||||
|
InLargeData<Palma::PalmaApplicationSection, BufferAttr_HipcPointer> data);
|
||||||
|
Result ReadPalmaUniqueCode(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result SetPalmaUniqueCodeInvalid(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result WritePalmaActivityEntry(Palma::PalmaConnectionHandle connection_handle,
|
||||||
|
Palma::PalmaActivityEntry activity_entry);
|
||||||
|
Result WritePalmaRgbLedPatternEntry(Palma::PalmaConnectionHandle connection_handle, u64 unknown,
|
||||||
|
InBuffer<BufferAttr_HipcMapAlias> led_pattern);
|
||||||
|
Result WritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle,
|
||||||
|
Palma::PalmaWaveSet wave_set, u64 unknown, u64 t_mem_size, u64 size,
|
||||||
|
InCopyHandle<Kernel::KTransferMemory> t_mem);
|
||||||
|
Result SetPalmaDataBaseIdentificationVersion(s32 database_id_version,
|
||||||
|
Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result GetPalmaDataBaseIdentificationVersion(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result SuspendPalmaFeature(Palma::PalmaFeature feature,
|
||||||
|
Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result GetPalmaOperationResult(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result ReadPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result ResetPalmaPlayLog(u16 unknown, Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result SetIsPalmaAllConnectable(bool is_palma_all_connectable, ClientAppletResourceUserId arui);
|
||||||
|
Result SetIsPalmaPairedConnectable(bool is_palma_paired_connectable,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result PairPalma(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result SetPalmaBoostMode(bool is_enabled);
|
||||||
|
Result CancelWritePalmaWaveEntry(Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result EnablePalmaBoostMode(bool is_enabled, ClientAppletResourceUserId aruid);
|
||||||
|
Result GetPalmaBluetoothAddress(Out<Palma::Address> out_bt_address,
|
||||||
|
Palma::PalmaConnectionHandle connection_handle);
|
||||||
|
Result SetDisallowedPalmaConnection(
|
||||||
|
ClientAppletResourceUserId aruid,
|
||||||
|
InArray<Palma::Address, BufferAttr_HipcPointer> disallowed_address);
|
||||||
|
Result SetNpadCommunicationMode(ClientAppletResourceUserId aruid,
|
||||||
|
NpadCommunicationMode communication_mode);
|
||||||
|
Result GetNpadCommunicationMode(Out<NpadCommunicationMode> out_communication_mode,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result SetTouchScreenConfiguration(Core::HID::TouchScreenConfigurationForNx touchscreen_config,
|
||||||
|
ClientAppletResourceUserId aruid);
|
||||||
|
Result IsFirmwareUpdateNeededForNotification(Out<bool> out_is_firmware_update_needed,
|
||||||
|
s32 unknown, ClientAppletResourceUserId aruid);
|
||||||
|
Result SetTouchScreenResolution(u32 width, u32 height, ClientAppletResourceUserId aruid);
|
||||||
|
|
||||||
std::shared_ptr<ResourceManager> resource_manager;
|
std::shared_ptr<ResourceManager> resource_manager;
|
||||||
std::shared_ptr<HidFirmwareSettings> firmware_settings;
|
std::shared_ptr<HidFirmwareSettings> firmware_settings;
|
||||||
|
|
|
@ -565,36 +565,28 @@ static_assert(sizeof(SixAxisSensorProperties) == 1, "SixAxisSensorProperties is
|
||||||
|
|
||||||
// This is nn::hid::SixAxisSensorCalibrationParameter
|
// This is nn::hid::SixAxisSensorCalibrationParameter
|
||||||
struct SixAxisSensorCalibrationParameter {
|
struct SixAxisSensorCalibrationParameter {
|
||||||
std::array<u8, 0x744> unknown_data{};
|
std::array<u8, 0x744> unknown_data;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SixAxisSensorCalibrationParameter) == 0x744,
|
static_assert(sizeof(SixAxisSensorCalibrationParameter) == 0x744,
|
||||||
"SixAxisSensorCalibrationParameter is an invalid size");
|
"SixAxisSensorCalibrationParameter is an invalid size");
|
||||||
|
static_assert(std::is_trivial_v<SixAxisSensorCalibrationParameter>,
|
||||||
|
"SixAxisSensorCalibrationParameter must be trivial.");
|
||||||
|
|
||||||
// This is nn::hid::SixAxisSensorIcInformation
|
// This is nn::hid::SixAxisSensorIcInformation
|
||||||
struct SixAxisSensorIcInformation {
|
struct SixAxisSensorIcInformation {
|
||||||
f32 angular_rate{2000.0f}; // dps
|
f32 angular_rate; // dps
|
||||||
std::array<f32, 6> unknown_gyro_data1{
|
std::array<f32, 6> unknown_gyro_data1; // dps
|
||||||
-10.0f, -10.0f, -10.0f, 10.0f, 10.0f, 10.0f,
|
std::array<f32, 9> unknown_gyro_data2;
|
||||||
}; // dps
|
std::array<f32, 9> unknown_gyro_data3;
|
||||||
std::array<f32, 9> unknown_gyro_data2{
|
f32 acceleration_range; // g force
|
||||||
0.95f, -0.003f, -0.003f, -0.003f, 0.95f, -0.003f, -0.003f, -0.003f, 0.95f,
|
std::array<f32, 6> unknown_accel_data1; // g force
|
||||||
};
|
std::array<f32, 9> unknown_accel_data2;
|
||||||
std::array<f32, 9> unknown_gyro_data3{
|
std::array<f32, 9> unknown_accel_data3;
|
||||||
1.05f, 0.003f, 0.003f, 0.003f, 1.05f, 0.003f, 0.003f, 0.003f, 1.05f,
|
|
||||||
};
|
|
||||||
f32 acceleration_range{8.0f}; // g force
|
|
||||||
std::array<f32, 6> unknown_accel_data1{
|
|
||||||
-0.0612f, -0.0612f, -0.0612f, 0.0612f, 0.0612f, 0.0612f,
|
|
||||||
}; // g force
|
|
||||||
std::array<f32, 9> unknown_accel_data2{
|
|
||||||
0.95f, -0.003f, -0.003f, -0.003f, 0.95f, -0.003f, -0.003f, -0.003f, 0.95f,
|
|
||||||
};
|
|
||||||
std::array<f32, 9> unknown_accel_data3{
|
|
||||||
1.05f, 0.003f, 0.003f, 0.003f, 1.05f, 0.003f, 0.003f, 0.003f, 1.05f,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
static_assert(sizeof(SixAxisSensorIcInformation) == 0xC8,
|
static_assert(sizeof(SixAxisSensorIcInformation) == 0xC8,
|
||||||
"SixAxisSensorIcInformation is an invalid size");
|
"SixAxisSensorIcInformation is an invalid size");
|
||||||
|
static_assert(std::is_trivial_v<SixAxisSensorIcInformation>,
|
||||||
|
"SixAxisSensorIcInformation must be trivial.");
|
||||||
|
|
||||||
// This is nn::hid::SixAxisSensorAttribute
|
// This is nn::hid::SixAxisSensorAttribute
|
||||||
struct SixAxisSensorAttribute {
|
struct SixAxisSensorAttribute {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/k_shared_memory.h"
|
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/hle/service/set/system_settings_server.h"
|
#include "core/hle/service/set/system_settings_server.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
@ -501,29 +500,4 @@ void ResourceManager::UpdateMotion(std::chrono::nanoseconds ns_late) {
|
||||||
console_six_axis->OnUpdate(core_timing);
|
console_six_axis->OnUpdate(core_timing);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAppletResource::IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
|
||||||
u64 applet_resource_user_id)
|
|
||||||
: ServiceFramework{system_, "IAppletResource"}, aruid{applet_resource_user_id},
|
|
||||||
resource_manager{resource} {
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, &IAppletResource::GetSharedMemoryHandle, "GetSharedMemoryHandle"},
|
|
||||||
};
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
IAppletResource::~IAppletResource() {
|
|
||||||
resource_manager->FreeAppletResourceId(aruid);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IAppletResource::GetSharedMemoryHandle(HLERequestContext& ctx) {
|
|
||||||
Kernel::KSharedMemory* handle;
|
|
||||||
const auto result = resource_manager->GetSharedMemoryHandle(&handle, aruid);
|
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}, result=0x{:X}", aruid, result.raw);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
|
||||||
rb.Push(result);
|
|
||||||
rb.PushCopyObjects(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -174,17 +174,4 @@ private:
|
||||||
KernelHelpers::ServiceContext service_context;
|
KernelHelpers::ServiceContext service_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IAppletResource final : public ServiceFramework<IAppletResource> {
|
|
||||||
public:
|
|
||||||
explicit IAppletResource(Core::System& system_, std::shared_ptr<ResourceManager> resource,
|
|
||||||
u64 applet_resource_user_id);
|
|
||||||
~IAppletResource() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetSharedMemoryHandle(HLERequestContext& ctx);
|
|
||||||
|
|
||||||
u64 aruid{};
|
|
||||||
std::shared_ptr<ResourceManager> resource_manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -56,12 +56,14 @@ Kernel::KReadableEvent& Palma::AcquirePalmaOperationCompleteEvent(
|
||||||
|
|
||||||
Result Palma::GetPalmaOperationInfo(const PalmaConnectionHandle& handle,
|
Result Palma::GetPalmaOperationInfo(const PalmaConnectionHandle& handle,
|
||||||
PalmaOperationType& operation_type,
|
PalmaOperationType& operation_type,
|
||||||
PalmaOperationData& data) const {
|
std::span<u8> out_data) const {
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation_type = operation.operation;
|
operation_type = static_cast<PalmaOperationType>(operation.operation);
|
||||||
data = operation.data;
|
std::memcpy(out_data.data(), operation.data.data(),
|
||||||
|
std::min(out_data.size(), operation.data.size()));
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ Result Palma::PlayPalmaActivity(const PalmaConnectionHandle& handle, u64 palma_a
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::PlayActivity;
|
operation.operation = PackedPalmaOperationType::PlayActivity;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -88,7 +90,7 @@ Result Palma::ReadPalmaStep(const PalmaConnectionHandle& handle) {
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::ReadStep;
|
operation.operation = PackedPalmaOperationType::ReadStep;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -117,7 +119,7 @@ Result Palma::ReadPalmaUniqueCode(const PalmaConnectionHandle& handle) {
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::ReadUniqueCode;
|
operation.operation = PackedPalmaOperationType::ReadUniqueCode;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -128,7 +130,7 @@ Result Palma::SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle& handle) {
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::SetUniqueCodeInvalid;
|
operation.operation = PackedPalmaOperationType::SetUniqueCodeInvalid;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -141,7 +143,7 @@ Result Palma::WritePalmaRgbLedPatternEntry(const PalmaConnectionHandle& handle,
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::WriteRgbLedPatternEntry;
|
operation.operation = PackedPalmaOperationType::WriteRgbLedPatternEntry;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -153,7 +155,7 @@ Result Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle, PalmaWave
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::WriteWaveEntry;
|
operation.operation = PackedPalmaOperationType::WriteWaveEntry;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -166,7 +168,7 @@ Result Palma::SetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle&
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
database_id_version = database_id_version_;
|
database_id_version = database_id_version_;
|
||||||
operation.operation = PalmaOperationType::ReadDataBaseIdentificationVersion;
|
operation.operation = PackedPalmaOperationType::ReadDataBaseIdentificationVersion;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data[0] = {};
|
operation.data[0] = {};
|
||||||
operation_complete_event->Signal();
|
operation_complete_event->Signal();
|
||||||
|
@ -177,7 +179,7 @@ Result Palma::GetPalmaDataBaseIdentificationVersion(const PalmaConnectionHandle&
|
||||||
if (handle.npad_id != active_handle.npad_id) {
|
if (handle.npad_id != active_handle.npad_id) {
|
||||||
return InvalidPalmaHandle;
|
return InvalidPalmaHandle;
|
||||||
}
|
}
|
||||||
operation.operation = PalmaOperationType::ReadDataBaseIdentificationVersion;
|
operation.operation = PackedPalmaOperationType::ReadDataBaseIdentificationVersion;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation.data[0] = static_cast<u8>(database_id_version);
|
operation.data[0] = static_cast<u8>(database_id_version);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/typed_address.h"
|
#include "common/typed_address.h"
|
||||||
#include "hid_core/hid_result.h"
|
#include "hid_core/hid_result.h"
|
||||||
|
@ -27,9 +29,31 @@ namespace Service::HID {
|
||||||
class Palma final : public ControllerBase {
|
class Palma final : public ControllerBase {
|
||||||
public:
|
public:
|
||||||
using PalmaOperationData = std::array<u8, 0x140>;
|
using PalmaOperationData = std::array<u8, 0x140>;
|
||||||
|
using PalmaApplicationSection = std::array<u8, 0x100>;
|
||||||
|
using Address = std::array<u8, 0x6>;
|
||||||
|
|
||||||
// This is nn::hid::PalmaOperationType
|
// This is nn::hid::PalmaOperationType
|
||||||
enum class PalmaOperationType {
|
enum class PalmaOperationType : u64 {
|
||||||
|
PlayActivity,
|
||||||
|
SetFrModeType,
|
||||||
|
ReadStep,
|
||||||
|
EnableStep,
|
||||||
|
ResetStep,
|
||||||
|
ReadApplicationSection,
|
||||||
|
WriteApplicationSection,
|
||||||
|
ReadUniqueCode,
|
||||||
|
SetUniqueCodeInvalid,
|
||||||
|
WriteActivityEntry,
|
||||||
|
WriteRgbLedPatternEntry,
|
||||||
|
WriteWaveEntry,
|
||||||
|
ReadDataBaseIdentificationVersion,
|
||||||
|
WriteDataBaseIdentificationVersion,
|
||||||
|
SuspendFeature,
|
||||||
|
ReadPlayLog,
|
||||||
|
ResetPlayLog,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class PackedPalmaOperationType : u32 {
|
||||||
PlayActivity,
|
PlayActivity,
|
||||||
SetFrModeType,
|
SetFrModeType,
|
||||||
ReadStep,
|
ReadStep,
|
||||||
|
@ -75,7 +99,7 @@ public:
|
||||||
|
|
||||||
// This is nn::hid::PalmaOperationInfo
|
// This is nn::hid::PalmaOperationInfo
|
||||||
struct PalmaOperationInfo {
|
struct PalmaOperationInfo {
|
||||||
PalmaOperationType operation{};
|
PackedPalmaOperationType operation{};
|
||||||
Result result{PalmaResultSuccess};
|
Result result{PalmaResultSuccess};
|
||||||
PalmaOperationData data{};
|
PalmaOperationData data{};
|
||||||
};
|
};
|
||||||
|
@ -92,8 +116,7 @@ public:
|
||||||
static_assert(sizeof(PalmaActivityEntry) == 0x20, "PalmaActivityEntry is an invalid size");
|
static_assert(sizeof(PalmaActivityEntry) == 0x20, "PalmaActivityEntry is an invalid size");
|
||||||
|
|
||||||
struct PalmaConnectionHandle {
|
struct PalmaConnectionHandle {
|
||||||
Core::HID::NpadIdType npad_id;
|
alignas(8) Core::HID::NpadIdType npad_id;
|
||||||
INSERT_PADDING_BYTES(4); // Unknown
|
|
||||||
};
|
};
|
||||||
static_assert(sizeof(PalmaConnectionHandle) == 0x8,
|
static_assert(sizeof(PalmaConnectionHandle) == 0x8,
|
||||||
"PalmaConnectionHandle has incorrect size.");
|
"PalmaConnectionHandle has incorrect size.");
|
||||||
|
@ -115,8 +138,7 @@ public:
|
||||||
Kernel::KReadableEvent& AcquirePalmaOperationCompleteEvent(
|
Kernel::KReadableEvent& AcquirePalmaOperationCompleteEvent(
|
||||||
const PalmaConnectionHandle& handle) const;
|
const PalmaConnectionHandle& handle) const;
|
||||||
Result GetPalmaOperationInfo(const PalmaConnectionHandle& handle,
|
Result GetPalmaOperationInfo(const PalmaConnectionHandle& handle,
|
||||||
PalmaOperationType& operation_type,
|
PalmaOperationType& operation_type, std::span<u8> out_data) const;
|
||||||
PalmaOperationData& data) const;
|
|
||||||
Result PlayPalmaActivity(const PalmaConnectionHandle& handle, u64 palma_activity);
|
Result PlayPalmaActivity(const PalmaConnectionHandle& handle, u64 palma_activity);
|
||||||
Result SetPalmaFrModeType(const PalmaConnectionHandle& handle, PalmaFrModeType fr_mode_);
|
Result SetPalmaFrModeType(const PalmaConnectionHandle& handle, PalmaFrModeType fr_mode_);
|
||||||
Result ReadPalmaStep(const PalmaConnectionHandle& handle);
|
Result ReadPalmaStep(const PalmaConnectionHandle& handle);
|
||||||
|
|
Loading…
Reference in a new issue